uk.ac.ic.doc.automed.reps
Class CompositeTransformation

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

public class CompositeTransformation
extends java.lang.Object

The CompositeTransformation class.
How to create a composite transformation representing a foreach statement:
//create partially the statement's arguments
TemplateArgumentSequence foreachArgs = new TemplateArgumentSequence();
//initilize argument sequence
foreachArgs.createArgument(1, value1);

//create the arguments for the statements that are going to
//be executed inside the foreach statement
...

//create the composite transformation
CompositeTransformation foreachBlock = new CompositeTransformation(name, null, false);

//built this composite transformation's program
...

//finish the foreach statement's arguments
foreachArgs.createArgument(2, String.valueOf(foreachBlock.getTransIf()));


Field Summary
static int ARG_ACTION_IN_PRIMITIVE
          Position in the PRIMITIVE_TRANSFORMATION_STATEMENT for action
static int ARG_ARGSEQUENCES_IN_FOREACH
          Position in the FOREACH_STATEMENT for argument sequence ID of the lists to iterate
static int ARG_ARGSINGLETONS_IN_FOREACH
          Position in the FOREACH_STATEMENT for argument sequence ID of singleton arguments
static int ARG_ARGUMENTS_IN_INVOCATION
          Position in the INVOCATION_STATEMENT for the argument sequnce ID
static int ARG_CID_IN_NEWOBJECT
          Position in the NEW_OBJECT_STATEMENT for CID(Construct ID)
static int ARG_CONSTRAINTS_IN_PRIMITIVE
          Position in the PRIMITIVE_TRANSFORMATION_STATEMENT for constraints
static int ARG_FROMOBJ_IN_PRIMITIVE
          Position in the PRIMITIVE_TRANSFORMATION_STATEMENT for FromObject OBID
static int ARG_FROMSCHEMA_IN_CONTRACT
          Position in the CONTRACT_STATEMENT for the initial schema ID
static int ARG_FROMSCHEMA_IN_PRIMITIVE
          Position in the PRIMITIVE_TRANSFORMATION_STATEMENT for FromSchema SID
static int ARG_FUNCTION_IN_PRIMITIVE
          Position in the PRIMITIVE_TRANSFORMATION_STATEMENT for function
static int ARG_ISTEMP_IN_NEWOBJECT
          Position in the NEW_OBJECT_STATEMENT for IsTemp
static int ARG_OBID_IN_NEWOBJECT
          Position in the NEW_OBJECT_STATEMENT for OBID(Object ID)
static int ARG_OBJECT_IN_CONTRACT
          Position in the CONTRACT_STATEMENT for object ID
static int ARG_RETURNED_ARGS_START_IN_FOREACH
          Position in the FOREACH_STATEMENT where the returned argument sequences start
static int ARG_SCHEMA_IN_FOREACH
          Position in the FOREACH_STATEMENT for current schema SID
static int ARG_SCHEME_IN_NEWOBJECT
          Position in the NEW_OBJECT_STATEMENT for the argument sequence ID of the object's scheme
static int ARG_SCHEMEID_IN_EXTGENSCHEME
          Position in the EXTGENSCHEME_STATEMENT for the argument sequence ID of the generalisation's scheme
static int ARG_SCHEMEPOS_IN_EXTGENSCHEME
          Position in the EXTGENSCHEME_STATEMENT for the position in the scheme where to start extending
static int ARG_SID_IN_NEWOBJECT
          Position in the NEW_OBJECT_STATEMENT for SID(Schema ID)
static int ARG_SUBENTITIES_IN_EXTGENSCHEME
          Position in the EXTGENSCHEME_STATEMENT for the argument sequence ID of the sub-entities
static int ARG_TOOBJ_IN_PRIMITIVE
          Position in the PRIMITIVE_TRANSFORMATION_STATEMENT for ToObject OBID
static int ARG_TOSCHEMA_IN_CONTRACT
          Position in the CONTRACT_STATEMENT for the final schema ID
static int ARG_TOSCHEMA_IN_PRIMITIVE
          Position in the PRIMITIVE_TRANSFORMATION_STATEMENT for ToSchema SID
static int ARG_TRANS_IN_FOREACH
          Position in the FOREACH_STATEMENT for template transformation ID
static int ARG_TRANSFORMATION_IN_INVOCATION
          Position in the INVOCATION_STATEMENT for the template transformation's ID
static int ARG_VALUE_IN_NEWOBJECT
          Position in the NEW_OBJECT_STATEMENT for the object's value
static java.lang.String CONTRACT_STATEMENT
          Statement to contract an object
static java.lang.String EXTGENSCHEME_STATEMENT
          Statement to extend an ER generalization's scheme
static java.lang.String FOREACH_STATEMENT
          Statement to iterate on lists
static java.lang.String INVOCATION_STATEMENT
          Statement to invoke other template transformations
static java.lang.String NEW_OBJECT_STATEMENT
          Statement to create new objects
static java.lang.String PRIMITIVE_TRANSFORMATION_STATEMENT
          Statement to execute primitive transformations
 
Constructor Summary
CompositeTransformation(java.lang.String name, java.lang.String description, boolean preservesEq)
          Constructs a new CompositeTransformation without any argument definitions nor program.
 
Method Summary
 TransformationArgumentDefinition createArgumentDefinition(int position, java.lang.String description, boolean isReturnedValue)
          Defines an argument for this CompositeTransformation.
 TransformationArgumentDefinition createArgumentDefinition(int position, java.lang.String tablename, java.lang.String fieldname, java.lang.String description, boolean isReturnedValue)
          Defines an argument for this CompositeTransformation.
protected  int createDefaultSchema(java.util.Vector createdSchemas)
          Creates a new schema and appends it to the STR.
protected  int createFirstArgument(int arg_pos, java.lang.String value, java.util.Vector createdArgIds)
          Creates a new sequence of arguments and adds a new argument to the sequence
protected  void createObjectScheme(int objectId, int argId)
          Creates the scheme for a schema object and appends it to the STR.
protected  void createPrimitiveTransformation(int argId)
          Creates a primitive transformation and appends it in the STR.
 void createReturnedArgumentsDefinition(TemplateArgumentSequence args)
          Defines the values of the arguments that store returned values after the transformation's invocation.
protected  int createSchemaObject(int argId, java.util.Vector createdObjects)
          Creates a new schema object and appends it to the STR.
 StatementExecution createStatementExecution(int pc, Statement stmnt, TemplateArgumentSequence args)
          Defines the statement to be invoked at a particular program counter.
protected  void executeContractStatement(int stmntId, int stmntTemplateArgId, int transIdToUse, java.lang.String[] transArgs, java.util.HashMap argMap, int runTimePc, java.lang.String[] resultingSID, java.lang.String[] createdOBID, java.util.Vector createdArgIds, java.util.Vector createdSchemas, java.util.Vector createdObjects)
          Executes a contract statement.
