org.globus.cog.karajan.workflow.nodes
Class FlowNode

java.lang.Object
  extended by org.globus.cog.karajan.workflow.nodes.FlowNode
All Implemented Interfaces:
LoadListener, EventListener, ExtendedFlowElement, FlowElement
Direct Known Subclasses:
Break, Continue, Disallowed, ElementList, FlowContainer, PassiveNode, UnknownElement

public class FlowNode
extends Object
implements ExtendedFlowElement, LoadListener


Nested Class Summary
static class FlowNode.FNTP
           
 
Field Summary
static Arg A_INLINE_TEXT
           
static boolean debug
           
static org.apache.log4j.Logger logger
           
static long startCount
           
static Arg.Channel STDERR
           
static Arg.Channel STDOUT
           
static Map threadTracker
           
 
Fields inherited from interface org.globus.cog.karajan.workflow.nodes.FlowElement
ANNOTATION, CALLER, FILENAME, LINE, TEXT, UID
 
Constructor Summary
FlowNode()
           
 
Method Summary
protected  void _finally(VariableStack stack)
           
protected  void abort(VariableStack stack)
           
protected  void abortEvent(AbortEvent e)
           
 boolean acceptsInlineText()
          Returns true if the implementation of this element makes use of inline XML text.
 void addElement(FlowElement element)
          Adds a child element to this element.
 void addStaticArgument(String name, Object value)
           
 Object checkClass(Object value, Class cls, String name)
           
protected  void checkCompleted(VariableStack stack)
           
protected  void checkFailed(VariableStack stack)
           
 void complete(VariableStack stack)
           
protected  void controlEvent(ControlEvent e)
           
 FlowElement copy()
           
protected  void echo(String message)
           
protected  void echo(String message, boolean nl)
           
 int elementCount()
          Returns the number of child elements for this element
 List elements()
          Returns the list of child elements
 void event(Event e)
           
 void execute(VariableStack stack)
           
protected  boolean executeErrorHandler(VariableStack stack, NotificationEvent error)
           
 void executeSimple(VariableStack stack)
           
 void fail(VariableStack stack, String message)
           
 void fail(VariableStack stack, String message, Throwable cause)
           
 void failIfNotDefined(VariableStack stack, String var, String message)
           
 void failIfNull(VariableStack stack, String name)
           
 void failIfNull(VariableStack stack, String name, String message)
           
 void failImmediately(VariableStack stack, FailureNotificationEvent fne)
           
 void failImmediately(VariableStack stack, String message)
          Provides means to cause the execution of this element under the given context (stack) to fail
 void failImmediately(VariableStack stack, String message, Exception exception)
           
 void failImmediately(VariableStack stack, Throwable exception)
           
 void fireControlEvent(FlowElement target, FlowEvent event)
           
 void fireMonitoringEvent(MonitoringEvent event)
           
 void fireNotificationEvent(FlowEvent event, VariableStack stack)
          Notification events notify callers of the status of the execution (completed, failed, aborted, ...)
 void fireStatusMonitoringEvent(MonitoringEventType type, VariableStack stack, Object detail)
           
 String get_locator()
           
 boolean getBooleanProperty(String name)
           
 boolean getBooleanProperty(String name, boolean defaultValue)
           
 Object getCanonicalType()
           
 FlowElement getElement(int index)
          Returns the child element at @param index
 String getElementType()
          Returns the type of this element
 int getIntProperty(String name)
           
 int getIntProperty(String name, int defaultValue)
           
 FlowElement getParent()
          Retrieves the parent previously set with setParent
 Object getProperty(String name)
          Retrieves the value of a property.
 Map getStaticArguments()
           
 String getStringProperty(String name)
           
protected  String getTextualName()
           
static Object getTreeProperty(String name, FlowElement element)
           
 Integer getUID()
           
protected  boolean hasFrame()
           
 boolean hasProperty(String name)
          Returns true if a property with the given name was set on this element.
protected  void initializeStatic()
           
 boolean isCheckpointable()
           
 boolean isSimple()
           
protected  boolean isSystemProperty(String name)
           
 void loadComplete()
           
 void loadStarted()
           
protected  void monitoringEvent(MonitoringEvent e)
           
protected  void notificationEvent(NotificationEvent e)
           
 Collection propertyNames()
          Returns a collection of all the property names that are set on this element.
 void removeElement(FlowElement element)
           
 void removeElement(int index)
          Removes the child element at @param index.
 void removeProperty(String name)
          Completely removes a property previously set on this element.
 void replaceElement(int index, FlowElement element)
          Replaces the child element at @param index with
 void restart(VariableStack stack)
           
 void restartElement(FlowElement c, VariableStack stack)
           
protected  void ret(VariableStack stack, Object value)
           
 void set_locator(String locator)
           
protected  void setAcceptsInlineText(boolean inlineText)
           
 void setCheckpointable(boolean checkpointable)
           
 void setElements(List elements)
           
 void setElementType(String string)
          Sets the element type.
