org.gcube.data.tml.clients
Class ReaderClient

java.lang.Object
  extended by org.gcube.data.tml.clients.ReaderClient
All Implemented Interfaces:
TReaderClient

public class ReaderClient
extends Object
implements TReaderClient

A TReaderClient implementation.

Author:
Fabio Simeoni

Constructor Summary
ReaderClient(org.gcube.common.clients.Client<org.gcube.data.tm.stubs.TReaderPortType> client)
           
ReaderClient(org.apache.axis.message.addressing.EndpointReferenceType endpoint)
          Creates an instance to read from a service at a given endpoint.
ReaderClient(org.gcube.common.clients.gcore.StatefulQuery query)
          Creates an instance for reading from a data source discovered with a given query.
ReaderClient(String sourceId)
          Creates an instance for reading from a given data source.
 
Method Summary
 org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> get()
          Returns all the Trees in the bound source.
 org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> get(org.gcube.data.trees.patterns.Pattern pattern)
          Returns all the Trees in the bound source which match a given Pattern.
 org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> get(org.gcube.data.streams.Stream<String> identifiers)
          Returns Trees in the bound source with given identifiers.
 org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> get(org.gcube.data.streams.Stream<String> identifiers, org.gcube.data.trees.patterns.Pattern pattern)
          Returns Trees in the bound source from their identifiers, after pruning them with a Pattern.
 org.gcube.data.trees.data.Tree get(String id)
          Returns a Tree in the bound source with a given identifier.
 org.gcube.data.trees.data.Tree get(String id, org.gcube.data.trees.patterns.Pattern pattern)
          Returns a Tree in the bound source with a given identifier, after pruning it with a Pattern.
 org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> get(URI loc)
          Returns Trees in the bound source with given identifiers.
 org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> get(URI loc, org.gcube.data.trees.patterns.Pattern pattern)
          Returns Trees in the bound source from their identifiers, after pruning them with a Pattern.
 Element getAsElement(String id)
          Returns a Tree in the bound source with a given identifier.
 Element getAsElement(String id, org.gcube.data.trees.patterns.Pattern pattern)
          Returns a Tree in the bound source with a given identifier, after pruning it with a Pattern.
 org.gcube.data.trees.data.Node getNode(String... path)
          Returns a Node in the bound source from its path in a tree, i.e.
 Element getNodeAsElement(String... ids)
          Returns a Node in the bound source from its path in a tree, Returns a Node from its in a tree, i.e.
 org.gcube.data.streams.Stream<org.gcube.data.trees.data.Node> getNodes(org.gcube.data.streams.Stream<org.gcube.data.tm.stubs.Path> paths)
          Returns Nodes from their paths in a tree, i.e.
 org.gcube.data.streams.Stream<org.gcube.data.trees.data.Node> getNodes(URI paths)
          Returns Nodes from their paths in a tree, i.e.
static org.gcube.data.trees.data.Node resolve(URI uri)
          Resolves a content URI in a scope and, optionally, with a given security manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReaderClient

public ReaderClient(org.gcube.common.clients.Client<org.gcube.data.tm.stubs.TReaderPortType> client)

ReaderClient

public ReaderClient(org.gcube.common.clients.gcore.StatefulQuery query)
Creates an instance for reading from a data source discovered with a given query.

Parameters:
query - the query.

ReaderClient

public ReaderClient(String sourceId)
Creates an instance for reading from a given data source.

Parameters:
sourceId - the source identifier

ReaderClient

public ReaderClient(org.apache.axis.message.addressing.EndpointReferenceType endpoint)
Creates an instance to read from a service at a given endpoint.

Parameters:
endpoint - the service endpoint
Method Detail

resolve

public static org.gcube.data.trees.data.Node resolve(URI uri)
                                              throws IllegalArgumentException,
                                                     URISyntaxException,
                                                     org.gcube.common.clients.DiscoveryException,
                                                     UnsupportedOperationException,
                                                     UnknownPathException,
                                                     Exception