protected  void executeExtGenSchemeStatement(int stmntId, int stmntTemplateArgId, int transIdToUse, java.lang.String[] transArgs, java.util.HashMap argMap, int runTimePc, java.lang.String[] resultingSID, java.lang.String[] createdOBID, java.util.Vector createdArgIds, java.util.Vector createdSchemas, java.util.Vector createdObjects)
          Executes a extend_gen_scheme statement.
protected  int executeForEachStatement(int stmntId, int stmntTemplateArgId, int transIdToUse, java.lang.String[] transArgs, java.util.HashMap argMap, int startRunTimePc, java.lang.String[] resultingSID, java.lang.String[] createdOBID, java.util.Vector createdArgIds, java.util.Vector createdSchemas, java.util.Vector createdObjects)
          Executes a foreach statement.
protected  int executeInvocationStatement(int stmntId, int stmntTemplateArgId, int transIdToUse, java.lang.String[] transArgs, java.util.HashMap argMap, int runTimePc, java.lang.String[] resultingSID, java.lang.String[] createdOBID, java.util.Vector createdArgIds, java.util.Vector createdSchemas, java.util.Vector createdObjects)
          Executes a transformation_invocation statement.
protected  void executeNewObjectStatement(int stmntId, int stmntTemplateArgId, int transIdToUse, java.lang.String[] transArgs, java.util.HashMap argMap, int runTimePc, java.lang.String[] resultingSID, java.lang.String[] createdOBID, java.util.Vector createdArgIds, java.util.Vector createdSchemas, java.util.Vector createdObjects)
          Executes a new_object statement.
protected  void executePrimitiveTransformationStatement(int stmntId, int stmntTemplateArgId, int transIdToUse, java.lang.String[] transArgs, java.util.HashMap argMap, int runTimePc, java.lang.String[] resultingSID, java.lang.String[] createdOBID, java.util.Vector createdArgIds, java.util.Vector createdSchemas, java.util.Vector createdObjects)
          Executes a primitive_transformation statement.
protected  int executeTransformation(int transIdToExecute, int transIdToUse, java.lang.String[] transArgs, java.util.HashMap argMap, int startRunTimePc, java.lang.String[] resultingSID, java.lang.String[] createdOBID, java.util.Vector createdArgIds, java.util.Vector createdSchemas, java.util.Vector createdObjects)
          Main method which executes a composite transformation.
static CompositeTransformation[] getAllCompositeTransformations()
          Returns an array of all CompositeTransformation objects.
 TransformationArgumentDefinition getArgumentDefinitionAt(int position)
          Returns a particular TransformationArgumentDefinition in the CompositeTransformations's argument definition list.
 TransformationArgumentDefinition[] getArgumentDefinitions()
          Returns an array of all the TransformationArgumentDefinition objects in this CompositeTransformation.
 TransformationArgumentDefinition[] getArgumentDefinitions(boolean isReturnedValue)
          Returns an array of TransformationArgumentDefinition objects.
protected static CompositeTransformation getCompositeTransformation(int transId)
          Returns a reference to a CompositeTransformation.
static CompositeTransformation getCompositeTransformation(java.lang.String name)
          Returns a reference to a CompositeTransformation.
static CompositeTransformation[] getCompositeTransformations(boolean preservesEq)
          Returns an array of CompositeTransformation objects.
 java.lang.String getDescription()
          Returns the description of this CompositeTransformation.
 java.lang.String getName()
          Returns the name of this CompositeTransformation.
 TemplateArgumentSequence getReturnedArgumentsDefinition()
          Returns the arguments that store returned values after the transformation's invocation.
 StatementExecution getStatementExecutionAt(int pc)
          Returns a particular StatementExecution in the CompositeTransformations's template program.
 StatementExecution[] getStatementExecutions()
          Returns an array of all the StatementExecution objects in this CompositeTransformation.
 int getTransId()
          Returns the ID of this CompositeTransformation.
protected  java.lang.String getValueForTemplateArgument(int templateArgIdRef, int templateArgPosRef, java.lang.String templateValue, java.lang.String[] transArgs, java.util.HashMap argMap)
          Returns the value for a template argument.
protected  java.lang.String getValueForTemplateArgumentPointingToArgId(int templateArgIdRef, int templateArgPosRef, java.lang.String templateValue, java.lang.String[] transArgs, java.util.HashMap argMap, java.util.Vector createdArgIds, boolean nestedPointersToSequences)
          Returns the value for a template argument that points to another argument in the TTR.
protected  int handleNonStatementArgument(int templateArgId, java.lang.String[] transArgs, java.util.HashMap argMap, java.util.Vector createdArgIds, boolean pointingToArgumentSequences)
          Creates an execution argument sequence according to a template argument sequence.
 Schema invoke(RuntimeArgumentSequence tas)
          Invokes this CompositeTransformation with the specified RuntimeArgumentSequence as arguments.
 boolean isExecuted()
          Returns false if the specified transformation is not currently being executed, true otherwise.
 boolean preservesEquivalence()
          Returns whether this CompositeTransformation preserves schema equivalence.
 void print()
           
 void remove()
          Removes this CompositeTransformation
 void removeArgumentDefinition(int position)
          Removes a particular argument definition from this CompositeTransformation's argument definition list.
static void removeCompositeTransformation(java.lang.String name)
          Removes a CompositeTransformation
protected  void removeExecutionTrace(int transId, java.util.Vector createdArgIds)
          Removes the trace of a composite transformation's executionfrom the TER.
 void removeReturnedArgumentsDefinition()
          Removes the definitions of this transformation's returned arguments.
 void removeStatementExecution(int pc)
          Removes a particular statement execution from this CompositeTransformations's template program
protected  void rollbackSTR(java.util.Vector createdSchemas, java.util.Vector createdObjects)
          Removes the trace of a composite transformation's execution for the STR.
 void setDescription(java.lang.String description)
          Sets this CompositeTransformation's description.
 void setName(java.lang.String name)
          Sets this CompositeTransformation's name.
 void setPreservesEquivalence(boolean preservesEq)
          Sets whether this CompositeTransformation preserves schema equivalence.
 void setReturnedArgumentsDefinition(TemplateArgumentSequence args)
          Sets the arguments that store returned values after the transformation's invocation.
protected  void updateObjectScheme(int objectId, int schemePos, int value)
          Extends a Generalisation's scheme in the STR.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEW_OBJECT_STATEMENT

public static final java.lang.String NEW_OBJECT_STATEMENT
Statement to create new objects

See Also:
Constant Field Values

PRIMITIVE_TRANSFORMATION_STATEMENT

public static final java.lang.String PRIMITIVE_TRANSFORMATION_STATEMENT
Statement to execute primitive transformations

See Also:
Constant Field Values

FOREACH_STATEMENT

public static final java.lang.String FOREACH_STATEMENT
Statement to iterate on lists

See Also:
Constant Field Values

EXTGENSCHEME_STATEMENT

