uk.ac.ic.doc.automed
Class SchemaModelingRepository

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

public class SchemaModelingRepository
extends java.lang.Object


Constructor Summary
SchemaModelingRepository()
           
 
Method Summary
static void createConstructModeling(int cid, int pc, java.lang.String method)
          Adds a new method invocation to a construct's modeling program
static int createMethod(java.lang.String name, java.lang.String cl)
          Adds a new method to the SMR.
static void createMethodArgument(int meth_id, int pos, java.lang.String type)
          Adds a new argument to the method's arguments.
static java.lang.String getClassName(int meth_id)
          Returns the class name of the method specified by meth_id
static java.lang.String[] getClassNameList()
          Returns the class names of all the methods found in the SMR
static java.lang.String getConstructModelingProgramMethod(int cid, int pc)
          Returns the method that is going to be invoked at the specified pc of a construct's modeling program.
static java.lang.String[] getConstructModelingProgramMethodList(int cid)
          Returns a list of method invocations of a particular construct's modeling program, ie the methods that are going to be invoked at each program counter.
static int[] getConstructModelingProgramPcList(int cid)
          Returns a list of program counters of a particular construct's modeling program.
static java.lang.String getDataSourceName()
          Returns the name of the repository in the local database.
static int[] getMethodArgumentsPosList(int meth_id)
          Returns a particular methods's list of argument positions.
static java.lang.String getMethodArgumentsType(int meth_id, int pos)
          Returns a particular method's argument type.
static java.lang.String[] getMethodArgumentsTypeList(int meth_id)
          Returns a particular methods's list of argument types.
static int getMethodByName(java.lang.String name, java.lang.String cl)
          Returns the ID (meth_id) of the method specified by name and class, or -1 if a method with the specified name doesn't exist in the specified class.
static java.lang.String getMethodName(int meth_id)
          Returns the name of the method specified by meth_id
static int[] getMethodsMethIdList()
          Returns the IDs of all the methods found in the SMR
static java.lang.String[] getMethodsNameList()
          Returns the names of all the methods found in the SMR
static java.lang.String getSMR_DataSourceName()
          Deprecated, use getDataSourceName instead
static boolean isValidMethId(int meth_id)
          This method determines if a method with the specified meth_id exists in the SMR.
static void main(java.lang.String[] args)
           
static void removeConstructModelingProgram(int cid)
          Removes a particular construct's modeling program
static void removeConstructModelingProgram(int cid, int pc)
          Removes a particular program counter of a constrcut's modeling program
static void removeMethod(int meth_id)
          Removes the method from the SMR methods table.
static void removeMethodArgument(int meth_id)
          Removes all arguments of a particular method
static void removeMethodArgument(int meth_id, int pos)
          Removes a particular position of a methods's arguments
static void setClassName(int meth_id, java.lang.String name)
          Sets the class name of the method specified by meth_id
static void setConstructModelingProgramMethod(int cid, int pc, java.lang.String method)
          Sets the method in a specific program counter in the specified construct's modeling program
static void setDataSourceName(java.lang.String str)
          Sets the name of the repository in the local database.
static void setMethodArgumentsType(int meth_id, int pos, java.lang.String type)
          Sets a particular method's argument type.
static void setMethodName(int meth_id, java.lang.String name)
          Sets the name of the method specified by meth_id
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaModelingRepository

public SchemaModelingRepository()
Method Detail

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.

getSMR_DataSourceName

public static java.lang.String getSMR_DataSourceName()
Deprecated, use getDataSourceName instead


setDataSourceName

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

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

createMethod

public static int createMethod(java.lang.String name,
                               java.lang.String cl)
                        throws SchemaModelingRepositoryException,
                               RepositoryAccessException
Adds a new method to the SMR. Methods that belong to the same class are assumed to have unique names. Returns an integer that specifies the ID assigned to the new method.

Parameters:
name - name of method
cl - name of the class this method belongs
Returns:
the method ID of the added method
Throws:
SchemaModelingRepositoryException - if the arguments are null, or if a method with the same name in the specified class already exists
RepositoryAccessException - if the repository cannot be accessed

getMethodByName

public static int getMethodByName(java.lang.String name,
                                  java.lang.String cl)
                           throws SchemaModelingRepositoryException,
                                  RepositoryAccessException
Returns the ID (meth_id) of the method specified by name and class, or -1 if a method with the specified name doesn't exist in the specified class.

Parameters:
name - name of method
cl - name of the class the method belongs
Returns:
the ID of the method
Throws:
SchemaModelingRepositoryException - if the arguments are null
RepositoryAccessException - if the repository cannot be accessed

getMethodName

public static java.lang.String getMethodName(int meth_id)
                                      throws SchemaModelingRepositoryException,
                                             RepositoryAccessException
Returns the name of the method specified by meth_id

Parameters:
meth_id - ID of the method
Returns:
the name of the method specified by meth_id
Throws:
SchemaModelingRepositoryException - if no record for the specified meth_id is found in the SMR
RepositoryAccessException - if the repository cannot be accessed

getClassName

