Xindice API

org.apache.xindice.client.corba
Class CollectionServant

java.lang.Object
  |
  +--org.omg.PortableServer.Servant
        |
        +--org.apache.xindice.client.corba.db.CollectionPOA
              |
              +--org.apache.xindice.client.corba.CollectionServant
All Implemented Interfaces:
CollectionOperations, org.omg.CORBA.portable.InvokeHandler, ServantManagementOperations

public class CollectionServant
extends CollectionPOA

Provides access to Collection instances through CORBA.

See Also:
Collection

Constructor Summary
CollectionServant(Collection collection)
          Constructor for the CollectionServant object
 
Method Summary
 java.lang.String createNewOID()
          Creates a new unique OID for this collection.
 java.lang.String getCanonicalName()
          Returns the Canonical Name of the Collection
 Collection getCollection(java.lang.String path)
          Retrieves a new Collection instance for the named collection.
 CollectionManager getCollectionManager()
          Returns a CollectionManager instance for this collection.
 EncodedBuffer getDocument(java.lang.String id, long stamp)
          Retrieves a document from the collection
 int getDocumentCount()
          Returns the number of documents stored in this collection.
 DocumentSet getDocuments()
          Returns a set containing all documents in the collection.
 java.lang.String getName()
          Gets the Name of the Collection
 Collection getParentCollection()
          Gets the parent Collection for this Collection
 java.lang.String insertDocument(java.lang.String nam, EncodedBuffer doc)
          Inserts a new document into the collection
 EncodedBuffer invokeXMLObject(java.lang.String uri)
          Invokes an XMLObject using the uri provided.
 java.lang.String[] listCollections()
          Lists all child collections under this collection
 java.lang.String[] listDocuments()
          Returns a set containing all documents in the collection.
 EncodedBuffer queryCollection(java.lang.String style, java.lang.String query, NamedVal[] namespaces, long stamp)
          Executes an query against a this collection
 EncodedBuffer queryDocument(java.lang.String style, java.lang.String query, NamedVal[] namespaces, java.lang.String id, long stamp)
          Executes a query against a Document in this collection
 void remove()
          Releases all resources associated with this object.
 void removeDocument(java.lang.String id)
          Deletes a document from the collection.
 void setDocument(java.lang.String id, EncodedBuffer doc)
          Sets a document in the collection.
 
Methods inherited from class org.apache.xindice.client.corba.db.CollectionPOA
_all_interfaces, _invoke, _this, _this
 
Methods inherited from class org.omg.PortableServer.Servant
_default_POA, _get_delegate, _get_interface_def, _get_interface, _is_a, _non_existent, _object_id, _orb, _orb, _poa, _set_delegate, _this_object, _this_object
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionServant

public CollectionServant(Collection collection)
Constructor for the CollectionServant object
Parameters:
collection - The collection that is being wrapped.
Method Detail

setDocument

public void setDocument(java.lang.String id,
                        EncodedBuffer doc)
                 throws APIException
Sets a document in the collection. setDocument should be called when the document already exists in the collection.
Parameters:
id - The key for the Document to set
doc - The Document value to set
Throws:
APIException - Thrown for all errors check faultCode for details.

getName

public java.lang.String getName()
                         throws APIException
Gets the Name of the Collection
Returns:
The Name of the collection
Throws:
APIException - Thrown for all errors check faultCode for details.

getCanonicalName

public java.lang.String getCanonicalName()
                                  throws APIException
Returns the Canonical Name of the Collection
Returns:
The Canonical Name of the collection
Throws:
APIException - Thrown for all errors check faultCode for details.

getCollectionManager

public CollectionManager getCollectionManager()
                                       throws APIException
Returns a CollectionManager instance for this collection.
Returns:
The CollectionManager instance
Throws:
APIException - Thrown for all errors check faultCode for details.

getParentCollection

public Collection getParentCollection()
                               throws APIException