public static final java.lang.String EXTGENSCHEME_STATEMENT
Statement to extend an ER generalization's scheme

See Also:
Constant Field Values

INVOCATION_STATEMENT

public static final java.lang.String INVOCATION_STATEMENT
Statement to invoke other template transformations

See Also:
Constant Field Values

CONTRACT_STATEMENT

public static final java.lang.String CONTRACT_STATEMENT
Statement to contract an object

See Also:
Constant Field Values

ARG_SID_IN_NEWOBJECT

public static final int ARG_SID_IN_NEWOBJECT
Position in the NEW_OBJECT_STATEMENT for SID(Schema ID)

See Also:
Constant Field Values

ARG_CID_IN_NEWOBJECT

public static final int ARG_CID_IN_NEWOBJECT
Position in the NEW_OBJECT_STATEMENT for CID(Construct ID)

See Also:
Constant Field Values

ARG_OBID_IN_NEWOBJECT

public static final int ARG_OBID_IN_NEWOBJECT
Position in the NEW_OBJECT_STATEMENT for OBID(Object ID)

See Also:
Constant Field Values

ARG_VALUE_IN_NEWOBJECT

public static final int ARG_VALUE_IN_NEWOBJECT
Position in the NEW_OBJECT_STATEMENT for the object's value

See Also:
Constant Field Values

ARG_ISTEMP_IN_NEWOBJECT

public static final int ARG_ISTEMP_IN_NEWOBJECT
Position in the NEW_OBJECT_STATEMENT for IsTemp

See Also:
Constant Field Values

ARG_SCHEME_IN_NEWOBJECT

public static final int ARG_SCHEME_IN_NEWOBJECT
Position in the NEW_OBJECT_STATEMENT for the argument sequence ID of the object's scheme

See Also:
Constant Field Values

ARG_ACTION_IN_PRIMITIVE

public static final int ARG_ACTION_IN_PRIMITIVE
Position in the PRIMITIVE_TRANSFORMATION_STATEMENT for action

See Also:
Constant Field Values

ARG_FROMOBJ_IN_PRIMITIVE

public static final int ARG_FROMOBJ_IN_PRIMITIVE
Position in the PRIMITIVE_TRANSFORMATION_STATEMENT for FromObject OBID

See Also:
Constant Field Values

ARG_TOOBJ_IN_PRIMITIVE

public static final int ARG_TOOBJ_IN_PRIMITIVE
Position in the PRIMITIVE_TRANSFORMATION_STATEMENT for ToObject OBID

See Also:
Constant Field Values

ARG_FROMSCHEMA_IN_PRIMITIVE

public static final int ARG_FROMSCHEMA_IN_PRIMITIVE
Position in the PRIMITIVE_TRANSFORMATION_STATEMENT for FromSchema SID

See Also:
Constant Field Values

ARG_TOSCHEMA_IN_PRIMITIVE

public static final int ARG_TOSCHEMA_IN_PRIMITIVE
Position in the PRIMITIVE_TRANSFORMATION_STATEMENT for ToSchema SID

See Also:
Constant Field Values

ARG_FUNCTION_IN_PRIMITIVE

public static final int ARG_FUNCTION_IN_PRIMITIVE
Position in the PRIMITIVE_TRANSFORMATION_STATEMENT for function

See Also:
Constant Field Values

ARG_CONSTRAINTS_IN_PRIMITIVE

public static final int ARG_CONSTRAINTS_IN_PRIMITIVE
Position in the PRIMITIVE_TRANSFORMATION_STATEMENT for constraints

See Also:
Constant Field Values

ARG_SCHEMA_IN_FOREACH

public static final int ARG_SCHEMA_IN_FOREACH
Position in the FOREACH_STATEMENT for current schema SID

See Also:
Constant Field Values

ARG_ARGSEQUENCES_IN_FOREACH

public static final int ARG_ARGSEQUENCES_IN_FOREACH
Position in the FOREACH_STATEMENT for argument sequence ID of the lists to iterate

See Also:
Constant Field Values

ARG_ARGSINGLETONS_IN_FOREACH

public static final int ARG_ARGSINGLETONS_IN_FOREACH
Position in the FOREACH_STATEMENT for argument sequence ID of singleton arguments

See Also:
Constant Field Values

ARG_TRANS_IN_FOREACH

public static final int ARG_TRANS_IN_FOREACH
Position in the FOREACH_STATEMENT for template transformation ID

See Also:
Constant Field Values

ARG_RETURNED_ARGS_START_IN_FOREACH

public static final int ARG_RETURNED_ARGS_START_IN_FOREACH
Position in the FOREACH_STATEMENT where the returned argument sequences start

See Also:
Constant Field Values

ARG_SUBENTITIES_IN_EXTGENSCHEME

public static final int ARG_SUBENTITIES_IN_EXTGENSCHEME
Position in the EXTGENSCHEME_STATEMENT for the argument sequence ID of the sub-entities

See Also:
Constant Field Values

ARG_SCHEMEID_IN_EXTGENSCHEME

public static final int ARG_SCHEMEID_IN_EXTGENSCHEME
Position in the EXTGENSCHEME_STATEMENT for the argument sequence ID of the generalisation's scheme

See Also:
Constant Field Values

ARG_SCHEMEPOS_IN_EXTGENSCHEME

public static final int ARG_SCHEMEPOS_IN_EXTGENSCHEME
Position in the EXTGENSCHEME_STATEMENT for the position in the scheme where to start extending

See Also:
Constant Field Values

ARG_TRANSFORMATION_IN_INVOCATION

public static final int ARG_TRANSFORMATION_IN_INVOCATION
Position in the INVOCATION_STATEMENT for the template transformation's ID

See Also:
Constant Field Values

ARG_ARGUMENTS_IN_INVOCATION

public static final int ARG_ARGUMENTS_IN_INVOCATION
Position in the INVOCATION_STATEMENT for the argument sequnce ID

See Also:
Constant Field Values

ARG_FROMSCHEMA_IN_CONTRACT

public static final int ARG_FROMSCHEMA_IN_CONTRACT
Position in the CONTRACT_STATEMENT for the initial schema ID

See Also:
Constant Field Values

ARG_OBJECT_IN_CONTRACT

public static final int ARG_OBJECT_IN_CONTRACT
Position in the CONTRACT_STATEMENT for object ID

See Also:
Constant Field Values

ARG_TOSCHEMA_IN_CONTRACT

public static final int ARG_TOSCHEMA_IN_CONTRACT
Position in the CONTRACT_STATEMENT for the final schema ID

See Also:
Constant Field Values
Constructor Detail

CompositeTransformation

public CompositeTransformation(java.lang.String name,
                               java.lang.String description,
                               boolean preservesEq)
                        throws TemplateTransformationRepositoryException,
                               RepositoryAccessException
Constructs a new CompositeTransformation without any argument definitions nor program.

