diff --git a/src/python/dm/ds_web_service/service/fileSessionController.py b/src/python/dm/ds_web_service/service/fileSessionController.py index 8dcbfb2f6c98678a5dcb22d8ea75bc9b59fbdca7..b28d89872ddb8700e33c6648837778d70177203d 100755 --- a/src/python/dm/ds_web_service/service/fileSessionController.py +++ b/src/python/dm/ds_web_service/service/fileSessionController.py @@ -33,3 +33,19 @@ class FileSessionController(DmSessionController): self.logger.debug('Returning: %s' % response) return response + @cherrypy.expose + @DmSessionController.require(DmSessionController.isAdministrator()) + @DmSessionController.execute + def statFile(self, **kwargs): + encodedFileInfo = kwargs.get('fileInfo') + if not encodedFileInfo: + raise InvalidRequest('Invalid file info provided.') + fileInfo = json.loads(Encoder.decode(encodedFileInfo)) + + if not fileInfo.has_key('experimentFilePath'): + raise InvalidRequest('Experiment file path is missing.') + if not fileInfo.has_key('experimentName'): + raise InvalidRequest('Experiment name is missing.') + response = self.fileSessionControllerImpl.statFile(fileInfo).getFullJsonRep() + self.logger.debug('Returning: %s' % response) + return response diff --git a/src/python/dm/ds_web_service/service/impl/fileSessionControllerImpl.py b/src/python/dm/ds_web_service/service/impl/fileSessionControllerImpl.py index 8c50368c44a538ecbc6db8c4b8f1e186fdd68be8..f527e6e1fc67555f8cd2cd9767e293fbb7eca920 100755 --- a/src/python/dm/ds_web_service/service/impl/fileSessionControllerImpl.py +++ b/src/python/dm/ds_web_service/service/impl/fileSessionControllerImpl.py @@ -25,3 +25,10 @@ class FileSessionControllerImpl(DmObjectManager): experiment = self.experimentDbApi.getExperimentByName(experimentName) ExperimentManager.getInstance().processExperimentFile(experimentFilePath, experiment, fileInfo) return FileMetadata(fileInfo) + + def statFile(self, fileInfo): + experimentFilePath = fileInfo.get('experimentFilePath') + experimentName = fileInfo.get('experimentName') + experiment = self.experimentDbApi.getExperimentByName(experimentName) + ExperimentManager.getInstance().statExperimentFile(experimentFilePath, experiment, fileInfo) + return FileMetadata(fileInfo)