org.gcube.contentmanagement.contentmanager.stubs.calls
Class ReadManagerCall

java.lang.Object
  extended by WSCall
      extended by org.gcube.contentmanagement.contentmanager.stubs.calls.BaseCall
          extended by org.gcube.contentmanagement.contentmanager.stubs.calls.ManagerCall
              extended by org.gcube.contentmanagement.contentmanager.stubs.calls.ReadManagerCall

public class ReadManagerCall
extends ManagerCall

A high-level call to a ReadManager resource of the Content Manager service.

A ReadManagerCall call may target known service instances or else do its best to find and talk with those which have the required properties. It may be used repeatedly and it will remember the service instance it last used successfully.

Author:
Fabio Simeoni (University of Strathclyde), Federico De Faveri defaveri@isti.cnr.it, Lucio Lelii (lucio.lelii@isti.cnr.it)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.gcube.contentmanagement.contentmanager.stubs.calls.ManagerCall
ManagerCall.DiscoveryException
 
Constructor Summary
ReadManagerCall(GCUBEScope scope, GCUBESecurityManager... securityManager)
          Creates an instance to use in a given scope and, optionally, with a given a security manager.
ReadManagerCall(java.lang.String collectionID, GCUBEScope scope, GCUBESecurityManager... securityManager)
          Creates an instance to use for a certain collection, in a given scope and, optionally, with a given a security manager.
 
Method Summary
 java.net.URI get()
          Returns all the gDoc documents in the target collection.
 java.net.URI get(Predicate projection)
          Returns all the gDoc documents, requesting the application of a projection over each of them.
 GDoc get(java.lang.String id)
          Returns a gDoc document from its identifier.
 GDoc get(java.lang.String id, Predicate projection)
          Returns a gDoc document from its identifier, requesting the preliminary application of a filter and a projection over it.
 java.net.URI get(java.net.URI locator)
          Returns zero or more gDoc documents from their identifier.
static Node get(java.net.URI uri, GCUBEScope scope, GCUBESecurityManager... manager)
          Resolves a content URI in a given scope and, optionally, with a given security manager.
 java.net.URI get(java.net.URI locator, Predicate projection)
          Returns zero or more gDoc documents from their identifiers, requesting the preliminary application of a filter and a projection over each of them.
 org.w3c.dom.Element getAsElement(java.lang.String id)
          Returns a gDoc document from its identifier.
 org.w3c.dom.Element getAsElement(java.lang.String id, Predicate projection)
          Returns a gDoc document from its identifier, requesting the preliminary application of a filter and a projection over it.
 Node getNode(java.lang.String... nodeIDs)
          Returns a gDoc document node from the list of identifiers that connect it to the document root.
 org.w3c.dom.Element getNodeAsElement(java.lang.String... ids)
          Returns a gDoc document node from the list of identifiers that connect it to the document root.
 java.net.URI getNodes(java.net.URI paths)
          Returns the document nodes identified by corresponding Paths into documents of the target collection.
 
Methods inherited from class org.gcube.contentmanagement.contentmanager.stubs.calls.ManagerCall
getCollectionID, resetQuery, setCollectionID
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReadManagerCall

public ReadManagerCall(GCUBEScope scope,
                       GCUBESecurityManager... securityManager)
                throws java.lang.Exception
Creates an instance to use in a given scope and, optionally, with a given a security manager.

Parameters:
scope - the scope.
securityManager - (optional) the security manager.
Throws:
java.lang.Exception - if the instance could not be created.

ReadManagerCall

public ReadManagerCall(java.lang.String collectionID,
                       GCUBEScope scope,
                       GCUBESecurityManager... securityManager)
                throws java.lang.Exception
Creates an instance to use for a certain collection, in a given scope and, optionally, with a given a security manager.

Parameters:
collectionID - the collection identifier.
scope - the scope.
securityManager - (optional) the security manager.
Throws:
java.lang.Exception - if the instance could not be created.
Method Detail

get