Parameters:
name - name of the transformation.
description - description of the transformation
preservesEq - true if transformation can be invoked independently on a schema, false otherwise
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.createCompositeTransformation(String, String, boolean)
RepositoryAccessException - if the repositories cannot be accessed
Method Detail

removeCompositeTransformation

public static void removeCompositeTransformation(java.lang.String name)
                                          throws TemplateTransformationRepositoryException,
                                                 RepositoryAccessException
Removes a CompositeTransformation

Parameters:
name - name of transformation to remove.
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.getCompositeTransformationByName(String) and TemplateTransformationRepository.removeCompositeTransformation(int) and remove()
RepositoryAccessException - if the repositories cannot be accessed

remove

public void remove()
            throws TemplateTransformationRepositoryException,
                   RepositoryAccessException
Removes this CompositeTransformation

Throws:
TemplateTransformationRepositoryException - see TransformationArgumentDefinition.remove() and StatementExecution.remove() and TemplateTransformationRepository.removeCompositeTransformation(int)
RepositoryAccessException - if the repositories cannot be accessed

getAllCompositeTransformations

public static CompositeTransformation[] getAllCompositeTransformations()
                                                                throws RepositoryAccessException
Returns an array of all CompositeTransformation objects. Returns null if no records of compoiste transformations exist in the TTR.

Returns:
an array of all CompositeTransformation objects.
Throws:
RepositoryAccessException - if the repositories cannot be accessed

getCompositeTransformations

public static CompositeTransformation[] getCompositeTransformations(boolean preservesEq)
                                                             throws RepositoryAccessException
Returns an array of CompositeTransformation objects. The returned transformation preserve schema equivalence (if preservesEq is true), or they don't preserve equivalence(if preservesEq is false). Method returns null if there aren't any appropriate transformations.

Parameters:
preservesEq - whether the CompositeTransformation objects preserve schema equivalence
Returns:
an array of CompositeTransformations.
Throws:
RepositoryAccessException - if the repositories cannot be accessed

getCompositeTransformation

public static CompositeTransformation getCompositeTransformation(java.lang.String name)
                                                          throws TemplateTransformationRepositoryException,
                                                                 RepositoryAccessException
Returns a reference to a CompositeTransformation.

Parameters:
name - name of the CompositeTransformation to return.
Returns:
the reference to the transformation with the given name.
Throws:
TemplateTransformationRepositoryException - if no transformation with the specified name exists. See TemplateTransformationRepository.getCompositeTransformationByName(String)
RepositoryAccessException - if the repositories cannot be accessed

getCompositeTransformation

protected static CompositeTransformation getCompositeTransformation(int transId)
                                                             throws TemplateTransformationRepositoryException,
                                                                    RepositoryAccessException
Returns a reference to a CompositeTransformation.

Parameters:
transId - identifier of the CompositeTransformation to return.
Returns:
the reference to the transformation with the given identifier.
Throws:
TemplateTransformationRepositoryException - if no transformation with the specified ID exists. See TemplateTransformationRepository.getCompositeTransformationName(int)
RepositoryAccessException - if the repositories cannot be accessed

getName

public java.lang.String getName()
                         throws TemplateTransformationRepositoryException,
                                RepositoryAccessException
Returns the name of this CompositeTransformation.

Returns:
name of CompositeTransformation.
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.getCompositeTransformationName(int)
RepositoryAccessException - if the repositories cannot be accessed

getDescription

public java.lang.String getDescription()
                                throws TemplateTransformationRepositoryException,
                                       RepositoryAccessException
Returns the description of this CompositeTransformation.

Returns:
description of CompositeTransformation.
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.getCompositeTransformationDescription(int)
RepositoryAccessException - if the repositories cannot be accessed

preservesEquivalence

public boolean preservesEquivalence()
                             throws TemplateTransformationRepositoryException,
                                    RepositoryAccessException
Returns whether this CompositeTransformation preserves schema equivalence.

Returns:
whether this CompositeTransformation preserves schema equivalence.
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.getCompositeTransformationPreservesEquivalence(int)
RepositoryAccessException - if the repositories cannot be accessed

getTransId

public int getTransId()
Returns the ID of this CompositeTransformation.

Returns:
ID of CompositeTransformation

setName

public void setName(java.lang.String name)
             throws TemplateTransformationRepositoryException,
                    RepositoryAccessException
Sets this CompositeTransformation's name.

Parameters:
name - new name of CompositeTransformation.
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.setCompositeTransformationName(int, String)
RepositoryAccessException - if the repositories cannot be accessed

setDescription

public void setDescription(java.lang.String description)
                    throws TemplateTransformationRepositoryException,
                           RepositoryAccessException
Sets this CompositeTransformation's description.

Parameters:
description - new description of CompositeTransformation.
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.setCompositeTransformationDescription(int, String)
RepositoryAccessException - if the repositories cannot be accessed

setPreservesEquivalence

public void setPreservesEquivalence(boolean preservesEq)
                             throws TemplateTransformationRepositoryException,
                                    RepositoryAccessException
Sets whether this CompositeTransformation preserves schema equivalence.

Parameters:
preservesEq - true if this CompositeTransformation preserves equivalence, false otherwise.
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.setCompositeTransformationPreservesEquivalence(int, boolean)
RepositoryAccessException - if the repositories cannot be accessed

getArgumentDefinitions

public TransformationArgumentDefinition[] getArgumentDefinitions()
Returns an array of all the TransformationArgumentDefinition objects in this CompositeTransformation. If no arguments have been defined for this CompositeTransformation, an empty array is returned.

Returns:
an array of all the ransformationArgumentDefinition objects in this CompositeTransformation.

getArgumentDefinitions

public TransformationArgumentDefinition[] getArgumentDefinitions(boolean isReturnedValue)
                                                          throws RepositoryAccessException
Returns an array of TransformationArgumentDefinition objects. If no arguments have been defined for this CompositeTransformation, an empty array is returned.

Parameters:
isReturnedValue -
Returns:
an array of the TransformationArgumentDefinition objects that define arguments for the invocation of this CompositeTransformation if isReturnedValue is false, or an array of TransformationArgumentDefinition objects defining the arguments storing the transformation's returned values
Throws:
RepositoryAccessException - if the repositories cannot be accessed

createArgumentDefinition

public TransformationArgumentDefinition createArgumentDefinition(int position,
                                                                 java.lang.String tablename,
                                                                 java.lang.String fieldname,
                                                                 java.lang.String description,
                                                                 boolean isReturnedValue)
                                                          throws TemplateTransformationRepositoryException,
                                                                 RepositoryAccessException
Defines an argument for this CompositeTransformation. Method constructs a new TransformationArgumentDefinition and adds it to this CompositeTransformation's argument definitions. The defined argument holds position position in this CompositeTransformation object's arguments. tablename, fieldname and description are used to describe the specific argument.

