uk.ac.ic.doc.automed
Class TemplateExecutionRepository

java.lang.Object
  |
  +--uk.ac.ic.doc.automed.TemplateExecutionRepository

public class TemplateExecutionRepository
extends java.lang.Object

Manipulate the Template Execution Repository and supply the methods to invoke template transformations


Field Summary
static java.lang.String SCHEMA_NAME
           
 
Constructor Summary
TemplateExecutionRepository()
           
 
Method Summary
static void createArgument(int arg_id, int arg_pos, java.lang.String value)
          Adds a new argument to a sequence of arguments
static void createCompositeTransformationExecution(int trans_id, int pc, int st_id, int arg_id)
          Adds a statement to the composite transformation's execution
static void createCompositeTransformationInvocation(int trans_id, int arg_id)
          Creates a composite transformation's invocation
static int createFirstArgument(int arg_pos, java.lang.String value)
          Creates a new sequence of arguments and adds a new argument to the sequence
static int[] getArgumentsArgIdList()
          Returns a list of identifiers of all the sequences of arguments
static int[] getArgumentsArgPosList(int arg_id)
          Returns a particular's sequence of arguments list of positions.
static java.lang.String getArgumentsValue(int arg_id, int arg_pos)
          Returns a particular argument's value field
static java.lang.String[] getArgumentsValueList(int arg_id)
          Returns a particular's sequence of arguments list of value fields.
static int getCompositeTransformationExecutionArgId(int trans_id, int pc)
          Returns a sequence of arguments ID in the execution of a particular composite transformation
static int[] getCompositeTransformationExecutionArgIdList(int trans_id)
          Returns a list of sequence of arguments identifiers of a particular composite transformation's execution
static int[] getCompositeTransformationExecutionPcList(int trans_id)
          Returns a list of program counters of a particular composite transformation's execution.
static int getCompositeTransformationExecutionStId(int trans_id, int pc)
          Returns the statement ID in the execution of a particular composite transformation
static int[] getCompositeTransformationExecutionStIdList(int trans_id)
          Returns a list of statement identifiers of a particular composite transformation's execution.
static int[] getCompositeTransformationExecutionTransIdList()
          Returns a list of sequence of transformation identifiers that are being executed
static int[] getCompositeTransformationInvocationArgIdList()
          Returns a list of sequence of arguments identifiers in the invocation of transformations
static java.lang.String getDataSourceName()
          Returns the name of the repository in the local database.
static void main(java.lang.String[] args)
           
static void removeArgument(int arg_id, int arg_pos)
          Removes a particular position from a sequence of arguments
static void removeArguments(int arg_id)
          Removes a particular sequence of arguments
static void removeCompositeTransformationExecution(int trans_id)
          Removes a template transformation's execution
static void removeCompositeTransformationExecution(int trans_id, int pc)
          Removes a particular program counter of a template transformation's execution
static void removeCompositeTransformationInvocation(int trans_id)
          Removes a composite transformation's invocation
static void setArgumentsValue(int arg_id, int arg_pos, java.lang.String value)
          Sets an argument's value field
static void setCompositeTransformationExecutionArgId(int trans_id, int pc, int arg_id)
          Sets the sequence of arguments identifier in a specific program counter in the composite transformation's execution
static void setCompositeTransformationExecutionStId(int trans_id, int pc, int st_id)
          Sets the statement identifier in a specific program counter in the composite transformation's execution
static void setDataSourceName(java.lang.String str)
          Sets the name of the repository in the local database.
static boolean transidExistsInCompositeTransformationExecution(int trans_id)
          Returns false if the specified transformation is not found in the execution table, true otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCHEMA_NAME

public static final java.lang.String SCHEMA_NAME
See Also:
Constant Field Values
Constructor Detail

TemplateExecutionRepository

public TemplateExecutionRepository()
Method Detail

createCompositeTransformationInvocation

public static void createCompositeTransformationInvocation(int trans_id,
                                                           int arg_id)
                                                    throws TemplateExecutionRepositoryException,
                                                           RepositoryAccessException
Creates a composite transformation's invocation

