uk.ac.ic.doc.automed
Class SSMDR

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

public class SSMDR
extends java.lang.Object

The SSMD library<<

Author:
Sasivimol Kittivoravitkul (sk297@doc.ic.ac.uk)

Field Summary
static java.lang.String SSMDR_DataSourceName
           
 
Constructor Summary
SSMDR()
           
 
Method Summary
static int createPattern(java.lang.String name, java.lang.String value)
          Adds a new pattern to the SSMDR.
static void createPatternSobjAssociation(int sfid, int obid, int spid, int gno)
          Add the association between ssdpattern and schema object to the SSMDR.
static int createSSDFormat(java.lang.String name)
          Adds a new ssdformat to the SSMDR.
static int createSSDPattern(int pid)
          Adds a ssdpattern to the SSMDR.
static java.util.Vector getAllPatternNames()
          Returns the vector of patterns'name
static java.lang.String getDataSourceName()
          Returns the name of the repository in the local database.
static int getGroupNo(int sfid, int obid)
          Returns the group no of ssdpattern and schemaobject in the SSMDR.
static int getOBIDBySFIDSPID(int sfid, int spid)
          Returns the ID of schemaobject in the SSMDR for the particular ssdformat and ssdpattern.
static int getPatternByName(java.lang.String name)
          Returns the pattern identifier (PID).
static int[] getPatternIDs()
          Returns the IDs of all the patterns found in the SSMDR.
static java.lang.String getPatternName(int pid)
          Returns the name of the pattern.
static java.lang.String getPatternValue(int pid)
          Returns the value (an actual pattern in regular expression) of the pattern.
static int getPIDBySPID(int spid)
          Returns the ssdpattern identifier (SPID).
static int getSFIDByName(java.lang.String name)
          Returns the ssd format identifier (SFID) of the ssd format specified by name.
Assumption:ssd format names are unique.
static int getSFIDBySID(int sid)
          Returns the ssdformat identifier (SFID) of the ssd format specified by schema identifier (SID).
static int getSIDBySFID(int sfid)
          Returns the schema identifier (SID) of the ssd format specified by ssd format identifier (SFID).
static int getSPIDByPID(int pid)
          Returns the recent ssdpattern identifier (SPID) of the specified pattern.
static int getSPIDBySFIDOBID(int sfid, int obid)
          Returns the ID of ssdpattern in the SSMDR for the particular ssdformat and schemaobject.
static int[] getSPIDsBySFID(int sfid)
          Returns the IDs of all the ssdpatterns found in the SSMDR.
static int[] getSSDFormatIDs()
          Returns the IDs of all the ssd formats found in the SSMDR.
static java.lang.String getSSDFormatName(int sfid)
          Returns the name of the ssd format with the given ssd format identifier.
static java.lang.String[] getSSDFormatNames()
          Returns the name of all the ssd formats found in the SSMDR.
static java.lang.String getSSMDR_DataSourceName()
          Deprecated. use getDataSourceName()
static void main(java.lang.String[] args)
           
static void removeAssociationBySFID(int sfid)
          Removes all associations for the given ssdformat identifier (SFID).
static void removePattern(int pid)
          Removes a pattern from the SSMDR.
static void removeSSDFormat(int sfid)
          Removes a ssd format from the SSMDR.
static void setDataSourceName(java.lang.String ssmd)
          Sets the name of the SemiStructured MetaData Repository in the local database.
static void setPatternValue(int pid, java.lang.String value)
          Sets the value of the pattern.
static void setSchema(int sfid, int sid)
          Sets the SID for the ssd format.
static void setSSDFormatName(int sfid, java.lang.String name)
          Sets the name of ssd format.
static void setSSMDR_DataSourceName(java.lang.String ssmd)
          Deprecated. use setDataSourceName()
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SSMDR_DataSourceName

public static java.lang.String SSMDR_DataSourceName
Constructor Detail

SSMDR

public SSMDR()
Method Detail

getDataSourceName

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

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

getSSMDR_DataSourceName

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


setDataSourceName

public static void setDataSourceName(java.lang.String ssmd)
Sets the name of the SemiStructured MetaData Repository in the local database. This name is set to SSMDR by default.

Parameters:
ssmd - the name of the SemiStructured MetaData Repository in the local database.

setSSMDR_DataSourceName

public static void setSSMDR_DataSourceName(java.lang.String ssmd)
Deprecated. use setDataSourceName()