Resolves a content URI in a scope and, optionally, with a given security manager.

Parameters:
uri - the URI
Returns:
the Node identified by the URI
Throws:
IllegalArgumentException - if the input scope is null
URISyntaxException - if the URI is not a content URI
org.gcube.common.clients.DiscoveryException - if a resolver for the URI cannot be found in the given scope
UnsupportedOperationException - if the target plugin does not support the operation
UnknownPathException - if the URI cannot be resolved to a tree or tree node
Exception - if the operation fails for an unexpected error

getAsElement

public Element getAsElement(String id,
                            org.gcube.data.trees.patterns.Pattern pattern)
                     throws UnknownTreeException,
                            UnsupportedOperationException,
                            org.gcube.common.clients.DiscoveryException,
                            Exception
Description copied from interface: TReaderClient
Returns a Tree in the bound source with a given identifier, after pruning it with a Pattern.

Specified by:
getAsElement in interface TReaderClient
Parameters:
id - the tree identifier
pattern - the pattern
Returns:
the Element representation of the tree
Throws:
UnknownTreeException - if the identifier does not identify a tree in the bound source
UnsupportedOperationException - if the bound source does not support the operation
org.gcube.common.clients.DiscoveryException - if, in discovery mode, there is no service for the bound source
UnsupportedRequestException - if the bound source does not support this particular request
Exception - if the operation fails for an unexpected error

get

public org.gcube.data.trees.data.Tree get(String id)
                                   throws UnknownTreeException,
                                          org.gcube.common.clients.DiscoveryException,
                                          UnsupportedOperationException,
                                          Exception
Description copied from interface: TReaderClient
Returns a Tree in the bound source with a given identifier.

Specified by:
get in interface TReaderClient
Parameters:
id - the tree identifier
Returns:
the tree
Throws:
UnknownTreeException - if the identifier does not identify a tree in the bound source
org.gcube.common.clients.DiscoveryException - if, in discovery mode, there is no service for the bound source
UnsupportedOperationException - if the bound source does not support the operation
UnsupportedRequestException - if the bound source does not support this particular request
Exception - if the operation fails for an unexpected error

get

public org.gcube.data.trees.data.Tree get(String id,
                                          org.gcube.data.trees.patterns.Pattern pattern)
                                   throws UnknownTreeException,
                                          org.gcube.common.clients.DiscoveryException,
                                          UnsupportedOperationException,
                                          Exception
Description copied from interface: TReaderClient
Returns a Tree in the bound source with a given identifier, after pruning it with a Pattern.

Specified by:
get in interface TReaderClient
Parameters:
id - the tree identifier
pattern - the pattern
Returns:
the Element representation of the tree
Throws:
UnknownTreeException - if the identifier does not identify a tree in the bound source
org.gcube.common.clients.DiscoveryException - if, in discovery mode, there is no service for the bound source
UnsupportedOperationException - if the bound source does not support the operation
UnsupportedRequestException - if the bound source does not support this particular request
Exception - if the operation fails for an unexpected error

getAsElement

public Element getAsElement(String id)
                     throws org.gcube.common.clients.DiscoveryException,
                            UnsupportedOperationException,
                            UnknownTreeException,
                            Exception
Description copied from interface: TReaderClient
Returns a Tree in the bound source with a given identifier.

Specified by:
getAsElement in interface TReaderClient
Parameters:
id - the tree identifier
Returns:
the Element representation of the tree
Throws:
org.gcube.common.clients.DiscoveryException - if, in discovery mode, there is no service for the bound source
UnsupportedOperationException - if the bound source does not support the operation
UnknownTreeException - if the identifier does not identify a tree in the bound source
UnsupportedRequestException - if the bound source does not support this particular request
Exception - if the operation fails for an unexpected error

get

