org.gcube.data.tmf.api
Interface SourceReader

All Superinterfaces:
Serializable
All Known Implementing Classes:
AbstractReader

public interface SourceReader
extends Serializable

Returns trees and node from a data source.

Trees and nodes are expected to conform to the 'data type' of the source.

Author:
Fabio Simeoni
See Also:
Source.reader(), Tree, Pattern, RemoteIterator

Method Summary
 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 source which match a given pattern, after pruning them with it.
 org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> get(org.gcube.data.streams.Stream<String> idStream, org.gcube.data.trees.patterns.Pattern pattern)
          Returns trees in the source with given identifiers, after pruning them with a given pattern.
 org.gcube.data.trees.data.Tree get(String id, org.gcube.data.trees.patterns.Pattern pattern)
          Returns a tree in the source with a given identifier, after pruning it with a given pattern.
 org.gcube.data.trees.data.Node getNode(String... path)
          Returns a tree node in the source from the path of identifiers which connects it to the root of the tree.
 org.gcube.data.streams.Stream<org.gcube.data.trees.data.Node> getNodes(org.gcube.data.streams.Stream<org.gcube.data.tm.stubs.Path> pathStream)
          Returns tree nodes in the source from the paths of identifiers which connect them to the roots of the trees.
 

Method Detail

get

org.gcube.data.trees.data.Tree get(String id,
                                   org.gcube.data.trees.patterns.Pattern pattern)
                                   throws UnsupportedOperationException,
                                          org.gcube.common.clients.exceptions.UnsupportedRequestException,
                                          org.gcube.data.tml.exceptions.UnknownTreeException,
                                          org.gcube.data.tml.exceptions.InvalidTreeException,
                                          Exception
Returns a tree in the source with a given identifier, after pruning it with a given pattern.

Parameters:
id - the identifier
pattern - the pattern
Returns:
the tree
Throws:
org.gcube.data.tml.exceptions.UnknownTreeException - if the source does not contain a tree with the given identifier
org.gcube.data.tml.exceptions.InvalidTreeException - if the Tree with the the given identifier does not match the Pattern
UnsupportedOperationException - if the data source does not support this operation
Exception - if the operation fails for any other error
org.gcube.common.clients.exceptions.UnsupportedRequestException

get

org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> get(org.gcube.data.streams.Stream<String> idStream,
                                                                  org.gcube.data.trees.patterns.Pattern pattern)
                                                                  throws UnsupportedOperationException,
                                                                         org.gcube.common.clients.exceptions.UnsupportedRequestException,
                                                                         Exception
Returns trees in the source with given identifiers, after pruning them with a given pattern.

Parameters:
idStream - a stream of tree identifiers
pattern - the pattern
Returns:
a stream over the pruned trees, relatively ordered as their identifiers
Throws:
UnsupportedOperationException - if the data source does not support this operation
Exception - if the operation fails for an unexpected error
org.gcube.common.clients.exceptions.UnsupportedRequestException

get

org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> get(org.gcube.data.trees.patterns.Pattern pattern)
                                                                  throws UnsupportedOperationException,
                                                                         org.gcube.common.clients.exceptions.UnsupportedRequestException,
                                                                         Exception
Returns all the trees in the source which match a given pattern, after pruning them with it.

Parameters:
pattern - the pattern
Returns:
a stream of matching and pruned trees
Throws:
UnsupportedOperationException - if the data source does not support this operation
org.gcube.common.clients.exceptions.UnsupportedRequestException - if the data source does not support this request
Exception - if the operation fails for an unexpected error

getNode

org.gcube.data.trees.data.Node getNode(String... path)
                                       throws UnsupportedOperationException,
                                              org.gcube.data.tml.exceptions.UnknownPathException,
                                              org.gcube.common.clients.exceptions.UnsupportedRequestException,
                                              Exception
Returns a tree node in the source from the path of identifiers which connects it to the root of the tree.

Parameters:
path - the identifiers
Returns:
the node
Throws:
org.gcube.data.tml.exceptions.UnknownPathException - if the path does not lead to a node
UnsupportedOperationException - if the data source does not support this operation
org.gcube.common.clients.exceptions.UnsupportedRequestException - if the data source does not support this request
Exception - if the operation fails for any other error

getNodes

org.gcube.data.streams.Stream<org.gcube.data.trees.data.Node> getNodes(org.gcube.data.streams.Stream<org.gcube.data.tm.stubs.Path> pathStream)
                                                                       throws UnsupportedOperationException,
                                                                              Exception
Returns tree nodes in the source from the paths of identifiers which connect them to the roots of the trees.

Parameters:
pathStream - a stream of paths to the nodes
Returns:
a stream of tree nodes, relatively ordered as the corresponding paths
Throws:
UnsupportedOperationException - if the data source does not support this operation
org.gcube.common.clients.exceptions.UnsupportedRequestException - if the data source does not support this request
Exception - if the operation fails for an unexpected error


Copyright © 2012. All Rights Reserved.