xdrs_impl.genericdb
Class GenericNodeHandler

java.lang.Object
  extended byxdrs_impl.genericdb.GenericNodeHandler
All Implemented Interfaces:
Handler
Direct Known Subclasses:
GenericDirectoryHandler, GenericLeafHandler

public class GenericNodeHandler
extends java.lang.Object
implements Handler


Constructor Summary
GenericNodeHandler()
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericNodeHandler

public GenericNodeHandler()
Method Detail

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
Description copied from interface: Handler
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.

Specified by:
add in interface Handler
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:
java.sql.SQLException
org.gjt.xpp.XmlPullParserException
soaprmi.RemoteException

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
Description copied from interface: Handler
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.

Specified by:
update in interface Handler
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:
org.gjt.xpp.XmlPullParserException
java.sql.SQLException
soaprmi.RemoteException

get

public Node get(DBImplementation db,
                java.sql.Connection connection,
                int id)
         throws soaprmi.RemoteException,
                java.sql.SQLException,
                org.gjt.xpp.XmlPullParserException
Description copied from interface: Handler
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.

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

exists

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

Specified by:
exists in interface Handler
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:
java.sql.SQLException
soaprmi.RemoteException

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
Description copied from interface: Handler
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.

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

delete

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

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

create

public void create(java.sql.Connection connection)
            throws soaprmi.RemoteException,
                   java.sql.SQLException
Description copied from interface: Handler
Create everything that is needed for storage.

Specified by:
create in interface Handler
Parameters:
connection - A database connection.
Throws:
java.sql.SQLException
soaprmi.RemoteException

drop

public void drop(java.sql.Connection connection)
          throws soaprmi.RemoteException,
                 java.sql.SQLException
Description copied from interface: Handler
Remove everything that is needed for storage.

Specified by:
drop in interface Handler
Parameters:
connection - A database connection.
Throws:
java.sql.SQLException
soaprmi.RemoteException