public class SQLRecording extends Recording
Modifier and Type | Class and Description |
---|---|
static class |
SQLRecording.PortDirection |
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,java.lang.String> |
_dbParams
The follow hold values from DatabaseFactory.Parameters.
|
protected DatabaseType |
_dbType
Connection to the database.
|
protected java.util.Map<Nameable,org.kepler.provenance.sql.RegEntity> |
_entityCacheTable
A table to cache RegEntity objects.
|
protected java.util.Map<Actor,FireState<java.lang.Integer>> |
_fireStateTable
A table to map actor to its firing state object.
|
protected int |
_maxDataSize
The maximum size in the SQL table for data values.
|
protected int |
_maxParameterValueSize
The maximum size in the SQL table for parameter values.
|
protected boolean |
_needReconnectDB
True when we need to reconnect to the database.
|
protected boolean |
_needReconnectWF
True when we need to load workflow id from database.
|
protected SQLRecordingParameters |
_params
The sql parameters object.
|
protected java.sql.PreparedStatement |
_psActionInsert |
protected java.sql.PreparedStatement |
_psActorFireStart |
protected java.sql.PreparedStatement |
_psActorFireStop |
protected java.sql.PreparedStatement |
_psActorInsert |
protected java.sql.PreparedStatement |
_psDirectorInsert |
protected java.sql.PreparedStatement |
_psEntityInsert |
protected java.sql.PreparedStatement |
_psEntityQuery |
protected java.sql.PreparedStatement |
_psLinkInsert |
protected java.sql.PreparedStatement |
_psParameterInsert |
protected java.sql.PreparedStatement |
_psPortInsert |
protected java.sql.PreparedStatement |
_psRelationInsert |
protected java.sql.PreparedStatement |
_psTokenFlowInsert |
protected java.sql.PreparedStatement |
_psWorkflowExecStart |
protected java.sql.PreparedStatement |
_psWorkflowExecStop |
protected java.sql.PreparedStatement |
_psWorkflowInsert |
protected java.sql.PreparedStatement |
_psWorkflowQuery |
protected Schema |
_schema
The schema containing table and column definitions.
|
protected int |
_wfExecId
The current workflow execution id.
|
protected int |
_wfId
The current workflow id.
|
protected java.lang.String |
_wfNameStr |
protected java.lang.String |
_wfUserStr |
static int |
DATA_NONE
The token data was not recorded.
|
static int |
DATA_TRUNCATED
The token data was too large to completely store.
|
static int |
DATA_VALID
The token data is valid.
|
protected static int |
SUCCESS |
protected static int |
WORKFLOW_ALREADY_EXISTS |
protected static int |
WORKFLOW_DOES_NOT_EXIST |
_containerFullName, _containerLSID, _containerName, _debugPrint, _debugWriter, _machineStr, _recorder, _recorderContainer, _stateSerializer
Constructor and Description |
---|
SQLRecording()
Construct a new SQLRecording.
|
Modifier and Type | Method and Description |
---|---|
protected org.kepler.provenance.sql.RegEntity |
_addEntity(int containerId,
RegEntity.EntityType type,
java.lang.String fullName,
java.lang.String displayName,
int prevId)
Add a new row to the entity table.
|
protected void |
_addWorkflow()
Add a new row to the workflow table.
|
protected java.lang.String |
_changeEntityFullName(java.lang.String name)
Modify a NamedObj's full name.
|
protected void |
_checkConnection(boolean allowReconnectWF)
This method opens the database connection if necessary.
|
protected org.kepler.provenance.sql.RegEntity |
_checkEntity(Nameable namedObj,
RegEntity.EntityType type)
Check if a NamedObj has been inserted into the entity table.
|
protected void |
_checkParameters()
Check parameters before (re)connecting to database or workflow.
|
protected void |
_checkWorkflowName()
Check validity of workflow name parameter.
|
protected void |
_createPreparedStatements()
Initialize the prepared statements.
|
protected Schema |
_createSchema()
Create a Schema to reflect the v6 schema.
|
protected void |
_dbReset()
Reset when we use a different db connection.
|
protected void |
_errorReset()
Reset when we encounter an error.
|
protected int |
_getContainerId(Nameable namedObj)
Find the container id of an entity.
|
protected int |
_getMaxParameterValueSize()
Get the maximum size of a parameter value that can be stored in the
database.
|
protected int |
_getMaxTokenDataSize()
Get the maximum size of token data that can be stored in the
database.
|
protected int |
_getWorkflowId()
Get the internal workflow id.
|
protected int |
_getWorkflowId(java.lang.String idStr)
Get the internal workflow id given a id string.
|
protected void |
_nullPreparedStatements()
Set our prepared statements to null.
|
protected void |
_reconnectDatabase(boolean resetDB)
Reconnect to the database.
|
protected void |
_reconnectWorkflow()
Re-acquire the current workflow id.
|
protected void |
_recordFiringEvent(Actor actor,
FiringEvent.FiringEventType type,
java.util.Date timestamp)
Record a specific type of firing for an actor.
|
protected void |
_recordPortEvent(IOPort port,
int fireId,
int rwfireId,
boolean isRead,
int channel,
Token token,
IOPort destPort,
java.util.Date timestamp)
Record a port read or write to the token_flow table.
|
protected int |
_regActorDirector(NamedObj namedObj,
boolean actor)
Convenience routine that regActor and regDirector can use since
the schema for actors and directors only differs by "actor" vs
"director".
|
protected void |
_regParameterReal(NamedObj parameter,
org.kepler.provenance.sql.RegEntity re)
Add an entity to the parameter table.
|
protected void |
_regPortReal(TypedIOPort port,
org.kepler.provenance.sql.RegEntity re)
Add a port to the port table.
|
protected int |
_updateWorkflowID(boolean isNew)
Update workflow ID either by retrieving the id from an existing
workflow in the database or creating a new one.
|
protected void |
_wfReset()
Reset when we use a different workflow.
|
void |
actorFire(FiringEvent event,
java.util.Date timestamp)
Record an actor fire event.
|
void |
attributeChanged(Attribute attribute)
React to a change in an attribute.
|
void |
disconnect()
Stop recording.
|
void |
executionImported()
An execution was imported.
|
void |
executionStart(java.util.Date timestamp)
Record the starting of workflow execution.
|
void |
executionStop(java.util.Date timestamp)
Record the stopping of workflow execution.
|
RecordingParameters |
generateParameters(NamedObj no)
Add Parameters for ProvenanceListener.
|
void |
portEvent(IOPortEvent event,
java.util.Date timestamp)
Record a port event.
|
boolean |
regActor(Actor actor)
Register an actor.
|
boolean |
regDirector(Director director)
Register a director.
|
boolean |
regLink(NamedObj endPoint1,
NamedObj endPoint2)
Register a link between two endpoints.
|
boolean |
regParameter(NamedObj parameter)
Register a parameter.
|
boolean |
regPort(TypedIOPort port)
Register a port or portparameter.
|
boolean |
regRelation(IORelation relation)
Register a relation.
|
void |
specificationStart()
Called before registering workflow contents.
|
_debug, _debug, _debugWrite, _debugWrite, _error, _getExceptionMessage, _getNameableFullName, _needWorkflowContents, _updateContainerName, _warn, actorFire, addFileForLastExecution, changeExecutionLSID, customProvEvent, evolutionStart, evolutionStop, executionError, executionError, executionImported, executionStart, executionStart, executionStart, executionStop, executionStop, executionStop, getContainer, getQueryable, portEvent, refillPortEvent, regContents, remove, removeLink, removeStateSerializer, rename, renamedWorkflow, setContainer, setContainerLSID, setContainerName, setDebugWriter, setStateSerializer, specificationStop, tagAdded, tagRemoved
public static final int DATA_VALID
public static final int DATA_NONE
public static final int DATA_TRUNCATED
protected int _wfId
protected int _wfExecId
protected int _maxDataSize
protected int _maxParameterValueSize
protected java.util.Map<Actor,FireState<java.lang.Integer>> _fireStateTable
protected java.util.Map<Nameable,org.kepler.provenance.sql.RegEntity> _entityCacheTable
protected java.sql.PreparedStatement _psWorkflowInsert
protected java.sql.PreparedStatement _psWorkflowQuery
protected java.sql.PreparedStatement _psActionInsert
protected java.sql.PreparedStatement _psEntityInsert
protected java.sql.PreparedStatement _psEntityQuery
protected java.sql.PreparedStatement _psActorInsert
protected java.sql.PreparedStatement _psDirectorInsert
protected java.sql.PreparedStatement _psParameterInsert
protected java.sql.PreparedStatement _psLinkInsert
protected java.sql.PreparedStatement _psPortInsert
protected java.sql.PreparedStatement _psRelationInsert
protected java.sql.PreparedStatement _psWorkflowExecStart
protected java.sql.PreparedStatement _psWorkflowExecStop
protected java.sql.PreparedStatement _psActorFireStart
protected java.sql.PreparedStatement _psActorFireStop
protected java.sql.PreparedStatement _psTokenFlowInsert
protected java.lang.String _wfNameStr
protected java.lang.String _wfUserStr
protected java.util.Map<java.lang.String,java.lang.String> _dbParams
protected DatabaseType _dbType
protected static final int SUCCESS
protected static final int WORKFLOW_ALREADY_EXISTS
protected static final int WORKFLOW_DOES_NOT_EXIST
protected SQLRecordingParameters _params
protected boolean _needReconnectDB
protected boolean _needReconnectWF
public SQLRecording() throws RecordingException
RecordingException
public void disconnect() throws RecordingException
disconnect
in class Recording
RecordingException
public boolean regActor(Actor actor) throws RecordingException
regActor
in class Recording
RecordingException
public boolean regDirector(Director director) throws RecordingException
regDirector
in class Recording
RecordingException
public boolean regParameter(NamedObj parameter) throws RecordingException
regNNN()
method. This can be user-level
parameters (e.g., Parameter, StringParameter, etc.) or
internal to Kepler (e.g., _location, semanticType000, etc.).
(A "parameter" corresponds to a property in the MoML).regParameter
in class Recording
RecordingException
public boolean regLink(NamedObj endPoint1, NamedObj endPoint2) throws RecordingException
regLink
in class Recording
endPoint1
- first endpoint.endPoint2
- second endpoint.RecordingException
public boolean regPort(TypedIOPort port) throws RecordingException
regPort
in class Recording
RecordingException
public boolean regRelation(IORelation relation) throws RecordingException
regRelation
in class Recording
RecordingException
public void specificationStart() throws RecordingException
specificationStart
in class Recording
RecordingException
public void executionStart(java.util.Date timestamp) throws RecordingException
executionStart
in class Recording
RecordingException
public void executionStop(java.util.Date timestamp) throws RecordingException
executionStop
in class Recording
RecordingException
public void executionImported()
executionImported
in class Recording
public void actorFire(FiringEvent event, java.util.Date timestamp) throws RecordingException
actorFire
in class Recording
RecordingException
public void portEvent(IOPortEvent event, java.util.Date timestamp) throws RecordingException
portEvent
in class Recording
RecordingException
public RecordingParameters generateParameters(NamedObj no) throws IllegalActionException, NameDuplicationException
generateParameters
in class Recording
IllegalActionException
NameDuplicationException
public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class Recording
IllegalActionException
protected void _checkParameters() throws IllegalActionException, RecordingException
protected void _checkWorkflowName() throws RecordingException
RecordingException
protected Schema _createSchema()
protected void _reconnectDatabase(boolean resetDB) throws RecordingException
RecordingException
protected int _getMaxParameterValueSize() throws java.sql.SQLException
java.sql.SQLException
protected int _getMaxTokenDataSize() throws java.sql.SQLException
java.sql.SQLException
protected void _reconnectWorkflow() throws RecordingException
RecordingException
protected void _createPreparedStatements() throws java.sql.SQLException
java.sql.SQLException
protected void _nullPreparedStatements()
protected int _updateWorkflowID(boolean isNew) throws RecordingException
isNew
- RecordingException
protected int _getWorkflowId() throws RecordingException
RecordingException
protected int _getWorkflowId(java.lang.String idStr) throws RecordingException
RecordingException
protected void _dbReset() throws RecordingException
RecordingException
protected void _wfReset()
protected void _errorReset() throws RecordingException
RecordingException
protected void _checkConnection(boolean allowReconnectWF) throws RecordingException
allowReconnectWF
- - default true, only false if you want to force no _reconnectWF, e.g
for non-write events like deleteRecordingException
protected java.lang.String _changeEntityFullName(java.lang.String name)
protected org.kepler.provenance.sql.RegEntity _checkEntity(Nameable namedObj, RegEntity.EntityType type) throws RecordingException
fullName
- fully qualified name of NamedObj.displayName
- display name (NOTE: can be null)type
- type of NamedObj. (NOTE: can be null)RecordingException
protected org.kepler.provenance.sql.RegEntity _addEntity(int containerId, RegEntity.EntityType type, java.lang.String fullName, java.lang.String displayName, int prevId) throws RecordingException, java.sql.SQLException
RecordingException
java.sql.SQLException
protected void _addWorkflow() throws RecordingException
RecordingException
protected int _getContainerId(Nameable namedObj) throws RecordingException
RecordingException
protected int _regActorDirector(NamedObj namedObj, boolean actor) throws RecordingException
RecordingException
protected void _regPortReal(TypedIOPort port, org.kepler.provenance.sql.RegEntity re) throws RecordingException
RecordingException
protected void _regParameterReal(NamedObj parameter, org.kepler.provenance.sql.RegEntity re) throws RecordingException
RecordingException
protected void _recordFiringEvent(Actor actor, FiringEvent.FiringEventType type, java.util.Date timestamp) throws RecordingException
RecordingException
protected void _recordPortEvent(IOPort port, int fireId, int rwfireId, boolean isRead, int channel, Token token, IOPort destPort, java.util.Date timestamp) throws RecordingException
RecordingException