org.gcube.contentmanagement.gcubedocumentlibrary.io
Class DocumentReader

java.lang.Object
  extended by org.gcube.contentmanagement.gcubedocumentlibrary.io.BaseReader
      extended by org.gcube.contentmanagement.gcubedocumentlibrary.io.DocumentReader
All Implemented Interfaces:
Reader

public class DocumentReader
extends BaseReader

A Reader that allows arbitrary Projections over document descriptions.

Author:
Fabio Simeoni (University of Strathclyde)

Constructor Summary
DocumentReader(CollectionReference reference, GCUBEScope scope)
          Creates an instance for a target collection, in a given GCUBEScope.
DocumentReader(CollectionReference reference, GCUBEScope scope, GCUBESecurityManager securityManager)
          Creates an instance for a target collection, in a given GCUBEScope and with a given GCUBESecurityManager.
DocumentReader(java.lang.String collectionId, org.apache.axis.message.addressing.EndpointReferenceType endpointReferenceType, GCUBEScope scope)
          Creates an instance for a target collection, in a given GCUBEScope.
DocumentReader(java.lang.String collectionId, org.apache.axis.message.addressing.EndpointReferenceType endpointReferenceType, GCUBEScope scope, GCUBESecurityManager securityManager)
          Creates an instance for a target collection, in a given GCUBEScope and with a given GCUBESecurityManager.
DocumentReader(java.lang.String collID, GCUBEScope scope)
          Creates an instance for a target collection in a given GCUBEScope.
DocumentReader(java.lang.String collID, GCUBEScope scope, GCUBESecurityManager securityManager)
          Creates an instance for a target collection, in a given GCUBEScope and with a given GCUBESecurityManager.
 
Method Summary
 java.lang.String collectionID()
          Returns the identifier of the target collection.
  get(java.util.Iterator<java.lang.String> ids, Projection<?,?> p)
          Retrieves a stream of proxies of document descriptions in the target collections.
  get(Projection<?,?> p)
          Retrieves a stream of proxies of document descriptions in the target collection.
 GCubeDocument get(java.lang.String id, Projection<?,?> p)
          Returns a proxy of a document description in the target collection.
<E extends GCubeInnerElement>
resolve(java.util.Iterator<java.net.URI> uris, Projection<E,?> p)
          Retrieves a stream of proxies of elements of document descriptions in the target collection.
<E extends GCubeInnerElement>
E
resolve(java.net.URI uri, Projection<E,?> p)
          Retrieves a proxy of an element of a document description in the target collection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentReader

public DocumentReader(java.lang.String collID,
                      GCUBEScope scope)
               throws java.lang.Exception
Creates an instance for a target collection in a given GCUBEScope.

Parameters:
collID - the identifier of the target collection.
scope - the scope.
Throws:
java.lang.Exception - id the instance could not be initialised.

DocumentReader

public DocumentReader(java.lang.String collID,
                      GCUBEScope scope,
                      GCUBESecurityManager securityManager)
               throws java.lang.Exception
Creates an instance for a target collection, in a given GCUBEScope and with a given GCUBESecurityManager.

Parameters:
collID - the identifier of the target collection.
scope - the scope.
securityManager - the security manager.
Throws:
java.lang.Exception - id the instance could not be initialised.

DocumentReader

public DocumentReader(java.lang.String collectionId,
                      org.apache.axis.message.addressing.EndpointReferenceType endpointReferenceType,
                      GCUBEScope scope)
               throws java.lang.Exception
Creates an instance for a target collection, in a given GCUBEScope.

Parameters:
collectionId - the identifier of the target collection.
endpointReferenceType - the service EPR.
scope - the scope.
Throws:
java.lang.Exception - id the instance could not be initialised.

DocumentReader

public DocumentReader(java.lang.String collectionId,
                      org.apache.axis.message.addressing.EndpointReferenceType endpointReferenceType,
                      GCUBEScope scope,
                      GCUBESecurityManager securityManager)
               throws java.lang.Exception
Creates an instance for a target collection, in a given GCUBEScope and with a given GCUBESecurityManager.

Parameters:
collectionId - the identifier of the target collection.
endpointReferenceType - the service EPR.
scope - the scope.
securityManager - the security manager.
Throws:
java.lang.Exception - id the instance could not be initialised.

DocumentReader

