Ejemplo n.º 1
0
 /** {@inheritDoc} */
 @MethodLog
 public StorageData removeLabelFromStorage(
     StorageData storageData, AbstractStorageLabel<?> storageLabel) throws StorageException {
   try {
     storageManager.removeLabelFromStorage(storageData, storageLabel);
     return storageManager.getStorageData(storageData.getId());
   } catch (IOException | SerializationException e) {
     throw new StorageException(
         "Exception occurred trying to save storage data changes to disk.", e);
   }
 }
Ejemplo n.º 2
0
 /** {@inheritDoc} */
 @MethodLog
 public String getCachedStorageDataFileLocation(StorageData storageData, int hash)
     throws StorageException {
   if (!storageManager.isStorageExisting(storageData)) {
     throw new StorageException(
         "The storage "
             + storageData
             + " does not exist on the CMR. Cached data file can not be resolved.");
   }
   return storageManager.getCachedStorageDataFileLocation(storageData, hash);
 }
Ejemplo n.º 3
0
 /**
  * Opens an already existing storage in means that it prepares it for write.
  *
  * @param storageData Storage to open.
  * @throws StorageException When storage with provided {@link StorageData} does not exists. When
  *     storage opening fails.
  */
 @MethodLog
 public void openStorage(StorageData storageData) throws StorageException {
   if (!storageManager.isStorageExisting(storageData)) {
     throw new StorageException("The storage " + storageData + " does not exsist on the CMR.");
   }
   try {
     storageManager.openStorage(storageData);
   } catch (Exception e) {
     throw new StorageException(
         "Exception occurred trying to open storage" + storageData + ".", e);
   }
 }
Ejemplo n.º 4
0
 /** {@inheritDoc} */
 @MethodLog
 public StorageData addLabelToStorage(
     StorageData storageData, AbstractStorageLabel<?> storageLabel, boolean doOverwrite)
     throws StorageException {
   try {
     storageManager.addLabelToStorage(storageData, storageLabel, doOverwrite);
     storageLabelDataDao.saveLabel(storageLabel);
     return storageManager.getStorageData(storageData.getId());
   } catch (IOException | SerializationException e) {
     throw new StorageException(
         "Exception occurred trying to save storage data changes to disk.", e);
   }
 }
Ejemplo n.º 5
0
 /** {@inheritDoc} */
 @MethodLog
 public Map<String, Long> getAgentFilesLocations(StorageData storageData) throws StorageException {
   if (!storageManager.isStorageExisting(storageData)) {
     throw new StorageException("The storage " + storageData + " does not exist on the CMR.");
   }
   try {
     return storageManager.getFilesHttpLocation(
         storageData, StorageFileType.AGENT_FILE.getExtension());
   } catch (IOException e) {
     throw new StorageException(
         "Exception occurred trying to load storage agent files locations.", e);
   }
 }
Ejemplo n.º 6
0
 /** {@inheritDoc} */
 @MethodLog
 public void stopRecording() throws StorageException {
   try {
     storageManager.stopRecording();
   } catch (Exception e) {
     throw new StorageException("Exception occurred trying to stop recording.", e);
   }
 }
Ejemplo n.º 7
0
 /** {@inheritDoc} */
 @MethodLog
 public void updateStorageData(StorageData storageData) throws StorageException {
   try {
     storageManager.updateStorageData(storageData);
   } catch (IOException | SerializationException e) {
     throw new StorageException(e);
   }
 }
Ejemplo n.º 8
0
 /** {@inheritDoc} */
 @MethodLog
 public void unpackUploadedStorage(IStorageData storageData) throws StorageException {
   try {
     storageManager.unpackUploadedStorage(storageData);
   } catch (IOException e) {
     throw new StorageException("Exception occurred trying to check for imported storage.", e);
   }
 }
Ejemplo n.º 9
0
 /** {@inheritDoc} */
 @MethodLog
 public void writeToStorage(
     StorageData storageData,
     Collection<DefaultData> defaultDataCollection,
     Collection<AbstractDataProcessor> dataProcessors,
     boolean synchronously)
     throws StorageException {
   if (!storageManager.isStorageOpen(storageData)) {
     throw new StorageException(
         "Writing to storage tried to be performed on the storage that is not opened. Please open the storage first.");
   }
   try {
     storageManager.writeToStorage(
         storageData, defaultDataCollection, dataProcessors, synchronously);
   } catch (IOException | SerializationException e) {
     throw new StorageException("Copy Buffer to Storage action encountered an error.", e);
   }
 }
Ejemplo n.º 10
0
 /** {@inheritDoc} */
 @MethodLog
 @Override
 public RecordingData getRecordingData() {
   if (storageManager.getRecordingState() == RecordingState.ON
       || storageManager.getRecordingState() == RecordingState.SCHEDULED) {
     RecordingData recordingData = new RecordingData();
     RecordingProperties recordingProperties = storageManager.getRecordingProperties();
     if (null != recordingProperties) {
       recordingData.setRecordStartDate(recordingProperties.getRecordStartDate());
       recordingData.setRecordEndDate(recordingProperties.getRecordEndDate());
     }
     recordingData.setRecordingStorage(storageManager.getRecordingStorage());
     recordingData.setRecordingWritingStatus(storageManager.getRecordingStatus());
     return recordingData;
   } else {
     return null;
   }
 }
