diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/tasks/PluginTaskInfoProvider.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/tasks/PluginTaskInfoProvider.java index 5a68bfa406410f0b975b8e3a9f5cfcb70f999ce5..072d277d4966bc1e238d4958ad37b7f1b1d4148d 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/tasks/PluginTaskInfoProvider.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/tasks/PluginTaskInfoProvider.java @@ -26,6 +26,7 @@ import ch.systemsx.cisd.openbis.dss.generic.server.DataStoreServer; import ch.systemsx.cisd.openbis.dss.generic.server.IServletPropertiesManager; import ch.systemsx.cisd.openbis.dss.generic.shared.Constants; import ch.systemsx.cisd.openbis.dss.generic.shared.utils.DssPropertyParametersUtil; +import ch.systemsx.cisd.openbis.dss.generic.shared.utils.SessionWorkspaceUtil; import ch.systemsx.cisd.openbis.generic.shared.dto.DatastoreServiceDescriptions; /** @@ -37,10 +38,6 @@ public class PluginTaskInfoProvider implements IPluginTaskInfoProvider { public static final String STOREROOT_DIR_KEY = "storeroot-dir"; - private static final String SESSION_WORKSPACE_ROOT_DIR_KEY = "session-workspace-root-dir"; - - private static final String SESSION_WORKSPACE_ROOT_DIR_DEFAULT = "data/sessionWorkspace"; - /** name of archiver properties section */ @Private static final String ARCHIVER_SECTION_NAME = "archiver"; @@ -62,10 +59,7 @@ public class PluginTaskInfoProvider implements IPluginTaskInfoProvider Properties properties = DssPropertyParametersUtil.loadServiceProperties(); final String storeRootDir = properties.getProperty(STOREROOT_DIR_KEY); final File storeRoot = new File(storeRootDir); - final String workspaceRootDir = - properties.getProperty(SESSION_WORKSPACE_ROOT_DIR_KEY, - SESSION_WORKSPACE_ROOT_DIR_DEFAULT); - final File workspaceRoot = new File(workspaceRootDir); + final File workspaceRoot = SessionWorkspaceUtil.getSessionWorkspace(properties); PluginTaskInfoProvider providers = new PluginTaskInfoProvider(properties, servletPropertiesManager, storeRoot, workspaceRoot); diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/content/ContentCache.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/content/ContentCache.java index c82fb40a95ca4338e5f49ac932c3180d784634a2..27be63515e75521351109d29b137f5682aa503b6 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/content/ContentCache.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/content/ContentCache.java @@ -35,9 +35,9 @@ import ch.systemsx.cisd.common.exceptions.ConfigurationFailureException; import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException; import ch.systemsx.cisd.common.filesystem.FileOperations; import ch.systemsx.cisd.common.filesystem.IFileOperations; -import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.IPluginTaskInfoProvider; import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.IDssServiceRpcGeneric; import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetPathInfo; +import ch.systemsx.cisd.openbis.dss.generic.shared.utils.SessionWorkspaceUtil; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IDatasetLocation; /** @@ -53,14 +53,14 @@ public class ContentCache static final String DOWNLOADING_FOLDER = "downloading"; - public static ContentCache create(Properties properties, IPluginTaskInfoProvider infoProvider) + public static ContentCache create(Properties properties) { String workspacePathOrNull = properties.getProperty(CACHE_WORKSPACE_FOLDER_KEY); boolean sessionCache = workspacePathOrNull == null; File cacheWorkspace; if (sessionCache) { - cacheWorkspace = infoProvider.getSessionWorkspaceRootDir(); + cacheWorkspace = SessionWorkspaceUtil.getSessionWorkspace(properties); } else { cacheWorkspace = new File(workspacePathOrNull); @@ -93,7 +93,7 @@ public class ContentCache fileLockManager = new LockManager(); } - IDssServiceRpcGeneric getDssService(IDatasetLocation dataSetLocation) + public IDssServiceRpcGeneric getDssService(IDatasetLocation dataSetLocation) { return serviceFactory.getService(dataSetLocation.getDataStoreUrl()); } @@ -116,7 +116,7 @@ public class ContentCache return dataSetLockManager.isLocked(dataSetPath); } - File getFile(String sessionToken, IDatasetLocation dataSetLocation, + public File getFile(String sessionToken, IDatasetLocation dataSetLocation, DataSetPathInfo path) { String pathInWorkspace = diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/utils/SessionWorkspaceUtil.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/utils/SessionWorkspaceUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..67ac76df110b63d1bd47d8d37f60f23b23c99c5a --- /dev/null +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/utils/SessionWorkspaceUtil.java @@ -0,0 +1,39 @@ +/* + * Copyright 2013 ETH Zuerich, CISD + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.dss.generic.shared.utils; + +import java.io.File; +import java.util.Properties; + +/** + * Utility functions for session workspace. + * + * @author Franz-Josef Elmer + */ +public class SessionWorkspaceUtil +{ + private static final String SESSION_WORKSPACE_ROOT_DIR_KEY = "session-workspace-root-dir"; + + private static final String SESSION_WORKSPACE_ROOT_DIR_DEFAULT = "data/sessionWorkspace"; + + public static File getSessionWorkspace(Properties properties) + { + return new File(properties.getProperty(SESSION_WORKSPACE_ROOT_DIR_KEY, + SESSION_WORKSPACE_ROOT_DIR_DEFAULT)); + + } +} diff --git a/datastore_server/source/java/dssApplicationContext.xml b/datastore_server/source/java/dssApplicationContext.xml index 6d475c1887065bd71882360a8ce737e9256c58f0..940ddf14790718c4011e1b3b6a64f46df8c96111 100644 --- a/datastore_server/source/java/dssApplicationContext.xml +++ b/datastore_server/source/java/dssApplicationContext.xml @@ -197,7 +197,6 @@ <bean id="content-cache" class="ch.systemsx.cisd.openbis.dss.generic.shared.content.ContentCache" factory-method="create"> <constructor-arg ref="configProperties" /> - <constructor-arg ref="plugin-tasks" /> </bean> <bean id="hierarchical-content-provider"