uk.ac.ic.doc.automed
Class STR

java.lang.Object
  |
  +--uk.ac.ic.doc.automed.STR
Direct Known Subclasses:
SchemaTransformationRepository

public class STR
extends java.lang.Object

The STR library<<

Author:
Michael Boyd (mboyd@doc.ic.ac.uk), Nerissa Tong (nnyt98@doc.ic.ac.uk)

Field Summary
static java.lang.String STR_DataSourceName
           
 
Constructor Summary
STR()
           
 
Method Summary
static boolean atDebugLevel(int level)
          Return true if the debug level set by setDebugLevel(int) is at least at a certain level.
static void copySchemaObject(int obidToCopy, int sid)
          Deprecated. contents of intentional schemas will no longer be stored in the STR. The materialization code does not use this method. This method is called when the contents of an intentional schema are being materialized. The temporary copy of the object has the same OBID as the original, it just exists in the new SID as well as the original (via the objectSchema table).
static int createAccessMethod(int sid, java.lang.String url, int pid, java.lang.String dbDriver, java.lang.String username)
          Add the access methods of a schema to the STR.
Precondition: The schema whose access methods are being added must already exist in the schemas table.
static int createIntSchema(java.lang.String name)
          Adds an intentional schema to the STR.
Returns an integer that specifies the schema identifier (SID) assigned to the new schema.
static int createProtocol(java.lang.String name)
          Add the given protocol to the STR.
static int createSchema(java.lang.String name, boolean isES, boolean isEDB, boolean isDataSrc)
          Adds a new schema to the STR.
static int createSchemaObject(int sid, int cid, java.lang.String value)
          Adds a new schema object to the STR.
static void createScheme(int obid, int pos, int sobid)
          Adds a scheme to the STR.
static void createTransformation(java.lang.String action, int fromObj, int toObj, int fromSchema, int toSchema, java.lang.String function, java.lang.String constraint)
          Adds a transformation to the STR.
static void debugPrintStackTrace(java.lang.Throwable throwable, int level)
          Print an throwable's stack trace, but only at a certain debug level
static java.lang.String flattenSchemes(java.lang.Object[] schemes)
          Converts an Object array representation of a schema object's scheme into a String representation.
static int[] getAccessMethodBySID(int sid)
          Returns all the access method identifiers (AMID) that point to the access methods for the specified schema.
static java.lang.String getAccessMethodDBDriver(int amid)
          Returns the database driver of the specified access method.
static int getAccessMethodPID(int amid)
          Returns the protocol identifier (PID) of the specified access method.
static int getAccessMethodSID(int amid)
          Returns the schema identifier (SID) to which the specified access method connects.
static java.lang.String getAccessMethodURL(int amid)
          Returns the URL of the specified access method.
static java.lang.String getAccessMethodUsername(int amid)
          Returns the username of the specified access method.
static java.lang.String[] getAllProtocols()
          Returns the name of all the protocols found in the STR.
static java.lang.String[] getAllSchemaNames()
          Returns the name of all the schemas found in the STR.
static java.lang.Object[][] getAllSchemeNames(int sid)
          Returns an Object array of all objects' schemes of a schema.
static java.lang.String getAllSchemeNamesString(int sid)
          Returns the scheme representation (of type String) of all objects' schemes of a schema.
static java.lang.String getCloseSchemeBracket()
          Return String used to close schemes
static java.lang.String getDataSourceName()
          Returns the name of the repository in the local database.
static int getDebugLevel()
          Return the value of the debug level at set by setDebugLevel(int)
static java.lang.Object[] getObjectSchemeNames(int obid)
          Returns an Object array of an object's scheme.
static java.lang.String getObjectSchemeNamesString(int obid)
          Returns the scheme representation (of type String}) of an object's scheme.
static java.lang.String getOpenSchemeBracket()
          Return String used to open schemes
static int getProtocolByName(java.lang.String name)
          Returns the protocol identifier (PID) of the specified protocol name.
static java.lang.String getProtocolName(int pid)
          Returns the name of the given protocol identifier (PID).
static int getSchemaByName(java.lang.String name)
          Returns the schema identifier (SID) of the schema specified by name.
Assumption:schema names are unique.
static int[] getSchemaIDs()
          Returns the IDs of all the schemas found in the STR.
static java.lang.String getSchemaName(int sid)
          Returns the name of the schema with the given schema identifier.
static java.lang.String[] getSchemaNames()
          Returns the name of all the schemas found in the STR.
static int getSchemaObjectCID(int obid)
          Returns the construct identifier (CID) of the schema object.
static int[] getSchemaObjects(int sid)
          Returns the object identifiers (OBID) in ascending order of all the schema objects that belong to a particular schema.
static int[] getSchemaObjectsByCID(int cid)
          Returns the object identifiers (OBID) in ascending order of all the schema objects that are instances of a certain construct type, in order of the OBID to which they belong
static int getSchemaObjectSID(int obid)
          Returns the schema identifier (SID) that a schema object belongs to.
static java.lang.String getSchemaObjectValue(int obid)
          Returns the name (value) of the schema object.
static int[] getSchemaSIDs()
          Returns the schema identifier (SID) of all the schemas found in the STR.
static int[] getSchemeOBIDList(int sobid)
          Returns a list of all schema object identifiers (OBID) by which a particular schema object is referenced.
static int getSchemePos(int obid, int sobid)
          Returns the position of a referenced schema object in the scheme of a particular schema object.
static int[] getSchemePosList(int obid)
          Returns a list of positions in the scheme of a particular schema object.
static int getSchemeSOBID(int obid, int pos)
          Returns the object identifier (SOBID) of the referenced schema object in the specified schema object's scheme at the given position.
static int[] getSchemeSOBIDList(int obid)
          Returns a list of all schema object identifiers (SOBID) referenced by a particular schema object.
static java.lang.String getSTR_DataSourceName()
          Deprecated. use getDataSourceName()
static java.lang.String getTranAction(int fromSchema, int toSchema)
          Returns the action of transformation between two schemas.
static java.lang.String getTranConstraint(int fromSchema, int toSchema)
          Returns the constraint of a transformation between two schemas.
static int getTranFromObject(int fromSchema, int toSchema)
          Returns the schema object to be transformed in a transformation.
static int[] getTranFromSchema(int toSchema)
          Returns a list of schema identifiers (SID) from which a particular schema can be derived.
static java.lang.String getTranFunction(int fromSchema, int toSchema)
          Returns the function of a transformation between two schemas.
static java.util.Vector getTransformations()
          Returns a vector representing all transformations in the repository
