diff --git a/datastore_server/dist/etc/service.properties b/datastore_server/dist/etc/service.properties index f8291b1fa726f89e255374774ac4176b01adf2ed..1779870c710ea1136719859e9ba2148aebc152c8 100644 --- a/datastore_server/dist/etc/service.properties +++ b/datastore_server/dist/etc/service.properties @@ -169,7 +169,7 @@ main-thread.incoming-data-completeness-condition = marker-file # Path to the script that will be executed after successful data set registration. # The script will be called with two parameters: <data-set-code> and <absolute-data-set-path> (in the data store). -# main-thread.postregistration-script = /example/scripts/my-script.sh +# main-thread.post-registration-script = /example/scripts/my-script.sh # --------------------------------------------------------------------------- # maintenance plugins configuration diff --git a/datastore_server/etc/service.properties b/datastore_server/etc/service.properties index 4bfb06a5b38209ad4b151fc1692d638d574fb933..992c0d91c1683203ac456f45ec7b38a9fe0279d5 100644 --- a/datastore_server/etc/service.properties +++ b/datastore_server/etc/service.properties @@ -110,7 +110,7 @@ demo-reporter.class = ch.systemsx.cisd.openbis.dss.generic.server.plugins.demo.D # The property file. Its content will be passed as a parameter to the plugin. demo-reporter.properties-file = -tsv-viewer.label = TSV View +tsv-viewer.label = TSV View tsv-viewer.dataset-types = TSV tsv-viewer.class = ch.systemsx.cisd.openbis.dss.generic.server.plugins.standard.TSVViewReportingPlugin tsv-viewer.properties-file = @@ -177,6 +177,10 @@ validator.site.value-range = [0,Infinity) # E.g. 'code-extractor' property for the thread 'my-etl' should be specified as 'my-etl.code-extractor' inputs=main-thread, tsv-thread, csv-thread, simple-thread, hdf5-thread, dss-system-test-thread +# True if incoming directories should be created on server startup if they don't exist. +# Default - false (server will fail at startup if one of incoming directories doesn't exist). +incoming-dir-create = true + # --------------------------------------------------------------------------- # Dataset uploader 'main-thread' configuration # --------------------------------------------------------------------------- @@ -228,7 +232,7 @@ main-thread.storage-processor.file-extractor = ch.systemsx.cisd.etlserver.imsb.H # Path to the script that will be executed after successful data set registration. # The script will be called with two parameters: <data-set-code> and <absolute-data-set-path> (in the data store). -# main-thread.postregistration-script = /example/scripts/my-script.sh +# main-thread.post-registration-script = /example/scripts/my-script.sh # The directory to watch for incoming data. tsv-thread.incoming-dir = ${root-dir}/incoming-tsv diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/ThreadParameters.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/ThreadParameters.java index 5d03ab456ea176d31eadd78ff742e7d808613563..3bd642b2567eadc1ed9bec45e3733b30990b3c9f 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/ThreadParameters.java +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/ThreadParameters.java @@ -45,7 +45,7 @@ public final class ThreadParameters * in the data store. */ @Private - static final String POSTREFGISTRATION_SCRIPT_KEY = "postregistration-script"; + static final String POST_REGISTRATION_SCRIPT_KEY = "post-registration-script"; @Private static final String GROUP_CODE_KEY = "group-code"; @@ -65,6 +65,8 @@ public final class ThreadParameters private static final String INCOMING_DIR = "incoming-dir"; + private static final String INCOMING_DIR_CREATE = "incoming-dir-create"; + private static final String DELETE_UNIDENTIFIED_KEY = "delete-unidentified"; private static final String REPROCESS_FAULTY_DATASETS_NAME = "reprocess-faulty-datasets"; @@ -75,6 +77,8 @@ public final class ThreadParameters */ private final File incomingDataDirectory; + private final boolean createIncomingDirectories; + private final IETLServerPlugin plugin; private final String threadName; @@ -96,6 +100,8 @@ public final class ThreadParameters public ThreadParameters(final Properties threadProperties, final String threadName) { this.incomingDataDirectory = extractIncomingDataDir(threadProperties); + this.createIncomingDirectories = + PropertyUtils.getBoolean(threadProperties, INCOMING_DIR_CREATE, false); this.plugin = new PropertiesBasedETLServerPlugin(threadProperties); this.groupCode = tryGetGroupCode(threadProperties); this.postRegistrationScript = tryGetPostRegistartionScript(threadProperties); @@ -136,6 +142,11 @@ public final class ThreadParameters final void check() { + if (createIncomingDirectories && incomingDataDirectory.exists() == false) + { + incomingDataDirectory.mkdir(); + operationLog.info("Created incoming directory '" + incomingDataDirectory + "'."); + } if (incomingDataDirectory.isDirectory() == false) { throw new ConfigurationFailureException("Incoming directory '" + incomingDataDirectory @@ -165,7 +176,7 @@ public final class ThreadParameters @Private static final String tryGetPostRegistartionScript(final Properties properties) { - return nullIfEmpty(PropertyUtils.getProperty(properties, POSTREFGISTRATION_SCRIPT_KEY)); + return nullIfEmpty(PropertyUtils.getProperty(properties, POST_REGISTRATION_SCRIPT_KEY)); } private static String nullIfEmpty(String value) @@ -223,6 +234,10 @@ public final class ThreadParameters : "no write access for some period"; logLine("Condition of incoming data completeness: %s.", completenessCond); logLine("Delete unidentified: '%s'.", deleteUnidentified); + if (postRegistrationScript != null) + { + logLine("Post registration script: '%s'.", postRegistrationScript); + } } } diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/TransferredDataSetHandler.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/TransferredDataSetHandler.java index 2826b9fc3a16d9a708c5ebcd249fe7de1e86ee38..e5cb3faf0fe734f8779d9e74ffc1ef7885652481 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/TransferredDataSetHandler.java +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/TransferredDataSetHandler.java @@ -40,7 +40,7 @@ import ch.systemsx.cisd.common.mail.IMailClient; import ch.systemsx.cisd.common.utilities.IDelegatedActionWithResult; import ch.systemsx.cisd.common.utilities.ISelfTestable; import ch.systemsx.cisd.etlserver.IStorageProcessor.UnstoreDataAction; -import ch.systemsx.cisd.etlserver.utils.PostregistrationExecutor; +import ch.systemsx.cisd.etlserver.utils.PostRegistrationExecutor; import ch.systemsx.cisd.etlserver.validation.IDataSetValidator; import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService; import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation; @@ -150,7 +150,7 @@ public final class TransferredDataSetHandler implements IPathHandler, ISelfTesta this.fileOperations = FileOperations.getMonitoredInstanceForCurrentThread(); this.useIsFinishedMarkerFile = useIsFinishedMarkerFile; this.deleteUnidentified = deleteUnidentified; - this.postRegistrationAction = PostregistrationExecutor.create(postRegistrationScriptOrNull); + this.postRegistrationAction = PostRegistrationExecutor.create(postRegistrationScriptOrNull); } /** diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/utils/PostregistrationExecutor.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/utils/PostRegistrationExecutor.java similarity index 93% rename from datastore_server/source/java/ch/systemsx/cisd/etlserver/utils/PostregistrationExecutor.java rename to datastore_server/source/java/ch/systemsx/cisd/etlserver/utils/PostRegistrationExecutor.java index 330943d00023d6eb29b5565e92668c3a025eb7b8..3724d44339a6dce686c30b2c5260bb46b7386ffb 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/utils/PostregistrationExecutor.java +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/utils/PostRegistrationExecutor.java @@ -39,14 +39,14 @@ import ch.systemsx.cisd.etlserver.IPostRegistrationAction; * * @author Izabela Adamczyk */ -public class PostregistrationExecutor implements IPostRegistrationAction +public class PostRegistrationExecutor implements IPostRegistrationAction { private final static Logger operationLog = LogFactory.getLogger(LogCategory.OPERATION, - PostregistrationExecutor.class); + PostRegistrationExecutor.class); private final static Logger machineLog = LogFactory.getLogger(LogCategory.MACHINE, - PostregistrationExecutor.class); + PostRegistrationExecutor.class); static class EmptyScriptExecutor implements IPostRegistrationAction { @@ -61,7 +61,7 @@ public class PostregistrationExecutor implements IPostRegistrationAction { if (scriptPath != null) { - return new PostregistrationExecutor(scriptPath); + return new PostRegistrationExecutor(scriptPath); } else { operationLog.debug("No postregistration script found, skipping execution."); @@ -71,7 +71,7 @@ public class PostregistrationExecutor implements IPostRegistrationAction private final String scriptPath; - private PostregistrationExecutor(String script) + private PostRegistrationExecutor(String script) { this.scriptPath = script; File file = new File(script); diff --git a/screening/etc/service.properties b/screening/etc/service.properties index 83e9cc6ed3157cecf0f00b99b0a82fe80fc16d89..8b203d9b54269a85731a624b11c04caadbe4db21 100644 --- a/screening/etc/service.properties +++ b/screening/etc/service.properties @@ -161,6 +161,10 @@ data-set-clean-up.data-source = imaging-db incoming-root-dir = ${root-dir} +# True if incoming directories should be created on server startup if they don't exist. +# Default - false (server will fail at startup if one of incoming directories doesn't exist). +incoming-dir-create = true + # Globally used separator character which separates entities in a data set file name data-set-file-name-entity-separator = _ @@ -224,7 +228,6 @@ merged-channels-images.storage-processor.data-source = imaging-db merged-channels-images.storage-processor.extract-single-image-channels = GREEN, BLUE # --------------------------------------------------------------------------- - # The directory to watch for incoming data. split-channels-images.incoming-dir = ${incoming-root-dir}/incoming-images-split-channels split-channels-images.incoming-data-completeness-condition = auto-detection