uk.ac.ic.doc.automed
Class STR

java.lang.Object
  extended by uk.ac.ic.doc.automed.STR

public class STR
extends java.lang.Object

The STR library. Provides a low level interface the persistent storages of meta data about data sources, and transformations between them. It is intended that this class is only used by the reps package, and that all other APIs and applications access the STR via the reps package.

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

Field Summary
static int DEBUG_GENERAL
           
static int DEBUG_GUI
          Debug information from the gui package
static int DEBUG_P2P
          Debug information from the p2p package
static int DEBUG_PATHWAY
          Debug information about pathway manipulations in the reps package
static int DEBUG_WRAPPER
          Debug information from the wrappers package
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 boolean atSectionDebugLevel(int section, int level)
          Tests whether the section of code has been set to at least the debug level specified.
static int createAccessMethod(int sid, java.lang.String url, int pid, java.lang.String dbDriver, java.lang.String username, java.lang.String password, java.lang.String wrapper, int awfFeatures)
          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 createProtocol(java.lang.String name)
          Add the given protocol to the STR.
static int createSchema(java.lang.String name, int type, int subnetSID)
          Adds a new schema to the STR.
static int createSchemaObject(int sid, int cid, int tid, java.lang.String value)
          As above but with the AMType in
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 between two existing schemas, which must not already have a transformation between them.
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 escapeSQLString(java.lang.String text)
          Take a string, and escape its characters such the \ character will be stored in SQL correctly.
static java.util.Vector executeQuery(java.lang.String sql)
          Execute a SQL query on the repository, and return the result in a Vector
static int executeUpdate(java.lang.String sql)
          Execute a SQL update on the repository.
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 getAccessMethodAWFFeatures(int amid)
          Returns the feature settings of the specified access method.
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 java.lang.String getAccessMethodPassword(int amid)
          Returns the password of the specified access method.
static int getAccessMethodPID(int amid)
          Returns the protocol identifier (PID) of the specified access method.
static java.lang.String getAccessMethodProperty(int amid, java.lang.String name)
          Access Method Property
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 getAccessMethodWrapper(int amid)
          Returns the feature settings 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) deprecated: use #Debugger.getDebugLevel() instead
static int[] getDependentSchemaObjects(int obid, int cid)
          Returns the object identifiers (OBID) in ascending order of all the schema objects that depedent on the existanace of some other object.
static java.lang.String getIDString()
          Return a string that is globally unique for a STR repository
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 getSchemaBackgroundColor(int sid)
           
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 getSchemaForegroundColor(int sid)
           
static int[] getSchemaIDs()
          Returns the IDs of all the schemas found in the STR.
static java.awt.Point getSchemaLabelPos(int sid)
           
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 getSchemaObjectBackgroundColor(int obid)
           
static int getSchemaObjectCID(int obid)
          Returns the construct identifier (CID) of the schema object.
static int getSchemaObjectForegroundColor(int obid)
           
static java.awt.Point getSchemaObjectLabelPos(int obid)
           
static java.awt.Point getSchemaObjectPos(int obid)
           
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 int getSchemaObjectTextColor(int obid)
           
static int getSchemaObjectTID(int obid)
          Returns the type identifier (TID) for a schema object.
static java.lang.String getSchemaObjectValue(int obid)
          Returns the name (value) of the schema object.
static java.awt.Point getSchemaPos(int sid)
           
static int[] getSchemaSIDs()
          Returns the schema identifier (SID) of all the schemas found in the STR.
static int getSchemaSubnetSID(int sid)
          Returns the subnet schema id of this schema.
static int getSchemaTextColor(int sid)
           
static int getSchemaType(int sid)
          Returns the type of a schema.
static int[] getSchemeOBIDList(int sobid)
          Returns a list of all schema object identifiers (OBID) by which a particular schema object is referenced.
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 int getSectionDebugLevel(int section)
          Gets the debug level which the section of code has been set to.
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.lang.String getTransformationProperty(int fsid, int tsid, java.lang.String name)
          Transformation Property
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 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 scheme_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 boolean repair(boolean report)
          Perform some operators to repair the STR repository after it has become corrupt.
static void setAccessMethodAWFFeatures(int amid, int awfFeatures)
          Sets the AutoMedWrapperFactory featrures of a particular access method.
static void setAccessMethodDBDriver(int amid, java.lang.String dbDriver)
          Sets the database driver of a particular access method.
static void setAccessMethodPassword(int amid, java.lang.String password)
          Sets the password of a particular access method.
static void setAccessMethodPID(int amid, int pid)
          Sets the protocol identifier (PID) of a particular access method.
