com.bareflow
Interface IRuntimeContext


public interface IRuntimeContext

This interface represents runtime context. Runtime context is a media in which a module runs. Components use runtime context to exchange information.

Runtime context can be treated as a set of attributes. Components can store attributes in the context and read attributes from it. Each context attribute has name and value. Attribute name uniquely identifies the attribute in the context.

Context can have one parent context thus forming context hierarchy. In the context hierarchy attributes can be defined with different visibility scope. Attributes defined in the local scope are visible in the current context and child context hierarchy of the current context only. If attribute with the same name is defined in the parent context hierarchy then the parent attribute is not visible in the current context and child context hierarchy: the parent attribute is shadowed by the local attribute defined in the current context. Attributes defined in the global scope are visible to the entire context hierarchy unless shadowed by local attributes. Root context, the top of the context hierarchy, can be created with runtime factory (IRuntimeFactory.createContext()).

See Also:
IRuntimeFactory

Method Summary
 IRuntimeContext createContext()
          Creates a child context for this context
 java.lang.Object getAttribute(java.lang.String name)
          Retrieves an attribute with the given name from this context
 java.lang.String getDefaultAttributeName()
          Returns a default attribute name.
 java.lang.String getErrorAttributeName()
          Returns a default error attribute name.
 void setAttribute(java.lang.String name, java.lang.Object value, AttributeScope scope)
          Stores an attribute with the given name, value and scope in this context
 

Method Detail

setAttribute

void setAttribute(java.lang.String name,
                  java.lang.Object value,
                  AttributeScope scope)
                  throws BareflowException
Stores an attribute with the given name, value and scope in this context

Parameters:
name - attribute name
value - attribute value
scope - attribute scope
Throws:
BareflowException - if attribute cannot be set

getAttribute

java.lang.Object getAttribute(java.lang.String name)
                              throws BareflowException
Retrieves an attribute with the given name from this context

Parameters:
name - attirubte name
Returns:
an attribute with the given name from this context
Throws:
BareflowException - if attribute cannot be retrieved

getDefaultAttributeName

java.lang.String getDefaultAttributeName()
Returns a default attribute name. Some components may choose to operate with default attribute to exchange data.

Returns:
a default attribute name

getErrorAttributeName

java.lang.String getErrorAttributeName()
Returns a default error attribute name. Some components may choose to operate with default error attribute to store and retrieve error data.

Returns:
a default error attribute name

createContext

IRuntimeContext createContext()
Creates a child context for this context

Returns:
a child context for this context