gov.noaa.gdsg.xmldbremote.service
Class XmlDbRemoteService

java.lang.Object
  extended bygov.noaa.gdsg.xmldbremote.service.XmlDbRemoteService
All Implemented Interfaces:
javax.xml.rpc.server.ServiceLifecycle

public class XmlDbRemoteService
extends java.lang.Object
implements javax.xml.rpc.server.ServiceLifecycle

This service is meant for session scope. It keeps track of the state the session is in and is meant as a functional interface to the XML:DB Database API.

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

Field Summary
protected  CollectionHandler collectionHandler
          Handler Collectio Object.
protected  org.xmldb.api.base.Database database
          The database this service wraps.
static java.lang.String databaseKey
           
protected  ResourceHandler resourceHandler
          Handler for resrouce object.
protected  ResourceSetHandler resourceSetHandler
          Handler for ResourceSet objects.
protected  ServiceHandler serviceHandler
          Handler for Service objects.
 
Constructor Summary
XmlDbRemoteService()
          Creates a new instance of XmlDbRemoteService
 
Method Summary
 boolean acceptsURI(java.lang.String uri)
          Determines if this database will accept the specified URI.
 void addResource(ResourceSetTransport transport, ResourceTransport resourceTransport)
          Wraps the ResourceSetHandler.addResource(gov.noaa.gdsg.xmldbremote.service.transport.ResourceSetTransport, org.xmldb.api.base.Resource) method.
 void clear(ResourceSetTransport transport)
          Wraps the ResourceSetHandler.clear(gov.noaa.gdsg.xmldbremote.service.transport.ResourceSetTransport) method.
 void clearNamespaces(ServiceTransport transport)
          Wrapper to ServiceHandler.clearNamespaces(gov.noaa.gdsg.xmldbremote.service.transport.ServiceTransport) method.
 void close(CollectionTransport transport)
          Wrapper for the Database#close method.
 java.lang.String createId(CollectionTransport transport)
          Wrapper for the Database#createId method.
 ResourceTransport createResource(CollectionTransport transport, java.lang.String id, java.lang.String type)
          Calls CollectionHandler.createResource(gov.noaa.gdsg.xmldbremote.service.transport.CollectionTransport, java.lang.String, java.lang.String) and the BaseHandler.saveForSession(java.lang.Object) with the resulting Resource.
 void destroy()
           
 CollectionTransport getChildCollection(CollectionTransport transport, java.lang.String name)
          Calls CollectionHander#getChildCollection and then BaseHandler.saveForSession(java.lang.Object) with the resulting Collection.
 int getChildCollectionCount(CollectionTransport transport)
          Wrapper for Collection#getCildCollectionCount.
 CollectionTransport getCollection(java.lang.String uri, java.lang.String userName, java.lang.String password)
          Returns the collection associated
 java.lang.String getConformanceLevel()
          A wrapper call to the Database object.
 java.lang.String getContentAsDOMText(ResourceTransport transport)
          Wraps the ResourceHandler.getContentAsDOMText(gov.noaa.gdsg.xmldbremote.service.transport.ResourceTransport) method.
 java.lang.String getDocumentId(ResourceTransport transport)
          Wraps the {@see ResourceHandler#getDocumentId) method.
 ResourceTransport getMembersAsResource(ResourceSetTransport transport)
          Wraps the method.
 java.lang.String getName()
          A wrapped call to the Database object.
 java.lang.String getNamespace(ServiceTransport transport, java.lang.String prefix)
          Wraps the ServiceHandler.getNamespace(gov.noaa.gdsg.xmldbremote.service.transport.ServiceTransport, java.lang.String) method.
 CollectionTransport getParentCollection(CollectionTransport transport)
          Wraps the CollectionHandler.getParentCollection(gov.noaa.gdsg.xmldbremote.service.transport.CollectionTransport) and the calls BaseHandler.saveForSession(java.lang.Object) with the resulting Collection.
 CollectionTransport getParentCollection(ResourceTransport transport)
          Wraps the Resource.getParentCollection() method.
 ResourceTransport getResource(CollectionTransport transport, java.lang.String id)
          Wraps the CollectionHandler.getResource(gov.noaa.gdsg.xmldbremote.service.transport.CollectionTransport, java.lang.String) method and calls BaseHandler.saveForSession(java.lang.Object) with the resulting Resource.
 ResourceTransport getResource(ResourceSetTransport transport, long index)
          Wraps the ResourceSetHandler.getResource(gov.noaa.gdsg.xmldbremote.service.transport.ResourceSetTransport, long) method.
 int getResourceCount(CollectionTransport transport)
          Wrapped the CollectionHandler#getResourcecount method.
 ServiceTransport getService(CollectionTransport transport, java.lang.String name, java.lang.String version)
          Wrap the CollectionHandler.getService(gov.noaa.gdsg.xmldbremote.service.transport.CollectionTransport, java.lang.String, java.lang.String) method then calls BaseHandler.saveForSession(java.lang.Object) with the resulting Service.
 ServiceTransport[] getServices(CollectionTransport transport)
          Wraps the CollectionHandler.getServices(gov.noaa.gdsg.xmldbremote.service.transport.CollectionTransport) method and the calls SercieHandler#saveForSession with the resulting Service object.
 long getSize(ResourceSetTransport transport)
          Wraps the ResourceSetHandler@getSize method.
 void init(java.lang.Object context)
          Grabs the Database from the servlet context with attribute "org.xmldb.api.base.Database".
 boolean isOpen(CollectionTransport transport)
          Wraps the CollectionHandler.isOpen(gov.noaa.gdsg.xmldbremote.service.transport.CollectionTransport) method.
 java.lang.String[] listChildCollections(CollectionTransport transport)
          Wrapps the CollectionHander#listChildCollections method.
 java.lang.String[] listResources(CollectionTransport transport)
          Wraps the CollectionHandler.listResources(gov.noaa.gdsg.xmldbremote.service.transport.CollectionTransport) method.
 ResourceSetTransport query(ServiceTransport transport, java.lang.String query)
          Wraps the ServiceHandler.query(gov.noaa.gdsg.xmldbremote.service.transport.ServiceTransport, java.lang.String) method.
 ResourceSetTransport queryResource(ServiceTransport transport, java.lang.String id, java.lang.String query)
          Wraps the ServiceHandler#queyResource method.
 void removeNamespace(ServiceTransport transport, java.lang.String prefix)
          Wraps the ServiceHandler.removeNamespace(gov.noaa.gdsg.xmldbremote.service.transport.ServiceTransport, java.lang.String) method.
 void removeResource(CollectionTransport transport, ResourceTransport resourceTransport)
          Wraps the CollectionHandler.removeResource(gov.noaa.gdsg.xmldbremote.service.transport.CollectionTransport, org.xmldb.api.base.Resource) method.
 void removeResource(ResourceSetTransport transport, long index)
          Wraps the ResourceSetHandler.removeResource(gov.noaa.gdsg.xmldbremote.service.transport.ResourceSetTransport, long) method.
 void setCollection(ServiceTransport transport, CollectionTransport collectionTransport)
          Wraps the ServiceHandler.setCollection(gov.noaa.gdsg.xmldbremote.service.transport.ServiceTransport, org.xmldb.api.base.Collection) method.
 void setContentAsDOMText(ResourceTransport transport, java.lang.String xml)
          Wraps the ResourceHandler.setContentAsDOMText(gov.noaa.gdsg.xmldbremote.service.transport.ResourceTransport, java.lang.String).
 void setNamespace(ServiceTransport transport, java.lang.String prefix, java.lang.String uri)
          Wraps the ServiceHandler.setNamespace(gov.noaa.gdsg.xmldbremote.service.transport.ServiceTransport, java.lang.String, java.lang.String) method.
 void storeResource(CollectionTransport transport, ResourceTransport resourceTransport)
          Wraps the CollectionHandler.storeResource(gov.noaa.gdsg.xmldbremote.service.transport.CollectionTransport, org.xmldb.api.base.Resource) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

databaseKey

public static final java.lang.String databaseKey
See Also:
Constant Field Values

collectionHandler

protected CollectionHandler collectionHandler
Handler Collectio Object.


resourceHandler

protected ResourceHandler resourceHandler
Handler for resrouce object.


resourceSetHandler

protected ResourceSetHandler resourceSetHandler
Handler for ResourceSet objects.


serviceHandler

protected ServiceHandler serviceHandler
Handler for Service objects.


database

protected org.xmldb.api.base.Database database
The database this service wraps.

Constructor Detail

XmlDbRemoteService

public XmlDbRemoteService()
Creates a new instance of XmlDbRemoteService

Throws:
XmlDbRemoteException - If it cannot find a database in the database manager.
Method Detail

destroy

public void destroy()
Specified by:
destroy in interface javax.xml.rpc.server.ServiceLifecycle

init

public void init(java.lang.Object context)
          throws javax.xml.rpc.ServiceException
Grabs the Database from the servlet context with attribute "org.xmldb.api.base.Database".

Specified by:
init in interface javax.xml.rpc.server.ServiceLifecycle
Parameters:
context - The ServletEndpiontContext
Throws:
javax.xml.rpc.ServiceException

acceptsURI

public boolean acceptsURI(java.lang.String uri)
                   throws XmlDbRemoteException
Determines if this database will accept the specified URI.

Parameters:
uri - The URI in which to check.
Returns:
True if the DB accepts the URI, false otherwise.
Throws:
XmlDbRemoteException - Rethrows whatever the DB throws.

getConformanceLevel

public java.lang.String getConformanceLevel()
                                     throws XmlDbRemoteException
A wrapper call to the Database object.

Returns:
Whatever the DB returns.
Throws:
XmlDbRemoteException - Throws whatever the DB throws.

getName

public java.lang.String getName()
                         throws XmlDbRemoteException
A wrapped call to the Database object.

Returns:
Whatever the DB returns.
Throws:
XmlDbRemoteException - Whatever the DB throws.

getCollection

public CollectionTransport getCollection(java.lang.String uri,
                                         java.lang.String userName,
                                         java.lang.String password)
                                  throws XmlDbRemoteException
Returns the collection associated

Parameters:
uri - The uri of the collectioin.
userName - The user name to log in with
password - The password used to log in with
Returns:
Whatever the wrapped method returns.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

close

public void close(CollectionTransport transport)
           throws XmlDbRemoteException
Wrapper for the Database#close method.

Parameters:
transport - The object representing the collection to close
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

createId

public java.lang.String createId(CollectionTransport transport)
                          throws XmlDbRemoteException
Wrapper for the Database#createId method.

Parameters:
transport - The object representing the collection to close
Returns:
Whatever the wrapped method returns.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

createResource

public ResourceTransport createResource(CollectionTransport transport,
                                        java.lang.String id,
                                        java.lang.String type)
                                 throws XmlDbRemoteException
Calls CollectionHandler.createResource(gov.noaa.gdsg.xmldbremote.service.transport.CollectionTransport, java.lang.String, java.lang.String) and the BaseHandler.saveForSession(java.lang.Object) with the resulting Resource.

Parameters:
transport - The object representing the collection to close
id - The id of the new resource
type - The type of resource to create
Returns:
Whatever the wrapped method returns.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

getChildCollection

public CollectionTransport getChildCollection(CollectionTransport transport,
                                              java.lang.String name)
                                       throws XmlDbRemoteException
Calls CollectionHander#getChildCollection and then BaseHandler.saveForSession(java.lang.Object) with the resulting Collection.

Parameters:
transport - Pass to wraped method.
name - Passed olong.
Returns:
Whatever the wrapped method returns.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

getChildCollectionCount

public int getChildCollectionCount(CollectionTransport transport)
                            throws XmlDbRemoteException
Wrapper for Collection#getCildCollectionCount.

Parameters:
transport - Pass along.
Returns:
Whatever the wrapped method returns.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

getParentCollection

public CollectionTransport getParentCollection(CollectionTransport transport)
                                        throws XmlDbRemoteException
Wraps the CollectionHandler.getParentCollection(gov.noaa.gdsg.xmldbremote.service.transport.CollectionTransport) and the calls BaseHandler.saveForSession(java.lang.Object) with the resulting Collection.

Parameters:
transport - Passed along.
Returns:
transport The object representing the collection
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

getResource

public ResourceTransport getResource(CollectionTransport transport,
                                     java.lang.String id)
                              throws XmlDbRemoteException
Wraps the CollectionHandler.getResource(gov.noaa.gdsg.xmldbremote.service.transport.CollectionTransport, java.lang.String) method and calls BaseHandler.saveForSession(java.lang.Object) with the resulting Resource.

Parameters:
transport - Passed along
id - Passed along.
Returns:
Whatever the wrapped method returns.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

getResourceCount

public int getResourceCount(CollectionTransport transport)
                     throws XmlDbRemoteException
Wrapped the CollectionHandler#getResourcecount method. Returns the number of resources in the specified collection

Parameters:
transport - Passed along.
Returns:
Whatever the wrapped method returns.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

getService

public ServiceTransport getService(CollectionTransport transport,
                                   java.lang.String name,
                                   java.lang.String version)
                            throws XmlDbRemoteException
Wrap the CollectionHandler.getService(gov.noaa.gdsg.xmldbremote.service.transport.CollectionTransport, java.lang.String, java.lang.String) method then calls BaseHandler.saveForSession(java.lang.Object) with the resulting Service.

Parameters:
transport - Passed along.
version - Passed along.
name - Passed along.
Returns:
Whatever the wrapped method returns.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

getServices

public ServiceTransport[] getServices(CollectionTransport transport)
                               throws XmlDbRemoteException
Wraps the CollectionHandler.getServices(gov.noaa.gdsg.xmldbremote.service.transport.CollectionTransport) method and the calls SercieHandler#saveForSession with the resulting Service object. Returns the services of the specified collection

Parameters:
transport - Passed along.
Returns:
Whatever the wrapped method returns.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

isOpen

public boolean isOpen(CollectionTransport transport)
               throws XmlDbRemoteException
Wraps the CollectionHandler.isOpen(gov.noaa.gdsg.xmldbremote.service.transport.CollectionTransport) method. Returns true if the Collection is open, false otherwise

Parameters:
transport - Passed along.
Returns:
Whatever the wrapped method returns.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

listChildCollections

public java.lang.String[] listChildCollections(CollectionTransport transport)
                                        throws XmlDbRemoteException
Wrapps the CollectionHander#listChildCollections method. Returns a list of collection names naming all child collections of the specified collection

Parameters:
transport - Passed along.
Returns:
Whatever the wrapped method returns.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

listResources

public java.lang.String[] listResources(CollectionTransport transport)
                                 throws XmlDbRemoteException
Wraps the CollectionHandler.listResources(gov.noaa.gdsg.xmldbremote.service.transport.CollectionTransport) method. Returns a list of the ids for all resources store in the specified collection.

Parameters:
transport - Passed along.
Returns:
Whatever the wrapped method returns.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

storeResource

public void storeResource(CollectionTransport transport,
                          ResourceTransport resourceTransport)
                   throws XmlDbRemoteException
Wraps the CollectionHandler.storeResource(gov.noaa.gdsg.xmldbremote.service.transport.CollectionTransport, org.xmldb.api.base.Resource) method. Stores the provided resource.

Parameters:
transport - Passed along.
resourceTransport - Passed along.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

removeResource

public void removeResource(CollectionTransport transport,
                           ResourceTransport resourceTransport)
                    throws XmlDbRemoteException
Wraps the CollectionHandler.removeResource(gov.noaa.gdsg.xmldbremote.service.transport.CollectionTransport, org.xmldb.api.base.Resource) method. Removes the resource.

Parameters:
transport - Passed along.
resourceTransport - Passed along.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

addResource

public void addResource(ResourceSetTransport transport,
                        ResourceTransport resourceTransport)
                 throws XmlDbRemoteException
Wraps the ResourceSetHandler.addResource(gov.noaa.gdsg.xmldbremote.service.transport.ResourceSetTransport, org.xmldb.api.base.Resource) method. Adds a resource instance to the set

Parameters:
transport - Passed along.
resourceTransport - Passed along.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

clear

public void clear(ResourceSetTransport transport)
           throws XmlDbRemoteException
Wraps the ResourceSetHandler.clear(gov.noaa.gdsg.xmldbremote.service.transport.ResourceSetTransport) method.

Parameters:
transport - Passed along.
Throws:
XmlDbRemoteException - You always take whats left behind You never seem to mind You always take whats left behind But you're never mine

getMembersAsResource

public ResourceTransport getMembersAsResource(ResourceSetTransport transport)
                                       throws XmlDbRemoteException
Wraps the method. Iiterator should be handled on the client

Parameters:
transport - Passed along.
Returns:
Whatever the wrapped method returns.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

getResource

public ResourceTransport getResource(ResourceSetTransport transport,
                                     long index)
                              throws XmlDbRemoteException
Wraps the ResourceSetHandler.getResource(gov.noaa.gdsg.xmldbremote.service.transport.ResourceSetTransport, long) method.

Parameters:
transport - Passed along.
index - Passed along.
Returns:
Whatever the wrapped method returns.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

getSize

public long getSize(ResourceSetTransport transport)
             throws XmlDbRemoteException
Wraps the ResourceSetHandler@getSize method.

Parameters:
transport - Passed along.
Returns:
Whatever the wrapped method thorws.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

removeResource

public void removeResource(ResourceSetTransport transport,
                           long index)
                    throws XmlDbRemoteException
Wraps the ResourceSetHandler.removeResource(gov.noaa.gdsg.xmldbremote.service.transport.ResourceSetTransport, long) method.

Parameters:
transport - Passed along.
index - Passed along.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

getContentAsDOMText

public java.lang.String getContentAsDOMText(ResourceTransport transport)
                                     throws XmlDbRemoteException
Wraps the ResourceHandler.getContentAsDOMText(gov.noaa.gdsg.xmldbremote.service.transport.ResourceTransport) method.

Parameters:
transport - Passed along.
Returns:
Whatever the wrapped method returns.
Throws:
XmlDbRemoteException - Whatever the wrapped method thorws.

getDocumentId

public java.lang.String getDocumentId(ResourceTransport transport)
                               throws XmlDbRemoteException
Wraps the {@see ResourceHandler#getDocumentId) method.

Parameters:
transport - Passed along.
Returns:
Whatever the wrapped method returns.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

setContentAsDOMText

public void setContentAsDOMText(ResourceTransport transport,
                                java.lang.String xml)
                         throws XmlDbRemoteException
Wraps the ResourceHandler.setContentAsDOMText(gov.noaa.gdsg.xmldbremote.service.transport.ResourceTransport, java.lang.String).

Parameters:
transport - Passed along.
xml - Passed along.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

getParentCollection

public CollectionTransport getParentCollection(ResourceTransport transport)
                                        throws XmlDbRemoteException
Wraps the Resource.getParentCollection() method.

Parameters:
transport - Passed along.
Returns:
Whatever the wrapped method returns.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

clearNamespaces

public void clearNamespaces(ServiceTransport transport)
                     throws XmlDbRemoteException
Wrapper to ServiceHandler.clearNamespaces(gov.noaa.gdsg.xmldbremote.service.transport.ServiceTransport) method.

Parameters:
transport - Passed along.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

getNamespace

public java.lang.String getNamespace(ServiceTransport transport,
                                     java.lang.String prefix)
                              throws XmlDbRemoteException
Wraps the ServiceHandler.getNamespace(gov.noaa.gdsg.xmldbremote.service.transport.ServiceTransport, java.lang.String) method.

Parameters:
transport - Passed along.
prefix - Passed along.
Returns:
Whatever the wrapped method returns.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

query

public ResourceSetTransport query(ServiceTransport transport,
                                  java.lang.String query)
                           throws XmlDbRemoteException
Wraps the ServiceHandler.query(gov.noaa.gdsg.xmldbremote.service.transport.ServiceTransport, java.lang.String) method.

Parameters:
transport - Passed along.
query - Passed along.
Returns:
Whatever the wrapped method returns.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

queryResource

public ResourceSetTransport queryResource(ServiceTransport transport,
                                          java.lang.String id,
                                          java.lang.String query)
                                   throws XmlDbRemoteException
Wraps the ServiceHandler#queyResource method.

Parameters:
transport - Passed along.
id - Passed along.
query - Passed along.
Returns:
Whatever the wrapped method returns.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

removeNamespace

public void removeNamespace(ServiceTransport transport,
                            java.lang.String prefix)
                     throws XmlDbRemoteException
Wraps the ServiceHandler.removeNamespace(gov.noaa.gdsg.xmldbremote.service.transport.ServiceTransport, java.lang.String) method.

Parameters:
transport - Passed along.
prefix - Passed along.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

setNamespace

public void setNamespace(ServiceTransport transport,
                         java.lang.String prefix,
                         java.lang.String uri)
                  throws XmlDbRemoteException
Wraps the ServiceHandler.setNamespace(gov.noaa.gdsg.xmldbremote.service.transport.ServiceTransport, java.lang.String, java.lang.String) method.

Parameters:
transport - Passed along.
prefix - Passed along.
uri - Passed along.
Throws:
XmlDbRemoteException - Whatever the wrapped method throws.

setCollection

public void setCollection(ServiceTransport transport,
                          CollectionTransport collectionTransport)
                   throws XmlDbRemoteException
Wraps the ServiceHandler.setCollection(gov.noaa.gdsg.xmldbremote.service.transport.ServiceTransport, org.xmldb.api.base.Collection) method.

Parameters:
transport - Passed along.
collectionTransport - Passed along.
Throws:
XmlDbRemoteException - Whatever the wrapped method thorws.


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