static int[][] getTransformationsByOBID(int obid)
          Returns the pairs of schema identifiers (SID) of all the schema transformations that involve the supplied OBID
static int getTranToObject(int fromSchema, int toSchema)
          Returns the schema object as a result of a transformation.
static int[] getTranToSchema(int fromSchema)
          Returns a list of schema identifiers (SID) which are derived from a particular schema.
static boolean isSchemaCached(int sid)
          Deprecated. the isCached field in the schema table is no longer in use. Determines whether or not the objects of the specified schema are cached.
static boolean isSchemaDataSource(int sid)
          Determines whether or not the specified schema represents a data source.
static boolean isSchemaExtDB(int sid)
          Determines whether or not the specified schema represents an extensional database.
static boolean isSchemaExtSchema(int sid)
          Determines whether or not the specified schema is an extensional schema.
static boolean isSchemaObjectTemp(int obid, int sid)
          Deprecated. the isTemp field in the object table is no longer in use. Determines whether or not the schema object is temporary.
static void main(java.lang.String[] args)
           
static void removeAccessMethod(int amid)
          Removes an access method from the STR.
static void removeAccessMethodBySID(int sid)
          Removes all access methods for the given schema identifier (SID).
static void removeAllSchemes(int obid)
          Removes all the schemes associated with the given schema object.
static void removeProtocol(int pid)
          Removes the name of a protocol from the STR.
static void removeSchema(int sid)
          Removes a schema from the STR.
static void removeSchemaObject(int obid)
          Removes a schema object from the STR.
static void removeScheme(int obid, int pos)
          Removes a particular position of an object's scheme from the STR.
static void removeTransformation(int fromSchema, int toSchema)
          Removes a transformation from the STR.
static void setAccessMethodDBDriver(int amid, java.lang.String dbDriver)
          Sets the database driver of a particular access method.
static void setAccessMethodPID(int amid, int pid)
          Sets the protocol identifier (PID) of a particular access method.
static void setAccessMethodSID(int amid, int sid)
          Sets the schema identifier (SID) of a particular access method.
static void setAccessMethodURL(int amid, java.lang.String url)
          Sets the URL of a particular access method.
static void setAccessMethodUsername(int amid, java.lang.String username)
          Sets the username of a particular access method.
static void setCloseSchemeBracket(java.lang.String cs)
          Set the String that is used to close a scheme name, such as "<<person>>" or "<<person,name>>" By default it is set to ">>".
static void setDataSourceName(java.lang.String str)
          Sets the name of the Schema Transformation Repository in the local database.
static void setDebugLevel(int level)
          Control the printing of debug information printed on the command line
static void setOpenSchemeBracket(java.lang.String os)
          Set the String that is used to open a scheme name, such as "<<person>>" or "<<person,name>>".
static void setProtocolName(int pid, java.lang.String name)
          Sets the name of the protocol specified by the given protocol identifier (PID).
static void setSchemaCached(int sid, boolean value)
          Deprecated. the isCached field in the schema table is no longer in use.
static void setSchemaDataSource(int sid, boolean value)
          Sets whether or not a schema is a data source.
static void setSchemaExtDB(int sid, boolean value)
          Sets whether or not a schema is an extentional database.
static void setSchemaExtSchema(int sid, boolean value)
          Sets whether or not a schema is an extentional schema.
static void setSchemaName(int sid, java.lang.String name)
          Sets the name of schema.
static void setSchemaObjectCID(int obid, int cid)
          Sets the construct identifier (CID) of the schema object.
static void setSchemaObjectSID(int obid, int sid)
          Sets the schema identifier (SID) to which a particular schema object belongs.
static void setSchemaObjectValue(int obid, java.lang.String value)
          Sets the name/value of the schema object.
static void setSchemeSOBID(int obid, int pos, int sobid)
          Sets the referenced schema object in a specific position of the scheme of a schema object.
static void setSTR_DataSourceName(java.lang.String str)
          Deprecated. use setDataSourceName()
static void setTranAction(int fromSchema, int toSchema, java.lang.String action)
          Sets the action of a transformation between two schemas.
static void setTranConstraint(int fromSchema, int toSchema, java.lang.String constraint)
          Sets the constraint of a transformation between two schemas.
static void setTranFromObject(int fromSchema, int toSchema, int fromObj)
          Sets the object identifier (OBID) of the schema object to be transformed in a transformation
static void setTranFunction(int fromSchema, int toSchema, java.lang.String function)
          Sets the function of a transformation between two schemas.
static void setTranToObject(int fromSchema, int toSchema, int toObj)
          Sets the object identifier (OBID) of the schema object as a result of a transformation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STR_DataSourceName

public static java.lang.String STR_DataSourceName
Constructor Detail

STR

public STR()
Method Detail

setDebugLevel

public static void setDebugLevel(int level)
Control the printing of debug information printed on the command line

Parameters:
level - value to set the debug level at, according to the following scale: -1: no debug information, and no reporting of errors the system finds in its execution if the system can ignore them 0: no debug information (default), but report on errors that the system has ignored during its execution 1: only debug information that is to explain to users what is going on 5: standard information for software development work on repository 8: detailed information for software development work on repository 10: all debug information

getDebugLevel

public static int getDebugLevel()
Return the value of the debug level at set by setDebugLevel(int)


atDebugLevel

public static boolean atDebugLevel(int level)
Return true if the debug level set by setDebugLevel(int) is at least at a certain level. For example, this is used in code of the form if (atDebugLevel(5)) ... to ensure that something is only executed when the system has been set at debug level 5 or more

Parameters:
level - threshold value of debug level for which being "at a debug level" is true

debugPrintStackTrace

public static final void debugPrintStackTrace(java.lang.Throwable throwable,
                                              int level)
Print an throwable's stack trace, but only at a certain debug level

Parameters:
throwable - that is to be reported on

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.

getSTR_DataSourceName

public static java.lang.String getSTR_DataSourceName()
Deprecated. use getDataSourceName()


setDataSourceName

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

Parameters:
str - the name of the Schema Transformation Repository in the local database.

setSTR_DataSourceName

public static void setSTR_DataSourceName(java.lang.String str)
Deprecated. use setDataSourceName()


createSchema

public static int createSchema(java.lang.String name,
                               boolean isES,
                               boolean isEDB,
                               boolean isDataSrc)
                        throws STRException,
                               java.sql.SQLException,
                               DataSourceRepositoryException,
                               java.io.IOException
