public static CopyObjectsEvent newIgnoredErrorsEvent(ThreadWatcher threadWatcher, Throwable[] ignoredErrors, Object uniqueOperationId) { CopyObjectsEvent event = new CopyObjectsEvent(EVENT_IGNORED_ERRORS, uniqueOperationId); event.setThreadWatcher(threadWatcher); event.setIgnoredErrors(ignoredErrors); return event; }
/** * @return * the {@link StorageObject}s that were created by a a successful copy operation. * @throws IllegalStateException * copied objects are only available from EVENT_COMPLETED events. */ public StorageObject[] getCopiedObjects() throws IllegalStateException { if (getEventCode() != EVENT_COMPLETED) { throw new IllegalStateException("Cancelled Objects are only available from EVENT_COMPLETED events"); } return destinationObjects; }
public static CopyObjectsEvent newCancelledEvent(StorageObject[] incompletedObjects, Object uniqueOperationId) { CopyObjectsEvent event = new CopyObjectsEvent(EVENT_CANCELLED, uniqueOperationId); event.setCopyCancelledObjects(incompletedObjects); return event; }
public static CopyObjectsEvent newErrorEvent(Throwable t, Object uniqueOperationId) { CopyObjectsEvent event = new CopyObjectsEvent(EVENT_ERROR, uniqueOperationId); event.setErrorCause(t); return event; }
public static CopyObjectsEvent newCompletedEvent(Object uniqueOperationId, String[] sourceObjectKeys, StorageObject[] destinationObjects) { CopyObjectsEvent event = new CopyObjectsEvent(EVENT_COMPLETED, uniqueOperationId); event.setDestinationObjects(destinationObjects); event.setSourceObjectKeys(sourceObjectKeys); return event; }
public static CopyObjectsEvent newInProgressEvent(ThreadWatcher threadWatcher, Map[] completedResults, Object uniqueOperationId) { CopyObjectsEvent event = new CopyObjectsEvent(EVENT_IN_PROGRESS, uniqueOperationId); event.setThreadWatcher(threadWatcher); event.setResults(completedResults); return event; }
@Override public void event(CopyObjectsEvent event) { super.event(event); if (ServiceEvent.EVENT_IN_PROGRESS == event.getEventCode()) { resultsList.addAll(Arrays.asList(event.getCopyResults())); } }; };
public static CopyObjectsEvent newStartedEvent(ThreadWatcher threadWatcher, Object uniqueOperationId) { CopyObjectsEvent event = new CopyObjectsEvent(EVENT_STARTED, uniqueOperationId); event.setThreadWatcher(threadWatcher); return event; }
@Override public void fireErrorEvent(Throwable throwable) { success[0] = false; fireServiceEvent(CopyObjectsEvent.newErrorEvent(throwable, uniqueOperationId)); } @Override
@Override public void fireProgressEvent(ThreadWatcher threadWatcher, List completedResults) { incompletedObjectsList.removeAll(completedResults); Map[] copyResults = (Map[]) completedResults .toArray(new Map[completedResults.size()]); fireServiceEvent(CopyObjectsEvent.newInProgressEvent(threadWatcher, copyResults, uniqueOperationId)); } @Override
@Override public void fireCancelEvent() { StorageObject[] incompletedObjects = (StorageObject[]) incompletedObjectsList .toArray(new StorageObject[incompletedObjectsList.size()]); success[0] = false; fireServiceEvent(CopyObjectsEvent.newCancelledEvent(incompletedObjects, uniqueOperationId)); } @Override
@Override public void fireStartEvent(ThreadWatcher threadWatcher) { fireServiceEvent(CopyObjectsEvent.newStartedEvent(threadWatcher, uniqueOperationId)); } @Override
@Override public void fireIgnoredErrorsEvent(ThreadWatcher threadWatcher, Throwable[] ignoredErrors) { success[0] = false; fireServiceEvent(CopyObjectsEvent.newIgnoredErrorsEvent(threadWatcher, ignoredErrors, uniqueOperationId)); } }).run();
@Override public void fireCompletedEvent() { fireServiceEvent(CopyObjectsEvent.newCompletedEvent(uniqueOperationId, sourceObjectKeys, destinationObjects)); } @Override
public static CopyObjectsEvent newCompletedEvent(Object uniqueOperationId, String[] sourceObjectKeys, StorageObject[] destinationObjects) { CopyObjectsEvent event = new CopyObjectsEvent(EVENT_COMPLETED, uniqueOperationId); event.setDestinationObjects(destinationObjects); event.setSourceObjectKeys(sourceObjectKeys); return event; }
public static CopyObjectsEvent newInProgressEvent(ThreadWatcher threadWatcher, Map[] completedResults, Object uniqueOperationId) { CopyObjectsEvent event = new CopyObjectsEvent(EVENT_IN_PROGRESS, uniqueOperationId); event.setThreadWatcher(threadWatcher); event.setResults(completedResults); return event; }
@Override public void event(CopyObjectsEvent event) { super.event(event); if (ServiceEvent.EVENT_IN_PROGRESS == event.getEventCode()) { resultsList.addAll(Arrays.asList(event.getCopyResults())); } }; };
public static CopyObjectsEvent newErrorEvent(Throwable t, Object uniqueOperationId) { CopyObjectsEvent event = new CopyObjectsEvent(EVENT_ERROR, uniqueOperationId); event.setErrorCause(t); return event; }
public static CopyObjectsEvent newStartedEvent(ThreadWatcher threadWatcher, Object uniqueOperationId) { CopyObjectsEvent event = new CopyObjectsEvent(EVENT_STARTED, uniqueOperationId); event.setThreadWatcher(threadWatcher); return event; }
@Override public void fireErrorEvent(Throwable throwable) { success[0] = false; fireServiceEvent(CopyObjectsEvent.newErrorEvent(throwable, uniqueOperationId)); } @Override