Parameters:
position - the position in the transformation's arguments
tablename - name of the table referenced by this argument.
fieldname - name of the table's field referenced by this argument.
description - description of this argument.
isReturnedValue - whether this argument stores a returned value or not.
Returns:
reference to the new CompositeTransformationArgumentDefinition.
Throws:
TemplateTransformationRepositoryException - see TransformationArgumentDefinition.TransformationArgumentDefinition(int, int, String, String, String, boolean)
RepositoryAccessException - if the repositories cannot be accessed

createArgumentDefinition

public TransformationArgumentDefinition createArgumentDefinition(int position,
                                                                 java.lang.String description,
                                                                 boolean isReturnedValue)
                                                          throws TemplateTransformationRepositoryException,
                                                                 RepositoryAccessException
Defines an argument for this CompositeTransformation. Method constructs a new TransformationArgumentDefinition and adds it to this CompositeTransformation's argument definitions. The defined argument holds position position in this CompositeTransformation object's arguments. description is used to describe the specific argument.

Parameters:
position - the position in the transformation's arguments
description - description of this argument.
isReturnedValue - whether this argument stores a returned value or not.
Returns:
reference to the new CompositeTransformationArgumentDefinition.
Throws:
TemplateTransformationRepositoryException - see TransformationArgumentDefinition.TransformationArgumentDefinition(int, int, String, String, String, boolean)
RepositoryAccessException - if the repositories cannot be accessed

getArgumentDefinitionAt

public TransformationArgumentDefinition getArgumentDefinitionAt(int position)
                                                         throws AutoRepException
Returns a particular TransformationArgumentDefinition in the CompositeTransformations's argument definition list.

Parameters:
position - the position in the transformation's arguments.
Returns:
the TransformationArgumentDefinition specified by the given position
Throws:
AutoRepException - if the specified position doesn't exist in this CompositeTransformation's argument definition list

removeArgumentDefinition

public void removeArgumentDefinition(int position)
                              throws TemplateTransformationRepositoryException,
                                     AutoRepException,
                                     RepositoryAccessException
Removes a particular argument definition from this CompositeTransformation's argument definition list.

Parameters:
position - the position to be removed from the transformation's argument definitions.
Throws:
AutoRepException - see getArgumentDefinitionAt(int)
TemplateTransformationRepositoryException - see TransformationArgumentDefinition.remove()
RepositoryAccessException - if the repositories cannot be accessed

createReturnedArgumentsDefinition

public void createReturnedArgumentsDefinition(TemplateArgumentSequence args)
                                       throws TemplateTransformationRepositoryException,
                                              RepositoryAccessException
Defines the values of the arguments that store returned values after the transformation's invocation.

Parameters:
args - the TemplateArgumentSequence defining which positions store the returned values and how these values can be obtained
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.createCompositeTransformationReturnedValuesDefinition(int, int)
RepositoryAccessException - if the repositories cannot be accessed

setReturnedArgumentsDefinition

public void setReturnedArgumentsDefinition(TemplateArgumentSequence args)
                                    throws TemplateTransformationRepositoryException,
                                           RepositoryAccessException
Sets the arguments that store returned values after the transformation's invocation.

Parameters:
args - the TemplateArgumentSequence defining which positions store the returned values and how these values can be obtained
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.setCompositeTransformationReturnedValuesDefinitionArgId(int, int)
RepositoryAccessException - if the repositories cannot be accessed

getReturnedArgumentsDefinition

public TemplateArgumentSequence getReturnedArgumentsDefinition()
                                                        throws TemplateTransformationRepositoryException,
                                                               RepositoryAccessException,
                                                               AutoRepException
Returns the arguments that store returned values after the transformation's invocation.

Returns:
the TemplateArgumentSequence defining which positions store the returned values and how these values can be obtained
Throws:
TemplateTransformationRepositoryException - if no returned arguments have been defined for this transformation. See TemplateTransformationRepository.getCompositeTransformationReturnedValuesDefinitionArgId(int)
AutoRepException - see TemplateArgumentSequence.getTemplateArgumentSequence(int)
RepositoryAccessException - if the repositories cannot be accessed

removeReturnedArgumentsDefinition

public void removeReturnedArgumentsDefinition()
                                       throws RepositoryAccessException
Removes the definitions of this transformation's returned arguments. The transformation doesn't return any values after this method call.

Throws:
RepositoryAccessException - if the repositories cannot be accessed

getStatementExecutions

public StatementExecution[] getStatementExecutions()
Returns an array of all the StatementExecution objects in this CompositeTransformation. If no StatementExecution objects have been defined for this CompositeTransformation, an empty array is returned.

Returns:
an array of all the StatementExecution objects in this CompositeTransformation.

createStatementExecution

public StatementExecution createStatementExecution(int pc,
                                                   Statement stmnt,
                                                   TemplateArgumentSequence args)
                                            throws TemplateTransformationRepositoryException,
                                                   RepositoryAccessException
Defines the statement to be invoked at a particular program counter. Method defines the statement (stmnt) to be invoked when the program counter reaches pc, and the sequence of arguments(args) used for the statement invocation. Method constructs a new StatementExecution and adds it to the CompositeTransformation's template program.

Parameters:
pc - the program counter in the transformation's template program
stmnt - Statement that is going to be executed at the specific pc by this transformation
args - TemplateArgumentSequence that is going to be used as arguments to the Statement
Returns:
reference to the new StatementExecution.
Throws:
TemplateTransformationRepositoryException - see StatementExecution.StatementExecution(int, int, Statement, TemplateArgumentSequence)
RepositoryAccessException - if the repositories cannot be accessed

getStatementExecutionAt

public StatementExecution getStatementExecutionAt(int pc)
                                           throws AutoRepException
Returns a particular StatementExecution in the CompositeTransformations's template program.

Parameters:
pc - the program counter in the transformation's template program
Returns:
the StatementExecution specified by the given pc
Throws:
AutoRepException - if the specified pc doesn't exist in this CompositeTransformation's program

removeStatementExecution

public void removeStatementExecution(int pc)
                              throws TemplateTransformationRepositoryException,
                                     AutoRepException,
                                     RepositoryAccessException
Removes a particular statement execution from this CompositeTransformations's template program

Parameters:
pc - the program counter in the transformation's template program to remove
Throws:
AutoRepException - see getStatementExecutionAt(int)
TemplateTransformationRepositoryException - see StatementExecution.remove()
RepositoryAccessException - if the repositories cannot be accessed

isExecuted

public boolean isExecuted()
                   throws RepositoryAccessException
Returns false if the specified transformation is not currently being executed, true otherwise.

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

invoke

public Schema invoke(RuntimeArgumentSequence tas)
              throws TemplateTransformationSyntaxRepositoryException,
                     TemplateExecutionRepositoryException,
                     TemplateTransformationRepositoryException,
                     AutoRepException,
                     RepositoryAccessException
Invokes this CompositeTransformation with the specified RuntimeArgumentSequence as arguments. The CompositeTransformaion must preserve schema equivalence and the RuntimeArgumentSequence object must contain RuntimeArgument objects.