public DocumentReader(CollectionReference reference,
                      GCUBEScope scope)
               throws java.lang.Exception
Creates an instance for a target collection, in a given GCUBEScope.

Parameters:
reference - a CollectionReference to the collection.
scope - the scope.
Throws:
java.lang.Exception - id the instance could not be initialised.

DocumentReader

public DocumentReader(CollectionReference reference,
                      GCUBEScope scope,
                      GCUBESecurityManager securityManager)
               throws java.lang.Exception
Creates an instance for a target collection, in a given GCUBEScope and with a given GCUBESecurityManager.

Parameters:
reference - a CollectionReference to the collection.
scope - the scope.
securityManager - the security manager.
Throws:
java.lang.Exception - id the instance could not be initialised.
Method Detail

collectionID

public java.lang.String collectionID()
Returns the identifier of the target collection.

Returns:
the identifier.

get

public GCubeDocument get(java.lang.String id,
                         Projection<?,?> p)
                  throws UnknownDocumentException,
                         DiscoveryException,
                         GCUBEException,
                         java.lang.Exception
Returns a proxy of a document description in the target collection.

Parameters:
id - the identifier of the description.
p - a projection over the inner elements of the description.
Returns:
the proxy of the description.
Throws:
UnknownDocumentException - if a description with the given identifier and matching the given projection is unknown in the target collection.
DiscoveryException - if the operation could not be completed due to collection discovery errors.
GCUBEException - if the operation could not be completed due to other forms of remote errors.
java.lang.Exception - if the operation could not be completed due to local errors.

get

public  get(java.util.Iterator<java.lang.String> ids,
                 Projection<?,?> p)
          throws DiscoveryException,
                 GCUBEException,
                 java.lang.Exception
Retrieves a stream of proxies of document descriptions in the target collections.

Parameters:
ids - an Iterator over the identifiers of the descriptions.
p - a projection over the inner elements of the descriptions.
Returns:
a RemoteIterator over the description proxies.
Throws:
DiscoveryException - if the operation could not be completed due to service discovery errors.
GCUBEException - if the operation could not be completed due to other forms of remote errors.
java.lang.Exception - if the operation could not be completed due to local errors.

get

public  get(Projection<?,?> p)
          throws DiscoveryException,
                 GCUBEException,
                 java.lang.Exception
Retrieves a stream of proxies of document descriptions in the target collection.

Parameters:
p - a projection over the inner elements of the descriptions.
Returns:
a RemoteIterator over the proxies of the descriptions.
Throws:
DiscoveryException - if the operation could not be completed due to collection discovery errors.
GCUBEException - if the operation could not be completed due to other forms of remote errors.
java.lang.Exception - if the operation could not be completed due to local errors.

resolve

public <E extends GCubeInnerElement> E resolve(java.net.URI uri,
                                               Projection<E,?> p)
                                    throws java.lang.IllegalArgumentException,
                                           UnknownDocumentException,
                                           DiscoveryException,
                                           GCUBEException,
                                           java.lang.Exception
Retrieves a proxy of an element of a document description in the target collection.

Type Parameters:
E - the type of the element.
Parameters:
uri - the content URI of the element.
p - a projection over the element.
Returns:
the proxy of the element.
Throws:
java.lang.IllegalArgumentException - if the URI is not a content URI, or if it does not refers to a description in the target collection.
UnknownDocumentException - if the URI does not identify an element that matches the given projection.
DiscoveryException - if the operation could not be completed due to collection discovery errors.
GCUBEException - if the operation could not be completed due to other forms of remote errors.
java.lang.Exception - if the operation could not be completed due to local errors.

resolve

public <E extends GCubeInnerElement>  resolve(java.util.Iterator<java.net.URI> uris,
                                                   Projection<E,?> p)
              throws DiscoveryException,
                     GCUBEException,
                     java.lang.Exception
Retrieves a stream of proxies of elements of document descriptions in the target collection.

Type Parameters:
E - the type of the elements.
Parameters:
uris - an Iterator over the content URIs of the elements.
p - the projection over the elements.
Returns:
a RemoteIterator over the proxies of the elements.
Throws:
DiscoveryException - if the operation could not be completed due to collection discovery errors.
GCUBEException - if the operation could not be completed due to other forms of remote errors.
java.lang.Exception - if the operation could not be completed due to local errors.