protected  void setFrame(boolean frame)
           
 void setParent(FlowElement element)
          Sets the lexical parent of this element.
 void setProperties(Map properties)
           
 void setProperty(String name, boolean value)
           
 void setProperty(String name, int value)
           
 void setProperty(String name, Object value)
          Sets a property on this element.
 void setStaticArguments(Map args)
           
 void start(VariableStack stack)
           
protected  void startElement(FlowElement c, VariableStack stack)
           
 void startElement(int index, VariableStack stack)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

public static final org.apache.log4j.Logger logger

A_INLINE_TEXT

public static final Arg A_INLINE_TEXT

STDOUT

public static final Arg.Channel STDOUT

STDERR

public static final Arg.Channel STDERR

threadTracker

public static final Map threadTracker

startCount

public static long startCount

debug

public static boolean debug
Constructor Detail

FlowNode

public FlowNode()
Method Detail

executeErrorHandler

protected boolean executeErrorHandler(VariableStack stack,
                                      NotificationEvent error)
                               throws ExecutionException
Throws:
ExecutionException

failImmediately

public void failImmediately(VariableStack stack,
                            FailureNotificationEvent fne)

failImmediately

public void failImmediately(VariableStack stack,
                            String message)
Description copied from interface: FlowElement
Provides means to cause the execution of this element under the given context (stack) to fail

Specified by:
failImmediately in interface FlowElement

failImmediately

public void failImmediately(VariableStack stack,
                            Throwable exception)

failImmediately

public void failImmediately(VariableStack stack,
                            String message,
                            Exception exception)

fireNotificationEvent

public void fireNotificationEvent(FlowEvent event,
                                  VariableStack stack)
Notification events notify callers of the status of the execution (completed, failed, aborted, ...)


fireControlEvent

public final void fireControlEvent(FlowElement target,
                                   FlowEvent event)

fireMonitoringEvent

public final void fireMonitoringEvent(MonitoringEvent event)

fireStatusMonitoringEvent

public final void fireStatusMonitoringEvent(MonitoringEventType type,
                                            VariableStack stack,
                                            Object detail)

checkFailed

protected final void checkFailed(VariableStack stack)

checkCompleted

protected final void checkCompleted(VariableStack stack)

restart

public final void restart(VariableStack stack)
                   throws ExecutionException
Throws:
ExecutionException

abort

protected void abort(VariableStack stack)
              throws ExecutionException
Throws:
ExecutionException

start

public final void start(VariableStack stack)
                 throws ExecutionException
Throws:
ExecutionException

execute

public void execute(VariableStack stack)
             throws ExecutionException
Throws:
ExecutionException

complete

public final void complete(VariableStack stack)
                    throws ExecutionException
Throws:
ExecutionException

_finally

protected void _finally(VariableStack stack)
                 throws ExecutionException
Throws:
ExecutionException

copy

public final FlowElement copy()

event

public void event(Event e)
           throws ExecutionException
Specified by:
event in interface EventListener
Throws:
ExecutionException

notificationEvent

protected void notificationEvent(NotificationEvent e)
                          throws ExecutionException
Throws:
ExecutionException

controlEvent

protected void controlEvent(ControlEvent e)
                     throws ExecutionException
Throws:
ExecutionException

abortEvent

protected void abortEvent(AbortEvent e)
                   throws ExecutionException
Throws:
ExecutionException

monitoringEvent

protected void monitoringEvent(MonitoringEvent e)
                        throws ExecutionException
Throws:
ExecutionException

fail

public void fail(VariableStack stack,
                 String message,
                 Throwable cause)
          throws ExecutionException
Throws:
ExecutionException

fail

public void fail(VariableStack stack,
                 String message)
          throws ExecutionException
Throws:
ExecutionException

failIfNotDefined

public void failIfNotDefined(VariableStack stack,
                             String var,
                             String message)
                      throws ExecutionException
Throws:
ExecutionException

failIfNull

public void failIfNull(VariableStack stack,
                       String name)
                throws ExecutionException
Throws:
ExecutionException

failIfNull

public void failIfNull(VariableStack stack,
                       String name,
                       String message)
                throws ExecutionException
Throws:
ExecutionException

startElement

public void startElement(int index,
                         VariableStack stack)
                  throws ExecutionException
Throws:
ExecutionException

startElement

protected void startElement(FlowElement c,
                            VariableStack stack)
                     throws ExecutionException
Throws:
ExecutionException

restartElement

public void restartElement(FlowElement c,
                           VariableStack stack)

ret

protected void ret(VariableStack stack,
                   Object value)
            throws ExecutionException
Throws:
ExecutionException

get_locator

public String get_locator()

set_locator

public void set_locator(String locator)

toString

public String toString()
Overrides:
toString in class Object

getTextualName

protected String getTextualName()

elements

public List elements()
Description copied from interface: FlowElement
Returns the list of child elements

Specified by:
elements in interface FlowElement

setCheckpointable

public void setCheckpointable(boolean checkpointable)

isCheckpointable

public boolean isCheckpointable()

addElement

public void addElement(FlowElement element)
Description copied from interface: FlowElement
Adds a child element to this element. The child element is added at the end of the list of child elements