Parameters:
tas - the RuntimeArgumentSequence used in the invocation
Returns:
the resulting Schema
Throws:
AutoRepException
TemplateExecutionRepositoryException
TemplateTransformationRepositoryException
RepositoryAccessException - if the repositories cannot be accessed
TemplateTransformationSyntaxRepositoryException

executeTransformation

protected int executeTransformation(int transIdToExecute,
                                    int transIdToUse,
                                    java.lang.String[] transArgs,
                                    java.util.HashMap argMap,
                                    int startRunTimePc,
                                    java.lang.String[] resultingSID,
                                    java.lang.String[] createdOBID,
                                    java.util.Vector createdArgIds,
                                    java.util.Vector createdSchemas,
                                    java.util.Vector createdObjects)
                             throws TemplateTransformationSyntaxRepositoryException,
                                    TemplateTransformationRepositoryException,
                                    TemplateExecutionRepositoryException,
                                    AutoRepException,
                                    RepositoryAccessException
Main method which executes a composite transformation. The method checks the current statement in the composite transformation's program, and calls the appropriate method. The initial composite transformation has ID transIdToUse. This transformation might call other composite transformations (in an transformation_invocation or in a for_each statement). The IDs of these invoked transformation are stored in transIdToExecute.

Parameters:
transIdToExecute - the ID of the composite transformation that is to be really executed
transIdToUse - the ID of the initial composite transformation
transArgs - the initial composite transformation's execution arguments' values
argMap - a mapping from template argument sequence IDs to execution argument sequence IDs
startRunTimePc - the starting program counter for the transformation that is going to be executed (transIdToExecute)
resultingSID - a single-element array storing the schema ID after the execution of the transformation
createdOBID - a single-element array storing the object ID of the object created by the execution of the transformation (meaningfull only in a new_object statement)
createdArgIds - vector of Integer objects storing the created execution argument sequence IDs
createdSchemas - vector of Integer objects storing the created schemas during the transformation's execution
createdObjects - vector of Integer objects storing the created objects during the transformation's execution
Returns:
the new run-time program counter that must be used after this execution
Throws:
AutoRepException
TemplateExecutionRepositoryException
TemplateTransformationRepositoryException
RepositoryAccessException - if the repositories cannot be accessed
TemplateTransformationSyntaxRepositoryException

executeNewObjectStatement

protected void executeNewObjectStatement(int stmntId,
                                         int stmntTemplateArgId,
                                         int transIdToUse,
                                         java.lang.String[] transArgs,
                                         java.util.HashMap argMap,
                                         int runTimePc,
                                         java.lang.String[] resultingSID,
                                         java.lang.String[] createdOBID,
                                         java.util.Vector createdArgIds,
                                         java.util.Vector createdSchemas,
                                         java.util.Vector createdObjects)
                                  throws TemplateExecutionRepositoryException,
                                         RepositoryAccessException,
                                         AutoRepException
Executes a new_object statement.

Parameters:
stmntId - statement's ID
stmntTemplateArgId - template argument sequence ID
transIdToUse - composite transformation's ID to use in the comp_transformation_execution entries
transArgs - current composite transformation's execution argument sequence
argMap - map IDs of template argument sequences to IDs of execution argument sequences
runTimePc - current program counter
resultingSID - one element array storing the resulting schema ID after this statement's execution
createdOBID - one element array storing the created schema object ID after this statement's execution
createdArgIds - Vector storing the IDs of all the created sequences of arguments during a composite transformation execution
createdSchemas - Vector storing the IDs of all the created schemas during the composite transformation execution
createdObjects - Vector storing the IDs of all the created objects during the composite transformation execution
Throws:
AutoRepException
TemplateExecutionRepositoryException
RepositoryAccessException - if the repositories cannot be accessed

executePrimitiveTransformationStatement

protected void executePrimitiveTransformationStatement(int stmntId,
                                                       int stmntTemplateArgId,
                                                       int transIdToUse,
                                                       java.lang.String[] transArgs,
                                                       java.util.HashMap argMap,
                                                       int runTimePc,
                                                       java.lang.String[] resultingSID,
                                                       java.lang.String[] createdOBID,
                                                       java.util.Vector createdArgIds,
                                                       java.util.Vector createdSchemas,
                                                       java.util.Vector createdObjects)
                                                throws TemplateExecutionRepositoryException,
                                                       AutoRepException,
                                                       RepositoryAccessException
Executes a primitive_transformation statement.

Parameters:
stmntId - statement's ID
stmntTemplateArgId - template argument sequence ID
transIdToUse - composite transformation's ID to use in the comp_transformation_execution entries
transArgs - current composite transformation's execution argument sequence
argMap - map IDs of template argument sequences to IDs of execution argument sequences
runTimePc - current program counter
resultingSID - one element array storing the resulting schema ID after this statement's execution
createdOBID - one element array storing the created schema object ID after this statement's execution
createdArgIds - Vector storing the IDs of all the created sequences of arguments during a composite transformation execution
createdSchemas - Vector storing the IDs of all the created schemas during the composite transformation execution
createdObjects - Vector storing the IDs of all the created objects during the composite transformation execution
Throws:
AutoRepException
TemplateExecutionRepositoryException
TemplateTransformationRepositoryException
RepositoryAccessException - if the repositories cannot be accessed

executeInvocationStatement

protected int executeInvocationStatement(int stmntId,
                                         int stmntTemplateArgId,
                                         int transIdToUse,
                                         java.lang.String[] transArgs,
                                         java.util.HashMap argMap,
                                         int runTimePc,
                                         java.lang.String[] resultingSID,
                                         java.lang.String[] createdOBID,
                                         java.util.Vector createdArgIds,
                                         java.util.Vector createdSchemas,
                                         java.util.Vector createdObjects)
                                  throws TemplateTransformationSyntaxRepositoryException,
                                         TemplateExecutionRepositoryException,
                                         TemplateTransformationRepositoryException,
                                         AutoRepException,
                                         RepositoryAccessException
Executes a transformation_invocation statement.

Parameters:
stmntId - statement's ID
stmntTemplateArgId - template argument sequence ID
transIdToUse - composite transformation's ID to use in the comp_transformation_execution entries
transArgs - current composite transformation's execution argument sequence
argMap - map IDs of template argument sequences to IDs of execution argument sequences
runTimePc - current program counter
resultingSID - one element array storing the resulting schema ID after this statement's execution
createdOBID - one element array storing the created schema object ID after this statement's execution
createdArgIds - Vector storing the IDs of all the created sequences of arguments during a composite transformation execution
createdSchemas - Vector storing the IDs of all the created schemas during the composite transformation execution
createdObjects - Vector storing the IDs of all the created objects during the composite transformation execution
Returns:
the new run-time program counter that must be used after this execution
Throws:
AutoRepException
TemplateExecutionRepositoryException
TemplateTransformationRepositoryException
RepositoryAccessException - if the repositories cannot be accessed
TemplateTransformationSyntaxRepositoryException