public org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> get(URI loc,
                                                                         org.gcube.data.trees.patterns.Pattern pattern)
                                                                  throws org.gcube.common.clients.DiscoveryException,
                                                                         UnsupportedOperationException,
                                                                         Exception
Description copied from interface: TReaderClient
Returns Trees in the bound source from their identifiers, after pruning them with a Pattern.

Specified by:
get in interface TReaderClient
Parameters:
loc - a locator to a Resultset of tree identifiers
pattern - the pattern
Returns:
a Stream of resolved Trees
Throws:
org.gcube.common.clients.DiscoveryException - if, in discovery mode, there is no service for the bound source
UnsupportedOperationException - if the bound source does not support the operation
UnsupportedRequestException - if the bound source does not support this particular request
Exception - if the operation fails for an unexpected error

get

public org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> get(org.gcube.data.streams.Stream<String> identifiers,
                                                                         org.gcube.data.trees.patterns.Pattern pattern)
                                                                  throws org.gcube.common.clients.DiscoveryException,
                                                                         UnsupportedOperationException,
                                                                         Exception
Description copied from interface: TReaderClient
Returns Trees in the bound source from their identifiers, after pruning them with a Pattern.

Specified by:
get in interface TReaderClient
Parameters:
identifiers - a Stream of tree identifiers
pattern - the pattern
Returns:
a Stream of resolved Trees
Throws:
org.gcube.common.clients.DiscoveryException - if, in discovery mode, there is no service for the bound source
UnsupportedOperationException - if the bound source does not support the operation
UnsupportedRequestException - if the bound source does not support this particular request
Exception - if the operation fails for an unexpected error

get

public org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> get(URI loc)
                                                                  throws org.gcube.common.clients.DiscoveryException,
                                                                         UnsupportedOperationException,
                                                                         Exception
Description copied from interface: TReaderClient
Returns Trees in the bound source with given identifiers.

Specified by:
get in interface TReaderClient
Parameters:
loc - a locator to a Result Set with tree identifiers
Returns:
a Stream of resolved Trees
Throws:
org.gcube.common.clients.DiscoveryException - if, in discovery mode, there is no service for the bound source
UnsupportedOperationException - if the bound source does not support the operation
UnsupportedRequestException - if the bound source does not support this particular request
Exception - if the operation fails for an unexpected error

get

public org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> get(org.gcube.data.streams.Stream<String> identifiers)
                                                                  throws org.gcube.common.clients.DiscoveryException,
                                                                         UnsupportedOperationException,
                                                                         Exception
Description copied from interface: TReaderClient
Returns Trees in the bound source with given identifiers.

Specified by:
get in interface TReaderClient
Parameters:
identifiers - a Stream of tree identifiers
Returns:
a Stream of resolved Trees
Throws:
org.gcube.common.clients.DiscoveryException - if, in discovery mode, there is no service for the bound source
UnsupportedOperationException - if the bound source does not support the operation
UnsupportedRequestException - if the bound source does not support this particular request
Exception - if the operation fails for an unexpected error

get

public org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> get(org.gcube.data.trees.patterns.Pattern pattern)
                                                                  throws org.gcube.common.clients.DiscoveryException,
                                                                         UnsupportedOperationException,
                                                                         Exception
Description copied from interface: TReaderClient
Returns all the Trees in the bound source which match a given Pattern.

Specified by:
get in interface TReaderClient
Parameters:
pattern - the pattern
Returns:
a Stream of matching Trees
Throws:
org.gcube.common.clients.DiscoveryException - if, in discovery mode, there is no service for the bound source
UnsupportedOperationException - if the bound source does not support the operation
UnsupportedRequestException - if the bound source does not support this particular request
Exception - if the operation fails for an unexpected error

get

public org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> get()
                                                                  throws org.gcube.common.clients.DiscoveryException,
                                                                         UnsupportedOperationException,
                                                                         Exception
Description copied from interface: TReaderClient
Returns all the Trees in the bound source.

