gov.noaa.gdsg.xmldbremote.service
Class CollectionHandler

java.lang.Object
  extended bygov.noaa.gdsg.xmldbremote.service.BaseHandler
      extended bygov.noaa.gdsg.xmldbremote.service.CollectionHandler

public class CollectionHandler
extends BaseHandler

Handles the saving and involking of Collection objects.

Version:
$Id: CollectionHandler.java,v 1.2 2004/11/04 00:06:00 mrxtravis Exp $
Author:
tns

Constructor Summary
CollectionHandler()
          Creates a new instance of CollectionHandler
 
Method Summary
 void close(CollectionTransport transport)
          Closes the specified collection
 void closeAllCollections()
          Closes all known collections -- use for cleanup.
 java.lang.String createId(CollectionTransport transport)
          Creates an Id for the given collection{
 org.xmldb.api.base.Resource createResource(CollectionTransport transport, java.lang.String id, java.lang.String type)
          Creates a new empty resource with the given id
protected  BaseTransport createTransportObject(java.lang.Object object)
          Needed by the super class to create the appropriate object
 org.xmldb.api.base.Collection getChildCollection(CollectionTransport transport, java.lang.String name)
          Returns the child collection
 int getChildCollectionCount(CollectionTransport transport)
          Returns whatever is returned by the wrapped Collection.
 org.xmldb.api.base.Collection getParentCollection(CollectionTransport transport)
          Finds the parent collection for the specified collection
 org.xmldb.api.base.Resource getResource(CollectionTransport transport, java.lang.String id)
          Finds the specified resource
 int getResourceCount(CollectionTransport transport)
          Returns the number of resources in the specified collection by calling the wrapped Collection.getResourceCount() method.
 org.xmldb.api.base.Service getService(CollectionTransport transport, java.lang.String name, java.lang.String version)
          Returns the specified service of the specified name by calling the Collection.getService(java.lang.String, java.lang.String) method.
 org.xmldb.api.base.Service[] getServices(CollectionTransport transport)
          A wrapper for the Collection.getServices() method.
 boolean isOpen(CollectionTransport transport)
          Wrapper for the Collection.isOpen() method.
 java.lang.String[] listChildCollections(CollectionTransport transport)
          Returns a list of collection names naming all child collections of the specified collection by wrapping Collection.listChildCollections().
 java.lang.String[] listResources(CollectionTransport transport)
          Returns a list of the ids for all resources store in the specified collection.
 void removeResource(CollectionTransport transport, org.xmldb.api.base.Resource resource)
          Removes the resource
 void storeResource(CollectionTransport transport, org.xmldb.api.base.Resource resource)
          Stores the provided resource
 
Methods inherited from class gov.noaa.gdsg.xmldbremote.service.BaseHandler
getAllStoredObjects, getObjectFromSession, nextId, saveForSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionHandler

public CollectionHandler()
Creates a new instance of CollectionHandler

Method Detail

createTransportObject

protected BaseTransport createTransportObject(java.lang.Object object)
                                       throws org.xmldb.api.base.XMLDBException
Needed by the super class to create the appropriate object

Specified by:
createTransportObject in class BaseHandler
Parameters:
object - The object to base the transport object on.
Returns:
A CollectionTransport object representing the given object.
Throws:
org.xmldb.api.base.XMLDBException - All exceptions are rethrown as one.

close

public void close(CollectionTransport transport)
           throws org.xmldb.api.base.XMLDBException
Closes the specified collection

Parameters:
transport - The object representing the collection to close
Throws:
org.xmldb.api.base.XMLDBException - If the collection object throws an exception...

createId

public java.lang.String createId(CollectionTransport transport)
                          throws org.xmldb.api.base.XMLDBException
Creates an Id for the given collection{

Parameters:
transport - The object representing the collection to close
Returns:
The created id from the actual Collection object.
Throws:
org.xmldb.api.base.XMLDBException - If Collection.createId() throws one.

createResource

public org.xmldb.api.base.Resource createResource(CollectionTransport transport,
                                                  java.lang.String id,
                                                  java.lang.String type)
                                           throws org.xmldb.api.base.XMLDBException
Creates a new empty resource with the given id

Parameters:
transport - The object representing the collection to close
id - The id of the new resource
type - The type of resource to create
Returns:
Returns the newly created resource.
Throws:
org.xmldb.api.base.XMLDBException - If Collection.createResource(java.lang.String, java.lang.String) throws one.

getChildCollection

public org.xmldb.api.base.Collection getChildCollection(CollectionTransport transport,
                                                        java.lang.String name)
                                                 throws org.xmldb.api.base.XMLDBException
Returns the child collection

Parameters:
transport - The object representing the real object.
name - The name of the child collection to get.
Returns:
The child collection.
Throws:
org.xmldb.api.base.XMLDBException - If Collectiion#getChildCollection throws one.

getChildCollectionCount

public int getChildCollectionCount(CollectionTransport transport)
                            throws org.xmldb.api.base.XMLDBException
Returns whatever is returned by the wrapped Collection.

Parameters:
transport - The transport object which represents the actual object.
Returns:
Whatever the wrapped Collection#getchildCollectionCount returns.
Throws:
org.xmldb.api.base.XMLDBException - If the wrapped colelction throws an exception.

getParentCollection

public org.xmldb.api.base.Collection getParentCollection(CollectionTransport transport)
                                                  throws org.xmldb.api.base.XMLDBException
Finds the parent collection for the specified collection

Parameters:
transport - The transport object representin the actual object.
Returns:
transport The object representing the collection
Throws:
org.xmldb.api.base.XMLDBException - If the wrapped Collection.getParentCollection() object thows something.

getResource

public org.xmldb.api.base.Resource getResource(CollectionTransport transport,
                                               java.lang.String id)
                                        throws org.xmldb.api.base.XMLDBException
Finds the specified resource

Parameters:
transport - The transport object representing the real object.
id - The id to pass to the wrapped Collection.getResource(java.lang.String) method.
Returns:
the resource
Throws:
org.xmldb.api.base.XMLDBException - IF the wrapped method throws one.

getResourceCount

public int getResourceCount(CollectionTransport transport)
                     throws org.xmldb.api.base.XMLDBException
Returns the number of resources in the specified collection by calling the wrapped Collection.getResourceCount() method.

Parameters:
transport - The object representing the actual object.
Returns:
Whatevere the wrapped method throws.
Throws:
org.xmldb.api.base.XMLDBException - If the wrapped method throws one.

getService

public org.xmldb.api.base.Service getService(CollectionTransport transport,
                                             java.lang.String name,
                                             java.lang.String version)
                                      throws org.xmldb.api.base.XMLDBException
Returns the specified service of the specified name by calling the Collection.getService(java.lang.String, java.lang.String) method.

Parameters:
transport - The transport representing the actual object.
version - The version passed to the wrapped method.
name - The name of the service, passed to the wrapped method.
Returns:
Whatever the wrapped method returns.
Throws:
org.xmldb.api.base.XMLDBException - If the wrapped method throws one.

getServices

public org.xmldb.api.base.Service[] getServices(CollectionTransport transport)
                                         throws org.xmldb.api.base.XMLDBException
A wrapper for the Collection.getServices() method.

Parameters:
transport - The transport object representing the actual object.
Returns:
Whatever is returned by the wrapped method.
Throws:
org.xmldb.api.base.XMLDBException - Whatever the wrapped method throws.

isOpen

public boolean isOpen(CollectionTransport transport)
               throws org.xmldb.api.base.XMLDBException
Wrapper for the Collection.isOpen() method.

Parameters:
transport - The transport object representing the actual object.
Returns:
Whatever is returned by the wrapped method.
Throws:
org.xmldb.api.base.XMLDBException - Whatever is thrown by the wrapped method.

listChildCollections

public java.lang.String[] listChildCollections(CollectionTransport transport)
                                        throws org.xmldb.api.base.XMLDBException
Returns a list of collection names naming all child collections of the specified collection by wrapping Collection.listChildCollections().

Parameters:
transport - Represents the actual object.
Returns:
Whatever the wrapped method returns.
Throws:
org.xmldb.api.base.XMLDBException - Whatever the wrapped method throws.

listResources

public java.lang.String[] listResources(CollectionTransport transport)
                                 throws org.xmldb.api.base.XMLDBException
Returns a list of the ids for all resources store in the specified collection. This method wraps Collection.listResources().

Parameters:
transport - The transport object which represents the actual object.
Returns:
whatever is returned by the wrapped method.
Throws:
org.xmldb.api.base.XMLDBException - Whatever the wrapped method throws.

storeResource

public void storeResource(CollectionTransport transport,
                          org.xmldb.api.base.Resource resource)
                   throws org.xmldb.api.base.XMLDBException
Stores the provided resource

Parameters:
transport - which represents the actual object.
resource - Passed to the wrapped method.
Throws:
org.xmldb.api.base.XMLDBException - Whatever the wrapped method throws.

removeResource

public void removeResource(CollectionTransport transport,
                           org.xmldb.api.base.Resource resource)
                    throws org.xmldb.api.base.XMLDBException
Removes the resource

Parameters:
transport - which represents the actual object.
resource - passed to the wrapped method.
Throws:
org.xmldb.api.base.XMLDBException - whatever the wrapped method throws.

closeAllCollections

public void closeAllCollections()
Closes all known collections -- use for cleanup.



Copyright © 2004 DOC > NOAA > NGDC > EDSD. All Rights Reserved.