001    package toolbus.viewer;
002    
003    import toolbus.StateElement;
004    import toolbus.process.ProcessInstance;
005    
006    /**
007     * This interface specifies the events the debug toolbus can fire.
008     * 
009     * @author Arnold Lankamp
010     */
011    public interface IViewer{
012            
013            /**
014             * Informs the viewer about what the debug toolbus is currently doing. A list of possible states
015             * can be found in toolbus.viewer.IViewerConstants
016             * 
017             * @see toolbus.viewer.IViewerConstants
018             * @param state
019             *            The state that identifies what the debug toolbus is currently doing.
020             */
021            void updateState(int state);
022            
023            /**
024             * Fired after the successfull completion of a step.
025             * 
026             * @param processInstance
027             *            The process instance in which a state element was executed.
028             * @param executedStateElement
029             *            The state element that was executed.
030             * @param partners
031             *            All the process instances that cooperated during the execution of the state element.
032             */
033            void stepExecuted(ProcessInstance processInstance, StateElement executedStateElement, ProcessInstance[] partners);
034            
035            /**
036             * Fired when a new process instance is started.
037             * 
038             * @param processInstance
039             *            The process instance that was started.
040             */
041            void processInstanceStarted(ProcessInstance processInstance);
042            
043            /**
044             * Fired when a process instance is terminated.
045             * 
046             * @param processInstance
047             *            The process instance that was terminated.
048             */
049            void processInstanceTerminated(ProcessInstance processInstance);
050            
051            /**
052             * Informs the viewer that a registered breakpoint on a process or process instance was hit. The
053             * debug toolbus will not suspend it's execution by itself; the action that will be taken is
054             * completely up to the viewer implementation. In case the execution needs to be paused this will
055             * need to be done explicitly by calling the doStop method.
056             * 
057             * @param processInstance
058             *            The process instance that matches the breakpoint.
059             */
060            void processBreakPointHit(ProcessInstance processInstance);
061            
062            /**
063             * Informs the viewer that a registered breakpoint on a state element was hit. The debug toolbus
064             * will not suspend it's execution by itself; the action that will be taken is completely up to
065             * the viewer implementation. In case the execution needs to be paused this will need to be done
066             * explicitly by calling the doStop method.
067             * 
068             * @param stateElement
069             *            The state element on which the breakpoint was set.
070             */
071            void stateElementBreakPointHit(StateElement stateElement);
072            
073            /**
074             * Informs the viewer that a registered breakpoint on a sourcecode coordinate was hit. The
075             * debug toolbus will not suspend it's execution by itself; the action that will be taken is
076             * completely up to the viewer implementation. In case the execution needs to be paused this
077             * will need to be done explicitly by calling the doStop method.
078             * 
079             * @param stateElement
080             *            The executed state element which's position information corresponded to a
081             *            breakpoint set on a sourcecode coordinate.
082             */
083            void sourceBreakPointHit(StateElement stateElement);
084            
085            /**
086             * Fired right before the debug ToolBus starts executing the process logic.
087             */
088            void toolbusStarting();
089            
090            /**
091             * Fired right before then debug ToolBus shuts down.
092             */
093            void toolbusTerminating();
094    }