Specified by:
addElement in interface FlowElement

setElements

public void setElements(List elements)
Specified by:
setElements in interface FlowElement

replaceElement

public void replaceElement(int index,
                           FlowElement element)
Description copied from interface: FlowElement
Replaces the child element at @param index with

Specified by:
replaceElement in interface FlowElement

removeElement

public void removeElement(int index)
Description copied from interface: FlowElement
Removes the child element at @param index. The elements with indexes > @param index will be shifted down in the list

Specified by:
removeElement in interface FlowElement

removeElement

public void removeElement(FlowElement element)

getElement

public FlowElement getElement(int index)
Description copied from interface: FlowElement
Returns the child element at @param index

Specified by:
getElement in interface FlowElement

elementCount

public int elementCount()
Description copied from interface: FlowElement
Returns the number of child elements for this element

Specified by:
elementCount in interface FlowElement

setProperty

public void setProperty(String name,
                        Object value)
Description copied from interface: FlowElement
Sets a property on this element. The value can be null

Specified by:
setProperty in interface FlowElement

setProperties

public void setProperties(Map properties)
Specified by:
setProperties in interface FlowElement

removeProperty

public void removeProperty(String name)
Description copied from interface: FlowElement
Completely removes a property previously set on this element. If no property with the given name exists, removeProperty will have no effect.

Specified by:
removeProperty in interface FlowElement

getProperty

public Object getProperty(String name)
Description copied from interface: FlowElement
Retrieves the value of a property. If no property with the given name exists, getProperty will return null. In order to distinguish between a property with a value of null and a property not set, hasProperty can be used.

Specified by:
getProperty in interface FlowElement

hasProperty

public boolean hasProperty(String name)
Description copied from interface: FlowElement
Returns true if a property with the given name was set on this element.

Specified by:
hasProperty in interface FlowElement

setProperty

public void setProperty(String name,
                        int value)

getIntProperty

public int getIntProperty(String name)

getIntProperty

public int getIntProperty(String name,
                          int defaultValue)

getStringProperty

public String getStringProperty(String name)

setProperty

public void setProperty(String name,
                        boolean value)

getBooleanProperty

public boolean getBooleanProperty(String name)

getBooleanProperty

public boolean getBooleanProperty(String name,
                                  boolean defaultValue)

addStaticArgument

public void addStaticArgument(String name,
                              Object value)
Specified by:
addStaticArgument in interface FlowElement

setStaticArguments

public void setStaticArguments(Map args)
Specified by:
setStaticArguments in interface FlowElement

getStaticArguments

public Map getStaticArguments()
Specified by:
getStaticArguments in interface FlowElement

getElementType

public String getElementType()
Description copied from interface: FlowElement
Returns the type of this element

Specified by:
getElementType in interface FlowElement

setElementType

public void setElementType(String string)
Description copied from interface: FlowElement
Sets the element type. The element type is a string reflecting the actual name used in source files.

Specified by:
setElementType in interface FlowElement

getCanonicalType

public Object getCanonicalType()

getParent

public FlowElement getParent()
Description copied from interface: FlowElement
Retrieves the parent previously set with setParent

Specified by:
getParent in interface FlowElement

setParent

public void setParent(FlowElement element)
Description copied from interface: FlowElement
Sets the lexical parent of this element. When adding a child element with addElement, setParent is automatically called on the child element with this element as the argument.

Specified by:
setParent in interface FlowElement

propertyNames

public Collection propertyNames()
Description copied from interface: FlowElement
Returns a collection of all the property names that are set on this element.

Specified by:
propertyNames in interface FlowElement

echo

protected void echo(String message)

echo

protected void echo(String message,
                    boolean nl)

setAcceptsInlineText

protected void setAcceptsInlineText(boolean inlineText)

acceptsInlineText

public boolean acceptsInlineText()
Description copied from interface: FlowElement
Returns true if the implementation of this element makes use of inline XML text. XML unfortunately does not provide means to separate relevant inline text from formatting whitespace (which in itself may or may not be relevant, depending on the context).

Specified by:
acceptsInlineText in interface FlowElement

checkClass

public final Object checkClass(Object value,
                               Class cls,
                               String name)
                        throws ExecutionException
Throws:
ExecutionException

getTreeProperty

public static Object getTreeProperty(String name,
                                     FlowElement element)

hasFrame

protected boolean hasFrame()

setFrame

protected void setFrame(boolean frame)

loadStarted

public void loadStarted()
Specified by:
loadStarted in interface LoadListener

getUID

public Integer getUID()

loadComplete

public void loadComplete()
Specified by:
loadComplete in interface LoadListener

initializeStatic

protected void initializeStatic()

isSystemProperty

protected boolean isSystemProperty(String name)

isSimple

public boolean isSimple()
Specified by:
isSimple in interface ExtendedFlowElement

executeSimple

public void executeSimple(VariableStack stack)
                   throws ExecutionException
Specified by:
executeSimple in interface ExtendedFlowElement
Throws:
ExecutionException