gov.noaa.eds.xapi.generic
Class GenericCollection

java.lang.Object
  extended bygov.noaa.eds.xapi.generic.GenericConfigurable
      extended bygov.noaa.eds.xapi.generic.GenericCollection
All Implemented Interfaces:
org.xmldb.api.base.Collection, org.xmldb.api.base.Configurable

public class GenericCollection
extends GenericConfigurable
implements org.xmldb.api.base.Collection

An implementation of Collection which uses a hashtable to map resource ids to resource objects.

Version:
$Id: GenericCollection.java,v 1.2 2004/12/23 22:26:01 mrxtravis Exp $
Author:
tns

Field Summary
(package private)  int nextId
           
(package private)  java.lang.Object nextIdMutex
           
 
Fields inherited from class gov.noaa.eds.xapi.generic.GenericConfigurable
properties
 
Constructor Summary
GenericCollection()
          Creates a new instance of ListCollection
 
Method Summary
 void close()
          Does nothing, it never closes.
 java.lang.String createId()
          Returns a random number that is not currently taken.
 org.xmldb.api.base.Resource createResource(java.lang.String str, java.lang.String str1)
          Not implemented, throws Exception
 org.xmldb.api.base.Collection getChildCollection(java.lang.String str)
          Not implemented, just throws an exception
 int getChildCollectionCount()
          Not implemented, thorws Exception
 java.lang.String getName()
          Return the name of this collection
 org.xmldb.api.base.Collection getParentCollection()
          Exception thrown
 org.xmldb.api.base.Resource getResource(java.lang.String id)
          Returns a resource if it is in the resources hash
 int getResourceCount()
          Returns the number of resources
 org.xmldb.api.base.Service getService(java.lang.String name, java.lang.String version)
          Returns the available service with the specified name and version.
 org.xmldb.api.base.Service[] getServices()
          Returns all know services of this collection
protected  void initServices()
           
 boolean isOpen()
          Always open
 java.lang.String[] listChildCollections()
          throws exceptioin
 java.lang.String[] listResources()
          Returns a list of Resource ids
 void removeResource(org.xmldb.api.base.Resource resource)
          Removes the resource from the hash of resources
 void setName(java.lang.String name)
          Set the name of this collection
 void storeResource(org.xmldb.api.base.Resource resource)
          Store the resource in the collection
 
Methods inherited from class gov.noaa.eds.xapi.generic.GenericConfigurable
getProperty, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xmldb.api.base.Configurable
getProperty, setProperty
 

Field Detail

nextId

int nextId

nextIdMutex

java.lang.Object nextIdMutex
Constructor Detail

GenericCollection

public GenericCollection()
Creates a new instance of ListCollection

Method Detail

initServices

protected void initServices()

getChildCollection

public org.xmldb.api.base.Collection getChildCollection(java.lang.String str)
                                                 throws org.xmldb.api.base.XMLDBException
Not implemented, just throws an exception

Specified by:
getChildCollection in interface org.xmldb.api.base.Collection
Throws:
org.xmldb.api.base.XMLDBException - all the time

getResource

public org.xmldb.api.base.Resource getResource(java.lang.String id)
                                        throws org.xmldb.api.base.XMLDBException
Returns a resource if it is in the resources hash

Specified by:
getResource in interface org.xmldb.api.base.Collection
Parameters:
id - The id of the resource to retrieve
Returns:
The resource with the specified id
Throws:
org.xmldb.api.base.XMLDBException

storeResource

public void storeResource(org.xmldb.api.base.Resource resource)
                   throws org.xmldb.api.base.XMLDBException
Store the resource in the collection

Specified by:
storeResource in interface org.xmldb.api.base.Collection
Parameters:
resource - The resource to store
Throws:
org.xmldb.api.base.XMLDBException

removeResource

public void removeResource(org.xmldb.api.base.Resource resource)
                    throws org.xmldb.api.base.XMLDBException
Removes the resource from the hash of resources

Specified by:
removeResource in interface org.xmldb.api.base.Collection
Parameters:
resource - The resource to remove
Throws:
org.xmldb.api.base.XMLDBException

listResources

public java.lang.String[] listResources()
Returns a list of Resource ids

Specified by:
listResources in interface org.xmldb.api.base.Collection
Returns:
One per string

close

public void close()
Does nothing, it never closes. This collection instance is shared

Specified by:
close in interface org.xmldb.api.base.Collection

createId

public java.lang.String createId()
Returns a random number that is not currently taken.

Specified by:
createId in interface org.xmldb.api.base.Collection
Returns:
The id

createResource

public org.xmldb.api.base.Resource createResource(java.lang.String str,
                                                  java.lang.String str1)
                                           throws org.xmldb.api.base.XMLDBException
Not implemented, throws Exception

Specified by:
createResource in interface org.xmldb.api.base.Collection
Throws:
org.xmldb.api.base.XMLDBException

getChildCollectionCount

public int getChildCollectionCount()
                            throws org.xmldb.api.base.XMLDBException
Not implemented, thorws Exception

Specified by:
getChildCollectionCount in interface org.xmldb.api.base.Collection
Throws:
org.xmldb.api.base.XMLDBException - with a NOT_IMPLEMENTED code

getName

public java.lang.String getName()
Return the name of this collection

Specified by:
getName in interface org.xmldb.api.base.Collection
Returns:
the collection name

setName

public void setName(java.lang.String name)
Set the name of this collection

Parameters:
name - The name of this collection.

getParentCollection

public org.xmldb.api.base.Collection getParentCollection()
                                                  throws org.xmldb.api.base.XMLDBException
Exception thrown

Specified by:
getParentCollection in interface org.xmldb.api.base.Collection
Throws:
org.xmldb.api.base.XMLDBException - with a NOT_IMPELEMNTED code

getResourceCount

public int getResourceCount()
Returns the number of resources

Specified by:
getResourceCount in interface org.xmldb.api.base.Collection
Returns:
the number of resource in this collection

getService

public org.xmldb.api.base.Service getService(java.lang.String name,
                                             java.lang.String version)
                                      throws org.xmldb.api.base.XMLDBException
Returns the available service with the specified name and version.

Specified by:
getService in interface org.xmldb.api.base.Collection
Parameters:
name - The name of the service, like "XPathQueryService"
version - The version of the service, like "1.0"
Returns:
The service that matches the requested service
Throws:
org.xmldb.api.base.XMLDBException - if there is not a service that matches the requested service

getServices

public org.xmldb.api.base.Service[] getServices()
Returns all know services of this collection

Specified by:
getServices in interface org.xmldb.api.base.Collection
Returns:
A list of Service object

isOpen

public boolean isOpen()
Always open

Specified by:
isOpen in interface org.xmldb.api.base.Collection
Returns:
true

listChildCollections

public java.lang.String[] listChildCollections()
                                        throws org.xmldb.api.base.XMLDBException
throws exceptioin

Specified by:
listChildCollections in interface org.xmldb.api.base.Collection
Throws:
org.xmldb.api.base.XMLDBException


Copyright © 2004 National Oceanic and Atmospheric Administration > National Geophysical Data Center > Enterprise Data Services Division. All Rights Reserved.