public static Node get(java.net.URI uri,
                       GCUBEScope scope,
                       GCUBESecurityManager... manager)
                throws java.lang.IllegalArgumentException,
                       java.net.URISyntaxException,
                       ManagerCall.DiscoveryException,
                       UnknownPathException,
                       GCUBEException,
                       java.lang.Exception
Resolves a content URI in a given scope and, optionally, with a given security manager.

Parameters:
uri - the URI.
scope - the scope.
manager - (optional) the security manager.
Returns:
the Node identified by the URI.
Throws:
java.lang.IllegalArgumentException - if the input scope is null.
java.net.URISyntaxException - if the URI is not a content URI.
DiscoveryException - if a resolver for the URI could not be found in the given scope.
UnknownPathException - if the URI could not be resolved to a document or document node.
GCUBEException - if the URI could not be resolved due to a generic remote error.
java.lang.Exception - if the URI could not be resolved due to a generi local error.
ManagerCall.DiscoveryException

getAsElement

public org.w3c.dom.Element getAsElement(java.lang.String id,
                                        Predicate projection)
                                 throws UnknownDocumentException,
                                        ManagerCall.DiscoveryException,
                                        GCUBEException,
                                        java.lang.Exception
Returns a gDoc document from its identifier, requesting the preliminary application of a filter and a projection over it.

Parameters:
id - the identifier.
projection - the projection predicate.
filter - the filter predicate.
Returns:
a GDoc representation of the document.
Throws:
DiscoveryException - if a Read Manager for the target collection could not be found.
UnknownDocumentException - if the identifier does not identify a document in the target collection.
java.lang.Exception - if the document could not be returned for a local error.
GCUBEException - if the document could not be returned for a remote error.
ManagerCall.DiscoveryException

get

public GDoc get(java.lang.String id,
                Predicate projection)
         throws UnknownDocumentException,
                ManagerCall.DiscoveryException,
                GCUBEException,
                java.lang.Exception
Returns a gDoc document from its identifier, requesting the preliminary application of a filter and a projection over it.

Parameters:
id - the identifier.
projection - the projection predicate.
filter - the filter predicate.
Returns:
a DOM representation of the document.
Throws:
DiscoveryException - if a Read Manager for the target collection could not be found.
UnknownDocumentException - if the identifier does not identify a document in the target collection.
java.lang.Exception - if the document could not be returned for a local error.
GCUBEException - if the document could not be returned for a remote error.
ManagerCall.DiscoveryException

getAsElement

public org.w3c.dom.Element getAsElement(java.lang.String id)
                                 throws ManagerCall.DiscoveryException,
                                        UnknownDocumentException,
                                        GCUBEException,
                                        java.lang.Exception
Returns a gDoc document from its identifier.

Parameters:
id - the identifier.
projection - the projection predicate.
Returns:
a DOM representation of the document.
Throws:
DiscoveryException - if a Read Manager for the target collection could not be found.
UnknownDocumentException - if the identifier does not identify a document in the target collection.
java.lang.Exception - if the document could not be returned for a local error.
GCUBEException - if the document could not be returned for a remote error.
ManagerCall.DiscoveryException

get

public GDoc get(java.lang.String id)
         throws UnknownDocumentException,
                ManagerCall.DiscoveryException,
                GCUBEException,
                java.lang.Exception
Returns a gDoc document from its identifier.

Parameters:
id - the identifier.
projection - the projection predicate.
Returns:
a GDoc representation of the document.
Throws:
DiscoveryException - if a Read Manager for the target collection could not be found.
UnknownDocumentException - if the identifier does not identify a document in the target collection.
java.lang.Exception - if the document could not be returned for a local error.
GCUBEException - if the document could not be returned for a remote error.
ManagerCall.DiscoveryException

get

public java.net.URI get(java.net.URI locator,
                        Predicate projection)
                 throws java.lang.Exception,
                        ManagerCall.DiscoveryException,
                        GCUBEException
Returns zero or more gDoc documents from their identifiers, requesting the preliminary application of a filter and a projection over each of them.