static void setAccessMethodProperty(int amid, java.lang.String name, java.lang.String value)
           
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 setAccessMethodWrapper(int amid, java.lang.String wrapper)
          Sets the wrapper 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 setSchemaBackgroundColor(int sid, int color)
           
static void setSchemaForegroundColor(int sid, int color)
           
static void setSchemaLabelPos(int sid, int x, int y)
           
static void setSchemaName(int sid, java.lang.String name)
          Sets the name of schema.
static void setSchemaObjectBackgroundColor(int obid, int color)
           
static void setSchemaObjectCID(int obid, int cid)
          Sets the construct identifier (CID) of the schema object.
static void setSchemaObjectForegroundColor(int obid, int color)
           
static void setSchemaObjectLabelPos(int obid, int x, int y)
           
static void setSchemaObjectPos(int obid, int x, int y)
           
static void setSchemaObjectSID(int obid, int sid)
          Sets the schema identifier (SID) to which a particular schema object belongs.
static void setSchemaObjectTextColor(int obid, int color)
           
static void setSchemaObjectType(int obid, int tid)
          Save type id for schema object
static void setSchemaObjectValue(int obid, java.lang.String value)
          Sets the name/value of the schema object.
static void setSchemaPos(int sid, int x, int y)
           
static void setSchemaSubnetSID(int sid, int subnet_sid)
          Sets the subnet SID of a schema.
static void setSchemaTextColor(int sid, int color)
           
static void setSchemaType(int sid, int type)
          Sets the type of a schema.
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 setSectionDebugLevel(int section, int level)
          Set the level of debug info output to the console for a numbered section of code.
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 setTransformationProperty(int fsid, int tsid, java.lang.String name, java.lang.String value)
           
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

DEBUG_GENERAL

public static final int DEBUG_GENERAL
See Also:
Constant Field Values

DEBUG_GUI

public static final int DEBUG_GUI
Debug information from the gui package

See Also:
Constant Field Values

DEBUG_PATHWAY

public static final int DEBUG_PATHWAY
Debug information about pathway manipulations in the reps package

See Also:
Constant Field Values

DEBUG_P2P

public static final int DEBUG_P2P
Debug information from the p2p package

See Also:
Constant Field Values

DEBUG_WRAPPER

public static final int DEBUG_WRAPPER
Debug information from the wrappers package

See Also:
Constant Field Values
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) deprecated: use #Debugger.getDebugLevel() instead


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

setSectionDebugLevel

public static void setSectionDebugLevel(int section,
                                        int level)
Set the level of debug info output to the console for a numbered section of code.

Parameters:
section - The section of code to set the level for. Setting the debug level for section 0 sets the global debug level
level - The debug level for the section of code deprecated Moved to Debugger classes

getSectionDebugLevel

public static int getSectionDebugLevel(int section)
Gets the debug level which the section of code has been set to.

Parameters:
section - The section of code for which the debug level is wanted. Getting section 0 returns the global debug level
Returns:
The debug level set for the numbered section or the global debug level if none is set for the specified section. deprecated Moved to Debugger classes

atSectionDebugLevel

public static boolean atSectionDebugLevel(int section,
                                          int level)
Tests whether the section of code has been set to at least the debug level specified.

Parameters:
section - The section of code to check the debug level for
level - The debug level for which is returned true if the section has been set to a least this value
Returns:
True if the general level of debug is at least at the specified level, or the numbered section of code has been set to at least the debug level specified. deprecated Moved to Debugger classes

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
debugLevel - that STR must be at in order for throwable to be reported on deprecated Moved to Debugger classes

repair

public static boolean repair(boolean report)
Perform some operators to repair the STR repository after it has become corrupt.

Parameters:
report - when set true, print comments of the repairs conducted on the command line.

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,
                               int type,
                               int subnetSID)
                        throws NotFoundException,
                               java.sql.SQLException,
                               DSRException,
                               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.
type - of schema: virtual, datasource, etc.
subnetSID - is the SID of the subnet's only extentional schema; set to -1 if this is the extentional schema that is being created
Returns:
the schema identifier (SID) of the new schema just created
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

getAllSchemaNames

public static java.lang.String[] getAllSchemaNames()
                                            throws NotFoundException,
                                                   java.sql.SQLException,
                                                   DSRException,
                                                   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:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

getSchemaByName

public static int getSchemaByName(java.lang.String name)
                           throws NotFoundException,
                                  java.sql.SQLException,
                                  DSRException,
                                  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:
NotFoundException - if no record for the specified name is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getSchemaName

public static java.lang.String getSchemaName(int sid)
                                      throws NotFoundException,
                                             java.sql.SQLException,
                                             DSRException,
                                             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:
NotFoundException - if no record for the specified SID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getSchemaSubnetSID