Adds a new schema to the STR. Schema names must be unique. The creation of a schema whose name already exists in the STR is rejected.
Returns an integer that specifies the schema identifier (SID) assigned to the new schema.

Parameters:
name - name of the new schema.
isES - set to true if the new schema is an extentional schema; false otherwise.
Returns:
the schema identifier (SID) of the new schema.
Throws:
STRException
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

createIntSchema

public static int createIntSchema(java.lang.String name)
                           throws STRException,
                                  java.sql.SQLException,
                                  DataSourceRepositoryException,
                                  java.io.IOException
Adds an intentional schema to the STR.
Returns an integer that specifies the schema identifier (SID) assigned to the new schema.

Parameters:
name - name of the intentional schema.
Returns:
the schema identifier (SID) of the new schema.
Throws:
STRException
java.sql.SQLException - if the name of the new schema is already in use.
DataSourceRepositoryException
java.io.IOException

getAllSchemaNames

public static java.lang.String[] getAllSchemaNames()
                                            throws STRException,
                                                   java.sql.SQLException,
                                                   DataSourceRepositoryException,
                                                   java.io.IOException
Returns the name of all the schemas found in the STR.

Returns:
the name of all the schemas found in the STR.
Throws:
STRException
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getSchemaByName

public static int getSchemaByName(java.lang.String name)
                           throws STRException,
                                  java.sql.SQLException,
                                  DataSourceRepositoryException,
                                  java.io.IOException
Returns the schema identifier (SID) of the schema specified by name.
Assumption:schema names are unique.

Parameters:
name - name of schema.
Returns:
the schema identifier (SID) of the schema.
Throws:
STRException - if no record for the specified name is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getSchemaName

public static java.lang.String getSchemaName(int sid)
                                      throws STRException,
                                             java.sql.SQLException,
                                             DataSourceRepositoryException,
                                             java.io.IOException
Returns the name of the schema with the given schema identifier.

Parameters:
sid - schema identifier (SID) of the schema.
Returns:
the name of the schema if the SID specified can be found in the schemas table.
Throws:
STRException - if no record for the specified SID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

isSchemaExtSchema

public static boolean isSchemaExtSchema(int sid)
                                 throws STRException,
                                        java.sql.SQLException,
                                        DataSourceRepositoryException,
                                        java.io.IOException
Determines whether or not the specified schema is an extensional schema.

Parameters:
sid - schema identifier (SID) of the schema.
Returns:
true if the schema is an extensional schema; false otherwise.
Throws:
STRException - if no record for the specified SID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

isSchemaExtDB

public static boolean isSchemaExtDB(int sid)
                             throws STRException,
                                    java.sql.SQLException,
                                    DataSourceRepositoryException,
                                    java.io.IOException
Determines whether or not the specified schema represents an extensional database.

Parameters:
sid - schema identifier (SID) of the schema.
Returns:
true if the schema represents an extensional database; false otherwise.
Throws:
STRException - if no record for the specified SID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

isSchemaDataSource

public static boolean isSchemaDataSource(int sid)
                                  throws STRException,
                                         java.sql.SQLException,
                                         DataSourceRepositoryException,
                                         java.io.IOException
Determines whether or not the specified schema represents a data source.

Parameters:
sid - schema identifier (SID) of the schema.
Returns:
true if the schema represents a data source; false otherwise.
Throws:
STRException - if no record for the specified SID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

isSchemaCached

public static boolean isSchemaCached(int sid)
                              throws STRException,
                                     java.sql.SQLException,
                                     DataSourceRepositoryException,
                                     java.io.IOException
Deprecated. the isCached field in the schema table is no longer in use. Determines whether or not the objects of the specified schema are cached.

Parameters:
sid - schema identifier (SID) of the schema.
Returns:
true if the objects of the specified schema are cached; false otherwise.
Throws:
STRException - if no record for the specified SID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

setSchemaName

public static void setSchemaName(int sid,
                                 java.lang.String name)
                          throws STRException,
                                 java.sql.SQLException,
                                 DataSourceRepositoryException,
                                 java.io.IOException
Sets the name of schema.

Parameters:
sid - schema identifier (SID) of the schema.
name - new name of the schema.
Throws:
STRException - if no record for the specified SID is found in the STR.
java.sql.SQLException - if the specified name is already in use.
DataSourceRepositoryException
java.io.IOException

setSchemaExtSchema

public static void setSchemaExtSchema(int sid,
                                      boolean value)
                               throws STRException,
                                      java.sql.SQLException,
                                      DataSourceRepositoryException,
                                      java.io.IOException
Sets whether or not a schema is an extentional schema.

Parameters:
sid - schema identifier (SID) of the schema.
value - set to true if the schema is an extentional schema; false otherwise.
Throws:
STRException - if no record for the specified SID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

setSchemaExtDB

public static void setSchemaExtDB(int sid,
                                  boolean value)
                           throws STRException,
                                  java.sql.SQLException,
                                  DataSourceRepositoryException,
                                  java.io.IOException
Sets whether or not a schema is an extentional database.

Parameters:
sid - schema identifier (SID) of the schema.
value - set to true if the schema is an extentional database; false otherwise.
Throws:
STRException - if no record for the specified SID is found in the STR; or if the specified schema is not already an extentional schema with value set to true.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

setSchemaDataSource

public static void setSchemaDataSource(int sid,
                                       boolean value)
                                throws STRException,
                                       java.sql.SQLException,
                                       DataSourceRepositoryException,
                                       java.io.IOException
Sets whether or not a schema is a data source.

Parameters:
sid - schema identifier (SID) of the schema.
value - set to true if the schema is a data source; false otherwise.
Throws:
STRException - if no record for the specified SID is found in the STR; or if the specified schema is not already an extentional database with value set to true.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

setSchemaCached

public static void setSchemaCached(int sid,
                                   boolean value)
                            throws STRException,
                                   java.sql.SQLException,
                                   DataSourceRepositoryException,
                                   java.io.IOException
Deprecated. the isCached field in the schema table is no longer in use.

Sets whether or not the objects of a schema are cached.

Parameters:
sid - schema identifier (SID) of the schema.
value - set to true if the schema objects are cached; false otherwise.
Throws:
STRException - if no record for the specified SID is found in the STR; or if the specified schema is not an intentional schema with value set to true.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getSchemaNames

public static java.lang.String[] getSchemaNames()
                                         throws STRException,
                                                java.sql.SQLException,
                                                DataSourceRepositoryException,
                                                java.io.IOException
Returns the name of all the schemas found in the STR.

