xdrs_impl.genericdb
Interface Handler

All Known Implementing Classes:
GenericNodeHandler

public interface Handler

A Handler is a piece of code that knows how to handle a specific type, or a group of types. It is specific to a certain data storage system, and should be able to store and retreive nodes in that storage system.


Method Summary
 Node add(DBImplementation db, java.sql.Connection connection, Mapping parent, java.lang.String path, org.gjt.xpp.XmlNode nodeXml)
          Add a new node described by the given nodeXml to the storage system.
 void addChild(DBImplementation db, java.sql.Connection connection, Mapping parentMapping, java.lang.String childPath, org.gjt.xpp.XmlNode child)
          Do whatever is necessary to add the given child to the described parent.
 void create(java.sql.Connection connection)
          Create everything that is needed for storage.
 void delete(DBImplementation db, java.sql.Connection connection, int id)
          Delete the node with the given id.
 void drop(java.sql.Connection connection)
          Remove everything that is needed for storage.
 boolean exists(DBImplementation db, java.sql.Connection connection, int id)
          Check and see if a node with the given id exists.
 Node get(DBImplementation db, java.sql.Connection connection, int id)
          Get the node with the given id from the storage system.
 Node update(DBImplementation db, java.sql.Connection connection, Mapping mapping, org.gjt.xpp.XmlNode nodeXml)
          Update the node whose mapping is given so it matches the given XML representation.
 

Method Detail

create

public void create(java.sql.Connection connection)
            throws soaprmi.RemoteException,
                   java.sql.SQLException
Create everything that is needed for storage.

Parameters:
connection - A database connection.
Throws:
soaprmi.RemoteException
java.sql.SQLException

drop

public void drop(java.sql.Connection connection)
          throws soaprmi.RemoteException,
                 java.sql.SQLException
Remove everything that is needed for storage.

Parameters:
connection - A database connection.
Throws:
soaprmi.RemoteException
java.sql.SQLException

add

public Node add(DBImplementation db,
                java.sql.Connection connection,
                Mapping parent,
                java.lang.String path,
                org.gjt.xpp.XmlNode nodeXml)
         throws soaprmi.RemoteException,
                java.sql.SQLException,
                org.gjt.xpp.XmlPullParserException
Add a new node described by the given nodeXml to the storage system. Also, return an instance of that node. NOTE: It is very important to set the returned Node's ID to the id created for the new node.

Parameters:
connection - A database connection.
parent - A mapping for the new node's parent.
path - The path to this new node.
nodeXml - An XML representation of the new node.
Returns:
A copy of the new node.
Throws:
soaprmi.RemoteException
java.sql.SQLException
org.gjt.xpp.XmlPullParserException

addChild

public void addChild(DBImplementation db,
                     java.sql.Connection connection,
                     Mapping parentMapping,
                     java.lang.String childPath,
                     org.gjt.xpp.XmlNode child)
              throws soaprmi.RemoteException,
                     java.sql.SQLException,
                     org.gjt.xpp.XmlPullParserException
Do whatever is necessary to add the given child to the described parent. An exception should be thrown in the addition of children is now allowed for the type of nodes being handled by the handler.

Parameters:
connection - A database connection.
parentMapping - The parent's mapping.
childPath - The child's path.
child - An XML representation of the child.
Throws:
soaprmi.RemoteException
java.sql.SQLException
org.gjt.xpp.XmlPullParserException

update

public Node update(DBImplementation db,
                   java.sql.Connection connection,
                   Mapping mapping,
                   org.gjt.xpp.XmlNode nodeXml)
            throws soaprmi.RemoteException,
                   java.sql.SQLException,
                   org.gjt.xpp.XmlPullParserException
Update the node whose mapping is given so it matches the given XML representation. Note: It is very important to set the id of the node that is returned, as it is used for automatically updating arributes.

Parameters:
connection - A database connection.
mapping - The mapping for the node to be updated.
nodeXml - The node's new XML representation.
Returns:
A copy of the new node.
Throws:
soaprmi.RemoteException
java.sql.SQLException
org.gjt.xpp.XmlPullParserException

get

public Node get(DBImplementation db,
                java.sql.Connection connection,
                int id)
         throws soaprmi.RemoteException,
                java.sql.SQLException,
                org.gjt.xpp.XmlPullParserException
Get the node with the given id from the storage system. Note: It is very important to set the returned node's id to the given id.

Parameters:
connection - A database connection.
id - The id of the node to be retreived.
Returns:
A representation of the requested node.
Throws:
soaprmi.RemoteException
java.sql.SQLException
org.gjt.xpp.XmlPullParserException

exists

public boolean exists(DBImplementation db,
                      java.sql.Connection connection,
                      int id)
               throws soaprmi.RemoteException,
                      java.sql.SQLException
Check and see if a node with the given id exists.

Parameters:
connection - A database connection.
id - The id of the node to look up.
Returns:
Whether or not a node with the given id exists.
Throws:
soaprmi.RemoteException
java.sql.SQLException

delete

public void delete(DBImplementation db,
                   java.sql.Connection connection,
                   int id)
            throws soaprmi.RemoteException,
                   java.sql.SQLException
Delete the node with the given id.

Parameters:
connection - A database connection.
id - The id of the node to delete.
Throws:
soaprmi.RemoteException
java.sql.SQLException