public static java.lang.String getClassName(int meth_id)
                                     throws SchemaModelingRepositoryException,
                                            RepositoryAccessException
Returns the class name of the method specified by meth_id

Parameters:
meth_id - ID of the method
Returns:
the class name of the method specified by meth_id
Throws:
SchemaModelingRepositoryException - if no record for the specified meth_id is found in the SMR
RepositoryAccessException - if the repository cannot be accessed

getMethodsMethIdList

public static int[] getMethodsMethIdList()
                                  throws RepositoryAccessException
Returns the IDs of all the methods found in the SMR

Returns:
a list of all method identifiers found in the SMR. Returns null if no records of methods is found in the SMR.
Throws:
RepositoryAccessException - if the repository cannot be accessed

getMethodsNameList

public static java.lang.String[] getMethodsNameList()
                                             throws RepositoryAccessException
Returns the names of all the methods found in the SMR

Returns:
a list of all method names found in the SMR. Returns null if no records of methods is found in the SMR.
Throws:
RepositoryAccessException - if the repository cannot be accessed

getClassNameList

public static java.lang.String[] getClassNameList()
                                           throws RepositoryAccessException
Returns the class names of all the methods found in the SMR

Returns:
a list of class names of all the methods found in the SMR. Returns null if no records of methods is found in the SMR.
Throws:
RepositoryAccessException - if the repository cannot be accessed

setMethodName

public static void setMethodName(int meth_id,
                                 java.lang.String name)
                          throws SchemaModelingRepositoryException,
                                 RepositoryAccessException
Sets the name of the method specified by meth_id

Parameters:
meth_id - ID of the method
name - new name of the method
Throws:
SchemaModelingRepositoryException - if no record for the specified meth_id is found in the SMR, or if there is already a method with the specified name in its class, or if the specified name is null.
RepositoryAccessException - if the repository cannot be accessed

setClassName

public static void setClassName(int meth_id,
                                java.lang.String name)
                         throws SchemaModelingRepositoryException,
                                RepositoryAccessException
Sets the class name of the method specified by meth_id

Parameters:
meth_id - ID of the method
name - new class name of the method
Throws:
SchemaModelingRepositoryException - if no record for the specified meth_id is found in the SMR, or if there is already a method with the existing name in this class, or if the specified class name is null.
RepositoryAccessException - if the repository cannot be accessed

removeMethod

public static void removeMethod(int meth_id)
                         throws SchemaModelingRepositoryException,
                                RepositoryAccessException
Removes the method from the SMR methods table.

Parameters:
meth_id - ID of the statement
Throws:
SchemaModelingRepositoryException - if no record for the specified meth_id is found in the SMR, or if there is a definition for this method in the method_arguments table (dependency conflict)
RepositoryAccessException - if the repository cannot be accessed

isValidMethId

public static boolean isValidMethId(int meth_id)
                             throws RepositoryAccessException
This method determines if a method with the specified meth_id exists in the SMR.

Returns:
true if a record of a method with the specified meth_id exists in the methods table, or false otherwise.
Throws:
RepositoryAccessException - if the repository cannot be accessed

createMethodArgument

public static void createMethodArgument(int meth_id,
                                        int pos,
                                        java.lang.String type)
                                 throws SchemaModelingRepositoryException,
                                        RepositoryAccessException
Adds a new argument to the method's arguments.

Parameters:
meth_id - ID of method
pos - position of argument in the methods's arguments
type - class type of this argument
Throws:
SchemaModelingRepositoryException - if the arguments are invalid ( meth_id or arg_pos is less/equal to zero, or if type is null), or if no record for the specified meth_id is found in the SMR, or if a record already exists with the specified meth_id and pos.
RepositoryAccessException - if the repository cannot be accessed

getMethodArgumentsPosList

public static int[] getMethodArgumentsPosList(int meth_id)
                                       throws SchemaModelingRepositoryException,
                                              RepositoryAccessException
Returns a particular methods's list of argument positions. Returns null if no arguments exists for the specific method.

Parameters:
meth_id - ID of statement
Returns:
a list of a method's argument positions
Throws:
SchemaModelingRepositoryException - if no record for the specified meth_id is found in the SMR
RepositoryAccessException - if the repository cannot be accessed

getMethodArgumentsTypeList

public static java.lang.String[] getMethodArgumentsTypeList(int meth_id)
                                                     throws SchemaModelingRepositoryException,
                                                            RepositoryAccessException
Returns a particular methods's list of argument types. Returns null if no arguments exists for the specific method.

Parameters:
meth_id - ID of statement
Returns:
a list of argument types
Throws:
SchemaModelingRepositoryException - if no record for the specified meth_id is found in the SMR
RepositoryAccessException - if the repository cannot be accessed

getMethodArgumentsType

public static java.lang.String getMethodArgumentsType(int meth_id,
                                                      int pos)
                                               throws SchemaModelingRepositoryException,
                                                      RepositoryAccessException
Returns a particular method's argument type.