Returns:
a list of all schema names found in the STR. Returns null if no record of schemas found in the STR.
Throws:
STRException
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getSchemaIDs

public static int[] getSchemaIDs()
                          throws STRException,
                                 java.sql.SQLException,
                                 DataSourceRepositoryException,
                                 java.io.IOException
Returns the IDs of all the schemas found in the STR.

Returns:
a list of all schema IDs found in the STR. Returns an empty array if no schemas are found in the STR.
Throws:
STRException
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getSchemaSIDs

public static int[] getSchemaSIDs()
                           throws STRException,
                                  java.sql.SQLException,
                                  DataSourceRepositoryException,
                                  java.io.IOException
Returns the schema identifier (SID) of all the schemas found in the STR.

Returns:
a list of all schema identifiers (SID) found in the STR. Returns null if no record of schemas found in the STR.
Throws:
STRException
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

removeSchema

public static void removeSchema(int sid)
                         throws STRException,
                                java.sql.SQLException,
                                DataSourceRepositoryException,
                                java.io.IOException
Removes a schema from the STR.

Parameters:
sid - schema identifier (SID) of the schema to be removed.
Throws:
STRException - if no record for the specified SID is found in the STR; or if data dependency of the specified schema with other data in the STR exists.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

createSchemaObject

public static int createSchemaObject(int sid,
                                     int cid,
                                     java.lang.String value)
                              throws STRException,
                                     java.sql.SQLException,
                                     DataSourceRepositoryException,
                                     java.io.IOException
Adds a new schema object to the STR.

Parameters:
sid - schema identifier (SID) of the schema to which the schema object belongs.
cid - the construct identifier (CID) of the schema object. (See ModelDefinitionsRepository.createConstruct(int mid, String name, int constructClass, boolean isRoot))
value - the name of (value given to) the schema object.
Returns:
the object identifier (OBID) of the new schema object.
Throws:
STRException - if the specified SID does not exist in the schema table in the STR; or if an invalid CID is given for the schema object.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

copySchemaObject

public static void copySchemaObject(int obidToCopy,
                                    int sid)
                             throws STRException,
                                    java.sql.SQLException,
                                    DataSourceRepositoryException,
                                    java.io.IOException
Deprecated. contents of intentional schemas will no longer be stored in the STR. The materialization code does not use this method. This method is called when the contents of an intentional schema are being materialized. The temporary copy of the object has the same OBID as the original, it just exists in the new SID as well as the original (via the objectSchema table).

Parameters:
obidToCopy - object identifier (OBID) of the schema object to copy.
sid - schema identifier (SID) of the schema to which the new object belongs.
Throws:
STRException - if the specified obidToCopy (OBID) does not exist in the object table in the STR; or if the specified SID does not exist in the schema table in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getObjectSchemeNames

public static java.lang.Object[] getObjectSchemeNames(int obid)
                                               throws STRException,
                                                      java.sql.SQLException,
                                                      DataSourceRepositoryException,
                                                      java.io.IOException
Returns an Object array of an object's scheme.

Parameters:
obid - object identifier (OBID) of the schema object.
Throws:
STRException - if the specified obidToCopy (OBID) does not exist in the object table in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getObjectSchemeNamesString

public static java.lang.String getObjectSchemeNamesString(int obid)
                                                   throws STRException,
                                                          java.sql.SQLException,
                                                          DataSourceRepositoryException,
                                                          java.io.IOException
Returns the scheme representation (of type String}) of an object's scheme.

Parameters:
obid - object identifier (OBID) of the schema object.
Throws:
STRException - if the specified obidToCopy (OBID) does not exist in the object table in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getAllSchemeNames

public static java.lang.Object[][] getAllSchemeNames(int sid)
                                              throws STRException,
                                                     java.sql.SQLException,
                                                     DataSourceRepositoryException,
                                                     java.io.IOException
Returns an Object array of all objects' schemes of a schema.

Parameters:
sid - schema identifier (SID) of the schema.
Throws:
STRException - if the specified SID does not exist in the schema table in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getAllSchemeNamesString

public static java.lang.String getAllSchemeNamesString(int sid)
                                                throws STRException,
                                                       java.sql.SQLException,
                                                       DataSourceRepositoryException,
                                                       java.io.IOException
Returns the scheme representation (of type String) of all objects' schemes of a schema.

Parameters:
sid - schema identifier (SID) of the schema.
Throws:
STRException - if the specified SID does not exist in the schema table in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

setOpenSchemeBracket

public static void setOpenSchemeBracket(java.lang.String os)
Set the String that is used to open a scheme name, such as "<<person>>" or "<<person,name>>". By default it is set to "<<". Normally this would be set to one of "<", "<<", or "«" (open double chevron)


getOpenSchemeBracket

public static java.lang.String getOpenSchemeBracket()
Return String used to open schemes


setCloseSchemeBracket

public static void setCloseSchemeBracket(java.lang.String cs)
Set the String that is used to close a scheme name, such as "<<person>>" or "<<person,name>>" By default it is set to ">>". Normally this would only be changed to ">", ">>", or "»" (close double chevron)


getCloseSchemeBracket

public static java.lang.String getCloseSchemeBracket()
Return String used to close schemes


flattenSchemes

public static java.lang.String flattenSchemes(java.lang.Object[] schemes)
                                       throws STRException
Converts an Object array representation of a schema object's scheme into a String representation.

Parameters:
schemes - the Object array representation of the schema object's scheme.
Throws:
STRException - if the scheme is somehow corrupt, and thus there is not a known way of representing it in the standard scheme format.

getSchemaObjectSID

public static int getSchemaObjectSID(int obid)
                              throws STRException,
                                     java.sql.SQLException,
                                     DataSourceRepositoryException,
                                     java.io.IOException
Returns the schema identifier (SID) that a schema object belongs to.

Parameters:
obid - object identifier (OBID) of the schema object.
Returns:
the schema identifier (SID) of the schema to which the schema object belongs.
Throws:
STRException - if no record for the specified OBID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getSchemaObjectCID

public static int getSchemaObjectCID(int obid)
                              throws STRException,
                                     java.sql.SQLException,
                                     DataSourceRepositoryException,
                                     java.io.IOException
Returns the construct identifier (CID) of the schema object. (See ModelDefinitionsRepository.createConstruct(int mid, String name, int constructClass, boolean isRoot))

Parameters:
obid - object identifier (OBID) of the schema object.
Returns:
the construct identifier (CID) of the schema object.
Throws:
STRException - if no record for the specified OBID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getSchemaObjectValue

