org.gcube.common.xml.databases.existlibrary.collections
Class CollectionImpl

java.lang.Object
  extended by org.gcube.common.xml.databases.existlibrary.collections.CollectionImpl
All Implemented Interfaces:
Collection
Direct Known Subclasses:
PartitionedCollection, SimpleCollection

public abstract class CollectionImpl
extends java.lang.Object
implements Collection

Partial implementation of collection in the database

Author:
Manuele Simi (CNR)

Nested Class Summary
static class CollectionImpl.CollectionType
          Enumeration for collection type
 
Nested classes/interfaces inherited from interface org.gcube.common.xml.databases.existlibrary.collections.Collection
Collection.CollectionAlreadyExistException, Collection.CollectionCreationException, Collection.CollectionException
 
Constructor Summary
CollectionImpl(java.lang.String name)
           
 
Method Summary
 java.util.List<java.lang.String> AddElement(java.util.List<XMLResource> listResources)
           
 void AddElementByResultSet(java.lang.String Locator, UpdateEventConsumer consumer)
          Stores the given resources in the collection
 void close()
           
 Collection createCollection(java.lang.String collectionName)
          Creates a new Collection
 Collection createPartitionedCollection(java.lang.String collectionName)
          Creates a new partitioned collection
 XMLResource createResource(java.lang.String name, java.lang.Object content, java.lang.String Type)
           
 void deleteCollection(java.lang.String collectionName)
          Removes a collection from the ExistDB
 java.util.List<java.lang.String> executeXPathDirect(java.lang.String xPath)
           
 java.lang.String executeXPathIndirect(java.lang.String xPath)
           
 java.util.List<java.lang.String> executeXQueryDirect(java.lang.String xQuery)
          execute the xquery
 java.lang.String executeXQueryInDirect(java.lang.String xQuery)
           
 int getChildCollectionCount()
          Gets the number of children
 Collection getCurrentCollection()
          Returns the current collection
 java.lang.String getName()
          Gets the collection name
 org.xmldb.api.base.Service getService(java.lang.String service, java.lang.String version)
           
 Collection openSubCollection(java.lang.String collectionName)
          Open a subCollection
 java.util.List<java.lang.String> removeElements(java.lang.String[] toRemove)
          removes elements from the collection
abstract  java.util.List<java.lang.String> store(java.util.List<XMLResource> resources)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.gcube.common.xml.databases.existlibrary.collections.Collection
create, getResourceById
 

Constructor Detail

CollectionImpl

public CollectionImpl(java.lang.String name)
Method Detail

openSubCollection

public Collection openSubCollection(java.lang.String collectionName)
                             throws Collection.CollectionException
Description copied from interface: Collection
Open a subCollection

Specified by:
openSubCollection in interface Collection
Throws:
Collection.CollectionException

close

public void close()
           throws Collection.CollectionException
Specified by:
close in interface Collection
Throws:
Collection.CollectionException

getName

public java.lang.String getName()
Description copied from interface: Collection
Gets the collection name

Specified by:
getName in interface Collection

getService

public org.xmldb.api.base.Service getService(java.lang.String service,
                                             java.lang.String version)
                                      throws java.lang.Exception
Throws:
java.lang.Exception

getChildCollectionCount

public int getChildCollectionCount()
                            throws Collection.CollectionException
Description copied from interface: Collection
Gets the number of children

Specified by:
getChildCollectionCount in interface Collection
Returns:
the number of children
Throws:
Collection.CollectionException

store

public abstract java.util.List<java.lang.String> store(java.util.List<XMLResource> resources)
                                                throws Collection.CollectionException
Throws:
Collection.CollectionException

removeElements

public java.util.List<java.lang.String> removeElements(java.lang.String[] toRemove)
                                                throws Collection.CollectionException
removes elements from the collection

Specified by:
removeElements in interface Collection
Parameters:
toRemove - List of Resources ID
Throws:
Collection.CollectionException

createResource

public XMLResource createResource(java.lang.String name,
                                  java.lang.Object content,
                                  java.lang.String Type)
                           throws XMLDBException
Throws:
XMLDBException

createCollection

public Collection createCollection(java.lang.String collectionName)
                            throws Collection.CollectionAlreadyExistException,
                                   Collection.CollectionCreationException
Creates a new Collection

Specified by:
createCollection in interface Collection
Parameters:
collectionName - String the collection name
Returns:
the collection created
Throws:
CollectionException
Collection.CollectionAlreadyExistException
Collection.CollectionCreationException

createPartitionedCollection

public Collection createPartitionedCollection(java.lang.String collectionName)
                                       throws Collection.CollectionAlreadyExistException,
                                              Collection.CollectionCreationException
Creates a new partitioned collection

Specified by:
createPartitionedCollection in interface Collection
Parameters:
collectionName - the colection name
Returns:
the new collection
Throws:
CollectionCreationException - if the creation fails
Collection.CollectionAlreadyExistException
Collection.CollectionCreationException

executeXQueryDirect

public java.util.List<java.lang.String> executeXQueryDirect(java.lang.String xQuery)
                                                     throws java.lang.Exception
execute the xquery

Specified by:
executeXQueryDirect in interface Collection
Parameters:
xQuery - the xquery
Returns:
List of String
Throws:
java.lang.Exception - If exist fails

executeXQueryInDirect

public java.lang.String executeXQueryInDirect(java.lang.String xQuery)
                                       throws java.lang.Exception
Specified by:
executeXQueryInDirect in interface Collection
Parameters:
xQuery -
Returns:
Throws:
java.lang.Exception

executeXPathIndirect

public java.lang.String executeXPathIndirect(java.lang.String xPath)
                                      throws java.lang.Exception
Specified by:
executeXPathIndirect in interface Collection
Parameters:
xPath -
Returns:
Throws:
java.lang.Exception

executeXPathDirect

public java.util.List<java.lang.String> executeXPathDirect(java.lang.String xPath)
                                                    throws java.lang.Exception
Specified by:
executeXPathDirect in interface Collection
Parameters:
xPath -
Returns:
Throws:
java.lang.Exception

deleteCollection

public void deleteCollection(java.lang.String collectionName)
                      throws Collection.CollectionException
Removes a collection from the ExistDB

Specified by:
deleteCollection in interface Collection
Throws:
if - the operation fails
Collection.CollectionException

getCurrentCollection

public Collection getCurrentCollection()
Returns the current collection

Returns:
the current collection

AddElementByResultSet

public void AddElementByResultSet(java.lang.String Locator,
                                  UpdateEventConsumer consumer)
Description copied from interface: Collection
Stores the given resources in the collection

Specified by:
AddElementByResultSet in interface Collection

AddElement

public java.util.List<java.lang.String> AddElement(java.util.List<XMLResource> listResources)
                                            throws java.lang.Exception
Specified by:
AddElement in interface Collection
Throws:
java.lang.Exception