Parameters:
trans_id - ID of transformation
arg_id - ID of the transformation's sequence of arguments
Throws:
TemplateExecutionRepositoryException - if a record for trans_id already exists in the TER invocation table
RepositoryAccessException - if the repository cannot be accessed

removeCompositeTransformationInvocation

public static void removeCompositeTransformationInvocation(int trans_id)
                                                    throws TemplateExecutionRepositoryException,
                                                           RepositoryAccessException
Removes a composite transformation's invocation

Parameters:
trans_id - ID of transformation
Throws:
TemplateExecutionRepositoryException - if no record for the specified trans_id is found in the TER's invocation table
RepositoryAccessException - if the repository cannot be accessed

getCompositeTransformationInvocationArgIdList

public static int[] getCompositeTransformationInvocationArgIdList()
                                                           throws RepositoryAccessException
Returns a list of sequence of arguments identifiers in the invocation of transformations

Returns:
a list of sequence of arguments identifiers in the invacation of transformations
Throws:
RepositoryAccessException - if the repository cannot be accessed

createFirstArgument

public static int createFirstArgument(int arg_pos,
                                      java.lang.String value)
                               throws TemplateExecutionRepositoryException,
                                      RepositoryAccessException
Creates a new sequence of arguments and adds a new argument to the sequence