public static java.lang.String getSchemaObjectValue(int obid)
                                             throws STRException,
                                                    java.sql.SQLException,
                                                    DataSourceRepositoryException,
                                                    java.io.IOException
Returns the name (value) of the schema object.

Parameters:
obid - object identifier (OBID) of the schema object.
Returns:
the name (value) of the schema object.
Throws:
STRException - if no record for the specified OBID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getSchemaObjects

public static int[] getSchemaObjects(int sid)
                              throws STRException,
                                     java.sql.SQLException,
                                     DataSourceRepositoryException,
                                     java.io.IOException
Returns the object identifiers (OBID) in ascending order of all the schema objects that belong to a particular schema.

Parameters:
sid - schema identifier (SID) of schema.
Returns:
a list of object identifiers (OBID) that belong to the specified schema. Returns null if no records are found in the object table which matches the specified SID.
Throws:
STRException - if no record for the specified SID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getSchemaObjectsByCID

public static int[] getSchemaObjectsByCID(int cid)
                                   throws STRException,
                                          java.sql.SQLException,
                                          DataSourceRepositoryException,
                                          java.io.IOException,
                                          ModelDefinitionsRepositoryException
Returns the object identifiers (OBID) in ascending order of all the schema objects that are instances of a certain construct type, in order of the OBID to which they belong

Parameters:
cid - identifier (CID) of construct.
Returns:
a list of object identifiers (OBID) that belong to the specified schema. Returns null if no records are found in the object table which matches the specified SID.
Throws:
STRException - if no record for the specified CID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException
ModelDefinitionsRepositoryException

getTransformationsByOBID

public static int[][] getTransformationsByOBID(int obid)
                                        throws STRException,
                                               java.sql.SQLException,
                                               DataSourceRepositoryException,
                                               java.io.IOException
Returns the pairs of schema identifiers (SID) of all the schema transformations that involve the supplied OBID

Parameters:
obid - identifier (OBID) of schema object.
Returns:
an array of pairs of schema identifiers (SID). Returns null if no records are found in the object table which matches the specified SID.
Throws:
STRException - if no transformations for the specified OBID are found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

isSchemaObjectTemp

public static boolean isSchemaObjectTemp(int obid,
                                         int sid)
                                  throws STRException,
                                         java.sql.SQLException,
                                         DataSourceRepositoryException,
                                         java.io.IOException
Deprecated. the isTemp field in the object table is no longer in use. Determines whether or not the schema object is temporary.

Parameters:
obid - object identifier (OBID) of the schema object.
sid - schema to which the object belongs.
Returns:
true if the schema object is marked as temporary; false otherwise.
Throws:
STRException - if no record for the specified OBID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

setSchemaObjectSID

public static void setSchemaObjectSID(int obid,
                                      int sid)
                               throws STRException,
                                      java.sql.SQLException,
                                      DataSourceRepositoryException,
                                      java.io.IOException
Sets the schema identifier (SID) to which a particular schema object belongs.

Parameters:
obid - object identifier (OBID) of the schema object.
sid - schema identifier (SID) of schema to which OBID should belong.
Throws:
STRException - if no record for the specified OBID is found in the STR; or if no record for the specified SID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

setSchemaObjectCID

public static void setSchemaObjectCID(int obid,
                                      int cid)
                               throws STRException,
                                      java.sql.SQLException,
                                      DataSourceRepositoryException,
                                      java.io.IOException
Sets the construct identifier (CID) of the schema object.

Parameters:
obid - object identifier (OBID) of schema object.
cid - construct identifier (CID) of schema object.
Throws:
STRException - if no record for the specified OBID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

setSchemaObjectValue

public static void setSchemaObjectValue(int obid,
                                        java.lang.String value)
                                 throws STRException,
                                        java.sql.SQLException,
                                        DataSourceRepositoryException,
                                        java.io.IOException
Sets the name/value of the schema object.

Parameters:
obid - object identifier (OBID) of schema object.
value - new value assigned to schema object.
Throws:
STRException - if no record for the specified OBID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

removeSchemaObject

public static void removeSchemaObject(int obid)
                               throws STRException,
                                      java.sql.SQLException,
                                      DataSourceRepositoryException,
                                      java.io.IOException
Removes a schema object from the STR.

Parameters:
obid - object identifier (OBID) of the schema object to be removed.
Throws:
STRException - if no record for the specified OBID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

createScheme

public static void createScheme(int obid,
                                int pos,
                                int sobid)
                         throws STRException,
                                java.sql.SQLException,
                                DataSourceRepositoryException,
                                java.io.IOException
Adds a scheme to the STR.

Parameters:
obid - object identifier (OBID) of schema object.
pos - position of the scheme of the schema object.
sobid - object identifier (SOBID) of the referenced schema object to be placed in the specified position in the scheme.
Throws:
STRException - if no record for the specified OBID or SOBID is found in the STR; or if a record already exists for the specified OBID and schemePos.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getSchemePosList

public static int[] getSchemePosList(int obid)
                              throws STRException,
                                     java.sql.SQLException,
                                     DataSourceRepositoryException,
                                     STRException,
                                     java.io.IOException
Returns a list of positions in the scheme of a particular schema object.

Parameters:
obid - object identifier (OBID) of schema object.
Returns:
a list of positions in the scheme of the schema object.
Throws:
STRException - if no record for the specified OBID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getSchemeSOBIDList

public static int[] getSchemeSOBIDList(int obid)
                                throws STRException,
                                       java.sql.SQLException,
                                       DataSourceRepositoryException,
                                       java.io.IOException
Returns a list of all schema object identifiers (SOBID) referenced by a particular schema object.

Parameters:
obid - object identifier (OBID) of schema object.
Returns:
a list of all schema object IDs referenced by the specified schema object; returns null if none exists.
Throws:
STRException - if no record for the specified OBID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getSchemeOBIDList

public static int[] getSchemeOBIDList(int sobid)
                               throws STRException,
                                      java.sql.SQLException,
                                      DataSourceRepositoryException,
                                      java.io.IOException
Returns a list of all schema object identifiers (OBID) by which a particular schema object is referenced.

Parameters:
sobid - object identifier (SOBID) of referenced schema object.
Returns:
a list of all schema object IDs by which the specified object is referenced.
Throws:
STRException - if no record for the specified SOBID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getSchemeSOBID

public static int getSchemeSOBID(int obid,
                                 int pos)
                          throws STRException,
                                 java.sql.SQLException,
                                 DataSourceRepositoryException,
                                 java.io.IOException
Returns the object identifier (SOBID) of the referenced schema object in the specified schema object's scheme at the given position.

