Skip to content

Commit

Permalink
fix detangle configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
user1 authored and user1 committed Jun 23, 2016
1 parent 07f3edf commit 9ebed50
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 81 deletions.
103 changes: 103 additions & 0 deletions src/main/java/edu/kit/scc/FilesystemBeanConfiguration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/*
* Copyright 2016 Karlsruhe Institute of Technology (KIT)
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*/

package edu.kit.scc;

import org.snia.cdmiserver.dao.CapabilityDao;
import org.snia.cdmiserver.dao.CdmiObjectDao;
import org.snia.cdmiserver.dao.ContainerDao;
import org.snia.cdmiserver.dao.DataObjectDao;
import org.snia.cdmiserver.dao.DomainDao;
import org.snia.cdmiserver.dao.filesystem.CapabilityDaoImpl;
import org.snia.cdmiserver.dao.filesystem.CdmiObjectDaoImpl;
import org.snia.cdmiserver.dao.filesystem.ContainerDaoImpl;
import org.snia.cdmiserver.dao.filesystem.DataObjectDaoImpl;
import org.snia.cdmiserver.dao.filesystem.DomainDaoImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

@Configuration
@Profile("filesystem")
public class FilesystemBeanConfiguration {

@Value("${cdmi.data.baseDirectory}")
private String baseDirectory;

@Value("${cdmi.data.objectIdPrefix}")
private String objectIdPrefix;

/**
* Initializes the file system version of the CDMI object DAO interface.
*
* @return a {@link CdmiObjectDao}
*/
@Bean
public CdmiObjectDao cdmiObjectDao() {
CdmiObjectDaoImpl cdmiObjectDaoImpl = new CdmiObjectDaoImpl();
cdmiObjectDaoImpl.setBaseDirectory(baseDirectory);
cdmiObjectDaoImpl.setObjectIdPrefix(objectIdPrefix);
cdmiObjectDaoImpl.setObjectIdDirectory("cdmi_objectid");
return cdmiObjectDaoImpl;
}

/**
* Initializes the file system version of the {@link ContainerDao}.
*
* @return a {@link ContainerDao}
*/
@Bean
public ContainerDao containerDao(CdmiObjectDao cdmiObjectDao) {
ContainerDaoImpl containerDaoImpl = new ContainerDaoImpl();
containerDaoImpl.setBaseDirectoryName(baseDirectory);
containerDaoImpl.setCdmiObjectDao(cdmiObjectDao);
return containerDaoImpl;
}

/**
* Initializes the file system version of the {@link DataObjectDao}.
*
* @return a {@link DataObjectDao}
*/
@Bean
public DataObjectDao dataObjectDao(CdmiObjectDao cdmiObjectDao) {
DataObjectDaoImpl dataObjectDaoImpl = new DataObjectDaoImpl();
dataObjectDaoImpl.setBaseDirectoryName(baseDirectory);
dataObjectDaoImpl.setCdmiObjectDao(cdmiObjectDao);
return dataObjectDaoImpl;
}

/**
* Initializes the file system version of the {@link CapabilityDao}.
*
* @return a {@link CapabilityDao}
*/
@Bean
public CapabilityDao capabilityDao(CdmiObjectDao cdmiObjectDao) {
CapabilityDaoImpl capabilityDaoImpl = new CapabilityDaoImpl();
capabilityDaoImpl.setBaseDirectory(baseDirectory);
capabilityDaoImpl.setCdmiObjectDao(cdmiObjectDao);
return capabilityDaoImpl;
}

/**
* Initializes the file system version of the {@link DomainDao}.
*
* @return a {@link DomainDao}
*/
@Bean
public DomainDao domainDao(CdmiObjectDao cdmiObjectDao) {
DomainDaoImpl domainDaoImpl = new DomainDaoImpl();
domainDaoImpl.setBaseDirectoryName(baseDirectory);
domainDaoImpl.setCdmiObjectDao(cdmiObjectDao);
return domainDaoImpl;
}

}
83 changes: 2 additions & 81 deletions src/main/java/edu/kit/scc/FilesystemConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,14 @@
import org.slf4j.LoggerFactory;
import org.snia.cdmiserver.dao.CapabilityDao;
import org.snia.cdmiserver.dao.CdmiObjectDao;
import org.snia.cdmiserver.dao.ContainerDao;
import org.snia.cdmiserver.dao.DataObjectDao;
import org.snia.cdmiserver.dao.DomainDao;
import org.snia.cdmiserver.dao.filesystem.CapabilityDaoImpl;
import org.snia.cdmiserver.dao.filesystem.CdmiObjectDaoImpl;
import org.snia.cdmiserver.dao.filesystem.ContainerDaoImpl;
import org.snia.cdmiserver.dao.filesystem.DataObjectDaoImpl;
import org.snia.cdmiserver.dao.filesystem.DomainDaoImpl;
import org.snia.cdmiserver.model.Capability;
import org.snia.cdmiserver.model.CdmiObject;
import org.snia.cdmiserver.model.Container;
import org.snia.cdmiserver.model.Domain;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.nio.file.Files;
Expand All @@ -45,7 +36,7 @@
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Configuration
@Component
@Profile("filesystem")
public class FilesystemConfiguration {

Expand All @@ -54,79 +45,9 @@ public class FilesystemConfiguration {
@Value("${cdmi.data.baseDirectory}")
private String baseDirectory;

@Value("${cdmi.data.objectIdPrefix}")
private String objectIdPrefix;

@Value("${cdmi.qos.backend.type}")
private String backendType;

/**
* Initializes the file system version of the CDMI object DAO interface.
*
* @return a {@link CdmiObjectDao}
*/
@Bean
public CdmiObjectDao cdmiObjectDao() {
CdmiObjectDaoImpl cdmiObjectDaoImpl = new CdmiObjectDaoImpl();
cdmiObjectDaoImpl.setBaseDirectory(baseDirectory);
cdmiObjectDaoImpl.setObjectIdPrefix(objectIdPrefix);
cdmiObjectDaoImpl.setObjectIdDirectory("cdmi_objectid");
return cdmiObjectDaoImpl;
}

/**
* Initializes the file system version of the {@link ContainerDao}.
*
* @return a {@link ContainerDao}
*/
@Bean
public ContainerDao containerDao(CdmiObjectDao cdmiObjectDao) {
ContainerDaoImpl containerDaoImpl = new ContainerDaoImpl();
containerDaoImpl.setBaseDirectoryName(baseDirectory);
containerDaoImpl.setCdmiObjectDao(cdmiObjectDao);
return containerDaoImpl;
}

/**
* Initializes the file system version of the {@link DataObjectDao}.
*
* @return a {@link DataObjectDao}
*/
@Bean
public DataObjectDao dataObjectDao(CdmiObjectDao cdmiObjectDao) {
DataObjectDaoImpl dataObjectDaoImpl = new DataObjectDaoImpl();
dataObjectDaoImpl.setBaseDirectoryName(baseDirectory);
dataObjectDaoImpl.setCdmiObjectDao(cdmiObjectDao);
return dataObjectDaoImpl;
}

/**
* Initializes the file system version of the {@link CapabilityDao}.
*
* @return a {@link CapabilityDao}
*/
@Bean
public CapabilityDao capabilityDao(CdmiObjectDao cdmiObjectDao) {
CapabilityDaoImpl capabilityDaoImpl = new CapabilityDaoImpl();
capabilityDaoImpl.setBaseDirectory(baseDirectory);
capabilityDaoImpl.setCdmiObjectDao(cdmiObjectDao);
return capabilityDaoImpl;
}

/**
* Initializes the file system version of the {@link DomainDao}.
*
* @return a {@link DomainDao}
*/
@Bean
public DomainDao domainDao(CdmiObjectDao cdmiObjectDao) {
DomainDaoImpl domainDaoImpl = new DomainDaoImpl();
domainDaoImpl.setBaseDirectoryName(baseDirectory);
domainDaoImpl.setCdmiObjectDao(cdmiObjectDao);
return domainDaoImpl;
}


@Autowired
private CdmiObjectDao cdmiObjectDao;

Expand Down

0 comments on commit 9ebed50

Please sign in to comment.