Ejemplo n.º 11
0
 /**
  * {@inheritDoc}
  *
  * @throws StorageException
  */
 @MethodLog
 public void closeStorage(StorageData storageData) throws StorageException {
   try {
     storageManager.closeStorage(storageData);
   } catch (IOException | SerializationException e) {
     throw new StorageException(
         "Exception occurred trying to close storage" + storageData + ".", e);
   }
 }
Ejemplo n.º 12
0
 /**
  * Creates the new storage on the CMR with information given in {@link StorageData} object.
  *
  * @param storageData Information about new storage.
  * @throws StorageException When storage creation fails.
  */
 @MethodLog
 public void createStorage(StorageData storageData) throws StorageException {
   try {
     storageManager.createStorage(storageData);
   } catch (Exception e) {
     throw new StorageException(
         "Exception occurred trying to create storage" + storageData + ".", e);
   }
 }
Ejemplo n.º 13
0
 /** {@inheritDoc} */
 @MethodLog
 public void createStorageFromUploadedDir(final IStorageData localStorageData)
     throws StorageException {
   try {
     storageManager.createStorageFromUploadedDir(localStorageData);
   } catch (IOException | SerializationException e) {
     throw new StorageException(
         "Exception occurred trying to create storage from uploaded local storage.", e);
   }
 }
Ejemplo n.º 14
0
 /** {@inheritDoc} */
 @MethodLog
 public void cacheStorageData(
     StorageData storageData, Collection<? extends DefaultData> data, int hash)
     throws StorageException {
   if (!storageManager.isStorageExisting(storageData)) {
     throw new StorageException(
         "The storage "
             + storageData
             + " does not exist on the CMR. Data caching is not possible.");
   }
   if (!storageManager.isStorageClosed(storageData)) {
     throw new StorageException(
         "The storage " + storageData + " is still not finalized.  Data caching is not possible.");
   }
   try {
     storageManager.cacheStorageData(storageData, data, hash);
   } catch (IOException | SerializationException e) {
     throw new StorageException("Exception occurred trying to cache data fpr storage.", e);
   }
 }
Ejemplo n.º 15
0
 /** {@inheritDoc} */
 @MethodLog
 public StorageData copyBufferToStorage(
     StorageData storageData,
     List<Long> platformIdents,
     Collection<AbstractDataProcessor> dataProcessors,
     boolean autoFinalize)
     throws StorageException {
   try {
     storageManager.copyBufferToStorage(storageData, platformIdents, dataProcessors, autoFinalize);
     return storageData;
   } catch (IOException | SerializationException e) {
     throw new StorageException("Copy Buffer to Storage action encountered an error.", e);
   }
 }
Ejemplo n.º 16
0
 @Override
 public StorageData copyDataToStorage(
     StorageData storageData,
     Collection<Long> elementIds,
     long platformIdent,
     Collection<AbstractDataProcessor> dataProcessors,
     boolean autoFinalize)
     throws StorageException {
   try {
     storageManager.copyDataToStorage(
         storageData, elementIds, platformIdent, dataProcessors, autoFinalize);
     return storageData;
   } catch (IOException | SerializationException e) {
     throw new StorageException("Copy Data to Storage action encountered an error.", e);
   }
 }
Ejemplo n.º 17
0
 /** {@inheritDoc} */
 @MethodLog
 public StorageData startOrScheduleRecording(
     StorageData storageData, RecordingProperties recordingProperties) throws StorageException {
   if ((storageManager.getRecordingState() == RecordingState.ON
           || storageManager.getRecordingState() == RecordingState.SCHEDULED)
       && !storageData.equals(storageManager.getRecordingStorage())) {
     throw new StorageException(
         "Recording is already active/scheduled with different storage. Only one storage at time can be chosen as recording destination.");
   } else if (storageManager.getRecordingState() == RecordingState.ON
       || storageManager.getRecordingState() == RecordingState.SCHEDULED) {
     throw new StorageException("Recording is already active/scheduled with selected storage.");
   } else {
     try {
       storageManager.startOrScheduleRecording(storageData, recordingProperties);
       return storageManager.getRecordingStorage();
     } catch (IOException | SerializationException e) {
       throw new StorageException(
           "Exception occurred trying to start recording on storage " + storageData + ".", e);
     }
   }
 }
Ejemplo n.º 18
0
 /** {@inheritDoc} */
 @MethodLog
 public List<StorageData> getOpenedStorages() {
   return storageManager.getOpenedStorages();
 }
Ejemplo n.º 19
0
 /** {@inheritDoc} */
 @MethodLog
 public List<StorageData> getExistingStorages() {
   return storageManager.getExistingStorages();
 }
Ejemplo n.º 20
0
 /** {@inheritDoc} */
 @MethodLog
 public long getStorageQueuedWriteTaskCount(StorageData storageData) {
   return storageManager.getStorageQueuedWriteTaskCount(storageData);
 }
Ejemplo n.º 21
0
 /** {@inheritDoc} */
 @MethodLog
 public List<StorageData> getReadableStorages() {
   return storageManager.getReadableStorages();
 }
Ejemplo n.º 22
0
 /** {@inheritDoc} */
 @MethodLog
 public RecordingState getRecordingState() {
   return storageManager.getRecordingState();
 }
Ejemplo n.º 23
0
 /** {@inheritDoc} */
 @MethodLog
 public boolean isStorageOpen(StorageData storageData) {
   return storageManager.isStorageOpen(storageData);
 }