com.bareflow
Interface IRuntimeFactory


public interface IRuntimeFactory

Defines a factory API to create the following essential runtime objects:

Each runtime is identified by its own id (see getRuntimeId()). If no runtime id specified module uses default runtime factory. Module can use custom runtime implementation. In order for the module to recognize the custom runtime it needs to be placed in a jar file and registered using the jar service provider discovery mechanism. The jar file should have a resource file META-INF/services/com.bareflow.IRuntimeFactory containing the name of the concrete runtime factory class to instantiate.

See Also:
IRuntime, IRuntimeContext, IRuntimeValue, IExpression, IScript

Method Summary
 IRuntimeContext createContext()
          Creates root runtime context that can be used by this runtime to run module.
 IExpression createExpression(java.lang.String expr)
          Creates an expression object from the source code
 IRuntime createRuntime()
          Creates a runtime instance
 IScript createScript(java.lang.String code)
          Creates a script object from the source code
 IRuntimeValue createValue(java.lang.String value)
          Creates a runtime value from its lexical representation
 java.lang.String getRuntimeId()
          Returns a unique identifier for the runtime represented by this runtime factory.
 

Method Detail

getRuntimeId

java.lang.String getRuntimeId()
Returns a unique identifier for the runtime represented by this runtime factory. Module can specify this runtime using this unique identifier.

Returns:
a unique identifier for the runtime represented by this runtime factory

createRuntime

IRuntime createRuntime()
                       throws BareflowException
Creates a runtime instance

Returns:
a runtime instance
Throws:
BareflowException - if a runtime instance cannot be created
See Also:
IRuntime

createContext

IRuntimeContext createContext()
                              throws BareflowException
Creates root runtime context that can be used by this runtime to run module.

Returns:
root runtime context that can be used by this runtime to run module
Throws:
BareflowException
See Also:
IRuntimeContext

createValue

IRuntimeValue createValue(java.lang.String value)
                          throws BareflowException
Creates a runtime value from its lexical representation

Parameters:
value - lexical representation of the runtime value
Returns:
a runtime value
Throws:
BareflowException - if runtime value cannot be created
See Also:
IRuntimeValue

createScript

IScript createScript(java.lang.String code)
                     throws BareflowException
Creates a script object from the source code

Parameters:
code - script source code
Returns:
a script object from the source code
Throws:
BareflowException - if script cannot be created

createExpression

IExpression createExpression(java.lang.String expr)
                             throws BareflowException
Creates an expression object from the source code

Parameters:
expr - expression source code
Returns:
an expression object from the source code
Throws:
BareflowException - if expression cannot be created