net.esper.eql.variable
Interface VariableService

All Known Implementing Classes:
VariableServiceImpl

public interface VariableService

Variables service for reading and writing variables, and for setting a version number for the current thread to consider variables for.

See implementation class for further details.


Method Summary
 void commit()
          Commits the variable outstanding changes.
 void createNewVariable(String variableName, Class type, Object value, StatementExtensionSvcContext extensionServicesContext)
          Creates a new variable.
 VariableReader getReader(String variableName)
          Returns a reader that provides access to variable values.
 ReadWriteLock getReadWriteLock()
          Lock for use in atomic writes to the variable space.
 void registerCallback(int variableNumber, VariableChangeCallback variableChangeCallback)
          Registers a callback invoked when the variable is written with a new value.
 void rollback()
          Rolls back the variable outstanding changes.
 void setLocalVersion()
          Sets the variable version that subsequent reads consider.
 void write(int variableNumber, Object newValue)
          Writes a new variable value.
 

Method Detail

setLocalVersion

void setLocalVersion()
Sets the variable version that subsequent reads consider.


getReadWriteLock

ReadWriteLock getReadWriteLock()
Lock for use in atomic writes to the variable space.

Returns:
read write lock for external coordinated write

createNewVariable

void createNewVariable(String variableName,
                       Class type,
                       Object value,
                       StatementExtensionSvcContext extensionServicesContext)
                       throws VariableExistsException,
                              VariableTypeException
Creates a new variable.

Parameters:
variableName - name of the variable
type - variable type
value - initialization value; String values are allowed and parsed according to type
extensionServicesContext - is extensions for implementing resilience attributes of variables
Throws:
VariableExistsException - if the variable name is already in use
VariableTypeException - if the variable type cannot be recognized

getReader

VariableReader getReader(String variableName)
Returns a reader that provides access to variable values. The reader considers the version currently set via setLocalVersion.

Parameters:
variableName - the variable that the reader should read
Returns:
reader

registerCallback

void registerCallback(int variableNumber,
                      VariableChangeCallback variableChangeCallback)
Registers a callback invoked when the variable is written with a new value.

Parameters:
variableNumber - the variable index number
variableChangeCallback - a callback

write

void write(int variableNumber,
           Object newValue)
Writes a new variable value.

Must be followed by either a commit or rollback.

Parameters:
variableNumber - the index number of the variable to write (from VariableReader)
newValue - the new value

commit

void commit()
Commits the variable outstanding changes.


rollback

void rollback()
Rolls back the variable outstanding changes.


© 2007 EsperTech Inc.
All rights reserved.
Visit us at espertech.com