public static int getSchemaSubnetSID(int sid)
                              throws NotFoundException,
                                     java.sql.SQLException,
                                     DSRException,
                                     java.io.IOException
Returns the subnet schema id of this schema. This is the SID of the extensional schema within this subnet.

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:
NotFoundException - if no record for the specified SID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getSchemaPos

public static java.awt.Point getSchemaPos(int sid)
                                   throws NotFoundException,
                                          java.sql.SQLException,
                                          DSRException,
                                          java.io.IOException
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

setSchemaPos

public static void setSchemaPos(int sid,
                                int x,
                                int y)
                         throws NotFoundException,
                                java.sql.SQLException,
                                DSRException,
                                java.io.IOException
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

getSchemaForegroundColor

public static int getSchemaForegroundColor(int sid)
                                    throws NotFoundException,
                                           java.sql.SQLException,
                                           DSRException,
                                           java.io.IOException
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

setSchemaForegroundColor

public static void setSchemaForegroundColor(int sid,
                                            int color)
                                     throws NotFoundException,
                                            java.sql.SQLException,
                                            DSRException,
                                            java.io.IOException
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

getSchemaBackgroundColor

public static int getSchemaBackgroundColor(int sid)
                                    throws NotFoundException,
                                           java.sql.SQLException,
                                           DSRException,
                                           java.io.IOException
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

setSchemaBackgroundColor

public static void setSchemaBackgroundColor(int sid,
                                            int color)
                                     throws NotFoundException,
                                            java.sql.SQLException,
                                            DSRException,
                                            java.io.IOException
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

getSchemaTextColor

public static int getSchemaTextColor(int sid)
                              throws NotFoundException,
                                     java.sql.SQLException,
                                     DSRException,
                                     java.io.IOException
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

setSchemaTextColor

public static void setSchemaTextColor(int sid,
                                      int color)
                               throws NotFoundException,
                                      java.sql.SQLException,
                                      DSRException,
                                      java.io.IOException
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

getSchemaLabelPos

public static java.awt.Point getSchemaLabelPos(int sid)
                                        throws NotFoundException,
                                               java.sql.SQLException,
                                               DSRException,
                                               java.io.IOException
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

setSchemaLabelPos

public static void setSchemaLabelPos(int sid,
                                     int x,
                                     int y)
                              throws NotFoundException,
                                     java.sql.SQLException,
                                     DSRException,
                                     java.io.IOException
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

getSchemaType

public static int getSchemaType(int sid)
                         throws NotFoundException,
                                java.sql.SQLException,
                                DSRException,
                                java.io.IOException
Returns the type of a schema.

Parameters:
sid - schema identifier (SID) of the schema.
Returns:
integer value representing type of schema. .
Throws:
NotFoundException - if no record for the specified SID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException - Schema.VIRTUAL_TYPE getType()!=Schema.VIRTUAL_TYPE

setSchemaName

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

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

setSchemaSubnetSID

public static void setSchemaSubnetSID(int sid,
                                      int subnet_sid)
                               throws NotFoundException,
                                      java.sql.SQLException,
                                      DSRException,
                                      java.io.IOException
Sets the subnet SID of a schema. A subnet contains a group of schemas connected by any transformation except an IDENT transformation, with an extensional schema at the centre of the subnet, and any number of pathways leading from that schema.

Parameters:
sid - schema identifier (SID) of the schema.
subnet_sid - the SID of the only extension schema in the subnet to which this schema belongs. .
Throws:
NotFoundException - if no record for the specified SID is found in the STR.
java.sql.SQLException - if the specified name is already in use.
DSRException
java.io.IOException

setSchemaType

public static void setSchemaType(int sid,
                                 int type)
                          throws NotFoundException,
                                 java.sql.SQLException,
                                 DSRException,
                                 java.io.IOException
Sets the type of a schema.

Parameters:
sid - schema identifier (SID) of the schema.
type - to assoicate with schema .
Throws:
NotFoundException - if no record for the specified SID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getSchemaNames

public static java.lang.String[] getSchemaNames()
                                         throws NotFoundException,
                                                java.sql.SQLException,
                                                DSRException,
                                                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 an empty list if no record of schemas found in the STR.
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

getSchemaIDs

public static int[] getSchemaIDs()
                          throws NotFoundException,
                                 java.sql.SQLException,
                                 DSRException,
                                 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:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

getSchemaSIDs

public static int[] getSchemaSIDs()
                           throws NotFoundException,
                                  java.sql.SQLException,
                                  DSRException,
                                  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:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

removeSchema

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

Parameters:
sid - schema identifier (SID) of the schema to be removed.
Throws:
NotFoundException - 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
DSRException
java.io.IOException