Parameters:
arg_pos - position of argument in the new sequence of arguments
value - the value of the specific argument
Returns:
ID of the new sequence of arguments
Throws:
TemplateExecutionRepositoryException - if the arguments are invalid ( arg_pos less/equal to zero or value equal to null.
RepositoryAccessException - if the repository cannot be accessed

createArgument

public static void createArgument(int arg_id,
                                  int arg_pos,
                                  java.lang.String value)
                           throws TemplateExecutionRepositoryException,
                                  RepositoryAccessException
Adds a new argument to a sequence of arguments

Parameters:
arg_id - ID of sequence of arguments
arg_pos - position of argument in the sequence of arguments
value - the value of the specific argument
Throws:
TemplateExecutionRepositoryException - if the arguments are invalid ( arg_id less/equal to zero,arg_pos less/equal to zero, value equal to null).or if a record already exists for the specified arg_id and arg_pos.
RepositoryAccessException - if the repository cannot be accessed

getArgumentsArgIdList

public static int[] getArgumentsArgIdList()
                                   throws RepositoryAccessException
Returns a list of identifiers of all the sequences of arguments

Returns:
a list of dentifiers of all the sequences of arguments
Throws:
RepositoryAccessException - if the repository cannot be accessed

getArgumentsArgPosList

public static int[] getArgumentsArgPosList(int arg_id)
                                    throws RepositoryAccessException
Returns a particular's sequence of arguments list of positions. Returns null if a sequence of arguments with the specific ID doesn't exist.

Parameters:
arg_id - ID of sequence of arguments
Returns:
a list of positions in the sequence
Throws:
RepositoryAccessException - if the repository cannot be accessed

getArgumentsValueList

public static java.lang.String[] getArgumentsValueList(int arg_id)
                                                throws RepositoryAccessException
Returns a particular's sequence of arguments list of value fields. Returns null if a sequence of arguments with the specific ID doesn't exist.

Parameters:
arg_id - ID of sequence of arguments
Returns:
a list of value fields in the sequence
Throws:
RepositoryAccessException - if the repository cannot be accessed

getArgumentsValue

public static java.lang.String getArgumentsValue(int arg_id,
                                                 int arg_pos)
                                          throws TemplateExecutionRepositoryException,
                                                 RepositoryAccessException
Returns a particular argument's value field

Parameters:
arg_id - ID of sequence
arg_pos - position in the specified sequence
Returns:
the value of the specified argument
Throws:
TemplateExecutionRepositoryException - if no record for the specified arg_id and arg_pos is found in the TER
RepositoryAccessException - if the repository cannot be accessed

setArgumentsValue

public static void setArgumentsValue(int arg_id,
                                     int arg_pos,
                                     java.lang.String value)
                              throws TemplateExecutionRepositoryException,
                                     RepositoryAccessException
Sets an argument's value field

Parameters:
arg_id - ID of sequence
arg_pos - position in the sequence of arguments
value - value to be put in the specified position
Throws:
TemplateExecutionRepositoryException - if value is null, or if no record for the specified arg_id and arg_pos is found in the TER
RepositoryAccessException - if the repository cannot be accessed

removeArgument

public static void removeArgument(int arg_id,
                                  int arg_pos)
                           throws TemplateExecutionRepositoryException,
                                  RepositoryAccessException
Removes a particular position from a sequence of arguments

Parameters:
arg_id - ID of sequence
arg_pos - position in the sequence of arguments to be removed
Throws:
TemplateExecutionRepositoryException - if no record for the specified arg_id and arg_pos is found in the TER or if there is a dependency conflict (a transformation using this arg_id in the comp_tranformation_invocation table)
RepositoryAccessException - if the repository cannot be accessed

removeArguments

public static void removeArguments(int arg_id)
                            throws TemplateExecutionRepositoryException,
                                   RepositoryAccessException
Removes a particular sequence of arguments

Parameters:
arg_id - ID of sequence to be removed
Throws:
TemplateExecutionRepositoryException - if there is a dependency conflict (a transformation using this arg_id in the comp_tranformation_invocation table)
RepositoryAccessException - if the repository cannot be accessed

createCompositeTransformationExecution

public static void createCompositeTransformationExecution(int trans_id,
                                                          int pc,
                                                          int st_id,
                                                          int arg_id)
                                                   throws TemplateExecutionRepositoryException,
                                                          RepositoryAccessException
Adds a statement to the composite transformation's execution

Parameters:
trans_id - ID of transformation
pc - program counter of statement to be added
st_id - ID of statement to be added
arg_id - ID of the statement's sequence of arguments
Throws:
TemplateExecutionRepositoryException - if pc is less/equal to zero, or if no record of the specified trans_id exists in TER's comp_transformation_invocaction table, or if the specified st_id isn't valid (see TemplateTransformationSyntaxRepository.isValidStId(int)), or if no record for the specified arg_id is found in the TER's invocation_arguments table, or if the number of the statement's arguments and the number of arg_id's arguments don't match, or if a record already exists for the specified trans_id and pc
RepositoryAccessException - if the repository cannot be accessed

getCompositeTransformationExecutionPcList

public static int[] getCompositeTransformationExecutionPcList(int trans_id)
                                                       throws TemplateExecutionRepositoryException,
                                                              RepositoryAccessException
Returns a list of program counters of a particular composite transformation's execution. Returns null if there isn't an execution for the specific transformation.

Parameters:
trans_id - ID of transformation
Returns:
a list of program counters of the transformation's execution
Throws:
TemplateExecutionRepositoryException - if no record for the specified trans_id is found in the TER's comp_transformation_invocation table.
RepositoryAccessException - if the repository cannot be accessed

getCompositeTransformationExecutionStIdList

public static int[] getCompositeTransformationExecutionStIdList(int trans_id)
                                                         throws TemplateExecutionRepositoryException,
                                                                RepositoryAccessException
Returns a list of statement identifiers of a particular composite transformation's execution. Returns null if there isn't an execution for the specific transformation.

Parameters:
trans_id - ID of transformation
Returns:
a list of statement identifiers of the transformation's execution
Throws:
TemplateExecutionRepositoryException - if no record for the specified trans_id is found in the TER's comp_transformation_invocation table.
RepositoryAccessException - if the repository cannot be accessed

getCompositeTransformationExecutionArgIdList

public static int[] getCompositeTransformationExecutionArgIdList(int trans_id)
                                                          throws TemplateExecutionRepositoryException,
                                                                 RepositoryAccessException
Returns a list of sequence of arguments identifiers of a particular composite transformation's execution

Parameters:
trans_id - ID of transformation
Returns:
a list of sequence of arguments identifiers of the transformation's execution
Throws:
TemplateExecutionRepositoryException - if no record for the specified trans_id is found in the TER's comp_transformation_invocation table.
RepositoryAccessException - if the repository cannot be accessed

getCompositeTransformationExecutionStId

public static int getCompositeTransformationExecutionStId(int trans_id,
                                                          int pc)
                                                   throws TemplateExecutionRepositoryException,
                                                          RepositoryAccessException
Returns the statement ID in the execution of a particular composite transformation

Parameters:
trans_id - ID of transformation
pc - program counter of transformation
Returns:
a statement identifier in the execution of the transformation
Throws:
TemplateExecutionRepositoryException - if no record for the specified trans_id and pc is found in the TER
RepositoryAccessException - if the repository cannot be accessed

getCompositeTransformationExecutionArgId

public static int getCompositeTransformationExecutionArgId(int trans_id,
                                                           int pc)
                                                    throws TemplateExecutionRepositoryException,
                                                           RepositoryAccessException
Returns a sequence of arguments ID in the execution of a particular composite transformation

Parameters:
trans_id - ID of transformation
pc - program counter of transformation
Returns:
a sequence of arguments identifier in the execution of the transformation
Throws:
TemplateExecutionRepositoryException - if no record for the specified trans_id and pc is found in the TER
RepositoryAccessException - if the repository cannot be accessed

setCompositeTransformationExecutionStId

public static void setCompositeTransformationExecutionStId(int trans_id,
                                                           int pc,
                                                           int st_id)
                                                    throws TemplateExecutionRepositoryException,
                                                           RepositoryAccessException
Sets the statement identifier in a specific program counter in the composite transformation's execution

Parameters:
trans_id - ID of composite transformation
pc - program counter in the template transformation's execution
st_id - statement identifier to be put in the specified pc
Throws:
TemplateExecutionRepositoryException - if no record for the specified trans_id and pc is found in the TER, or if the specified transformation hasn't been invoked, or if the st_id isn't valid
RepositoryAccessException - if the repository cannot be accessed

setCompositeTransformationExecutionArgId

public static void setCompositeTransformationExecutionArgId(int trans_id,
                                                            int pc,
                                                            int arg_id)
                                                     throws TemplateExecutionRepositoryException,
                                                            RepositoryAccessException
Sets the sequence of arguments identifier in a specific program counter in the composite transformation's execution

Parameters:
trans_id - ID of composite transformation
pc - program counter in the template transformation's execution
arg_id - sequence of arguments identifier to be put in the specified pc
Throws:
TemplateExecutionRepositoryException - if no record for the specified trans_id and pc is found in the TER, or if the specified transformation hasn't been invoked, or if the arg_id isn't valid
RepositoryAccessException - if the repository cannot be accessed

removeCompositeTransformationExecution

public static void removeCompositeTransformationExecution(int trans_id,
                                                          int pc)
                                                   throws TemplateExecutionRepositoryException,
                                                          RepositoryAccessException
Removes a particular program counter of a template transformation's execution

Parameters:
trans_id - ID of transformation
pc - program counter in the transformation's execution
Throws:
TemplateExecutionRepositoryException - if no record for the specified trans_id and pc is found in the TER
RepositoryAccessException - if the repository cannot be accessed

removeCompositeTransformationExecution

public static void removeCompositeTransformationExecution(int trans_id)
                                                   throws TemplateExecutionRepositoryException,
                                                          RepositoryAccessException
Removes a template transformation's execution

Parameters:
trans_id - ID of transformation
Throws:
RepositoryAccessException - if the repository cannot be accessed
TemplateExecutionRepositoryException

getCompositeTransformationExecutionTransIdList

public static int[] getCompositeTransformationExecutionTransIdList()
                                                            throws RepositoryAccessException
Returns a list of sequence of transformation identifiers that are being executed

Returns:
a list of trans_ids in the comp_transformation_execution table
Throws:
RepositoryAccessException - if the repository cannot be accessed

transidExistsInCompositeTransformationExecution

public static boolean transidExistsInCompositeTransformationExecution(int trans_id)
                                                               throws RepositoryAccessException
Returns false if the specified transformation is not found in the execution table, true otherwise.

Returns:
whether this transformation is currently being executed or not
Throws:
RepositoryAccessException - if the repository cannot be accessed

main

public static void main(java.lang.String[] args)

getDataSourceName

public static java.lang.String getDataSourceName()
Returns the name of the repository in the local database.

Returns:
the name of the repository in the local database.

setDataSourceName

public static void setDataSourceName(java.lang.String str)
Sets the name of the repository in the local database. This name is set to TER by default.

Parameters:
str - the name of the repository in the local database.