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.tml.outcomes.AddTreeOutcome> 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.tml.outcomes.UpdateTreeFailure> 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.
 void 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 org.gcube.data.tml.exceptions.UnsupportedOperationException,
                                          org.gcube.data.tml.exceptions.UnsupportedRequestException,
                                          org.gcube.data.tml.exceptions.InvalidTreeException,
                                          Exception
Adds a tree to the source.

Parameters:
tree - the tree
Returns:
the input tree, possibly annotated with metadata added at the time of insertion in the source.
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)
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 reason

add

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

Parameters:
treeStream - the stream of trees
Returns:
a stream of outcomes, one per tree in the input stream and in the same relative order.
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 as a whole for an unexpected error

update

void update(org.gcube.data.trees.data.Tree delta)
            throws org.gcube.data.tml.exceptions.UnsupportedOperationException,
                   org.gcube.data.tml.exceptions.UnknownTreeException,
                   org.gcube.data.tml.exceptions.UnsupportedRequestException,
                   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
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
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

update

org.gcube.data.streams.Stream<org.gcube.data.tml.outcomes.UpdateTreeFailure> update(org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> deltaStream)
                                                                                    throws org.gcube.data.tml.exceptions.UnsupportedOperationException,
                                                                                           org.gcube.data.tml.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:
the failures that may occur in the process
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 as a whole for an expected error


Copyright © 2012. All Rights Reserved.