fuego.components
Interface ServerEventSource


public interface ServerEventSource

This interface represents a server event source, which provides events for Global Automatic Listener activities. When building an external event listening component, the component should implement the fuego.components.ServerEventSource interface. By implementing ServerEventSource, the class file appears in the Listener class drop-down menu on the activity properties dialog box. The listener component through the public fields ARG_ will set the possible arguments. The argument types should be catalogued first.
In the definition of the global automatic listening, when introspecting the Listener class, the types of fields named ARG_ will be searched to be a possible return type of the class. Thus, the class programmer should add non-private fields with a name starting with ARG_ for each type that the class may return. This field name will be passed as an argument to the activities in the second BP-Method.
An example of an external event listening component is provided in the GlobalAutoListCase01.fpr project in FuegoBPM's installation directory, in the studio/samples directory. The component that works as the external listening component is called TimerComponent.
     - Deploy the project.      - Find in the project's root directory, some java files that are Listener components to use as an example or a guide:          1. TimerComponent.java: This component is an example of a Listener that needs to be compiled and catalogued. The component activates the second FBL in the Global automatic activity (ListenerbyInterval) every 5 minutes. This FBL creates a logmessage.          2. MyEventListener: This is a template java component that shows the different methods you can implement in your own listener.
Find the project GlobalAutoListCase01.fpr in FuegoBPM's installation directory, in the studio/samples directory to study the example further.
As well, you can find in the project's root directory some java files that are Listener components to use as an example or a guide: - TimerComponent.java: This component is an example of a Listener that needs to be compiled and catalogued. The component activates the second FBL in the Global automatic activity (ListenerbyInterval) every 5 minutes. This FBL creates a logmessage. - MyEventListener: This is a template java component that shows the different methods you can implement in your own listener.


Method Summary
 void commit()
          This method is optional, it's called after the transaction associated with the listening FBL is commited successfully.
 void init(java.util.Map properties, ServerEventHandler server, java.lang.String argumentName)
          Initializes this event source.
 void rollback()
          This method is optional, it's called after the transaction associated with the listening FBL is rolledback.
 void shutdown()
          Shuts down this listener.
 

Method Detail

commit

void commit()
            throws java.lang.Exception
This method is optional, it's called after the transaction associated with the listening FBL is commited successfully.

Throws:
java.lang.Exception

init

void init(java.util.Map properties,
          ServerEventHandler server,
          java.lang.String argumentName)
          throws java.lang.Exception
Initializes this event source. This method is called by the server after the component is instantiated, the properties argument is obtained from the init FBL of the Global Automatic Listening activity that uses this component. Events should be dispatched in a component's thread, by calling ServerEventHandler.processEvent(Object event) passing the right type of event.

Parameters:
properties - - properties for initialization (implementation defined)
server - - server component that handles the events produced by this source
argumentName - - name of the argument expected by the ServerEventHandler (without the "ARG_" prefix)
Throws:
java.lang.Exception - implementation defined exception (is logged in the server log)

rollback

void rollback()
              throws java.lang.Exception
This method is optional, it's called after the transaction associated with the listening FBL is rolledback.

Throws:
java.lang.Exception

shutdown

void shutdown()
Shuts down this listener. This method is called whenever the server decides that it doesn't want any events from this source. After this method returns, the component MUST NOT DISPATCH any events.