createSSDFormat

public static int createSSDFormat(java.lang.String name)
                           throws SSMDRException,
                                  java.sql.SQLException,
                                  DSRException,
                                  java.io.IOException
Adds a new ssdformat to the SSMDR. The creation of a ssd format whose name already exists in the SSMDR is rejected.
Returns an integer that specifies the ssd format identifier (SFID) Assumption:ssd format names are unique. assigned to the new ssd format.

Parameters:
name - name of the new ssd format.
Returns:
the ssd format identifier (SFID) of the new ssd format.
Throws:
SSMDRException
java.sql.SQLException
DSRException
java.io.IOException

getSFIDByName

public static int getSFIDByName(java.lang.String name)
                         throws SSMDRException,
                                java.sql.SQLException,
                                DSRException,
                                java.io.IOException
Returns the ssd format identifier (SFID) of the ssd format specified by name.
Assumption:ssd format names are unique.

Parameters:
name - name of ssd format.
Returns:
the ssd format identifier (SFID) of the ssd format.
Throws:
SSMDRException - if no record for the specified name is found in the SSMDR.
java.sql.SQLException
DSRException
java.io.IOException

getSFIDBySID

public static int getSFIDBySID(int sid)
                        throws SSMDRException,
                               java.sql.SQLException,
                               DSRException,
                               java.io.IOException
Returns the ssdformat identifier (SFID) of the ssd format specified by schema identifier (SID).

Parameters:
sid - identifier of schema.
Returns:
sfid the ssdformat identifier (SFID) of the specified schema.
Throws:
SSMDRException - if no record for the specified name is found in the SSMDR.
java.sql.SQLException
DSRException
java.io.IOException

getSIDBySFID

public static int getSIDBySFID(int sfid)
                        throws SSMDRException,
                               java.sql.SQLException,
                               DSRException,
                               java.io.IOException
Returns the schema identifier (SID) of the ssd format specified by ssd format identifier (SFID).

Parameters:
sfid - identifier of ssd format.
Returns:
the schema identifier (SID) of the ssd format.
Throws:
SSMDRException - if no record for the specified name is found in the SSMDR.
java.sql.SQLException
DSRException
java.io.IOException

getSSDFormatName

public static java.lang.String getSSDFormatName(int sfid)
                                         throws SSMDRException,
                                                java.sql.SQLException,
                                                DSRException,
                                                java.io.IOException
Returns the name of the ssd format with the given ssd format identifier.

Parameters:
sfid - ssdformat identifier (SFID) of the ssd format.
Returns:
the name of the ssd format if the SFID specified can be found in the ssdformats table.
Throws:
SSMDRException - if no record for the specified SFID is found in the SSMDR.
java.sql.SQLException
DSRException
java.io.IOException

setSSDFormatName

public static void setSSDFormatName(int sfid,
                                    java.lang.String name)
                             throws SSMDRException,
                                    java.sql.SQLException,
                                    DSRException,
                                    java.io.IOException
Sets the name of ssd format.

Parameters:
sfid - ssd format identifier (SFID) of the ssd format.
name - new name of the ssd format.
Throws:
SSMDRException - if no record for the specified SFID is found in the SSMDR.
java.sql.SQLException - if the specified name is already in use.
DSRException
java.io.IOException

setSchema

public static void setSchema(int sfid,
                             int sid)
                      throws SSMDRException,
                             java.sql.SQLException,
                             DSRException,
                             java.io.IOException
Sets the SID for the ssd format.

Parameters:
sfid - ssd format identifier (SFID) of the ssd format.
sid - schema identifier (SID) of the schema.
Throws:
SSMDRException - if no record for the specified SFID is found in the SSMDR.
java.sql.SQLException - if the specified name is already in use.
DSRException
java.io.IOException

getSSDFormatNames

public static java.lang.String[] getSSDFormatNames()
                                            throws SSMDRException,
                                                   java.sql.SQLException,
                                                   DSRException,
                                                   java.io.IOException
Returns the name of all the ssd formats found in the SSMDR.

Returns:
a list of all ssd format names found in the SSMDR. Returns null if no record of ssd formats found in the SSMDR.
Throws:
SSMDRException
java.sql.SQLException
DSRException
java.io.IOException

getSSDFormatIDs

public static int[] getSSDFormatIDs()
                             throws SSMDRException,
                                    java.sql.SQLException,
                                    DSRException,
                                    java.io.IOException
