From 9506d95b68c3f3ed7193b851679a7d44a7909f0f Mon Sep 17 00:00:00 2001 From: felmer <felmer> Date: Mon, 22 Nov 2010 11:29:19 +0000 Subject: [PATCH] LMS-1888 add logging for DssServiceRpcScreening SVN: 18831 --- .../server/DssServiceRpcScreening.java | 11 +- .../server/DssServiceRpcScreeningLogger.java | 147 ++++++++++++++++++ .../shared/api/v1/dto/ImageSize.java | 6 + .../java/screening-dssApplicationContext.xml | 13 +- 4 files changed, 174 insertions(+), 3 deletions(-) create mode 100644 screening/source/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreeningLogger.java 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 7e7e867d66f..8b589901486 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 @@ -40,6 +40,7 @@ import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException; import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.common.io.ConcatenatedContentInputStream; import ch.systemsx.cisd.common.io.IContent; +import ch.systemsx.cisd.common.spring.IInvocationLoggerContext; import ch.systemsx.cisd.openbis.dss.etl.AbsoluteImageReference; import ch.systemsx.cisd.openbis.dss.etl.HCSImageDatasetLoaderFactory; import ch.systemsx.cisd.openbis.dss.etl.IHCSImageDatasetLoader; @@ -51,6 +52,7 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.ServiceProvider; import ch.systemsx.cisd.openbis.dss.generic.shared.dto.Size; import ch.systemsx.cisd.openbis.dss.generic.shared.utils.CodeAndLabelUtil; import ch.systemsx.cisd.openbis.dss.generic.shared.utils.ImageUtil; +import ch.systemsx.cisd.openbis.dss.screening.shared.api.v1.IDssServiceRpcScreening; import ch.systemsx.cisd.openbis.dss.screening.shared.api.v1.IDssServiceRpcScreeningInternal; import ch.systemsx.cisd.openbis.dss.shared.DssScreeningUtils; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; @@ -86,7 +88,7 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.imaging.dataaccess.Trans * * @author Tomasz Pylak */ -public class DssServiceRpcScreening extends AbstractDssServiceRpc implements +public class DssServiceRpcScreening extends AbstractDssServiceRpc<IDssServiceRpcScreeningInternal> implements IDssServiceRpcScreeningInternal { @@ -145,6 +147,11 @@ public class DssServiceRpcScreening extends AbstractDssServiceRpc implements return listAvailableFeatureCodes(sessionToken, featureDatasets); } + public IDssServiceRpcScreeningInternal createLogger(IInvocationLoggerContext context) + { + return new DssServiceRpcScreeningLogger(context); + } + public List<String> listAvailableFeatureCodes(String sessionToken, List<? extends IFeatureVectorDatasetIdentifier> featureDatasets) { @@ -368,7 +375,7 @@ public class DssServiceRpcScreening extends AbstractDssServiceRpc implements if (thumbnailSizeOrNull != null) { size = new Size(thumbnailSizeOrNull.getWidth(), thumbnailSizeOrNull.getHeight()); - } + } List<IContent> imageContents = new ArrayList<IContent>(); for (PlateImageReference imageReference : imageReferences) { diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreeningLogger.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreeningLogger.java new file mode 100644 index 00000000000..ee1ab6f843a --- /dev/null +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreeningLogger.java @@ -0,0 +1,147 @@ +/* + * Copyright 2010 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.screening.server; + +import java.io.InputStream; +import java.util.List; + +import ch.systemsx.cisd.base.image.IImageTransformerFactory; +import ch.systemsx.cisd.common.spring.IInvocationLoggerContext; +import ch.systemsx.cisd.openbis.dss.screening.shared.api.v1.IDssServiceRpcScreeningInternal; +import ch.systemsx.cisd.openbis.generic.server.AbstractServerLogger; +import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.FeatureVectorDataset; +import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.FeatureVectorDatasetReference; +import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.FeatureVectorDatasetWellReference; +import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.FeatureVectorWithDescription; +import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.IDatasetIdentifier; +import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.IFeatureVectorDatasetIdentifier; +import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.IImageDatasetIdentifier; +import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.ImageDatasetMetadata; +import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.ImageSize; +import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateImageReference; +import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.WellPosition; + +/** + * + * + * @author Franz-Josef Elmer + */ +public class DssServiceRpcScreeningLogger extends AbstractServerLogger implements + IDssServiceRpcScreeningInternal +{ + + DssServiceRpcScreeningLogger(IInvocationLoggerContext context) + { + super(null, context); + } + + public int getMajorVersion() + { + return 0; + } + + public int getMinorVersion() + { + return 0; + } + + public List<String> listAvailableFeatureNames(String sessionToken, + List<? extends IFeatureVectorDatasetIdentifier> featureDatasets) + { + logAccess(sessionToken, "load_available_feature_codes", "DATASET_REFERENCES(%s)", + featureDatasets); + return null; + } + + public List<String> listAvailableFeatureCodes(String sessionToken, + List<? extends IFeatureVectorDatasetIdentifier> featureDatasets) + { + logAccess(sessionToken, "load_available_feature_names", "DATASET_REFERENCES(%s)", + featureDatasets); + return null; + } + + public List<FeatureVectorDataset> loadFeatures(String sessionToken, + List<FeatureVectorDatasetReference> featureDatasets, List<String> featureCodes) + { + logAccess(sessionToken, "load_features", "DATASET_REFERENCES(%s) FEATURES(%s)", + featureDatasets, featureCodes); + return null; + } + + public List<FeatureVectorWithDescription> loadFeaturesForDatasetWellReferences( + String sessionToken, List<FeatureVectorDatasetWellReference> datasetWellReferences, + List<String> featureCodes) + { + logAccess(sessionToken, "load_feature_for_dataset_well_references", + "WELL_REFERENCES(%s) FEATURES(%s)", datasetWellReferences, featureCodes); + return null; + } + + public InputStream loadImages(String sessionToken, List<PlateImageReference> imageReferences, + boolean convertToPng) + { + logAccess(sessionToken, "load_images", "IMAGE_REFERENCES(%s) CONVERT(%s)", imageReferences, + convertToPng); + return null; + } + + public InputStream loadImages(String sessionToken, List<PlateImageReference> imageReferences) + { + logAccess(sessionToken, "load_images", "IMAGE_REFERENCES(%s)", imageReferences); + return null; + } + + public InputStream loadImages(String sessionToken, IDatasetIdentifier dataSetIdentifier, + List<WellPosition> wellPositions, String channel, ImageSize thumbnailSizeOrNull) + { + logAccess(sessionToken, "load_images", "DATA_SET(%s) CHANNEL(%s) IMAGE_SIZE(%s)", + dataSetIdentifier, channel, thumbnailSizeOrNull); + return null; + } + + public void saveImageTransformerFactory(String sessionToken, + List<IDatasetIdentifier> dataSetIdentifiers, String channel, + IImageTransformerFactory transformerFactory) + { + logTracking(sessionToken, "save_image_transformer_factory", + "DATA_SETS(%s) CHANNEL(%s) FACTORY(%s)", dataSetIdentifiers, channel, + transformerFactory); + } + + public IImageTransformerFactory getImageTransformerFactoryOrNull(String sessionToken, + List<IDatasetIdentifier> dataSetIdentifiers, String channel) + { + logAccess(sessionToken, "get_image_transformer_factory", "DATA_SETS(%s) CHANNEL(%s)", + dataSetIdentifiers, channel); + return null; + } + + public List<ImageDatasetMetadata> listImageMetadata(String sessionToken, + List<? extends IImageDatasetIdentifier> imageDatasets) + { + logAccess(sessionToken, "load_image_metadata", "DATA_SETS(%s)", imageDatasets); + return null; + } + + public void checkDatasetsAuthorizationForIDatasetIdentifier(String sessionToken, + List<? extends IDatasetIdentifier> featureDatasets) + { + // server already logs + } + +} diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/api/v1/dto/ImageSize.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/api/v1/dto/ImageSize.java index 90a2db66708..88f48e3c8dc 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/api/v1/dto/ImageSize.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/api/v1/dto/ImageSize.java @@ -48,5 +48,11 @@ public class ImageSize implements Serializable { return height; } + + @Override + public String toString() + { + return width + "x" + height; + } } diff --git a/screening/source/java/screening-dssApplicationContext.xml b/screening/source/java/screening-dssApplicationContext.xml index 45d91c9f250..80d65a713cd 100644 --- a/screening/source/java/screening-dssApplicationContext.xml +++ b/screening/source/java/screening-dssApplicationContext.xml @@ -46,10 +46,21 @@ <property name="serviceInterface" value="ch.systemsx.cisd.openbis.dss.screening.shared.api.v1.IDssServiceRpcScreening" /> </bean> - <!-- + <!-- + // This discovers on-the-fly all <code>org.springframework.aop.Advisor</code> implementations. + --> + <bean id="bean-post-processor" + class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" /> + + <!-- // Authorization --> <bean id="screening-rpc-authorization-advisor" class="ch.systemsx.cisd.openbis.dss.generic.server.DssServiceRpcAuthorizationAdvisor" /> + <!-- + // Logging + --> + + <bean class="ch.systemsx.cisd.common.spring.LogAdvisor" /> </beans> \ No newline at end of file -- GitLab