org.gcube.data.tmf.api
Interface SourceWriter

All Superinterfaces:
Serializable
All Known Implementing Classes:
AbstractWriter

public interface SourceWriter
extends Serializable

Writes, changes, or deletes trees in a data source.

The trees and the updates to the trees are expected to conform to the 'data type' of the source.

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

Method Summary
 org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> add(org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> treeStream)
          Adds many trees at once to the source.
 org.gcube.data.trees.data.Tree add(org.gcube.data.trees.data.Tree tree)
          Adds a tree to the source.
 org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> update(org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> deltaStream)
          Updates many trees at once in the source with the delta trees that capture their changes.
 org.gcube.data.trees.data.Tree update(org.gcube.data.trees.data.Tree delta)
          Updates a tree in the source with the delta tree that captures the changes.
 

Method Detail

add

org.gcube.data.trees.data.Tree add(org.gcube.data.trees.data.Tree tree)
                                   throws UnsupportedOperationException,
                                          org.gcube.common.clients.exceptions.UnsupportedRequestException,
                                          org.gcube.data.tml.exceptions.InvalidTreeException,
                                          Exception
Adds a tree to the source.

Parameters:
tree - the tree
Returns:
a tree that models the outcome of adding the tree in input. If not otherwise documented for this plugin, the outcome is the input tree with modifications made at the point of addition to the source, if any.
Throws:
org.gcube.data.tml.exceptions.InvalidTreeException - if the tree does not conform to the data type of the source or if it is invalid for addition (e.g. some of its nodes have already identifiers)
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 reason

add

org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> add(org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> treeStream)
                                                                  throws UnsupportedOperationException,
                                                                         org.gcube.common.clients.exceptions.UnsupportedRequestException,
                                                                         Exception
Adds many trees at once to the source.

Parameters:
treeStream - the stream of trees
Returns:
a stream with the outcomes of adding the input trees. Successful outcomes are trees; if not otherwise documented for this plugin, these are the input trees with modifications made at the point of addition if any. Unsuccessful outcomes are failures and will be raised as the stream is consumed.
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 as a whole for an unexpected error

update

org.gcube.data.trees.data.Tree update(org.gcube.data.trees.data.Tree delta)
                                      throws org.gcube.data.tml.exceptions.UnknownTreeException,
                                             org.gcube.data.tml.exceptions.InvalidTreeException,
                                             Exception
Updates a tree in the source with the delta tree that captures the changes.

Parameters:
delta - the delta tree
Returns:
a tree that models the outcome of updating the tree in input. If not otherwise documented for this plugin, the outcome is the input tree with modifications made at the point of update, if any.
Throws:
org.gcube.data.tml.exceptions.UnknownTreeException - if the delta tree does not identify a tree in the source
org.gcube.data.tml.exceptions.InvalidTreeException - if the delta tree does now qualify for update
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

update

org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> update(org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> deltaStream)
                                                                     throws UnsupportedOperationException,
                                                                            org.gcube.common.clients.exceptions.UnsupportedRequestException,
                                                                            Exception
Updates many trees at once in the source with the delta trees that capture their changes.

Parameters:
deltaStream - the delta trees
Returns:
a stream with the outcomes of updating the input trees. Successful outcomes are trees; if not otherwise documented for this plugin, these are the input trees with modifications made at the point of addition if any. Unsuccessful outcomes are failures and will be raised as the stream is consumed.
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 as a whole for an expected error


Copyright © 2012. All Rights Reserved.