escapeSQLString

public static java.lang.String escapeSQLString(java.lang.String text)
Take a string, and escape its characters such the \ character will be stored in SQL correctly. Used by methods that write values to SQL


createSchemaObject

public static int createSchemaObject(int sid,
                                     int cid,
                                     java.lang.String value)
                              throws NotFoundException,
                                     java.sql.SQLException,
                                     DSRException,
                                     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 MDR.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:
NotFoundException - 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
DSRException
java.io.IOException

createSchemaObject

public static int createSchemaObject(int sid,
                                     int cid,
                                     int tid,
                                     java.lang.String value)
                              throws NotFoundException,
                                     java.sql.SQLException,
                                     DSRException,
                                     java.io.IOException
As above but with the AMType in

Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

getObjectSchemeNames

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

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

getObjectSchemeNamesString

public static java.lang.String getObjectSchemeNamesString(int obid)
                                                   throws NotFoundException,
                                                          java.sql.SQLException,
                                                          NotFoundException,
                                                          DSRException,
                                                          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:
NotFoundException - if the specified obidToCopy (OBID) does not exist in the object table in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getAllSchemeNames

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

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

getAllSchemeNamesString

public static java.lang.String getAllSchemeNamesString(int sid)
                                                throws NotFoundException,
                                                       java.sql.SQLException,
                                                       DSRException,
                                                       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:
NotFoundException - if the specified SID does not exist in the schema table in the STR.
java.sql.SQLException
DSRException
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 NotFoundException
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:
NotFoundException - 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 NotFoundException,
                                     java.sql.SQLException,
                                     DSRException,
                                     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:
NotFoundException - if no record for the specified OBID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getSchemaObjectTID

public static int getSchemaObjectTID(int obid)
                              throws NotFoundException,
                                     java.sql.SQLException,
                                     DSRException,
                                     java.io.IOException
Returns the type identifier (TID) for a schema object.

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

getSchemaObjectCID

public static int getSchemaObjectCID(int obid)
                              throws NotFoundException,
                                     java.sql.SQLException,
                                     DSRException,
                                     java.io.IOException
