From 64fef26e00b5f766a2522fe8ffccedc09dd594f1 Mon Sep 17 00:00:00 2001 From: cramakri <cramakri> Date: Tue, 1 Jun 2010 09:28:28 +0000 Subject: [PATCH] LMS-1503 Refactored put command and moved it to etl. SVN: 16240 --- .../resource/dependency-structure.ddf | 16 +++++++++++- .../api/v1/PutDataSetExecutor.java | 11 +++++--- .../api/v1/PutDataSetService.java | 26 +++++++++++++------ .../server/api/v1/DssServiceRpcGeneric.java | 10 ++----- 4 files changed, 43 insertions(+), 20 deletions(-) rename datastore_server/source/java/ch/systemsx/cisd/{openbis/dss/generic/server => etlserver}/api/v1/PutDataSetExecutor.java (95%) rename datastore_server/source/java/ch/systemsx/cisd/{openbis/dss/generic/server => etlserver}/api/v1/PutDataSetService.java (82%) diff --git a/datastore_server/resource/dependency-structure.ddf b/datastore_server/resource/dependency-structure.ddf index be9217071a8..01008a223ce 100644 --- a/datastore_server/resource/dependency-structure.ddf +++ b/datastore_server/resource/dependency-structure.ddf @@ -23,7 +23,7 @@ check [dss] [etlserver] independentOf [private_openbis] # Check dependencies of etlserver to dss [dss.shared] = ${dss}.generic.shared.* -[private_dss] = ${dss}.* excluding [dss.shared] ${dss}.BuildAndEnvironmentInfo ${dss}.generic.DataStoreServer +[private_dss] = ${dss}.* excluding [dss.shared] ${dss}.BuildAndEnvironmentInfo ${dss}.generic.DataStoreServer ${dss}.generic.server.api.v1.DssServiceRpcGeneric check sets [dss.shared] [private_dss] @@ -37,4 +37,18 @@ check layeringOf l1 l2 [dss.api.client] = ${dss}.client.api.* ${dss}.generic.shared.api.* [dss.internal] = ${dss}.* excluding [dss.api.client] +check sets [dss.api.client] [dss.internal] + check [dss.api.client] independentOf [dss.internal] + +###################################################################### +# Check dependencies between the dss api and the etl api +[dss.api.server] = ${dss}.generic.server.api.* +[etl.api.server] = ${etlserver}.api.* + +check sets [dss.api.server] [etl.api.server] + +layer dssApi = [dss.api.server] +layer etlApi = [etl.api.server] + +check layeringOf etlApi dssApickow diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/api/v1/PutDataSetExecutor.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/api/v1/PutDataSetExecutor.java similarity index 95% rename from datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/api/v1/PutDataSetExecutor.java rename to datastore_server/source/java/ch/systemsx/cisd/etlserver/api/v1/PutDataSetExecutor.java index bf6ef417205..d26d9e13996 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/api/v1/PutDataSetExecutor.java +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/api/v1/PutDataSetExecutor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package ch.systemsx.cisd.openbis.dss.generic.server.api.v1; +package ch.systemsx.cisd.etlserver.api.v1; import java.io.BufferedOutputStream; import java.io.File; @@ -25,6 +25,7 @@ import java.io.InputStream; import java.io.OutputStream; import org.apache.commons.io.FileUtils; +import org.apache.log4j.Logger; import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException; import ch.systemsx.cisd.common.exceptions.UserFailureException; @@ -132,8 +133,7 @@ class PutDataSetExecutor FileUtils.deleteDirectory(dataSetDir); } catch (IOException ex) { - DssServiceRpcGeneric.getOperationLog().error( - "Could not delete data set directory " + dataSetDir, ex); + getOperationLog().error("Could not delete data set directory " + dataSetDir, ex); ex.printStackTrace(); } } @@ -162,4 +162,9 @@ class PutDataSetExecutor { return service.getOpenBisService(); } + + private Logger getOperationLog() + { + return service.getOperationLog(); + } } diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/api/v1/PutDataSetService.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/api/v1/PutDataSetService.java similarity index 82% rename from datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/api/v1/PutDataSetService.java rename to datastore_server/source/java/ch/systemsx/cisd/etlserver/api/v1/PutDataSetService.java index b624d5c2a83..f4cbf273566 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/api/v1/PutDataSetService.java +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/api/v1/PutDataSetService.java @@ -14,16 +14,19 @@ * limitations under the License. */ -package ch.systemsx.cisd.openbis.dss.generic.server.api.v1; +package ch.systemsx.cisd.etlserver.api.v1; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.Properties; +import org.apache.log4j.Logger; + import ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked; import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.common.mail.MailClient; +import ch.systemsx.cisd.etlserver.Parameters; import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService; import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.NewDataSetDTO; @@ -33,7 +36,7 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.NewDataSetDTO; * * @author Chandrasekhar Ramakrishnan */ -class PutDataSetService +public class PutDataSetService { private final IEncapsulatedOpenBISService openBisService; @@ -41,9 +44,12 @@ class PutDataSetService private final File incomingDir; - PutDataSetService(IEncapsulatedOpenBISService openBisService) + private final Logger operationLog; + + public PutDataSetService(IEncapsulatedOpenBISService openBisService, Logger operationLog) { this.openBisService = openBisService; + this.operationLog = operationLog; PutDataSetServiceInitializer initializer = new PutDataSetServiceInitializer(); @@ -54,7 +60,7 @@ class PutDataSetService mailClient = null; } - void putDataSet(String sessionToken, NewDataSetDTO newDataSet, InputStream inputStream) + public void putDataSet(String sessionToken, NewDataSetDTO newDataSet, InputStream inputStream) throws IOExceptionUnchecked, IllegalArgumentException { try @@ -94,6 +100,11 @@ class PutDataSetService { return incomingDir; } + + Logger getOperationLog() + { + return operationLog; + } } /** @@ -103,11 +114,11 @@ class PutDataSetService */ class PutDataSetServiceInitializer { - // private final Parameters params; + private final Parameters params; PutDataSetServiceInitializer() { - // params = new Parameters(); + params = Parameters.createParametersForApiUse(); } File getIncomingDir() @@ -117,8 +128,7 @@ class PutDataSetServiceInitializer Properties getMailProperties() { - // return Parameters.createMailProperties(params.getProperties()); - return null; + return Parameters.createMailProperties(params.getProperties()); } Object getPlugin() diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/api/v1/DssServiceRpcGeneric.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/api/v1/DssServiceRpcGeneric.java index f9fed56c914..e85348c1ab0 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/api/v1/DssServiceRpcGeneric.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/api/v1/DssServiceRpcGeneric.java @@ -22,9 +22,8 @@ import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; -import org.apache.log4j.Logger; - import ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked; +import ch.systemsx.cisd.etlserver.api.v1.PutDataSetService; import ch.systemsx.cisd.openbis.dss.generic.server.AbstractDssServiceRpc; import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService; import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.DataSetFileDTO; @@ -40,17 +39,12 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.NewDataSetDTO; */ public class DssServiceRpcGeneric extends AbstractDssServiceRpc implements IDssServiceRpcGeneric { - static Logger getOperationLog() - { - return operationLog; - } - private final PutDataSetService putService; public DssServiceRpcGeneric(IEncapsulatedOpenBISService openBISService) { super(openBISService); - putService = new PutDataSetService(openBISService); + putService = new PutDataSetService(openBISService, operationLog); operationLog.info("[rpc] Started DSS API V1 service."); } -- GitLab