From cbed0ac236d77d748a2f2e2c377e06bab31b9788 Mon Sep 17 00:00:00 2001 From: felmer <felmer> Date: Thu, 10 Jan 2013 12:05:32 +0000 Subject: [PATCH] SP-439 BIS-255: fixing dependency bug SVN: 28052 --- .../plugins/tasks/PluginTaskInfoProvider.java | 10 +---- .../generic/shared/content/ContentCache.java | 10 ++--- .../shared/utils/SessionWorkspaceUtil.java | 39 +++++++++++++++++++ .../source/java/dssApplicationContext.xml | 1 - 4 files changed, 46 insertions(+), 14 deletions(-) create mode 100644 datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/utils/SessionWorkspaceUtil.java 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 5a68bfa4064..072d277d496 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 c82fb40a95c..27be63515e7 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 00000000000..67ac76df110 --- /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 6d475c18870..940ddf14790 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" -- GitLab