Specified by:
get in interface TReaderClient
Returns:
a Stream of matching Trees
Throws:
org.gcube.common.clients.DiscoveryException - if, in discovery mode, there is no service for the bound source
UnsupportedOperationException - if the bound source does not support the operation
UnsupportedRequestException - if the bound source does not support this particular request
Exception - if the operation fails for an unexpected error

getNodeAsElement

public Element getNodeAsElement(String... ids)
                         throws IllegalArgumentException,
                                org.gcube.common.clients.DiscoveryException,
                                UnsupportedOperationException,
                                UnknownPathException,
                                Exception
Description copied from interface: TReaderClient
Returns a Node in the bound source from its path in a tree, Returns a Node from its in a tree, i.e. the list of identifiers of the nodes that connect it to the root of the tree.

Specified by:
getNodeAsElement in interface TReaderClient
Parameters:
ids - the node identifiers.
Returns:
the Element representation of the node
Throws:
org.gcube.common.clients.DiscoveryException - if, in discovery mode, there is no service for the bound source
UnsupportedOperationException - if the bound source does not support the operation
UnknownPathException - if the identifiers do not identify a node in the bound source
UnsupportedRequestException - if the bound source does not support this particular request
Exception - if the operation fails for an unexpected error
IllegalArgumentException

getNode

public org.gcube.data.trees.data.Node getNode(String... path)
                                       throws IllegalArgumentException,
                                              org.gcube.common.clients.DiscoveryException,
                                              UnsupportedOperationException,
                                              UnknownPathException,
                                              Exception
Description copied from interface: TReaderClient
Returns a Node in the bound source from its path in a tree, i.e. the list of of one or more identifiers of the nodes that connect it to the root of the tree.

Specified by:
getNode in interface TReaderClient
Parameters:
path - the node identifiers
Returns:
the node
Throws:
org.gcube.common.clients.DiscoveryException - if, in discovery mode, there is no service for the bound source
UnsupportedOperationException - if the bound source does not support the operation
UnknownPathException - if the identifiers do not identify a node in the bound source
UnsupportedRequestException - if the bound source does not support this particular request
Exception - if the operation fails for an unexpected error
IllegalArgumentException

getNodes

public org.gcube.data.streams.Stream<org.gcube.data.trees.data.Node> getNodes(org.gcube.data.streams.Stream<org.gcube.data.tm.stubs.Path> paths)
                                                                       throws org.gcube.common.clients.DiscoveryException,
                                                                              UnsupportedOperationException,
                                                                              Exception
Description copied from interface: TReaderClient
Returns Nodes from their paths in a tree, i.e. lists of identifiers of the nodes that connect them to the root of a tree.

Specified by:
getNodes in interface TReaderClient
Parameters:
paths - a Stream of Paths
Returns:
a Stream of Nodes
Throws:
org.gcube.common.clients.DiscoveryException - if, in discovery mode, there is no service for the bound source
UnsupportedOperationException - if the bound source does not support the operation
UnsupportedRequestException - if the bound source does not support this particular request
Exception - if the operation fails for an unexpected error

getNodes

public org.gcube.data.streams.Stream<org.gcube.data.trees.data.Node> getNodes(URI paths)
                                                                       throws org.gcube.common.clients.DiscoveryException,
                                                                              UnsupportedOperationException,
                                                                              Exception
Description copied from interface: TReaderClient
Returns Nodes from their paths in a tree, i.e. lists of identifiers of the nodes that connect them to the root of a tree.

Specified by:
getNodes in interface TReaderClient
Parameters:
paths - a locator to a ResultSet of paths.
Returns:
a Stream of Nodes
Throws:
org.gcube.common.clients.DiscoveryException - if, in discovery mode, there is no service for the bound source
UnsupportedOperationException - if the bound source does not support the operation
UnsupportedRequestException - if the bound source does not support this particular request
Exception - if the operation fails for an unexpected error


Copyright © 2012. All Rights Reserved.