User:Emre/tb/activitymanagerInterface: Difference between revisions

Jump to navigation Jump to search
Line 52: Line 52:
** Progress bar: <i>Self explanatory</i>
** Progress bar: <i>Self explanatory</i>


== Activity Manager Interfaces ==
== Interfaces ==


* Activity Initiator: The entity that generates the activity. It is internal
* <b>nsIActivityMgrListener</b>: The implementor of this interface gets notified when an activity is added/removed to/from the activities list managed by Activity Manager.  


An initiator is an optional property of the activity set during the initialization. It is internal to the activity and not used by <b>Activity Manager</b>. Can be any XPCOM components related to the activity.
* <b>nsIActivityManager</b>: Keeps the list of the recent Processes and Events. It is also responsible of serialization/deserialization of the Events.  Activity Manager doesn't add/remove activities but might change the state of the activities.


is optional and internal to the activity.
* <b>nsIActivity</b>: Base interface for both nsIActivityProcess and nsIActivityEvent. Exposes common properties and methods.
 
* <b>nsIActivityProcess</b>: [https://wiki.mozilla.org/Thunderbird:Activity_Manager#Processes Processes] activity types should implement this interface. Possible states are:
** ACTIVITY_NOTSTARTED: State of an uninitialized activity. Represents an invalid activity.
** ACTIVITY_INPROGESS: Initial state for a successfully initialized process activity. The progress of the activity can only be set in this state.
** ACTIVITY_COMPLETED: Activity is successfully completed ([https://wiki.mozilla.org/Thunderbird:Activity_Manager#Processes Finished]). The activity should be removed from the activity list by the initiator.
** ACTIVITY_FAILED: Activity failed due to an error. At this point, the initiator can set the state to ACTIVITY_WAITINGFORRETRY, if  nsIActivityRetryable is supported.
** ACTIVITY_CANCELED: Activity is canceled by the user. This is possible if the activity supports nsIActivityCancelable interface.
** ACTIVITY_PAUSED: Activity is paused by the user. This is possible if the activity supports nsIActivityPausable interface.
** ACTIVITY_WAITINGFORINPUT: A failure has been occurred, and the user needs to provides data to recover from the problem, such as account credentials, password etc..
** ACTIVITY_WAITINGFORRETRY: A failure has been occurred and the activity is waiting to be retried by the user, or by the Activity Manager.
 
* <b>nsIActivityEvent</b>:[https://wiki.mozilla.org/Thunderbird:Activity_Manager#Events Event] activity types should implement this interface. ACTIVITY_COMPLETED is the only valid state for this type.  


Initiator is required to be an XPCOM component and support nsISupports interface. It is stored in the
* <b>nsIActivityListener</b>: The implementor of this interface gets notified when the activity in question changes state or changes progress.  


* <b>nsIActivity</b>: Base interface for both nsIActivityProcess and nsIActivityEvent. Exposes common properties and methods.
* <b>nsIActivityPausable</b>: If provided with the activity, it allows the user to pause/resume the activity during its progress. Processes only.
* <b>nsIActivityProcess</b>: Exposes an interface for [https://wiki.mozilla.org/Thunderbird:Activity_Manager#Processes Processes] activity types. Possible states for Processes are:
** ACTIVITY_NOTSTARTED: State of an uninitialized activity. Represents an invalid activity.
** ACTIVITY_INPROGESS: Initial state for successfully initialized process activities ([https://wiki.mozilla.org/Thunderbird:Activity_Manager#Processes Active]). This state can be set by the implementer of the acti


** ACTIVITY_COMPLETED: Activity is successfully completed ([https://wiki.mozilla.org/Thunderbird:Activity_Manager#Processes Finished]).
* <b>nsIActivityRetryable</b>: If provided with the activity, it allows the user to retry the failed activity. Processes only.
** ACTIVITY_FAILED: Activity failed due to an error. This state is transient and once the activity is set to this state, <b>Activity Manager</b>  


This state is transient and the activity is required to be set either to ACTIVITY_WAITINGFORINPUT or ACTIVITY_WAITINGFORRETRY by <b>Activity Manager</b> based on recovery interfaces supported by the activity such as nsIActivityRetyable.
* <b>nsIActivityCancelable</b>: If provided with the activity, it allows the user to cancel the activity. Processes only.
** ACTIVITY_CANCELED: Activity is canceled by the user. Allows
** ACTIVITY_PAUSED
** ACTIVITY_WAITINGFORINPUT
** ACTIVITY_WAITINGFORRETRY


* <b>nsIActivityEvent</b>:
* <b>nsIActivityUndoable</b>: If provided with the activity, it allows the user to undo the operation subject of the event. Persisted Events cannot be undo.<i> This feature will be supported in the future when we have a better undo mechanism in place.</i>
* <b>Activity Context</b>:
*


== Extending the Activity System ==
== Extending the Activity System ==
270

edits

Navigation menu