Parameters:
a - locator to a resultset of document identifiers.
projection - the projection predicate.
filter - the filter predicate.
Returns:
a locator to a remote resultset of (string representations of) gDoc documents.
Throws:
java.lang.Exception - if the locator to the remote resultset could not be returned for a local error.
DiscoveryException - if a Read Manager for the target collection could not be found.
GCUBEException - if the locator to the remote resultset could not be returned for a remote error.
ManagerCall.DiscoveryException

get

public java.net.URI get(java.net.URI locator)
                 throws java.lang.Exception,
                        ManagerCall.DiscoveryException,
                        GCUBEException
Returns zero or more gDoc documents from their identifier.

Parameters:
a - locator to a resultset of document identifiers.
Returns:
a locator to a remote resultset of (string representations of) gDoc documents.
Throws:
java.lang.Exception - if the locator to the remote resultset could not be returned for a local error.
DiscoveryException - if a Read Manager for the target collection could not be found.
GCUBEException - if the locator to the remote resultset could not be returned for a remote error.
ManagerCall.DiscoveryException

get

public java.net.URI get(Predicate projection)
                 throws java.lang.Exception,
                        ManagerCall.DiscoveryException,
                        GCUBEException
Returns all the gDoc documents, requesting the application of a projection over each of them.

Parameters:
projection - the projection predicate.
Returns:
a locator to a remote resultset of (string representations of) gDoc documents.
Throws:
java.lang.Exception - if the locator to the remote resultset could not be returned for a local error.
DiscoveryException - if a Read Manager for the target collection could not be found.
GCUBEException - if the locator to the remote resultset could not be returned for a remote error.
ManagerCall.DiscoveryException

get

public java.net.URI get()
                 throws java.lang.Exception,
                        ManagerCall.DiscoveryException,
                        GCUBEException
Returns all the gDoc documents in the target collection.

Returns:
a locator to a remote resultset of (string representations of) gDoc documents.
Throws:
java.lang.Exception - if the locator to the remote resultset could not be returned for a local error.
DiscoveryException - if a Read Manager for the target collection could not be found.
GCUBEException - if the locator to the remote resultset could not be returned for a remote error.
ManagerCall.DiscoveryException

getNode

public Node getNode(java.lang.String... nodeIDs)
             throws java.net.URISyntaxException,
                    ManagerCall.DiscoveryException,
                    UnknownPathException,
                    GCUBEException,
                    java.lang.Exception
Returns a gDoc document node from the list of identifiers that connect it to the document root.

Parameters:
ids - the node identifiers.
Returns:
the document node as a Node.
Throws:
java.net.URISyntaxException - if the URI is not a content URI.
DiscoveryException - if a Read Manager for the target collection could not be found.
UnknownPathException - if the URI does not identify a document or document node in the target collection.
java.lang.Exception - if the document could not be returned for a local error.
GCUBEException - if the document could not be returned for a remote error.
ManagerCall.DiscoveryException

getNodeAsElement

public org.w3c.dom.Element getNodeAsElement(java.lang.String... ids)
                                     throws ManagerCall.DiscoveryException,
                                            UnknownPathException,
                                            GCUBEException,
                                            java.lang.Exception
Returns a gDoc document node from the list of identifiers that connect it to the document root.

Parameters:
ids - the node identifiers.
Returns:
a DOM representation of the node.
Throws:
DiscoveryException - if a Read Manager for the target collection could not be found.
UnknownPathException - if the URI does not identify a document node in the target collection.
GCUBEException - if the document could not be returned for a generic remote error.
java.lang.Exception - if the document could not be returned for a generic local error.
ManagerCall.DiscoveryException

getNodes

public java.net.URI getNodes(java.net.URI paths)
                      throws ManagerCall.DiscoveryException,
                             GCUBEException,
                             java.lang.Exception
Returns the document nodes identified by corresponding Paths into documents of the target collection.

Parameters:
a - locator to a ResultSet of paths.
Returns:
a locator a ResultSet of document nodes.
Throws:
DiscoveryException - if a Read Manager for the target collection could not be found.
GCUBEException - if the document nodes could not be returned for a generic remote error.
java.lang.Exception - if the document nodes could not be returned for a generic local error.
ManagerCall.DiscoveryException