Gets the parent Collection for this Collection
Returns:
The parent Collection of this Collection
Throws:
APIException - Thrown for all errors check faultCode for details.

getCollection

public Collection getCollection(java.lang.String path)
                         throws APIException
Retrieves a new Collection instance for the named collection.
Parameters:
path - The path of the collection to retrieve
Returns:
The Collection instance
Throws:
APIException - Thrown for all errors check faultCode for details.

getDocument

public EncodedBuffer getDocument(java.lang.String id,
                                 long stamp)
                          throws APIException
Retrieves a document from the collection
Parameters:
id - The id of the document to retrieve.
Returns:
The Document
Throws:
APIException - Thrown for all errors check faultCode for details.

getDocuments

public DocumentSet getDocuments()
                         throws APIException
Returns a set containing all documents in the collection.
Returns:
A DocumentSet containing all documents
Throws:
APIException - Thrown for all errors check faultCode for details.

getDocumentCount

public int getDocumentCount()
                     throws APIException
Returns the number of documents stored in this collection.
Returns:
the number of documents
Throws:
APIException - Thrown for all errors check faultCode for details.

listCollections

public java.lang.String[] listCollections()
                                   throws APIException
Lists all child collections under this collection
Returns:
The list of child collections
Throws:
APIException - Thrown for all errors check faultCode for details.

insertDocument

public java.lang.String insertDocument(java.lang.String nam,
                                       EncodedBuffer doc)
                                throws APIException
Inserts a new document into the collection
Parameters:
nam - The key to store the document under. If nam is empty a new key value will be generated.
doc - The Document instance to store
Returns:
The key used to store the document
Throws:
APIException - Thrown for all errors check faultCode for details.

removeDocument

public void removeDocument(java.lang.String id)
                    throws APIException
Deletes a document from the collection.
Parameters:
id - The key for the document to delete
Throws:
APIException - Thrown for all errors check faultCode for details.

listDocuments

public java.lang.String[] listDocuments()
                                 throws APIException
Returns a set containing all documents in the collection.
Returns:
an array of strings containing the ids for all documents stored in the collection.
Throws:
APIException - Thrown for all errors check faultCode for details.

createNewOID

public java.lang.String createNewOID()
                              throws APIException
Creates a new unique OID for this collection.
Returns:
the oid as a string.
Throws:
APIException - Thrown for all errors check faultCode for details.

queryCollection

public EncodedBuffer queryCollection(java.lang.String style,
                                     java.lang.String query,
                                     NamedVal[] namespaces,
                                     long stamp)
                              throws APIException
Executes an query against a this collection
Parameters:
style - The query style to use
query - The xpath query string to use.
Returns:
A document containing the serialized NodeList of resuls. The results are bracketed with a tag named "result"
Throws:
APIException - Thrown for all errors check faultCode for details.

queryDocument

public EncodedBuffer queryDocument(java.lang.String style,
                                   java.lang.String query,
                                   NamedVal[] namespaces,
                                   java.lang.String id,
                                   long stamp)
                            throws APIException
Executes a query against a Document in this collection
Parameters:
style - The query style to use
query - The xpath query string to use.
Returns:
A document containing the serialized NodeList of resuls. The results are bracketed with a tag named "result"
Throws:
APIException - Thrown for all errors check faultCode for details.

invokeXMLObject

public EncodedBuffer invokeXMLObject(java.lang.String uri)
                              throws APIException
Invokes an XMLObject using the uri provided. The URI must include the full path to the XMLObject including method name and all parameters.
Parameters:
uri - The URI to use to locate and invoke the XMLObject
Returns:
An encoded buffer containing the result of the invocation.
Throws:
APIException - Thrown for all errors check faultCode for details.

remove

public void remove()
Releases all resources associated with this object. This method must be called when usage of the object is complete. If it is not called the server side servant will not be properly released.

Xindice API

Copyright (c) 1999-2001 The Apache Software Foundation