Returns the construct identifier (CID) of the schema object. (See MDR.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:
NotFoundException - if no record for the specified OBID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getSchemaObjectPos

public static java.awt.Point getSchemaObjectPos(int obid)
                                         throws NotFoundException,
                                                java.sql.SQLException,
                                                DSRException,
                                                java.io.IOException
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

setSchemaObjectPos

public static void setSchemaObjectPos(int obid,
                                      int x,
                                      int y)
                               throws NotFoundException,
                                      java.sql.SQLException,
                                      DSRException,
                                      java.io.IOException
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

getSchemaObjectLabelPos

public static java.awt.Point getSchemaObjectLabelPos(int obid)
                                              throws NotFoundException,
                                                     java.sql.SQLException,
                                                     DSRException,
                                                     java.io.IOException
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

setSchemaObjectLabelPos

public static void setSchemaObjectLabelPos(int obid,
                                           int x,
                                           int y)
                                    throws NotFoundException,
                                           java.sql.SQLException,
                                           DSRException,
                                           java.io.IOException
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

getSchemaObjectForegroundColor

public static int getSchemaObjectForegroundColor(int obid)
                                          throws NotFoundException,
                                                 java.sql.SQLException,
                                                 DSRException,
                                                 java.io.IOException
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

setSchemaObjectForegroundColor

public static void setSchemaObjectForegroundColor(int obid,
                                                  int color)
                                           throws NotFoundException,
                                                  java.sql.SQLException,
                                                  DSRException,
                                                  java.io.IOException
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

getSchemaObjectBackgroundColor

public static int getSchemaObjectBackgroundColor(int obid)
                                          throws NotFoundException,
                                                 java.sql.SQLException,
                                                 DSRException,
                                                 java.io.IOException
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

setSchemaObjectBackgroundColor

public static void setSchemaObjectBackgroundColor(int obid,
                                                  int color)
                                           throws NotFoundException,
                                                  java.sql.SQLException,
                                                  DSRException,
                                                  java.io.IOException
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

getSchemaObjectTextColor

public static int getSchemaObjectTextColor(int obid)
                                    throws NotFoundException,
                                           java.sql.SQLException,
                                           DSRException,
                                           java.io.IOException
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

setSchemaObjectTextColor

public static void setSchemaObjectTextColor(int obid,
                                            int color)
                                     throws NotFoundException,
                                            java.sql.SQLException,
                                            DSRException,
                                            java.io.IOException
Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

getSchemaObjectValue

public static java.lang.String getSchemaObjectValue(int obid)
                                             throws NotFoundException,
                                                    java.sql.SQLException,
                                                    DSRException,
                                                    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:
NotFoundException - if no record for the specified OBID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getSchemaObjects

public static int[] getSchemaObjects(int sid)
                              throws NotFoundException,
                                     java.sql.SQLException,
                                     DSRException,
                                     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:
NotFoundException - if no record for the specified SID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getSchemaObjectsByCID

public static int[] getSchemaObjectsByCID(int cid)
                                   throws NotFoundException,
                                          java.sql.SQLException,
                                          DSRException,
                                          java.io.IOException,
                                          MDRException
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:
NotFoundException - if no record for the specified CID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException
MDRException

getDependentSchemaObjects

public static int[] getDependentSchemaObjects(int obid,
                                              int cid)
                                       throws NotFoundException,
                                              java.sql.SQLException,
                                              DSRException,
                                              java.io.IOException,
                                              MDRException
Returns the object identifiers (OBID) in ascending order of all the schema objects that depedent on the existanace of some other object.

Parameters:
obid - identifier (OBID) of existing object
cid - identifier (CID) of depedent objects to find (-1 will return all dependent objects)
Returns:
a list of object identifiers (OBID) that
Throws:
NotFoundException - if no record for the specified OBID or CID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException
MDRException

getTransformationsByOBID

public static int[][] getTransformationsByOBID(int obid)
                                        throws NotFoundException,
                                               java.sql.SQLException,
                                               DSRException,
                                               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:
NotFoundException - if no transformations for the specified OBID are found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

setSchemaObjectSID

public static void setSchemaObjectSID(int obid,
                                      int sid)
                               throws NotFoundException,
                                      java.sql.SQLException,
                                      DSRException,
                                      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:
NotFoundException - 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
DSRException
java.io.IOException

setSchemaObjectCID

public static void setSchemaObjectCID(int obid,
                                      int cid)
                               throws NotFoundException,
                                      java.sql.SQLException,
                                      DSRException,
                                      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:
NotFoundException - if no record for the specified OBID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

setSchemaObjectValue

public static void setSchemaObjectValue(int obid,
                                        java.lang.String value)
                                 throws NotFoundException,
                                        java.sql.SQLException,
                                        DSRException,
                                        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:
NotFoundException - if no record for the specified OBID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

setSchemaObjectType

public static void setSchemaObjectType(int obid,
                                       int tid)
                                throws NotFoundException,
                                       java.sql.SQLException,
                                       DSRException,
                                       java.io.IOException
Save type id for schema object

Throws:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

removeSchemaObject

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

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

createScheme

public static void createScheme(int obid,
                                int pos,
                                int sobid)
                         throws NotFoundException,
                                java.sql.SQLException,
                                IntegrityException,
                                DSRException,
                                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:
NotFoundException - if no record for the specified OBID or SOBID is found in the STR
IntegrityException - if a record already exists for the specified OBID and schemePos.
java.sql.SQLException
DSRException
java.io.IOException

getSchemePosList

public static int[] getSchemePosList(int obid)
                              throws NotFoundException,
                                     java.sql.SQLException,
                                     DSRException,
                                     NotFoundException,
                                     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:
NotFoundException - if no record for the specified OBID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getSchemeSOBIDList

public static int[] getSchemeSOBIDList(int obid)
                                throws NotFoundException,
                                       java.sql.SQLException,
                                       NotFoundException,
                                       DSRException,
                                       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:
NotFoundException - if no record for the specified OBID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getSchemeOBIDList

public static int[] getSchemeOBIDList(int sobid)
                               throws NotFoundException,
                                      java.sql.SQLException,
                                      NotFoundException,
                                      DSRException,
                                      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:
NotFoundException - if no record for the specified SOBID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getSchemeSOBID

public static int getSchemeSOBID(int obid,
                                 int pos)
                          throws NotFoundException,
                                 java.sql.SQLException,
                                 NotFoundException,
                                 DSRException,
                                 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:
NotFoundException - if no record for the specified OBID and pos is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

setSchemeSOBID

public static void setSchemeSOBID(int obid,
                                  int pos,
                                  int sobid)
                           throws NotFoundException,
                                  java.sql.SQLException,
                                  NotFoundException,
                                  DSRException,
                                  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:
NotFoundException - 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
DSRException
java.io.IOException

removeAllSchemes

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

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

removeScheme

public static void removeScheme(int obid,
                                int scheme_pos)
                         throws NotFoundException,
                                java.sql.SQLException,
                                NotFoundException,
                                DSRException,
                                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:
NotFoundException - if no record for the specified OBID and schemePos is found in the STR.
java.sql.SQLException
DSRException
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 NotFoundException,
                                        java.sql.SQLException,
                                        IntegrityException,
                                        DSRException,
                                        java.io.IOException
Adds a transformation to the STR between two existing schemas, which must not already have a transformation between them.

Parameters:
action - action of the transformation, its value can be one of Transformation.ACTION_ADD_STR, Transformation.ACTION_DELETE_STR, Transformation.ACTION_RENAME_STR, Transformation.ACTION_EXTEND_STR, Transformation.ACTION_CONTRACT_STR, and Transformation.ACTION_IDENT_STR.
fromObj - object identifier (OBID) of schema object to be transformed, which should be -1 of there is no such object as will be the case for add and extend transformations.
toObj - object identifier (OBID) of schema object as the result of transformation, which should be -1 of there is no such object as will be the case for delete and contract transformations.
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.
cons - any constraints on the transformation.
Throws:
IntegrityException - if a transformation has already been defined from the specified fromSchema to toSchema.
NotFoundException - if any schema or schema object does not exist already.
java.sql.SQLException
DSRException
java.io.IOException

getTranFromSchema

public static int[] getTranFromSchema(int toSchema)
                               throws NotFoundException,
                                      java.sql.SQLException,
                                      NotFoundException,
                                      DSRException,
                                      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:
NotFoundException - if no record for the specified toSchema SID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getTranToSchema

public static int[] getTranToSchema(int fromSchema)
                             throws NotFoundException,
                                    java.sql.SQLException,
                                    NotFoundException,
                                    DSRException,
                                    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:
NotFoundException - if no record for the specified fromSchema SID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getTranAction

public static java.lang.String getTranAction(int fromSchema,
                                             int toSchema)
                                      throws NotFoundException,
                                             java.sql.SQLException,
                                             NotFoundException,
                                             DSRException,
                                             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 Transformation.ACTION_ADD_STR, Transformation.ACTION_DELETE_STR, Transformation.ACTION_RENAME_STR, Transformation.ACTION_EXTEND_STR, Transformation.ACTION_CONTRACT_STR, and ident.
Throws:
NotFoundException - if no record for the specified fromSchema and toSchema SID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getTranFunction

public static java.lang.String getTranFunction(int fromSchema,
                                               int toSchema)
                                        throws NotFoundException,
                                               java.sql.SQLException,
                                               NotFoundException,
                                               DSRException,
                                               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:
NotFoundException - if no record for the specified fromSchema and toSchema SID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getTranConstraint

public static java.lang.String getTranConstraint(int fromSchema,
                                                 int toSchema)
                                          throws NotFoundException,
                                                 java.sql.SQLException,
                                                 NotFoundException,
                                                 DSRException,
                                                 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:
NotFoundException - if no record for the specified fromSchema and toSchema SID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getTranFromObject

public static int getTranFromObject(int fromSchema,
                                    int toSchema)
                             throws NotFoundException,
                                    java.sql.SQLException,
                                    NotFoundException,
                                    DSRException,
                                    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:
NotFoundException - if no record for the specified fromSchema and toSchema SID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getTranToObject

public static int getTranToObject(int fromSchema,
                                  int toSchema)
                           throws NotFoundException,
                                  java.sql.SQLException,
                                  NotFoundException,
                                  DSRException,
                                  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:
NotFoundException - if no record for the specified fromSchema and toSchema SID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

setTranAction

public static void setTranAction(int fromSchema,
                                 int toSchema,
                                 java.lang.String action)
                          throws NotFoundException,
                                 java.sql.SQLException,
                                 NotFoundException,
                                 DSRException,
                                 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:
NotFoundException - 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
DSRException
java.io.IOException

setTranFromObject

public static void setTranFromObject(int fromSchema,
                                     int toSchema,
                                     int fromObj)
                              throws NotFoundException,
                                     java.sql.SQLException,
                                     NotFoundException,
                                     DSRException,
                                     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:
NotFoundException - if no record for the specified fromSchema and toSchema SID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

setTranToObject

public static void setTranToObject(int fromSchema,
                                   int toSchema,
                                   int toObj)
                            throws NotFoundException,
                                   java.sql.SQLException,
                                   NotFoundException,
                                   DSRException,
                                   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:
NotFoundException - if no record for the specified fromSchema and toSchema SID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

setTranFunction

public static void setTranFunction(int fromSchema,
                                   int toSchema,
                                   java.lang.String function)
                            throws NotFoundException,
                                   java.sql.SQLException,
                                   NotFoundException,
                                   DSRException,
                                   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:
NotFoundException - if no record for the specified fromSchema and toSchema SID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

setTranConstraint

public static void setTranConstraint(int fromSchema,
                                     int toSchema,
                                     java.lang.String constraint)
                              throws NotFoundException,
                                     java.sql.SQLException,
                                     NotFoundException,
                                     DSRException,
                                     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:
NotFoundException - if no record for the specified fromSchema and toSchema SID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

removeTransformation

public static void removeTransformation(int fromSchema,
                                        int toSchema)
                                 throws NotFoundException,
                                        java.sql.SQLException,
                                        NotFoundException,
                                        DSRException,
                                        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:
NotFoundException - if no record for the specified fromSchema and toSchema SID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getTransformationProperty

public static java.lang.String getTransformationProperty(int fsid,
                                                         int tsid,
                                                         java.lang.String name)
                                                  throws NotFoundException
Transformation Property

Throws:
NotFoundException

setTransformationProperty

public static void setTransformationProperty(int fsid,
                                             int tsid,
                                             java.lang.String name,
                                             java.lang.String value)
                                      throws NotFoundException
Throws:
NotFoundException

createAccessMethod

public static int createAccessMethod(int sid,
                                     java.lang.String url,
                                     int pid,
                                     java.lang.String dbDriver,
                                     java.lang.String username,
                                     java.lang.String password,
                                     java.lang.String wrapper,
                                     int awfFeatures)
                              throws NotFoundException,
                                     java.sql.SQLException,
                                     DSRException,
                                     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 - for connecting to the database (and null if none required).
password - for connecting to the database (and null if none required)..
wrapper - classname of the AutoMedWrapper ysed for wrapping the datasouce.
awfFeatures - feature setting for the AutoMedWrapperFactory.
Returns:
the access method identifier (AMID) of the new access method.
Throws:
NotFoundException - 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.
DSRException
java.io.IOException

getAccessMethodBySID

public static int[] getAccessMethodBySID(int sid)
                                  throws NotFoundException,
                                         java.sql.SQLException,
                                         DSRException,
                                         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:
NotFoundException - if no record for the specified SID is found in the schema table in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getAccessMethodSID

public static int getAccessMethodSID(int amid)
                              throws NotFoundException,
                                     java.sql.SQLException,
                                     DSRException,
                                     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:
NotFoundException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getAccessMethodURL

public static java.lang.String getAccessMethodURL(int amid)
                                           throws NotFoundException,
                                                  java.sql.SQLException,
                                                  DSRException,
                                                  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:
NotFoundException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getAccessMethodPID

public static int getAccessMethodPID(int amid)
                              throws NotFoundException,
                                     java.sql.SQLException,
                                     DSRException,
                                     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:
NotFoundException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getAccessMethodDBDriver

public static java.lang.String getAccessMethodDBDriver(int amid)
                                                throws NotFoundException,
                                                       java.sql.SQLException,
                                                       DSRException,
                                                       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:
NotFoundException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getAccessMethodPassword

public static java.lang.String getAccessMethodPassword(int amid)
                                                throws NotFoundException,
                                                       java.sql.SQLException,
                                                       DSRException,
                                                       java.io.IOException
Returns the password of the specified access method.

Parameters:
amid - access method identifier (AMID) for which the password is required
Returns:
the password required to access the database (and null if no such password is required)
Throws:
NotFoundException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getAccessMethodAWFFeatures

public static int getAccessMethodAWFFeatures(int amid)
                                      throws NotFoundException,
                                             java.sql.SQLException,
                                             DSRException,
                                             java.io.IOException
Returns the feature settings of the specified access method. When the access method was created by an AutoMedWrapper this the setting of the features.

Parameters:
amid - access method identifier (AMID) for which the setting is required is required
Returns:
the feature setting of the wrapper factory
Throws:
NotFoundException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getAccessMethodWrapper

public static java.lang.String getAccessMethodWrapper(int amid)
                                               throws NotFoundException,
                                                      java.sql.SQLException,
                                                      DSRException,
                                                      java.io.IOException
Returns the feature settings of the specified access method. When the access method was created by an AutoMedWrapper this the setting of the features.

Parameters:
amid - access method identifier (AMID) for which the setting is required is required
Returns:
the feature setting of the wrapper factory
Throws:
NotFoundException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getAccessMethodUsername

public static java.lang.String getAccessMethodUsername(int amid)
                                                throws NotFoundException,
                                                       java.sql.SQLException,
                                                       DSRException,
                                                       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:
NotFoundException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

setAccessMethodSID

public static void setAccessMethodSID(int amid,
                                      int sid)
                               throws NotFoundException,
                                      java.sql.SQLException,
                                      DSRException,
                                      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:
NotFoundException - if no record for the specified AMID or SID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

setAccessMethodURL

public static void setAccessMethodURL(int amid,
                                      java.lang.String url)
                               throws NotFoundException,
                                      java.sql.SQLException,
                                      DSRException,
                                      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:
NotFoundException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

setAccessMethodPID

public static void setAccessMethodPID(int amid,
                                      int pid)
                               throws NotFoundException,
                                      java.sql.SQLException,
                                      DSRException,
                                      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:
NotFoundException - if no record for the specified AMID or PID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

setAccessMethodDBDriver

public static void setAccessMethodDBDriver(int amid,
                                           java.lang.String dbDriver)
                                    throws NotFoundException,
                                           java.sql.SQLException,
                                           DSRException,
                                           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:
NotFoundException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

setAccessMethodPassword

public static void setAccessMethodPassword(int amid,
                                           java.lang.String password)
                                    throws NotFoundException,
                                           java.sql.SQLException,
                                           DSRException,
                                           java.io.IOException
Sets the password of a particular access method.

Parameters:
amid - the access method identifier (AMID).
password - of the database that the access method is associated
Throws:
NotFoundException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

setAccessMethodUsername

public static void setAccessMethodUsername(int amid,
                                           java.lang.String username)
                                    throws NotFoundException,
                                           java.sql.SQLException,
                                           DSRException,
                                           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:
NotFoundException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

setAccessMethodWrapper

public static void setAccessMethodWrapper(int amid,
                                          java.lang.String wrapper)
                                   throws NotFoundException,
                                          java.sql.SQLException,
                                          DSRException,
                                          java.io.IOException
Sets the wrapper of a particular access method.

Parameters:
amid - the access method identifier (AMID).
wrapper - full class name of the AccessMethod.
Throws:
NotFoundException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

setAccessMethodAWFFeatures

public static void setAccessMethodAWFFeatures(int amid,
                                              int awfFeatures)
                                       throws NotFoundException,
                                              java.sql.SQLException,
                                              DSRException,
                                              java.io.IOException
Sets the AutoMedWrapperFactory featrures of a particular access method.

Parameters:
amid - the access method identifier (AMID).
awfFeatures - features
Throws:
NotFoundException - if no record for the specified AMID or SID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

removeAccessMethod

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

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

removeAccessMethodBySID

public static void removeAccessMethodBySID(int sid)
                                    throws NotFoundException,
                                           java.sql.SQLException,
                                           DSRException,
                                           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:
NotFoundException - if no record for the specified AMID is found in the STR.
java.sql.SQLException
DSRException
java.io.IOException

createProtocol

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

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

getProtocolByName

public static int getProtocolByName(java.lang.String name)
                             throws NotFoundException,
                                    java.sql.SQLException,
                                    DSRException,
                                    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:
NotFoundException - if no record for the specified name is found in the protocol table in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getProtocolName

public static java.lang.String getProtocolName(int pid)
                                        throws NotFoundException,
                                               java.sql.SQLException,
                                               DSRException,
                                               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:
NotFoundException - if no record for the specified PID is found in the protocol table in the STR.
java.sql.SQLException
DSRException
java.io.IOException

getAllProtocols

public static java.lang.String[] getAllProtocols()
                                          throws NotFoundException,
                                                 java.sql.SQLException,
                                                 DSRException,
                                                 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:
NotFoundException
java.sql.SQLException
DSRException
java.io.IOException

setProtocolName

public static void setProtocolName(int pid,
                                   java.lang.String name)
                            throws NotFoundException,
                                   java.sql.SQLException,
                                   DSRException,
                                   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:
NotFoundException - if no record for the specified PID is found in the protocol table in the STR.
java.sql.SQLException
DSRException
java.io.IOException

removeProtocol

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

Parameters:
pid - the protocol identifier (PID).
Throws:
NotFoundException - 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
DSRException
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

getIDString

public static java.lang.String getIDString()
Return a string that is globally unique for a STR repository


executeQuery

public static java.util.Vector executeQuery(java.lang.String sql)
Execute a SQL query on the repository, and return the result in a Vector

Returns:
a Vector or Vector, each of the later representing one row in the result of the SQL query.

executeUpdate

public static int executeUpdate(java.lang.String sql)
Execute a SQL update on the repository.

Parameters:
sql - Statement to execute on the repository
Returns:
the number of rows affected by the update.

getAccessMethodProperty

public static java.lang.String getAccessMethodProperty(int amid,
                                                       java.lang.String name)
                                                throws NotFoundException
Access Method Property

Throws:
NotFoundException

setAccessMethodProperty

public static void setAccessMethodProperty(int amid,
                                           java.lang.String name,
                                           java.lang.String value)
                                    throws NotFoundException
Throws:
NotFoundException