executeForEachStatement

protected int executeForEachStatement(int stmntId,
                                      int stmntTemplateArgId,
                                      int transIdToUse,
                                      java.lang.String[] transArgs,
                                      java.util.HashMap argMap,
                                      int startRunTimePc,
                                      java.lang.String[] resultingSID,
                                      java.lang.String[] createdOBID,
                                      java.util.Vector createdArgIds,
                                      java.util.Vector createdSchemas,
                                      java.util.Vector createdObjects)
                               throws TemplateTransformationSyntaxRepositoryException,
                                      TemplateTransformationRepositoryException,
                                      TemplateExecutionRepositoryException,
                                      AutoRepException,
                                      RepositoryAccessException
Executes a foreach statement.

Parameters:
stmntId - statement's ID
stmntTemplateArgId - template argument sequence ID
transIdToUse - composite transformation's ID to use in the comp_transformation_execution entries
transArgs - current composite transformation's execution argument sequence
argMap - map IDs of template argument sequences to IDs of execution argument sequences
resultingSID - one element array storing the resulting schema ID after this statement's execution
createdOBID - one element array storing the created schema object ID after this statement's execution
createdArgIds - Vector storing the IDs of all the created sequences of arguments during a composite transformation execution
createdSchemas - Vector storing the IDs of all the created schemas during the composite transformation execution
createdObjects - Vector storing the IDs of all the created objects during the composite transformation execution
Returns:
the new run-time program counter that must be used after this execution
Throws:
AutoRepException
TemplateExecutionRepositoryException
TemplateTransformationRepositoryException
RepositoryAccessException - if the repositories cannot be accessed
TemplateTransformationSyntaxRepositoryException

executeExtGenSchemeStatement

protected void executeExtGenSchemeStatement(int stmntId,
                                            int stmntTemplateArgId,
                                            int transIdToUse,
                                            java.lang.String[] transArgs,
                                            java.util.HashMap argMap,
                                            int runTimePc,
                                            java.lang.String[] resultingSID,
                                            java.lang.String[] createdOBID,
                                            java.util.Vector createdArgIds,
                                            java.util.Vector createdSchemas,
                                            java.util.Vector createdObjects)
                                     throws TemplateExecutionRepositoryException,
                                            AutoRepException,
                                            RepositoryAccessException
Executes a extend_gen_scheme statement. The last created obejct before this method invocation must be a generalisation object.

Parameters:
stmntId - statement's ID
stmntTemplateArgId - template argument sequence ID
transIdToUse - composite transformation's ID to use in the comp_transformation_execution entries
transArgs - current composite transformation's execution argument sequence
argMap - map IDs of template argument sequences to IDs of execution argument sequences
runTimePc - current program counter
resultingSID - one element array storing the resulting schema ID after this statement's execution
createdOBID - one element array storing the created schema object ID after this statement's execution
createdArgIds - Vector storing the IDs of all the created sequences of arguments during a composite transformation execution
createdSchemas - Vector storing the IDs of all the created schemas during the composite transformation execution
createdObjects - Vector storing the IDs of all the created objects during the composite transformation execution
Throws:
AutoRepException
TemplateExecutionRepositoryException
RepositoryAccessException - if the repositories cannot be accessed

executeContractStatement

protected void executeContractStatement(int stmntId,
                                        int stmntTemplateArgId,
                                        int transIdToUse,
                                        java.lang.String[] transArgs,
                                        java.util.HashMap argMap,
                                        int runTimePc,
                                        java.lang.String[] resultingSID,
                                        java.lang.String[] createdOBID,
                                        java.util.Vector createdArgIds,
                                        java.util.Vector createdSchemas,
                                        java.util.Vector createdObjects)
                                 throws TemplateExecutionRepositoryException,
                                        AutoRepException,
                                        RepositoryAccessException
Executes a contract statement.

Parameters:
stmntId - statement's ID
stmntTemplateArgId - template argument sequence ID
transIdToUse - composite transformation's ID to use in the comp_transformation_execution entries
transArgs - current composite transformation's execution argument sequence
argMap - map IDs of template argument sequences to IDs of execution argument sequences
runTimePc - current program counter
resultingSID - one element array storing the resulting schema ID after this statement's execution
createdOBID - one element array storing the created schema object ID after this statement's execution
createdArgIds - Vector storing the IDs of all the created sequences of arguments during a composite transformation execution
createdSchemas - Vector storing the IDs of all the created schemas during the composite transformation execution
createdObjects - Vector storing the IDs of all the created objects during the composite transformation execution
Throws:
AutoRepException
TemplateExecutionRepositoryException
RepositoryAccessException - if the repositories cannot be accessed

createFirstArgument

protected int createFirstArgument(int arg_pos,
                                  java.lang.String value,
                                  java.util.Vector createdArgIds)
                           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
createdArgIds - Vector storing the IDs of all the created sequences of arguments during a composite transformation execution
Returns:
ID of the new sequence of arguments
Throws:
TemplateExecutionRepositoryException - see TemplateExecutionRepository.createFirstArgument(int, String)
RepositoryAccessException - if the repositories cannot be accessed

getValueForTemplateArgument

protected java.lang.String getValueForTemplateArgument(int templateArgIdRef,
                                                       int templateArgPosRef,
                                                       java.lang.String templateValue,
                                                       java.lang.String[] transArgs,
                                                       java.util.HashMap argMap)
                                                throws TemplateExecutionRepositoryException,
                                                       RepositoryAccessException,
                                                       AutoRepException
Returns the value for a template argument. If the argument references another argument then it returns the other argument's value. Note: any referenced argument must be already mapped to an execution argument.

Parameters:
templateArgIdRef - ID of referenced argument sequence
templateArgPosRef - position in the referenced argument sequence
templateValue - value field of the template argument
transArgs - current composite transformation's execution argument sequence
argMap - map IDs of template argument sequences to IDs of execution argument sequences
Returns:
value of template argument
Throws:
AutoRepException - if the argument doesn't reference another argument and the templateValue is null, or if a run-time argument doesn't exist for templateArgIdRef.
TemplateExecutionRepositoryException - see TemplateExecutionRepository.getArgumentsValue(int,int)
RepositoryAccessException - if the repositories cannot be accessed

getValueForTemplateArgumentPointingToArgId

protected java.lang.String getValueForTemplateArgumentPointingToArgId(int templateArgIdRef,
                                                                      int templateArgPosRef,
                                                                      java.lang.String templateValue,
                                                                      java.lang.String[] transArgs,
                                                                      java.util.HashMap argMap,
                                                                      java.util.Vector createdArgIds,
                                                                      boolean nestedPointersToSequences)
                                                               throws TemplateExecutionRepositoryException,
                                                                      RepositoryAccessException,
                                                                      AutoRepException
