eu.larkc.core.executor
Class Executor

java.lang.Object
  extended by eu.larkc.core.executor.Executor
All Implemented Interfaces:
javax.jms.MessageListener

public class Executor
extends java.lang.Object
implements javax.jms.MessageListener

The executor is responsible for actually constructing a workflow (or 'plumbing' the pipelines so to speak). The executor needs a workflow (described in RDF) to operate. Workflows can be generated by hand or by any plug-in (which is then usually called a 'decider').

Author:
Christoph Fuchs

Constructor Summary
Executor(SetOfStatements workflowDescription)
          Constructor.
 
Method Summary
 void execute(SetOfStatements query)
          Execute the given workflow by invoking the plugins.
 void execute(SetOfStatements query, java.lang.String pipeId)
          Execute the given workflow by invoking the plugins.
 java.lang.String getBrokerUrl()
          Returns the URL of the broker.
 Endpoint getEndpoint(java.lang.String type)
          This method returns the endpoint of a specific type.
 java.util.UUID getId()
          Getter.
 SetOfStatements getNextResults()
          Returns the next results of the workflow.
 SetOfStatements getNextResults(int offset, int limit)
          Get the next x results.
 SetOfStatements getNextResults(java.lang.String pipeId)
          Returns the next results of the workflow.
 java.util.Set<java.lang.String> getPipeIds()
          Deprecated. 
 void messagingShutdown()
          Shuts down the messaging.
 void onMessage(javax.jms.Message arg0)
           
 void startListening(java.lang.String topic)
          need to be implemented to handle the received message
 void stopEndpoints()
          Removes all endpoints of this executor.
 void stopExecution()
          Stops the execution of the workflow but does not terminate the executor.
 void terminate()
          Removes the executor and the endpoints from the mapping and stops all endpoints.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Executor

public Executor(SetOfStatements workflowDescription)
         throws IllegalWorkflowGraphException
Constructor. Initializes an executor for the given workflow, with the given decider in charge.

Parameters:
workflowDescription - the workflow to be executed. Everything that is needed to execute the workflow has to be included in this workflow description. This can either be a full description of the workflow or some special parameters used by the decider (to actually create the workflow).
Throws:
IllegalWorkflowGraphException
Method Detail

getBrokerUrl

public java.lang.String getBrokerUrl()
Returns the URL of the broker.

Returns:
brokerUrl The URL of the broker.

execute

public void execute(SetOfStatements query)
Execute the given workflow by invoking the plugins.

Parameters:
query - the query

execute

public void execute(SetOfStatements query,
                    java.lang.String pipeId)
Execute the given workflow by invoking the plugins.

Parameters:
query - the query
pipeId - the ID of the pipe that should be called

getNextResults

public SetOfStatements getNextResults(int offset,
                                      int limit)
Get the next x results.

Parameters:
offset -
limit -
Returns:
a set of statements containing the specified results

getId

public java.util.UUID getId()
Getter. Retrieves the uuid of this executor.

Returns:
the uuid
See Also:
UUID

terminate

public void terminate()
               throws EndpointShutdownException
Removes the executor and the endpoints from the mapping and stops all endpoints.

Throws:
EndpointShutdownException - thrown if one or more endpoints are unable to shutdown

stopExecution

public void stopExecution()
Stops the execution of the workflow but does not terminate the executor.


getNextResults

public SetOfStatements getNextResults(java.lang.String pipeId)
Returns the next results of the workflow.

Parameters:
pipeId - the ID of the pipe that sould be called
Returns:
the next results of the workflow.

getNextResults

public SetOfStatements getNextResults()
Returns the next results of the workflow.

Returns:
the next results of the workflow.

getEndpoint

public Endpoint getEndpoint(java.lang.String type)
This method returns the endpoint of a specific type.

Parameters:
type - type of the endpoint
Returns:
endpoint the specific endpoint

stopEndpoints

public void stopEndpoints()
                   throws EndpointShutdownException
Removes all endpoints of this executor.

Throws:
EndpointShutdownException - if one or more endpoints are unable to shutdown

onMessage

public void onMessage(javax.jms.Message arg0)
Specified by:
onMessage in interface javax.jms.MessageListener

startListening

public void startListening(java.lang.String topic)
need to be implemented to handle the received message

Parameters:
topic - topic on what the class should listen

messagingShutdown

public void messagingShutdown()
Shuts down the messaging.


getPipeIds

@Deprecated
public java.util.Set<java.lang.String> getPipeIds()
Deprecated. 

Method returns all pipe IDs.

Returns:
pipe IDs