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

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

public class AccessMethod
extends java.lang.Object

The AccessMethod class describes how a particular database presented by a Schema can be accessed by an AutoMed application, using a particular Protocol. This is very experimental at present, and has only been designed to handle JDBC/ODBC type protocols.

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

Method Summary
protected static void clearAccessMethods()
           
static AccessMethod createAccessMethod(Schema schema, java.lang.String url, Protocol protocol, java.lang.String dbDriver, java.lang.String username)
          Creates a new access method.
static AccessMethod getAccessMethod(int amid)
          Returns the AccessMethod held with the given identifier in in the STR.
 java.lang.String getDBDriver()
          Returns the database driver used for connecting to the database.
 Protocol getProtocol()
          Returns the Protocol used for connecting to the database.
 Schema getSchema()
          Returns the schema that represents the database to which the access method connects.
 java.lang.String getURL()
          Returns the URL of the database to which the access method connects.
 java.lang.String getUsername()
          Returns the username used for connecting to the database.
 void remove()
          Remove this AccessMethod from the repository.
 void retract()
          Remove this AccessMethod, and any other classes that are dependent upon its existance.
 void setDBDriver(java.lang.String dbDriver)
          Sets the database driver used for connecting to the database.
 void setProtocol(Protocol protocol)
          Sets the protocol used for connecting to the database.
 void setSchema(Schema schema)
          Sets the schema that represents the database to which the access method connects.
 void setURL(java.lang.String url)
          Sets the URL of the database to which the access method connects.
 void setUsername(java.lang.String username)
          Sets the username used for connecting to the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createAccessMethod

public static AccessMethod createAccessMethod(Schema schema,
                                              java.lang.String url,
                                              Protocol protocol,
                                              java.lang.String dbDriver,
                                              java.lang.String username)
                                       throws STRException,
                                              java.sql.SQLException,
                                              DataSourceRepositoryException,
                                              java.io.IOException
Creates a new access method.

Parameters:
schema - the Schema that represents the database to which the access method connects.
url - the URL of the database the access method connects to.
protocol - the Protocol used for the connection.
dbDriver - the database driver used for the connection.
username - the username for connecting to the database.
Throws:
AutoRepException
STRException
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException
ModelDefinitionsRepositoryException
BadSchemaException

remove

public void remove()
            throws InconsistentException
Remove this AccessMethod from the repository.

InconsistentException

retract

public void retract()
             throws InconsistentException
Remove this AccessMethod, and any other classes that are dependent upon its existance. Note that in the current version of the repository there are no such classes, and therefore this is equivalent to calling {link #remove()}.

InconsistentException

getAccessMethod

public static AccessMethod getAccessMethod(int amid)
                                    throws NotFoundException
Returns the AccessMethod held with the given identifier in in the STR.

Parameters:
amid - the access method identifier (AMID) found in the STR.
Throws:
AutoRepException
STRException
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException
ModelDefinitionsRepositoryException
BadSchemaException
NotFoundException

getSchema

public Schema getSchema()
Returns the schema that represents the database to which the access method connects.

Returns:
the schema that represents the database to which the access method connects.

getURL

public java.lang.String getURL()
Returns the URL of the database to which the access method connects.

Returns:
the URL of the database to which the access method connects.

getProtocol

public Protocol getProtocol()
Returns the Protocol used for connecting to the database.

Returns:
the Protocol used for connecting to the database.

getDBDriver

public java.lang.String getDBDriver()
Returns the database driver used for connecting to the database.

Returns:
the database driver used for connecting to the database.

getUsername

public java.lang.String getUsername()
Returns the username used for connecting to the database.

Returns:
the username used for connecting to the database.

setSchema

public void setSchema(Schema schema)
               throws STRException,
                      java.sql.SQLException,
                      DataSourceRepositoryException,
                      java.io.IOException
Sets the schema that represents the database to which the access method connects.

Parameters:
schema - the Schema that represents the database to which the access method connects.
Throws:
AutoRepException
STRException
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException
ModelDefinitionsRepositoryException
BadSchemaException

setURL

public void setURL(java.lang.String url)
            throws STRException,
                   java.sql.SQLException,
                   DataSourceRepositoryException,
                   java.io.IOException
Sets the URL of the database to which the access method connects.

Parameters:
url - the URL of the database to which the access method connects.
Throws:
AutoRepException
STRException
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException
ModelDefinitionsRepositoryException

setProtocol

public void setProtocol(Protocol protocol)
                 throws STRException,
                        java.sql.SQLException,
                        DataSourceRepositoryException,
                        java.io.IOException
Sets the protocol used for connecting to the database.

Parameters:
protocol - the Protocol used for connecting to the database.
Throws:
AutoRepException
STRException
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException
ModelDefinitionsRepositoryException

setDBDriver

public void setDBDriver(java.lang.String dbDriver)
                 throws STRException,
                        java.sql.SQLException,
                        DataSourceRepositoryException,
                        java.io.IOException
Sets the database driver used for connecting to the database.

Parameters:
dbDriver - the database driver used for connecting to the database.
Throws:
AutoRepException
STRException
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException
ModelDefinitionsRepositoryException

setUsername

public void setUsername(java.lang.String username)
                 throws STRException,
                        java.sql.SQLException,
                        DataSourceRepositoryException,
                        java.io.IOException
Sets the username used for connecting to the database.

Parameters:
username - the username used for connecting to the database.
Throws:
AutoRepException
STRException
java.sql.SQLException
DataSourceRepositoryException
java.io.IOException
ModelDefinitionsRepositoryException

clearAccessMethods

protected static void clearAccessMethods()