Parameters:
meth_id - ID of statement
pos - position in the method's arguments
Returns:
methods's argument type
Throws:
SchemaModelingRepositoryException - if no record for the specified meth_id and posis found in the SMR
RepositoryAccessException - if the repository cannot be accessed

setMethodArgumentsType

public static void setMethodArgumentsType(int meth_id,
                                          int pos,
                                          java.lang.String type)
                                   throws SchemaModelingRepositoryException,
                                          RepositoryAccessException
Sets a particular method's argument type.

Parameters:
meth_id - ID of statement
pos - position in the method's arguments
type - type to be put in the specified position
Throws:
SchemaModelingRepositoryException - if type is null, or if no record for the specified meth_id is found in the SMR's methods table, or if no record for the specified meth_id and posis found in the SMR's method_arguments table.
RepositoryAccessException - if the repository cannot be accessed

removeMethodArgument

public static void removeMethodArgument(int meth_id,
                                        int pos)
                                 throws SchemaModelingRepositoryException,
                                        RepositoryAccessException
Removes a particular position of a methods's arguments

Parameters:
meth_id - ID of method
pos - position in the method's arguments to be removed
Throws:
SchemaModelingRepositoryException - if no record for the specified meth_id and pos is found in the SMR
RepositoryAccessException - if the repository cannot be accessed

removeMethodArgument

public static void removeMethodArgument(int meth_id)
                                 throws RepositoryAccessException
Removes all arguments of a particular method

Parameters:
meth_id - ID of statement
Throws:
RepositoryAccessException - if the repository cannot be accessed

createConstructModeling

public static void createConstructModeling(int cid,
                                           int pc,
                                           java.lang.String method)
                                    throws SchemaModelingRepositoryException,
                                           RepositoryAccessException
Adds a new method invocation to a construct's modeling program

Parameters:
cid - ID of construct
pc - program counter of method invocation to be added
method - method invocation to be added
Throws:
SchemaModelingRepositoryException - if the arguments are invalid ( pc less/equal to zero, method is null), or if the cid isn't valid, or if a record already exists for the specified cid and pc
RepositoryAccessException - if the repository cannot be accessed

getConstructModelingProgramPcList

public static int[] getConstructModelingProgramPcList(int cid)
                                               throws SchemaModelingRepositoryException,
                                                      RepositoryAccessException
Returns a list of program counters of a particular construct's modeling program. Returns null if there isn't a program for the specific construct.

Parameters:
cid - ID of construct
Returns:
a list of program counters of the construct's modeling program
Throws:
SchemaModelingRepositoryException - if the specified cid isn''t valid.
RepositoryAccessException - if the repository cannot be accessed

getConstructModelingProgramMethodList

public static java.lang.String[] getConstructModelingProgramMethodList(int cid)
                                                                throws SchemaModelingRepositoryException,
                                                                       RepositoryAccessException
Returns a list of method invocations of a particular construct's modeling program, ie the methods that are going to be invoked at each program counter. Returns null if there isn't a modeling program for the specific construct.

Parameters:
cid - ID of construct
Returns:
a list of method invocations of the construct's modeling program
Throws:
SchemaModelingRepositoryException - if the specified cid isn''t valid.
RepositoryAccessException - if the repository cannot be accessed

getConstructModelingProgramMethod

public static java.lang.String getConstructModelingProgramMethod(int cid,
                                                                 int pc)
                                                          throws SchemaModelingRepositoryException,
                                                                 RepositoryAccessException
Returns the method that is going to be invoked at the specified pc of a construct's modeling program.

Parameters:
cid - ID of construct
pc - program counter
Returns:
the statement identifier of the statement that is going to be executed at the specified program counter of the specified template program
Throws:
SchemaModelingRepositoryException - if no record for the specified cid and pc is found in the SMR's construct_modeling table.
RepositoryAccessException - if the repository cannot be accessed

setConstructModelingProgramMethod

public static void setConstructModelingProgramMethod(int cid,
                                                     int pc,
                                                     java.lang.String method)
                                              throws SchemaModelingRepositoryException,
                                                     RepositoryAccessException
Sets the method in a specific program counter in the specified construct's modeling program

Parameters:
cid - ID of construct
pc - program counter in the construct's modeling program
method - method to be invoked at the specified pc
Throws:
SchemaModelingRepositoryException - if the specified cid is not valid, or if no record for the specified cid and pc is found in the SMR
RepositoryAccessException - if the repository cannot be accessed

removeConstructModelingProgram

public static void removeConstructModelingProgram(int cid,
                                                  int pc)
                                           throws SchemaModelingRepositoryException,
                                                  RepositoryAccessException
Removes a particular program counter of a constrcut's modeling program

Parameters:
cid - ID of construct
pc - program counter
Throws:
SchemaModelingRepositoryException - if no record for the specified cid and pc is found in the SMR
RepositoryAccessException - if the repository cannot be accessed

removeConstructModelingProgram

public static void removeConstructModelingProgram(int cid)
                                           throws RepositoryAccessException
Removes a particular construct's modeling program

Parameters:
cid - ID of construct
Throws:
RepositoryAccessException - if the repository cannot be accessed

main

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