Returns the value for a template argument that points to another argument in the TTR. If the argument references another argument then it returns the other argument's value. If not, then the value of this argument is a template argument sequence ID, so it clones the sequence into the TER and returns the ID of the execution argument sequence. nestedPoinstersToSequence should be true if the pointed argument sequence has only references to other sequence and false if the pointerd argument sequence only refers to other arguments.

Parameters:
templateArgIdRef - ID of referenced argument sequence
templateArgPosRef - position in the referenced argument sequence
templateValue - value field of the template argument
transArgs - current composite transformation's execution argument sequence
argMap - map IDs of template argument sequences to IDs of execution argument sequences
createdArgIds - Vector storing the IDs of all the created sequences of arguments during a composite transformation execution
Returns:
value of template argument. The value is an execution argument sequence ID.
Throws:
AutoRepException - see getValueForTemplateArgument(int,int, String, String[], HashMap) and handleNonStatementArgument(int,String[], HashMap, Vector, boolean)
TemplateExecutionRepositoryException - see uk.ac.ic.doc.automed.TemplateExecutionRepository#getValueForTemplateArgument(int,int, String, String[], HashMap) and uk.ac.ic.doc.automed.TemplateExecutionRepository#handleNonStatementArgument(int,String[], HashMap, Vector, boolean)
RepositoryAccessException - if the repositories cannot be accessed

handleNonStatementArgument

protected int handleNonStatementArgument(int templateArgId,
                                         java.lang.String[] transArgs,
                                         java.util.HashMap argMap,
                                         java.util.Vector createdArgIds,
                                         boolean pointingToArgumentSequences)
                                  throws AutoRepException,
                                         TemplateExecutionRepositoryException,
                                         RepositoryAccessException
Creates an execution argument sequence according to a template argument sequence. If template argument sequence has only references to other sequences then pointingToArgumentSequences must be true. If the sequence doesn't refer to other sequences then pointingToArgumentSequences must be false.

Parameters:
templateArgId - ID of template argument sequence
transArgs - current composite transformation's execution argument sequence
argMap - map IDs of template argument sequences to IDs of execution argument sequences
createdArgIds - Vector storing the IDs of all the created sequences of arguments during a composite transformation execution
pointingToArgumentSequences - whether this argument sequence points to other sequences or not
Returns:
ID of the new sequence of arguments
Throws:
AutoRepException - if no records for the specified templateArgId exist in TTR, or if there is no mapping for the templateArgId to an argument sequence in the TER. See also getValueForTemplateArgument(int,int, String, String[], HashMap) and uk.ac.ic.doc.automed.reps.CompositeTransformation#getValueForTemplateArgumentPointingToArgId(int,int, String, String[], HashMap, Vector)
TemplateExecutionRepositoryException - see TemplateExecutionRepository.createFirstArgument(int, String), getValueForTemplateArgument(int,int, String, String[], HashMap) and uk.ac.ic.doc.automed.reps.CompositeTransformation#getValueForTemplateArgumentPointingToArgId(int,int, String, String[], HashMap, Vector) and TemplateExecutionRepository.createArgument(int, int, String)
RepositoryAccessException - if the repositories cannot be accessed

removeExecutionTrace

protected void removeExecutionTrace(int transId,
                                    java.util.Vector createdArgIds)
Removes the trace of a composite transformation's executionfrom the TER.

Parameters:
transId - ID of composite transformation executed
createdArgIds - Vector storing the IDs of all the created sequences of arguments during the composite transformation execution

rollbackSTR

protected void rollbackSTR(java.util.Vector createdSchemas,
                           java.util.Vector createdObjects)
Removes the trace of a composite transformation's execution for the STR. If there is a run-time error in the transformation's execution then this method rollbacks the STR in its state before the execution.

Parameters:
createdSchemas - Vector storing the IDs of all the created schemas during the composite transformation execution
createdObjects - Vector storing the IDs of all the created objects during the composite transformation execution

createDefaultSchema

protected int createDefaultSchema(java.util.Vector createdSchemas)
                           throws AutoRepException,
                                  RepositoryAccessException
Creates a new schema and appends it to the STR. The new schema's name is a temporary name created automatically.

Parameters:
createdSchemas - Vector storing the IDs of all the created schemas during the composite transformation execution
Returns:
new schema ID
Throws:
AutoRepException - if the new schema couldn't be created due to error in the STR
RepositoryAccessException - if the repositories cannot be accessed

createSchemaObject

protected int createSchemaObject(int argId,
                                 java.util.Vector createdObjects)
                          throws TemplateExecutionRepositoryException,
                                 RepositoryAccessException,
                                 AutoRepException
Creates a new schema object and appends it to the STR.

Parameters:
argId - execution argument sequence ID pointing to the new object's fields (SID, MIC, CID...)
createdObjects - Vector storing the IDs of all the created objects during the composite transformation execution
Returns:
the ID of the new schema object
Throws:
TemplateExecutionRepositoryException
AutoRepException - if the new schema object couldn't be created due to error in the STR
RepositoryAccessException - if the repositories cannot be accessed

createObjectScheme

protected void createObjectScheme(int objectId,
                                  int argId)
                           throws TemplateExecutionRepositoryException,
                                  RepositoryAccessException,
                                  AutoRepException
Creates the scheme for a schema object and appends it to the STR.

Parameters:
objectId - schema object ID
argId - execution argument sequence ID pointing to the scheme's values
Throws:
AutoRepException - if there are no arguments for argId in the TER, or if the object's scheme couldn't be created due to error in the STR
RepositoryAccessException - if the repositories cannot be accessed
TemplateExecutionRepositoryException

updateObjectScheme

protected void updateObjectScheme(int objectId,
                                  int schemePos,
                                  int value)
                           throws AutoRepException,
                                  RepositoryAccessException
Extends a Generalisation's scheme in the STR.

Parameters:
objectId - ID of the generalisation object
schemePos - position in the the generalisation object's scheme
value - value of object's scheme in the specified position
Throws:
AutoRepException - if the object's scheme couldn't be extended due to error in the STR
RepositoryAccessException - if the repositories cannot be accessed

createPrimitiveTransformation

protected void createPrimitiveTransformation(int argId)
                                      throws RepositoryAccessException,
                                             AutoRepException
Creates a primitive transformation and appends it in the STR.

Parameters:
argId - execution argument sequence ID pointing to the primitive transformation's values (action, fromObj...)
Throws:
AutoRepException - if there are no arguments for argId in the TER, or if the primitive transformation couldn't be created due to error in the STR
RepositoryAccessException - if the repositories cannot be accessed

print

public void print()
           throws TemplateTransformationRepositoryException,
                  TemplateTransformationSyntaxRepositoryException,
                  AutoRepException,
                  RepositoryAccessException
TemplateTransformationRepositoryException
TemplateTransformationSyntaxRepositoryException
AutoRepException
RepositoryAccessException