gov.noaa.edsd.sessionlessRemoteXmlDb
Class SessionlessXmldbService

java.lang.Object
  extended bygov.noaa.edsd.sessionlessRemoteXmlDb.SessionlessXmldbService
All Implemented Interfaces:
javax.xml.rpc.server.ServiceLifecycle

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

Provides a really simple interface to an XAPI database.

Version:
$Id$
Author:
tns

Field Summary
static java.lang.String DATABASE_KEY
           
 
Constructor Summary
SessionlessXmldbService()
          Creates a new instance of Service
 
Method Summary
 void destroy()
          removes reference to database
 java.lang.String getXmlResource(java.lang.String collectionName, java.lang.String resourceId, java.lang.String userName, java.lang.String password)
          Retrieves a resource by id
 java.lang.String getXmlResourceWithXpath(java.lang.String collectionName, java.lang.String xpathQuery, java.lang.String userName, java.lang.String password)
          Retrieves a resource using xpath
 void init(java.lang.Object context)
          Grabs the Database from the servlet context with attribute "org.xmldb.api.base.Database".
 java.lang.String insertResource(java.lang.String collectionName, java.lang.String xml, java.lang.String userName, java.lang.String password)
          Saves the specified XML String in the collection.
 boolean isCollectionAvailable(java.lang.String collectionName)
          Checks to see if the collection is available
 void updateResource(java.lang.String collectionName, java.lang.String resourceId, java.lang.String xml, java.lang.String userName, java.lang.String password)
          Updates the specified resource by replaceing the entire record with the specified record.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATABASE_KEY

public static java.lang.String DATABASE_KEY
Constructor Detail

SessionlessXmldbService

public SessionlessXmldbService()
Creates a new instance of Service

Method Detail

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

destroy

public void destroy()
removes reference to database

Specified by:
destroy in interface javax.xml.rpc.server.ServiceLifecycle

isCollectionAvailable

public boolean isCollectionAvailable(java.lang.String collectionName)
                              throws SessionlessException
Checks to see if the collection is available

Parameters:
collectionName -
Throws:
SessionlessException

getXmlResourceWithXpath

public java.lang.String getXmlResourceWithXpath(java.lang.String collectionName,
                                                java.lang.String xpathQuery,
                                                java.lang.String userName,
                                                java.lang.String password)
                                         throws SessionlessException
Retrieves a resource using xpath

Parameters:
collectionName - The name of the collection to user
xpathQuery - The xpath to use to find a resource
userName - The user name used for verification
password - The password used for verification
Returns:
String the XML as a String or null if there is not a resource that satisfies the query.
Throws:
SessionlessException

getXmlResource

public java.lang.String getXmlResource(java.lang.String collectionName,
                                       java.lang.String resourceId,
                                       java.lang.String userName,
                                       java.lang.String password)
                                throws SessionlessException
Retrieves a resource by id

Parameters:
collectionName - The name of the collection
resourceId - The id of the resource to retrieve
Throws:
SessionlessException

updateResource

public void updateResource(java.lang.String collectionName,
                           java.lang.String resourceId,
                           java.lang.String xml,
                           java.lang.String userName,
                           java.lang.String password)
                    throws SessionlessException
Updates the specified resource by replaceing the entire record with the specified record.

Parameters:
collectionName - The collection which contains the current resource
resourceId - The id of the resource
xml - The xml string to replace
userName - The user name to use for verification
password - The password to use for verification
Throws:
SessionlessException

insertResource

public java.lang.String insertResource(java.lang.String collectionName,
                                       java.lang.String xml,
                                       java.lang.String userName,
                                       java.lang.String password)
                                throws SessionlessException
Saves the specified XML String in the collection.

Parameters:
collectionName - The name of the collection to insert the record in.
xml - The xml to insert.
userName - The user name to use for verification
password - The password to use for verification
Throws:
SessionlessException


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