Parameters:
obid - object identifier (OBID) of schema object.
pos - position of the schema object's scheme.
Returns:
the object identifier (SOBID) of the referenced schema object in the specified schema object's scheme at the given position.
Throws:
STRException - if no record for the specified OBID and pos is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getSchemePos

public static int getSchemePos(int obid,
                               int sobid)
                        throws STRException,
                               java.sql.SQLException,
                               DataSourceRepositoryException,
                               java.io.IOException
Returns the position of a referenced schema object in the scheme of a particular schema object.

Parameters:
obid - object identifier (OBID) of schema object.
sobid - object identifier (SOBID) of referenced schema object.
Returns:
the position of a referenced schema object in the scheme of the specified schema object.
Throws:
STRException - if no record for the specified OBID or SOBID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

setSchemeSOBID

public static void setSchemeSOBID(int obid,
                                  int pos,
                                  int sobid)
                           throws STRException,
                                  java.sql.SQLException,
                                  DataSourceRepositoryException,
                                  java.io.IOException
Sets the referenced schema object in a specific position of the scheme of a schema object.

Parameters:
obid - object identifier (OBID) of schema object.
pos - position of the scheme of the schema object.
sobid - object identifier (SOBID) of the referenced schema object to be put in the specified position.
Throws:
STRException - if no record for the specified OBID and pos is found in the STR; or if no record for the specified SOBID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

removeAllSchemes

public static void removeAllSchemes(int obid)
                             throws STRException,
                                    java.sql.SQLException,
                                    DataSourceRepositoryException,
                                    java.io.IOException
Removes all the schemes associated with the given schema object.

Parameters:
obid - object identifier (OBID) of the schema object.
Throws:
STRException - if no record for the specified OBID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

removeScheme

public static void removeScheme(int obid,
                                int pos)
                         throws STRException,
                                java.sql.SQLException,
                                DataSourceRepositoryException,
                                java.io.IOException
Removes a particular position of an object's scheme from the STR.

Parameters:
obid - object identifier (OBID) of schema object.
pos - position of the scheme of the schema object to be removed.
Throws:
STRException - if no record for the specified OBID and schemePos is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

createTransformation

public static void createTransformation(java.lang.String action,
                                        int fromObj,
                                        int toObj,
                                        int fromSchema,
                                        int toSchema,
                                        java.lang.String function,
                                        java.lang.String constraint)
                                 throws STRException,
                                        java.sql.SQLException,
                                        DataSourceRepositoryException,
                                        java.io.IOException
Adds a transformation to the STR.

Parameters:
action - action of the transformation, its value can be one of "add", "del", "ren", "ext", "con", and ident.
fromObj - object identifier (OBID) of schema object to be transformed.
toObj - object identifier (OBID) of schema object as the result of transformation.
fromSchema - schema identifier (SID) of schema to be transformed.
toSchema - schema identifier (SID) of schema as the result of transformation.
function - query which expresses how data of the transformed object can be derived from the original object.
Throws:
STRException - if a transformation has already been defined from the specified fromSchema to toSchema; or if the specified fromObj or toObj is not a valid OBID; or if fromSchema or toSchema is not a valid SID.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getTranFromSchema

public static int[] getTranFromSchema(int toSchema)
                               throws STRException,
                                      java.sql.SQLException,
                                      DataSourceRepositoryException,
                                      java.io.IOException
Returns a list of schema identifiers (SID) from which a particular schema can be derived.

Parameters:
toSchema - schema identifier (SID) of schema as a result of a transformation.
Returns:
a list of schema IDs from which the specified schema can be derived. Returns null if no transformations are defined with toSchema set to the specified SID.
Throws:
STRException - if no record for the specified toSchema SID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getTranToSchema

public static int[] getTranToSchema(int fromSchema)
                             throws STRException,
                                    java.sql.SQLException,
                                    DataSourceRepositoryException,
                                    java.io.IOException
Returns a list of schema identifiers (SID) which are derived from a particular schema.

Parameters:
fromSchema - schema identifier (SID) of source schema.
Returns:
a list of schema identifiers (SID) which are derived from the specified fromSchema. Returns the empty list if no transformations are defined with fromSchema set to the specified SID.
Throws:
STRException - if no record for the specified fromSchema SID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getTranAction

public static java.lang.String getTranAction(int fromSchema,
                                             int toSchema)
                                      throws STRException,
                                             java.sql.SQLException,
                                             DataSourceRepositoryException,
                                             java.io.IOException
Returns the action of transformation between two schemas.

Parameters:
fromSchema - schema identifier (SID) of source schema.
toSchema - schema identifier (SID) of schema transformed.
Returns:
the action of transformation between two schemas - one of "add", "del", "ren", "ext", "con", and ident.
Throws:
STRException - if no record for the specified fromSchema and toSchema SID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getTranFunction

public static java.lang.String getTranFunction(int fromSchema,
                                               int toSchema)
                                        throws STRException,
                                               java.sql.SQLException,
                                               DataSourceRepositoryException,
                                               java.io.IOException
Returns the function of a transformation between two schemas.

Parameters:
fromSchema - schema identifier (SID) of source schema.
toSchema - schema identifier (SID) of schema as a result of a transformation.
Returns:
the function of the transformation between the two specified schemas.
Throws:
STRException - if no record for the specified fromSchema and toSchema SID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getTranConstraint

public static java.lang.String getTranConstraint(int fromSchema,
                                                 int toSchema)
                                          throws STRException,
                                                 java.sql.SQLException,
                                                 DataSourceRepositoryException,
                                                 java.io.IOException
Returns the constraint of a transformation between two schemas.

Parameters:
fromSchema - schema identifier (SID) of source schema.
toSchema - schema identifier (SID) of schema as a result of a transformation.
Returns:
the constraint of the transformation between the two specified schemas.
Throws:
STRException - if no record for the specified fromSchema and toSchema SID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getTranFromObject

public static int getTranFromObject(int fromSchema,
                                    int toSchema)
                             throws STRException,
                                    java.sql.SQLException,
                                    DataSourceRepositoryException,
                                    java.io.IOException
Returns the schema object to be transformed in a transformation.

Parameters:
fromSchema - schema identifier (SID) of source schema.
toSchema - schema identifier (SID) of schema as a result of a transformation.
Returns:
object identifier (OBID) of schema object to be transformed in the transformation between the two specified schemas. Returns -1 if fromObj is null.
Throws:
STRException - if no record for the specified fromSchema and toSchema SID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getTranToObject

