diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/AbstractDssServiceRpc.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/AbstractDssServiceRpc.java index 316500c96f848e5e47cfe6218213010d448dd2ea..7200100dd065329c65eafb02b74666d37c8ba69c 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/AbstractDssServiceRpc.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/AbstractDssServiceRpc.java @@ -30,6 +30,7 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.ServiceProvider; import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.DataStoreApiUrlUtilities; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseInstance; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; +import ch.systemsx.cisd.openbis.generic.shared.dto.OpenBISSessionHolder; /** * Abstract superclass of DssServiceRpc implementations. @@ -84,13 +85,15 @@ public abstract class AbstractDssServiceRpc<T> extends AbstractServiceWithLogger this.contentProvider = contentProvider; } - protected IHierarchicalContentProvider getHierarchicalContentProvider() + protected IHierarchicalContentProvider getHierarchicalContentProvider(String sessionToken) { if (contentProvider == null) { contentProvider = ServiceProvider.getHierarchicalContentProvider(); } - return contentProvider; + OpenBISSessionHolder sessionTokenHolder = new OpenBISSessionHolder(); + sessionTokenHolder.setSessionToken(sessionToken); + return contentProvider.cloneFor(sessionTokenHolder); } protected IShareIdManager getShareIdManager() @@ -128,9 +131,9 @@ public abstract class AbstractDssServiceRpc<T> extends AbstractServiceWithLogger return homeDatabaseInstance; } - protected IHierarchicalContent getHierarchicalContent(String dataSetCode) + protected IHierarchicalContent getHierarchicalContent(String sessionToken, String dataSetCode) { - return getHierarchicalContentProvider().asContent(dataSetCode); + return getHierarchicalContentProvider(sessionToken).asContent(dataSetCode); } protected ExternalData tryGetDataSet(String sessionToken, String dataSetCode) diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ApplicationContext.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ApplicationContext.java index 2ab1363a7d745d2337d5dc0de5f5e25e9c724ca3..c874a4e70b7c7f41f15605f30a4398115c995815 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ApplicationContext.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ApplicationContext.java @@ -19,6 +19,7 @@ package ch.systemsx.cisd.openbis.dss.generic.server; import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService; import ch.systemsx.cisd.openbis.dss.generic.shared.IHierarchicalContentProvider; import ch.systemsx.cisd.openbis.dss.generic.shared.IShareIdManager; +import ch.systemsx.cisd.openbis.generic.shared.dto.OpenBISSessionHolder; /** * Application context. It contains the object accessing the openBIS for retrieving the data set, @@ -61,9 +62,15 @@ class ApplicationContext return configParameters; } - public IHierarchicalContentProvider getHierarchicalContentProvider() + public IHierarchicalContentProvider getHierarchicalContentProvider(String sessionTokenOrNull) { - return hierarchicalContentProvider; + if (sessionTokenOrNull == null) + { + return hierarchicalContentProvider; + } + OpenBISSessionHolder sessionHolder = new OpenBISSessionHolder(); + sessionHolder.setSessionToken(sessionTokenOrNull); + return hierarchicalContentProvider.cloneFor(sessionHolder); } } diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DatasetDownloadServlet.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DatasetDownloadServlet.java index f300d402a45daf0d3a3858893f295fc87a8b6317..1067e55249207085299201e213d8d9d7009482b4 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DatasetDownloadServlet.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DatasetDownloadServlet.java @@ -40,6 +40,7 @@ import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.openbis.common.io.hierarchical_content.HierarchicalContentUtils; import ch.systemsx.cisd.openbis.common.io.hierarchical_content.api.IHierarchicalContent; import ch.systemsx.cisd.openbis.common.io.hierarchical_content.api.IHierarchicalContentNode; +import ch.systemsx.cisd.openbis.dss.generic.shared.IHierarchicalContentProvider; import ch.systemsx.cisd.openbis.dss.generic.shared.dto.Size; import ch.systemsx.cisd.openbis.generic.shared.util.HttpRequestUtils; @@ -223,8 +224,10 @@ public class DatasetDownloadServlet extends AbstractDatasetDownloadServlet IHierarchicalContent rootContent = null; try { - rootContent = - applicationContext.getHierarchicalContentProvider().asContent(dataSetCode); + String sessionTokenOrNull = requestParams.tryGetSessionId(); + IHierarchicalContentProvider contentProvider = + applicationContext.getHierarchicalContentProvider(sessionTokenOrNull); + rootContent = contentProvider.asContent(dataSetCode); } catch (IllegalArgumentException ex) { throw new UserFailureException(ex.getMessage()); diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DatasetImageOverviewServlet.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DatasetImageOverviewServlet.java index f0d32b0cd8e03492a966cc2e2d290bcd794f15ae..3931cd85bab16aa11f0af7542363259830d75030 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DatasetImageOverviewServlet.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DatasetImageOverviewServlet.java @@ -112,7 +112,8 @@ public class DatasetImageOverviewServlet extends AbstractDatasetDownloadServlet ensureDatasetAccessible(datasetCode, session, sessionId); ResponseContentStream responseStream = - createImageResponse(session, datasetCode, datasetTypeCode, resolution); + createImageResponse(session, sessionId, datasetCode, datasetTypeCode, + resolution); if (responseStream != null && operationLog.isDebugEnabled()) { @@ -128,11 +129,11 @@ public class DatasetImageOverviewServlet extends AbstractDatasetDownloadServlet } } - private ResponseContentStream createImageResponse(HttpSession session, String dataSetCode, + private ResponseContentStream createImageResponse(HttpSession session, String sessionToken, String dataSetCode, String dataSetTypeCode, ImageResolutionKind resolution) { IHierarchicalContent content = - applicationContext.getHierarchicalContentProvider().asContent(dataSetCode); + applicationContext.getHierarchicalContentProvider(sessionToken).asContent(dataSetCode); IDatasetImageOverviewPlugin plugin = configuration.getDatasetImageOverviewPlugin(dataSetTypeCode); return plugin.createImageOverview(dataSetCode, dataSetTypeCode, content, resolution); 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 8df26f4ae41a7836d12b56bc94fab1f235c0b517..9f00a3d8fe7ee696a6c7efb316d1a3044b54cbf8 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 @@ -135,7 +135,7 @@ public class DssServiceRpcGeneric extends AbstractDssServiceRpc<IDssServiceRpcGe IHierarchicalContent content = null; try { - content = getHierarchicalContent(dataSetCode); + content = getHierarchicalContent(sessionToken, dataSetCode); IHierarchicalContentNode startPathNode = getContentNode(content, startPath); ArrayList<FileInfoDssDTO> list = new ArrayList<FileInfoDssDTO>(); if (startPathNode.isDirectory()) @@ -173,7 +173,7 @@ public class DssServiceRpcGeneric extends AbstractDssServiceRpc<IDssServiceRpcGe IHierarchicalContent content = null; try { - content = getHierarchicalContent(dataSetCode); + content = getHierarchicalContent(sessionToken, dataSetCode); IHierarchicalContentNode contentNode = getContentNode(content, path); return HierarchicalContentUtils.getInputStreamAutoClosingContent(contentNode, content); } catch (RuntimeException ex) diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ftp/FtpPathResolverContext.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ftp/FtpPathResolverContext.java index 965589004ac9a0976276047c59076d53ca84b4f5..fc1a5c189134b0df51ba81312cbed14dbed4d7dd 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ftp/FtpPathResolverContext.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ftp/FtpPathResolverContext.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.EnumSet; import java.util.List; +import ch.systemsx.cisd.common.server.ISessionTokenProvider; import ch.systemsx.cisd.openbis.generic.shared.IETLLIMSService; import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationService; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet; @@ -37,7 +38,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifi * * @author Kaloyan Enimanev */ -public class FtpPathResolverContext +public class FtpPathResolverContext implements ISessionTokenProvider { private final String sessionToken; @@ -61,6 +62,7 @@ public class FtpPathResolverContext this.cache = cache; } + @Override public String getSessionToken() { return sessionToken; diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ftp/resolver/TemplateBasedDataSetResourceResolver.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ftp/resolver/TemplateBasedDataSetResourceResolver.java index 5aed27c597ff8070f7050467d390ab33463d6260..25af80ade764829f0fbf85ecc580105cf7b42a60 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ftp/resolver/TemplateBasedDataSetResourceResolver.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ftp/resolver/TemplateBasedDataSetResourceResolver.java @@ -34,6 +34,7 @@ import ch.rinn.restrictions.Private; import ch.systemsx.cisd.common.exceptions.ConfigurationFailureException; import ch.systemsx.cisd.common.logging.LogCategory; import ch.systemsx.cisd.common.logging.LogFactory; +import ch.systemsx.cisd.common.server.ISessionTokenProvider; import ch.systemsx.cisd.common.string.Template; import ch.systemsx.cisd.openbis.common.io.hierarchical_content.IHierarchicalContentNodeFilter; import ch.systemsx.cisd.openbis.common.io.hierarchical_content.api.IHierarchicalContent; @@ -113,7 +114,7 @@ public class TemplateBasedDataSetResourceResolver implements IFtpPathResolver, addNodesOfType(PARENT_PREFIX, result, dataSetWithMetaData.getParentCodes()); addNodesOfType(CHILD_PREFIX, result, dataSetWithMetaData.getChildrenCodes()); } - FtpFileEvaluationContext evalContext = createFtpFileEvaluationContext(); + FtpFileEvaluationContext evalContext = createFtpFileEvaluationContext(resolverContext); try { IHierarchicalContent hierarchicalContent = @@ -246,7 +247,7 @@ public class TemplateBasedDataSetResourceResolver implements IFtpPathResolver, service.listDataSetsByExperimentID(sessionToken, new TechId(experiment)); if (fileNamePresent) { - FtpFileEvaluationContext evalContext = evaluateDataSetPaths(dataSets); + FtpFileEvaluationContext evalContext = evaluateDataSetPaths(resolverContext, dataSets); try { @@ -425,18 +426,18 @@ public class TemplateBasedDataSetResourceResolver implements IFtpPathResolver, List<ExternalData> dataSets = service.listDataSetsByExperimentID(sessionToken, new TechId(experiment)); - FtpFileEvaluationContext evalContext = evaluateDataSetPaths(dataSets); + FtpFileEvaluationContext evalContext = evaluateDataSetPaths(context, dataSets); try { - return createFtpFilesFromEvaluationResult(parentPath, evalContext); + return createFtpFilesFromEvaluationResult(context, parentPath, evalContext); } finally { evalContext.close(); } } - private List<FtpFile> createFtpFilesFromEvaluationResult(final String parentPath, - FtpFileEvaluationContext evalResult) + private List<FtpFile> createFtpFilesFromEvaluationResult(ISessionTokenProvider sessionTokenProvider, + final String parentPath, FtpFileEvaluationContext evalResult) { ArrayList<FtpFile> result = new ArrayList<FtpFile>(); for (EvaluatedElement evalElement : evalResult.getEvalElements()) @@ -447,7 +448,7 @@ public class TemplateBasedDataSetResourceResolver implements IFtpPathResolver, String childPath = parentPath + FtpConstants.FILE_SEPARATOR + evalElement.evaluatedTemplate; String dataSetCode = evalElement.dataSet.getCode(); - IHierarchicalContentProvider getContentProvider = getContentProvider(); + IHierarchicalContentProvider getContentProvider = getContentProvider(sessionTokenProvider); FtpFile childFtpFile = FtpFileFactory.createFtpFile(dataSetCode, childPath, @@ -460,9 +461,10 @@ public class TemplateBasedDataSetResourceResolver implements IFtpPathResolver, return result; } - private FtpFileEvaluationContext evaluateDataSetPaths(List<ExternalData> dataSets) + private FtpFileEvaluationContext evaluateDataSetPaths(ISessionTokenProvider sessionTokenProvider, + List<ExternalData> dataSets) { - FtpFileEvaluationContext evalContext = createFtpFileEvaluationContext(); + FtpFileEvaluationContext evalContext = createFtpFileEvaluationContext(sessionTokenProvider); for (int disambiguationIdx = 0; disambiguationIdx < dataSets.size(); disambiguationIdx++) { @@ -664,18 +666,20 @@ public class TemplateBasedDataSetResourceResolver implements IFtpPathResolver, return getDataSetTypeConfig(dataSet).fileListSubPath; } - private FtpFileEvaluationContext createFtpFileEvaluationContext() + private FtpFileEvaluationContext createFtpFileEvaluationContext( + ISessionTokenProvider sessionTokenProvider) { - return new FtpFileEvaluationContext(getContentProvider()); + return new FtpFileEvaluationContext(getContentProvider(sessionTokenProvider)); } - private IHierarchicalContentProvider getContentProvider() + private IHierarchicalContentProvider getContentProvider( + ISessionTokenProvider sessionTokenProvider) { if (contentProvider == null) { contentProvider = ServiceProvider.getHierarchicalContentProvider(); } - return contentProvider; + return contentProvider.cloneFor(sessionTokenProvider); } } diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/DataSetProcessingContext.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/DataSetProcessingContext.java index b0a4a9c337ae316ac4d0d5ffe1ebe8513bfcd477..07a8c834ecd08983c9fd8a603d51846fcb1095f7 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/DataSetProcessingContext.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/DataSetProcessingContext.java @@ -24,6 +24,7 @@ import org.apache.log4j.Logger; import ch.systemsx.cisd.common.logging.LogCategory; import ch.systemsx.cisd.common.logging.LogFactory; import ch.systemsx.cisd.common.mail.IMailClient; +import ch.systemsx.cisd.common.server.ISessionTokenProvider; import ch.systemsx.cisd.openbis.common.io.hierarchical_content.api.IHierarchicalContent; import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.IProcessingPluginTask; import ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.ISessionWorkspaceProvider; @@ -105,7 +106,7 @@ public class DataSetProcessingContext * Creates an instance for specified service, directory provider, workspace provider, parameter * bindings, e-mail client, and optional user e-mail address and sessionToken. */ - public DataSetProcessingContext(IEncapsulatedOpenBISService service, + private DataSetProcessingContext(IEncapsulatedOpenBISService service, IHierarchicalContentProvider contentProvider, IDataSetDirectoryProvider directoryProvider, ISessionWorkspaceProvider sessionWorkspaceProviderOrNull, @@ -195,6 +196,14 @@ public class DataSetProcessingContext { return hierarchicalContentProvider.asContent(datasetLocation); } + + @Override + public IHierarchicalContentProvider cloneFor( + ISessionTokenProvider sessionTokenProvider) + { + return hierarchicalContentProvider.cloneFor(sessionTokenProvider); + } + }; } diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/HierarchicalContentProvider.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/HierarchicalContentProvider.java index 47bd1f3a9e2fd819c874c4c4a852f9a9c294090f..62a62a24397953824c88771d14bc907446d05795 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/HierarchicalContentProvider.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/HierarchicalContentProvider.java @@ -19,7 +19,6 @@ package ch.systemsx.cisd.openbis.dss.generic.shared; import java.io.File; import java.util.ArrayList; import java.util.List; -import java.util.Properties; import org.apache.log4j.Logger; @@ -99,6 +98,18 @@ public class HierarchicalContentProvider implements IHierarchicalContentProvider IDssServiceRpcGenericFactory serviceFactory, IContentCache contentCache, ISessionTokenProvider sessionTokenProvider, String dataStoreCode, ExposablePropertyPlaceholderConfigurer infoProvider) + { + this(openbisService, directoryProvider, hierarchicalContentFactory, serviceFactory, + contentCache, sessionTokenProvider, dataStoreCode, infoProvider != null + && "true".equalsIgnoreCase(infoProvider.getResolvedProps().getProperty( + "trust-all-certificates"))); + } + + private HierarchicalContentProvider(IEncapsulatedOpenBISService openbisService, + IDataSetDirectoryProvider directoryProvider, + IHierarchicalContentFactory hierarchicalContentFactory, + IDssServiceRpcGenericFactory serviceFactory, IContentCache contentCache, + ISessionTokenProvider sessionTokenProvider, String dataStoreCode, boolean trustAllCertificates) { this.openbisService = openbisService; this.directoryProvider = directoryProvider; @@ -107,15 +118,16 @@ public class HierarchicalContentProvider implements IHierarchicalContentProvider this.cache = contentCache; this.sessionTokenProvider = sessionTokenProvider; this.dataStoreCode = dataStoreCode; - if (infoProvider != null) - { - Properties properties = infoProvider.getResolvedProps(); - String trust = properties.getProperty("trust-all-certificates"); - trustAllCertificates = (trust != null && trust.equalsIgnoreCase("true")); - } else - { - trustAllCertificates = false; - } + this.trustAllCertificates = trustAllCertificates; + + } + + @Override + public IHierarchicalContentProvider cloneFor(ISessionTokenProvider anotherSessionTokenProvider) + { + return new HierarchicalContentProvider(openbisService, directoryProvider, + hierarchicalContentFactory, serviceFactory, cache, anotherSessionTokenProvider, + dataStoreCode, trustAllCertificates); } @Override diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/IHierarchicalContentProvider.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/IHierarchicalContentProvider.java index 2a6d2fe9877d351987ae11b522eb6a71c4836074..441f50e04d390b4fd5f1b48ad98554203b076bb7 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/IHierarchicalContentProvider.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/IHierarchicalContentProvider.java @@ -18,6 +18,7 @@ package ch.systemsx.cisd.openbis.dss.generic.shared; import java.io.File; +import ch.systemsx.cisd.common.server.ISessionTokenProvider; import ch.systemsx.cisd.openbis.common.io.hierarchical_content.api.IHierarchicalContent; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IDatasetLocation; @@ -69,5 +70,9 @@ public interface IHierarchicalContentProvider */ @Deprecated IHierarchicalContent asContent(File datasetDirectory); - + + /** + * Creates a clone of this provider for the specified session token provider. + */ + IHierarchicalContentProvider cloneFor(ISessionTokenProvider sessionTokenProvider); } diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/UploadingCommandTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/UploadingCommandTest.java index bee8a16dfb72ba75b24befa7c7a58e1838a781aa..592f0bc147a5df82536313e1f75f982f0533fa6e 100644 --- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/UploadingCommandTest.java +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/UploadingCommandTest.java @@ -51,6 +51,7 @@ import ch.systemsx.cisd.common.exceptions.AuthorizationFailureException; import ch.systemsx.cisd.common.filesystem.FileUtilities; import ch.systemsx.cisd.common.logging.BufferedAppender; import ch.systemsx.cisd.common.mail.MailClientParameters; +import ch.systemsx.cisd.common.server.ISessionTokenProvider; import ch.systemsx.cisd.openbis.common.io.hierarchical_content.DefaultFileBasedHierarchicalContentFactory; import ch.systemsx.cisd.openbis.common.io.hierarchical_content.api.IHierarchicalContent; import ch.systemsx.cisd.openbis.dss.generic.shared.IDataSetDirectoryProvider; @@ -126,6 +127,13 @@ public class UploadingCommandTest extends AssertJUnit { return getContent(LOCATION_PREFIX + dataSetCode); } + + @Override + public IHierarchicalContentProvider cloneFor( + ISessionTokenProvider sessionTokenProvider) + { + return null; + } }; private static final class MockDataSetDirectoryProvider implements IDataSetDirectoryProvider diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/ftp/resolver/TemplateBasedDataSetResourceResolverTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/ftp/resolver/TemplateBasedDataSetResourceResolverTest.java index 57953fab7c6ad403ea8ac3f56ee3ef74e6a1ed17..3e071d35405d4fb270d7db2d7d82f71c035b71e8 100644 --- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/ftp/resolver/TemplateBasedDataSetResourceResolverTest.java +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/ftp/resolver/TemplateBasedDataSetResourceResolverTest.java @@ -40,6 +40,7 @@ import ch.systemsx.cisd.base.tests.AbstractFileSystemTestCase; import ch.systemsx.cisd.common.action.IDelegatedAction; import ch.systemsx.cisd.common.exceptions.ConfigurationFailureException; import ch.systemsx.cisd.common.filesystem.FileUtilities; +import ch.systemsx.cisd.common.server.ISessionTokenProvider; import ch.systemsx.cisd.common.test.TrackingMockery; import ch.systemsx.cisd.common.utilities.ITimeProvider; import ch.systemsx.cisd.openbis.common.io.hierarchical_content.DefaultFileBasedHierarchicalContentFactory; @@ -106,6 +107,12 @@ public class TemplateBasedDataSetResourceResolverTest extends AbstractFileSystem return new DefaultFileBasedHierarchicalContentFactory().asHierarchicalContent( datasetDirectory, IDelegatedAction.DO_NOTHING); } + + @Override + public IHierarchicalContentProvider cloneFor(ISessionTokenProvider sessionTokenProvider) + { + return null; + } } private static final Date REGISTRATION_DATE = new Date(42); diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/standard/TSVViewReportingPluginTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/standard/TSVViewReportingPluginTest.java index fac4d390249f48a1b1b23b76ce7f0827424d456a..58edb1adad9143941194e73e4abb038cddf5ff66 100644 --- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/standard/TSVViewReportingPluginTest.java +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/standard/TSVViewReportingPluginTest.java @@ -31,6 +31,7 @@ import ch.systemsx.cisd.base.tests.AbstractFileSystemTestCase; import ch.systemsx.cisd.common.action.IDelegatedAction; import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.common.filesystem.FileUtilities; +import ch.systemsx.cisd.common.server.ISessionTokenProvider; import ch.systemsx.cisd.openbis.common.io.hierarchical_content.DefaultFileBasedHierarchicalContentFactory; import ch.systemsx.cisd.openbis.common.io.hierarchical_content.api.IHierarchicalContent; import ch.systemsx.cisd.openbis.dss.generic.shared.DataSetProcessingContext; @@ -114,6 +115,13 @@ public class TSVViewReportingPluginTest extends AbstractFileSystemTestCase { return getContent("dataset-" + dataSetCode); } + + @Override + public IHierarchicalContentProvider cloneFor( + ISessionTokenProvider sessionTokenProvider) + { + return null; + } }; } diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/tasks/PluginTaskParametersTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/tasks/PluginTaskParametersTest.java index 68f458b79fd98dfa721c3339b22b7a7bbe6eee01..166f66cf8095d34e3a729e7a8dead2c929b2d4f5 100644 --- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/tasks/PluginTaskParametersTest.java +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/tasks/PluginTaskParametersTest.java @@ -39,6 +39,7 @@ import ch.systemsx.cisd.base.tests.AbstractFileSystemTestCase; import ch.systemsx.cisd.common.action.IDelegatedAction; import ch.systemsx.cisd.common.exceptions.ConfigurationFailureException; import ch.systemsx.cisd.common.properties.PropertyParametersUtil.SectionProperties; +import ch.systemsx.cisd.common.server.ISessionTokenProvider; import ch.systemsx.cisd.common.test.RecordingMatcher; import ch.systemsx.cisd.openbis.common.io.hierarchical_content.DefaultFileBasedHierarchicalContentFactory; import ch.systemsx.cisd.openbis.common.io.hierarchical_content.api.IHierarchicalContent; @@ -105,6 +106,13 @@ public class PluginTaskParametersTest extends AbstractFileSystemTestCase { return null; } + + @Override + public IHierarchicalContentProvider cloneFor( + ISessionTokenProvider sessionTokenProvider) + { + return null; + } }; final BeanFactory beanFactory = context.mock(BeanFactory.class); ServiceProviderTestWrapper.setApplicationContext(beanFactory); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/AbstractImagesDownloadServlet.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/AbstractImagesDownloadServlet.java index 120eb0d870134b1d4690fe2da818832bded8ccb8..b5915c54bbe1abd48ab1ea046c9b73da50db5eb5 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/AbstractImagesDownloadServlet.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/AbstractImagesDownloadServlet.java @@ -81,14 +81,16 @@ abstract class AbstractImagesDownloadServlet extends AbstractDatasetDownloadServ protected void deliverFile(HttpServletResponse response, ImageGenerationDescription params, HttpSession session) throws IOException { - ensureDatasetsAccessible(params, session, params.getSessionId()); + String sessionId = params.getSessionId(); + ensureDatasetsAccessible(params, session, sessionId); long start = System.currentTimeMillis(); ResponseContentStream responseStream; try { responseStream = - createImageResponse(params, applicationContext.getHierarchicalContentProvider()); + createImageResponse(params, + applicationContext.getHierarchicalContentProvider(sessionId)); } catch (HighLevelException e) { operationLog.warn(e.getMessage()); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreening.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreening.java index b925397281eca80160075a5b0e52f2d4c7c70c4d..9aa9509ff8988685d4cfe14b2ca92b5fb580906e 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreening.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreening.java @@ -248,7 +248,7 @@ public class DssServiceRpcScreening extends AbstractDssServiceRpc<IDssServiceRpc for (IImageDatasetIdentifier dataset : imageDatasets) { final IHierarchicalContent content = - getHierarchicalContent(dataset.getDatasetCode()); + getHierarchicalContent(sessionToken, dataset.getDatasetCode()); try { result.add(extractImageMetadata(dataset, content)); @@ -828,7 +828,7 @@ public class DssServiceRpcScreening extends AbstractDssServiceRpc<IDssServiceRpc public InputStream loadImages(String sessionToken, IDatasetIdentifier dataSetIdentifier, List<WellPosition> wellPositions, String channel, ImageSize thumbnailSizeOrNull) { - final IImagingDatasetLoader imageAccessor = createImageLoader(dataSetIdentifier); + final IImagingDatasetLoader imageAccessor = createImageLoader(sessionToken, dataSetIdentifier); final List<PlateImageReference> imageReferences = createPlateImageReferences(imageAccessor, dataSetIdentifier, wellPositions, channel); @@ -870,7 +870,7 @@ public class DssServiceRpcScreening extends AbstractDssServiceRpc<IDssServiceRpc public InputStream loadImages(String sessionToken, IDatasetIdentifier dataSetIdentifier, String channel, ImageSize thumbnailSizeOrNull) { - final IImagingDatasetLoader imageAccessor = createImageLoader(dataSetIdentifier); + final IImagingDatasetLoader imageAccessor = createImageLoader(sessionToken, dataSetIdentifier); List<MicroscopyImageReference> imageReferences = listImageReferences(dataSetIdentifier, channel, imageAccessor); final Size sizeOrNull = tryAsSize(thumbnailSizeOrNull); @@ -903,7 +903,7 @@ public class DssServiceRpcScreening extends AbstractDssServiceRpc<IDssServiceRpc public InputStream loadThumbnailImages(String sessionToken, IDatasetIdentifier dataSetIdentifier, List<String> channels) { - final IImagingDatasetLoader imageAccessor = createImageLoader(dataSetIdentifier); + final IImagingDatasetLoader imageAccessor = createImageLoader(sessionToken, dataSetIdentifier); assert imageAccessor != null : "imageAccessor not found for: " + dataSetIdentifier; final List<MicroscopyImageReference> imageReferences = listImageReferences(dataSetIdentifier, channels, imageAccessor); @@ -936,7 +936,7 @@ public class DssServiceRpcScreening extends AbstractDssServiceRpc<IDssServiceRpc public List<MicroscopyImageReference> listImageReferences(String sessionToken, IDatasetIdentifier dataSetIdentifier, String channel) { - IImagingDatasetLoader imageAccessor = createImageLoader(dataSetIdentifier); + IImagingDatasetLoader imageAccessor = createImageLoader(sessionToken, dataSetIdentifier); return listImageReferences(dataSetIdentifier, channel, imageAccessor); } @@ -944,7 +944,7 @@ public class DssServiceRpcScreening extends AbstractDssServiceRpc<IDssServiceRpc public List<MicroscopyImageReference> listImageReferences(String sessionToken, IDatasetIdentifier dataSetIdentifier, List<String> channels) { - IImagingDatasetLoader imageAccessor = createImageLoader(dataSetIdentifier); + IImagingDatasetLoader imageAccessor = createImageLoader(sessionToken, dataSetIdentifier); return listImageReferences(dataSetIdentifier, channels, imageAccessor); } @@ -982,7 +982,7 @@ public class DssServiceRpcScreening extends AbstractDssServiceRpc<IDssServiceRpc public List<PlateImageReference> listPlateImageReferences(String sessionToken, IDatasetIdentifier dataSetIdentifier, List<WellPosition> wellPositions, String channel) { - IImagingDatasetLoader imageAccessor = createImageLoader(dataSetIdentifier); + IImagingDatasetLoader imageAccessor = createImageLoader(sessionToken, dataSetIdentifier); return createPlateImageReferences(imageAccessor, dataSetIdentifier, wellPositions, channel); } @@ -991,7 +991,7 @@ public class DssServiceRpcScreening extends AbstractDssServiceRpc<IDssServiceRpc IDatasetIdentifier dataSetIdentifier, List<WellPosition> wellPositions, List<String> channels) { - IImagingDatasetLoader imageAccessor = createImageLoader(dataSetIdentifier); + IImagingDatasetLoader imageAccessor = createImageLoader(sessionToken, dataSetIdentifier); return createPlateImageReferences(imageAccessor, dataSetIdentifier, wellPositions, channels); } @@ -1107,10 +1107,10 @@ public class DssServiceRpcScreening extends AbstractDssServiceRpc<IDssServiceRpc return transformations; } - private IImagingDatasetLoader createImageLoader(IDatasetIdentifier dataSetIdentifier) + private IImagingDatasetLoader createImageLoader(String sessionToken, IDatasetIdentifier dataSetIdentifier) { final String datasetCode = dataSetIdentifier.getDatasetCode(); - return createImageLoader(datasetCode); + return createImageLoader(sessionToken, datasetCode); } @Override @@ -1442,7 +1442,7 @@ public class DssServiceRpcScreening extends AbstractDssServiceRpc<IDssServiceRpc if (imageDatasetsMap.containsKey(imageReference.getDatasetCode()) == false) { IImagingDatasetLoader imageAccessor = - tryCreateImageLoader(imageReference.getDatasetCode()); + tryCreateImageLoader(sessionToken, imageReference.getDatasetCode()); if (imageAccessor == null) // Check whether this is a feature vector data set { final ExternalData imageDataset = @@ -1450,7 +1450,7 @@ public class DssServiceRpcScreening extends AbstractDssServiceRpc<IDssServiceRpc if (imageDataset != null) { imageAccessor = - createImageLoader(imageDataset.getCode()); + createImageLoader(sessionToken, imageDataset.getCode()); } else { throw UserFailureException.fromTemplate( @@ -1536,15 +1536,15 @@ public class DssServiceRpcScreening extends AbstractDssServiceRpc<IDssServiceRpc return new Size(thumbnailSizeOrNull.getWidth(), thumbnailSizeOrNull.getHeight()); } - private IImagingDatasetLoader tryCreateImageLoader(String datasetCode) + private IImagingDatasetLoader tryCreateImageLoader(String sessionToken, String datasetCode) { - final IHierarchicalContent content = getHierarchicalContent(datasetCode); + final IHierarchicalContent content = getHierarchicalContent(sessionToken, datasetCode); return tryCreateImageLoader(datasetCode, content, false); } - private IImagingDatasetLoader createImageLoader(String datasetCode) + private IImagingDatasetLoader createImageLoader(String sessionToken, String datasetCode) { - final IHierarchicalContent content = getHierarchicalContent(datasetCode); + final IHierarchicalContent content = getHierarchicalContent(sessionToken, datasetCode); return createImageLoader(datasetCode, content); }