Returns the IDs of all the ssd formats found in the SSMDR.

Returns:
a list of all ssd format IDs found in the SSMDR. Returns an empty array if no schemas are found in the SSMDR.
Throws:
SSMDRException
java.sql.SQLException
DSRException
java.io.IOException

removeSSDFormat

public static void removeSSDFormat(int sfid)
                            throws SSMDRException,
                                   java.sql.SQLException,
                                   DSRException,
                                   java.io.IOException
Removes a ssd format from the SSMDR.

Parameters:
sfid - ssdformat identifier (SFID) of the ssdformat to be removed.
Throws:
SSMDRException - if no record for the specified SFID is found in the SSMDR; or if data dependency of the specified schema with other data in the SSMDR exists.
java.sql.SQLException
DSRException
java.io.IOException

createPattern

public static int createPattern(java.lang.String name,
                                java.lang.String value)
                         throws SSMDRException,
                                java.sql.SQLException,
                                DSRException,
                                java.io.IOException
Adds a new pattern to the SSMDR.

Parameters:
name - the name the pattern.
value - the value given to the pattern (regular expression).
Returns:
the pattern identifier (PID) of the new pattern.
Throws:
SSMDRException
java.sql.SQLException
DSRException
java.io.IOException

getPatternByName

public static int getPatternByName(java.lang.String name)
                            throws SSMDRException,
                                   java.sql.SQLException,
                                   DSRException,
                                   java.io.IOException
Returns the pattern identifier (PID).

Parameters:
name - pattern name.
Returns:
the pattern identifier (PID).
Throws:
SSMDRException - if no record for the specified pattern name is found in the SSMDR.
java.sql.SQLException
DSRException
java.io.IOException

getAllPatternNames

public static java.util.Vector getAllPatternNames()
                                           throws SSMDRException,
                                                  java.sql.SQLException,
                                                  DSRException,
                                                  java.io.IOException
Returns the vector of patterns'name

Returns:
the vector of patterns'name
Throws:
SSMDRException - if no pattern in the SSMDR.
java.sql.SQLException
DSRException
java.io.IOException

getPatternValue

public static java.lang.String getPatternValue(int pid)
                                        throws SSMDRException,
                                               java.sql.SQLException,
                                               DSRException,
                                               java.io.IOException
Returns the value (an actual pattern in regular expression) of the pattern.

Parameters:
pid - pattern identifier (PID) of the pattern.
Returns:
the value (an actual pattern in regular expression) of the pattern.
Throws:
SSMDRException - if no record for the specified PID is found in the SSMDR.
java.sql.SQLException
DSRException
java.io.IOException

getPatternName

public static java.lang.String getPatternName(int pid)
                                       throws SSMDRException,
                                              java.sql.SQLException,
                                              DSRException,
                                              java.io.IOException
Returns the name of the pattern.

Parameters:
pid - pattern identifier (PID) of the pattern.
Returns:
the name of the pattern.
Throws:
SSMDRException - if no record for the specified PID is found in the SSMDR.
java.sql.SQLException
DSRException
java.io.IOException

getPatternIDs

public static int[] getPatternIDs()
                           throws SSMDRException,
                                  java.sql.SQLException,
                                  DSRException,
                                  java.io.IOException
Returns the IDs of all the patterns found in the SSMDR.

Returns:
a list of all pattern IDs found in the SSMDR. Returns an empty array if no patterns are found in the SSMDR.
Throws:
SSMDRException
java.sql.SQLException
DSRException
java.io.IOException

setPatternValue

public static void setPatternValue(int pid,
                                   java.lang.String value)
                            throws SSMDRException,
                                   java.sql.SQLException,
                                   DSRException,
                                   java.io.IOException
Sets the value of the pattern.

Parameters:
pid - pattern identifier (PID) of pattern.
value - new value assigned to pattern.
Throws:
SSMDRException - if no record for the specified PID is found in the SSMDR.
java.sql.SQLException
DSRException
java.io.IOException

removePattern

public static void removePattern(int pid)
                          throws SSMDRException,
                                 java.sql.SQLException,
                                 DSRException,
                                 java.io.IOException
Removes a pattern from the SSMDR.

Parameters:
pid - pattern identifier (PID) of the pattern to be removed.
Throws:
SSMDRException - if no record for the specified PID is found in the SSMDR.
java.sql.SQLException
DSRException
java.io.IOException

createSSDPattern