public static int getTranToObject(int fromSchema,
                                  int toSchema)
                           throws STRException,
                                  java.sql.SQLException,
                                  DataSourceRepositoryException,
                                  java.io.IOException
Returns the schema object as a result of a transformation.

Parameters:
fromSchema - schema identifier (SID) of source schema.
toSchema - schema identifier (SID) of schema as a result of a transformation.
Returns:
object identifier (OBID) of schema object that is the result of a transformation between the two specified schemas. Returns -1 if toObj is null.
Throws:
STRException - if no record for the specified fromSchema and toSchema SID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

setTranAction

public static void setTranAction(int fromSchema,
                                 int toSchema,
                                 java.lang.String action)
                          throws STRException,
                                 java.sql.SQLException,
                                 DataSourceRepositoryException,
                                 java.io.IOException
Sets the action of a transformation between two schemas.

Parameters:
fromSchema - schema identifier (SID) of source schema.
toSchema - schema identifier (SID) of schema as a result of a transformation.
action - action of the transformation - one of 'add', 'del', 'ren', 'ext', 'con', and 'ident'.
Throws:
STRException - if no record for the specified fromSchema and toSchema SID is found in the STR; or if the specified action is not a valid action (i.e., if it is not one of 'add', 'del', 'ren', 'ext', 'con', and 'ident').
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

setTranFromObject

public static void setTranFromObject(int fromSchema,
                                     int toSchema,
                                     int fromObj)
                              throws STRException,
                                     java.sql.SQLException,
                                     DataSourceRepositoryException,
                                     java.io.IOException
Sets the object identifier (OBID) of the schema object to be transformed in a transformation

Parameters:
fromSchema - schema identifier (SID) of source schema.
toSchema - schema identifier (SID) of schema as a result of a transformation.
fromObj - object identifier (OBID) of schema object to be transformed.
Throws:
STRException - if no record for the specified fromSchema and toSchema SID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

setTranToObject

public static void setTranToObject(int fromSchema,
                                   int toSchema,
                                   int toObj)
                            throws STRException,
                                   java.sql.SQLException,
                                   DataSourceRepositoryException,
                                   java.io.IOException
Sets the object identifier (OBID) of the schema object as a result of a transformation.

Parameters:
fromSchema - schema identifier (SID) of source schema.
toSchema - schema identifier (SID) of schema as a result of a transformation.
toObj - object identifier (OBID) of schema object as the result of transformation.
Throws:
STRException - if no record for the specified fromSchema and toSchema SID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

setTranFunction

public static void setTranFunction(int fromSchema,
                                   int toSchema,
                                   java.lang.String function)
                            throws STRException,
                                   java.sql.SQLException,
                                   DataSourceRepositoryException,
                                   java.io.IOException
Sets the function of a transformation between two schemas.

Parameters:
fromSchema - schema identifier (SID) of source schema.
toSchema - schema identifier (SID) of schema as a result of a transformation.
function - query which expresses how data of the transformed object can be derived from the original object.
Throws:
STRException - if no record for the specified fromSchema and toSchema SID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

setTranConstraint

public static void setTranConstraint(int fromSchema,
                                     int toSchema,
                                     java.lang.String constraint)
                              throws STRException,
                                     java.sql.SQLException,
                                     DataSourceRepositoryException,
                                     java.io.IOException
Sets the constraint of a transformation between two schemas.

Parameters:
fromSchema - schema identifier (SID) of source schema.
toSchema - schema identifier (SID) of schema as a result of a transformation.
constraint - the constraint of the transformation.
Throws:
STRException - if no record for the specified fromSchema and toSchema SID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

removeTransformation

public static void removeTransformation(int fromSchema,
                                        int toSchema)
                                 throws STRException,
                                        java.sql.SQLException,
                                        DataSourceRepositoryException,
                                        java.io.IOException
Removes a transformation from the STR.

Parameters:
fromSchema - schema identifier (SID) of source schema.
toSchema - schema identifier (SID) of schema as a result of a transformation.
Throws:
STRException - if no record for the specified fromSchema and toSchema SID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

createAccessMethod

public static int createAccessMethod(int sid,
                                     java.lang.String url,
                                     int pid,
                                     java.lang.String dbDriver,
                                     java.lang.String username)
                              throws STRException,
                                     java.sql.SQLException,
                                     DataSourceRepositoryException,
                                     java.io.IOException
Add the access methods of a schema to the STR.
Precondition: The schema whose access methods are being added must already exist in the schemas table.

Parameters:
sid - schema identifier (SID) of the schema whose access method entry is being created.
url - URL of database to connect to.
pid - protocol identifier (PID) of the protocol used for the access method.
dbDriver - database driver for connecting to the database.
username - username for connecting to the database.
Returns:
the access method identifier (AMID) of the new access method.
Throws:
STRException - if a record whose values match the specified values already exists in the accessMethod table; or if the specified SID or PID is found in the STR.
java.sql.SQLException - if no record for the specified SID or PID is found in the STR.
DataSourceRepositoryException
java.io.IOException

getAccessMethodBySID

public static int[] getAccessMethodBySID(int sid)
                                  throws STRException,
                                         java.sql.SQLException,
                                         DataSourceRepositoryException,
                                         java.io.IOException
Returns all the access method identifiers (AMID) that point to the access methods for the specified schema.

Parameters:
sid - schema identifier (SID) of schema.
Returns:
a list of access method identifiers (AMID) that point to the access methods for the specified schema. Returns null if no access methods are defined for the specified schema.
Throws:
STRException - if no record for the specified SID is found in the schema table in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getAccessMethodSID

public static int getAccessMethodSID(int amid)
                              throws STRException,
                                     java.sql.SQLException,
                                     DataSourceRepositoryException,
                                     java.io.IOException
Returns the schema identifier (SID) to which the specified access method connects.

Parameters:
amid - access method identifier (AMID).
Returns:
the schema identifer (SID) to which the specified access method connects.
Throws:
STRException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getAccessMethodURL

public static java.lang.String getAccessMethodURL(int amid)
                                           throws STRException,
                                                  java.sql.SQLException,
                                                  DataSourceRepositoryException,
                                                  java.io.IOException
Returns the URL of the specified access method.

Parameters:
amid - access method identifier (AMID).
Returns:
the URL of the specified access method.
Throws:
STRException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getAccessMethodPID

public static int getAccessMethodPID(int amid)
                              throws STRException,
                                     java.sql.SQLException,
                                     DataSourceRepositoryException,
                                     java.io.IOException
Returns the protocol identifier (PID) of the specified access method.

