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 org.gcube.data.tml.exceptions.UnsupportedOperationException,
                                          org.gcube.data.tml.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
org.gcube.data.tml.exceptions.UnsupportedOperationException - if the data source does not support this operation
Exception - if the operation fails for any other error
org.gcube.data.tml.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 org.gcube.data.tml.exceptions.UnsupportedOperationException,
                                                                         org.gcube.data.tml.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:
org.gcube.data.tml.exceptions.UnsupportedOperationException - if the data source does not support this operation
Exception - if the operation fails for an unexpected error
org.gcube.data.tml.exceptions.UnsupportedRequestException

get

org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> get(org.gcube.data.trees.patterns.Pattern pattern)
                                                                  throws org.gcube.data.tml.exceptions.UnsupportedOperationException,
                                                                         org.gcube.data.tml.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:
org.gcube.data.tml.exceptions.UnsupportedOperationException - if the data source does not support this operation
org.gcube.data.tml.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 org.gcube.data.tml.exceptions.UnsupportedOperationException,
                                              org.gcube.data.tml.exceptions.UnknownPathException,
                                              org.gcube.data.tml.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
org.gcube.data.tml.exceptions.UnsupportedOperationException - if the data source does not support this operation
org.gcube.data.tml.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 org.gcube.data.tml.exceptions.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:
org.gcube.data.tml.exceptions.UnsupportedOperationException - if the data source does not support this operation
org.gcube.data.tml.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.