public static int createSSDPattern(int pid)
                            throws SSMDRException,
                                   java.sql.SQLException,
                                   DSRException,
                                   java.io.IOException
Adds a ssdpattern to the SSMDR.

Parameters:
pid - pattern identifier (PID) of pattern.
Throws:
SSMDRException - if a record already exists for the specified SPID.
java.sql.SQLException
DSRException
java.io.IOException

getSPIDByPID

public static int getSPIDByPID(int pid)
                        throws SSMDRException,
                               java.sql.SQLException,
                               DSRException,
                               java.io.IOException
Returns the recent ssdpattern identifier (SPID) of the specified pattern.

Parameters:
pid - pattern identifier.
Returns:
the ssdpattern identifier (SPID).
Throws:
SSMDRException - if no record for the specified pattern name is found in the SSMDR.
java.sql.SQLException
DSRException
java.io.IOException

getPIDBySPID

public static int getPIDBySPID(int spid)
                        throws SSMDRException,
                               java.sql.SQLException,
                               DSRException,
                               java.io.IOException
Returns the ssdpattern identifier (SPID).

Parameters:
pid - pattern identifier.
Returns:
the ssdpattern identifier (SPID).
Throws:
SSMDRException - if no record for the specified pattern name is found in the SSMDR.
java.sql.SQLException
DSRException
java.io.IOException

createPatternSobjAssociation

public static void createPatternSobjAssociation(int sfid,
                                                int obid,
                                                int spid,
                                                int gno)
                                         throws SSMDRException,
                                                java.sql.SQLException,
                                                DSRException,
                                                java.io.IOException
Add the association between ssdpattern and schema object to the SSMDR.

Parameters:
sfid - ssdformat identifier (SFID) of the ssd format which is already created.
obid - schema object of a schema which applies the ssd format.
spid - ssdformat identifier (SPID) of the ssdformat.
gno - a capturing group number used for pattern matching.
Throws:
SSMDRException - if a record whose values match the specified values already exists in the schemaObject_ssdPattern table.
java.sql.SQLException - if no record for the specified SID or PID is found in the STR.
DSRException
java.io.IOException

getSPIDBySFIDOBID

public static int getSPIDBySFIDOBID(int sfid,
                                    int obid)
                             throws SSMDRException,
                                    java.sql.SQLException,
                                    DSRException,
                                    java.io.IOException
Returns the ID of ssdpattern in the SSMDR for the particular ssdformat and schemaobject.

Returns:
a ssdpattern identifier
Throws:
SSMDRException
java.sql.SQLException
DSRException
java.io.IOException

getOBIDBySFIDSPID

public static int getOBIDBySFIDSPID(int sfid,
                                    int spid)
                             throws SSMDRException,
                                    java.sql.SQLException,
                                    DSRException,
                                    java.io.IOException
Returns the ID of schemaobject in the SSMDR for the particular ssdformat and ssdpattern.

Returns:
a ssdpattern identifier
Throws:
SSMDRException
java.sql.SQLException
DSRException
java.io.IOException

getGroupNo

public static int getGroupNo(int sfid,
                             int obid)
                      throws SSMDRException,
                             java.sql.SQLException,
                             DSRException,
                             java.io.IOException
Returns the group no of ssdpattern and schemaobject in the SSMDR.

Returns:
a group no of the particular ssdpattern and schemaobject.
Throws:
SSMDRException
java.sql.SQLException
DSRException
java.io.IOException

getSPIDsBySFID

public static int[] getSPIDsBySFID(int sfid)
                            throws SSMDRException,
                                   java.sql.SQLException,
                                   DSRException,
                                   java.io.IOException
Returns the IDs of all the ssdpatterns found in the SSMDR.

Returns:
a list of all ssdpattern IDs found in the SSMDR. Returns an empty array if no ssdpattern are found in the SSMDR.
Throws:
SSMDRException
java.sql.SQLException
DSRException
java.io.IOException

removeAssociationBySFID

public static void removeAssociationBySFID(int sfid)
                                    throws SSMDRException,
                                           java.sql.SQLException,
                                           DSRException,
                                           java.io.IOException
Removes all associations for the given ssdformat identifier (SFID).

Parameters:
sfid - the ssdformat identifier (SFID) whose associations are to be removed.
Throws:
SSMDRException - if no record for the specified SFID is found in the SSMDR.
java.sql.SQLException
DSRException
java.io.IOException

main

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