Parameters:
amid - access method identifier (AMID).
Returns:
the protocol identifier (PID) of the specified access method.
Throws:
STRException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getAccessMethodDBDriver

public static java.lang.String getAccessMethodDBDriver(int amid)
                                                throws STRException,
                                                       java.sql.SQLException,
                                                       DataSourceRepositoryException,
                                                       java.io.IOException
Returns the database driver of the specified access method.

Parameters:
amid - access method identifier (AMID).
Returns:
the database driver of the specified access method.
Throws:
STRException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getAccessMethodUsername

public static java.lang.String getAccessMethodUsername(int amid)
                                                throws STRException,
                                                       java.sql.SQLException,
                                                       DataSourceRepositoryException,
                                                       java.io.IOException
Returns the username of the specified access method.

Parameters:
amid - access method identifier (AMID).
Returns:
the username of the specified access method.
Throws:
STRException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

setAccessMethodSID

public static void setAccessMethodSID(int amid,
                                      int sid)
                               throws STRException,
                                      java.sql.SQLException,
                                      DataSourceRepositoryException,
                                      java.io.IOException
Sets the schema identifier (SID) of a particular access method.

Parameters:
amid - the access method identifier (AMID).
sid - schema identifier (SID) of the access method.
Throws:
STRException - if no record for the specified AMID or SID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

setAccessMethodURL

public static void setAccessMethodURL(int amid,
                                      java.lang.String url)
                               throws STRException,
                                      java.sql.SQLException,
                                      DataSourceRepositoryException,
                                      java.io.IOException
Sets the URL of a particular access method.

Parameters:
amid - the access method identifier (AMID).
url - URL of database that the access method connects to.
Throws:
STRException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

setAccessMethodPID

public static void setAccessMethodPID(int amid,
                                      int pid)
                               throws STRException,
                                      java.sql.SQLException,
                                      DataSourceRepositoryException,
                                      java.io.IOException
Sets the protocol identifier (PID) of a particular access method.

Parameters:
amid - the access method identifier (AMID).
pid - the protocol identifier (PID) that is used for establishing a connection to the database.
Throws:
STRException - if no record for the specified AMID or PID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

setAccessMethodDBDriver

public static void setAccessMethodDBDriver(int amid,
                                           java.lang.String dbDriver)
                                    throws STRException,
                                           java.sql.SQLException,
                                           DataSourceRepositoryException,
                                           java.io.IOException
Sets the database driver of a particular access method.

Parameters:
amid - the access method identifier (AMID).
dbDriver - database driver that is used for establishing a connection to the database.
Throws:
STRException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

setAccessMethodUsername

public static void setAccessMethodUsername(int amid,
                                           java.lang.String username)
                                    throws STRException,
                                           java.sql.SQLException,
                                           DataSourceRepositoryException,
                                           java.io.IOException
Sets the username of a particular access method.

Parameters:
amid - the access method identifier (AMID).
username - username that is used for establishing a connection to the database.
Throws:
STRException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

removeAccessMethod

public static void removeAccessMethod(int amid)
                               throws STRException,
                                      java.sql.SQLException,
                                      DataSourceRepositoryException,
                                      java.io.IOException
Removes an access method from the STR.

Parameters:
amid - the access method identifier (AMID).
Throws:
STRException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

removeAccessMethodBySID

public static void removeAccessMethodBySID(int sid)
                                    throws STRException,
                                           java.sql.SQLException,
                                           DataSourceRepositoryException,
                                           java.io.IOException
Removes all access methods for the given schema identifier (SID).

Parameters:
sid - the schema identifier (SID) whose access methods are to be removed.
Throws:
STRException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

createProtocol

public static int createProtocol(java.lang.String name)
                          throws STRException,
                                 java.sql.SQLException,
                                 DataSourceRepositoryException,
                                 java.io.IOException
Add the given protocol to the STR.

Parameters:
name - the name of the protocol.
Returns:
the protocol identifier (PID).
Throws:
STRException
java.sql.SQLException - if a record for the specified name already exists in the protocol table in the STR.
DataSourceRepositoryException
java.io.IOException

getProtocolByName

public static int getProtocolByName(java.lang.String name)
                             throws STRException,
                                    java.sql.SQLException,
                                    DataSourceRepositoryException,
                                    java.io.IOException
Returns the protocol identifier (PID) of the specified protocol name.

Parameters:
name - name of the protocol.
Returns:
ID of the protocol (PID).
Throws:
STRException - if no record for the specified name is found in the protocol table in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getProtocolName

public static java.lang.String getProtocolName(int pid)
                                        throws STRException,
                                               java.sql.SQLException,
                                               DataSourceRepositoryException,
                                               java.io.IOException
Returns the name of the given protocol identifier (PID).

Parameters:
pid - the protocol identifier (PID).
Returns:
the name of the given protocol identifier (PID).
Throws:
STRException - if no record for the specified PID is found in the protocol table in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

getAllProtocols

public static java.lang.String[] getAllProtocols()
                                          throws STRException,
                                                 java.sql.SQLException,
                                                 DataSourceRepositoryException,
                                                 java.io.IOException
Returns the name of all the protocols found in the STR.

Returns:
a list of names of all protocols. Returns null if no record is found in the protocol table in the STR.
Throws:
STRException
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

setProtocolName

public static void setProtocolName(int pid,
                                   java.lang.String name)
                            throws STRException,
                                   java.sql.SQLException,
                                   DataSourceRepositoryException,
                                   java.io.IOException
Sets the name of the protocol specified by the given protocol identifier (PID).

Parameters:
pid - the protocol identifier (PID).
name - new name of the protocol.
Throws:
STRException - if no record for the specified PID is found in the protocol table in the STR.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

removeProtocol

public static void removeProtocol(int pid)
                           throws STRException,
                                  java.sql.SQLException,
                                  DataSourceRepositoryException,
                                  STRException,
                                  java.io.IOException
Removes the name of a protocol from the STR.

Parameters:
pid - the protocol identifier (PID).
Throws:
STRException - if no record for the specified PID is found in the protocol table in the STR; or if data denpendency of the specified protocol with other data in the STR exists.
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException

main

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

getTransformations

public static java.util.Vector getTransformations()
                                           throws AutoMedException,
                                                  java.sql.SQLException,
                                                  java.io.IOException
Returns a vector representing all transformations in the repository

Returns:
a vector of each transformation, containing in each row action,fromObj,toObj,fromSchema,toSchema,function,constraint
Throws:
AutoMedException
java.sql.SQLException
java.io.IOException