View Javadoc

1   /*
2    * #%L
3    * Bitrepository Protocol
4    * 
5    * $Id$
6    * $HeadURL$
7    * %%
8    * Copyright (C) 2010 - 2011 The State and University Library, The Royal Library and The State Archives, Denmark
9    * %%
10   * This program is free software: you can redistribute it and/or modify
11   * it under the terms of the GNU Lesser General Public License as 
12   * published by the Free Software Foundation, either version 2.1 of the 
13   * License, or (at your option) any later version.
14   * 
15   * This program is distributed in the hope that it will be useful,
16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18   * GNU General Lesser Public License for more details.
19   * 
20   * You should have received a copy of the GNU General Lesser Public 
21   * License along with this program.  If not, see
22   * <http://www.gnu.org/licenses/lgpl-2.1.html>.
23   * #L%
24   */
25  package org.bitrepository.client.eventhandler;
26  
27  import org.bitrepository.protocol.OperationType;
28  
29  /**
30   * Container for information regarding events occurring during an operation on the Bit Repository.
31   */
32  public interface OperationEvent {
33      /**
34       * Defines the different types of events that can be received. These are:<ol>
35       * <li>PillarIdentified: An identify response has been received from a pillar.
36       * <li>PillarSelected: Enough responses has now been received from pillar to select a pillar to perform the 
37       * operation on.
38       * <li>RequestSent: A request for the operation has ben sent to the relevant pillar(s). 
39       * <li>Progress: In case of longer operations (e.g. requiring file transfers) progress information might be 
40       * received from the pillars.
41       * <li>PartiallyComplete: The cases when part of the operation has been completed (e.g. when the operation has been
42       * to be performed at several pillars, and it has been completed on one of them).
43       * <li>Complete: The operation has finished
44       * </ol>
45       * The following error types exist:<ol>
46       * <li>Failed: A general failure occurred during the operation
47       * <li>NoPillarFound: No relevant response was received before a timeout occurred.
48       * <li>TimeOut: The operation did't finish before a timeout occurred.
49       * </ol>
50       */
51      public enum OperationEventType {
52          IDENTIFY_REQUEST_SENT,
53          COMPONENT_IDENTIFIED,
54          IDENTIFICATION_COMPLETE,
55          REQUEST_SENT,
56          PROGRESS,
57          COMPONENT_COMPLETE,
58          COMPLETE, 
59          COMPONENT_FAILED,
60          FAILED,
61          IDENTIFY_TIMEOUT, 
62          WARNING 
63      }
64      
65      /**
66       * A string representation of what has happened
67       * @return
68       */
69      String getInfo();
70      
71      /**
72       * Used to get the type of event.
73       * @return A <code>OperationEventType</code> categorizing this event.
74       */
75      OperationEventType getEventType();
76  
77      /**
78       * Used to get the type of operation.
79       * @return A <code>OperationEventType</code> categorizing this event.
80       */
81      OperationType getOperationType();
82  
83      /**
84       * Used to get the fileID this operation is performed on, if any.
85       * @return A <code>OperationEventType</code> categorizing this event.
86       */
87      String getFileID();
88  
89      /**
90       * Deliver the conversation ID of the event.
91       */
92      String getConversationID();
93      
94      /**
95       * The ID of the collection that the  
96       */
97      String getCollectionID();
98  }