コード例 #1
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);
     }
   }
 }