org.gcube.data.speciesplugin.store
Interface SpeciesStore

All Known Implementing Classes:
SpeciesNeoStore

public interface SpeciesStore

Author:
"Federico De Faveri defaveri@isti.cnr.it", "Valentina Marioli valentina.marioli@isti.cnr.it"

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 store.
 org.gcube.data.trees.data.Tree add(org.gcube.data.trees.data.Tree doc)
          Adds a tree to the store.
 long cardinality()
          Returns the cardinality of the store.
 void delete()
          Deletes a store, stopping it if it has been started.
 Iterator<org.gcube.data.trees.data.Tree> get(org.gcube.data.trees.patterns.Pattern pattern)
          Returns all the trees in the store which match a given pattern, after pruning them with it.
 org.gcube.data.trees.data.Tree get(String id, org.gcube.data.trees.patterns.Pattern pattern)
          Returns a tree in the store with a given identifier, after pruning it with a given pattern.
 String id()
          Returns the store identifier.
 File location()
          Returns the location of the store.
 void start(File storageLocation)
          Starts the store in a given storage location,
 void stop()
          Stops a started store.
 

Method Detail

id

String id()
Returns the store identifier.

Returns:
the identifier

start

void start(File storageLocation)
Starts the store in a given storage location,

Parameters:
storageLocation - the location

stop

void stop()
Stops a started store.


delete

void delete()
Deletes a store, stopping it if it has been started.


location

File location()
Returns the location of the store.

Returns:
the location

cardinality

long cardinality()
Returns the cardinality of the store.

Returns:
the cardinality

get

org.gcube.data.trees.data.Tree get(String id,
                                   org.gcube.data.trees.patterns.Pattern pattern)
                                   throws org.gcube.data.tmf.api.exceptions.UnknownTreeException,
                                          org.gcube.data.tmf.api.exceptions.InvalidTreeException,
                                          Exception
Returns a tree in the store 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.tmf.api.exceptions.UnknownTreeException - if the store does not contain a tree with the given identifier
org.gcube.data.tmf.api.exceptions.InvalidTreeException - if the Tree with the the given identifier does not match the Pattern
Exception - if the operation fails for any other error

get

Iterator<org.gcube.data.trees.data.Tree> get(org.gcube.data.trees.patterns.Pattern pattern)
                                             throws Exception
Returns all the trees in the store which match a given pattern, after pruning them with it.

Parameters:
pattern - the pattern
Returns:
a stream of matching and pruned trees
Throws:
Exception - if the operation fails for an unexpected error

add

org.gcube.data.trees.data.Tree add(org.gcube.data.trees.data.Tree doc)
                                   throws org.gcube.data.tmf.api.exceptions.InvalidTreeException
Adds a tree to the store.

Parameters:
tree - the tree
Returns:
the input tree with any change post insertion
Throws:
org.gcube.data.tmf.api.exceptions.InvalidTreeException - if the tree does is invalid for addition (e.g. some of its nodes have already identifiers)
UnsupportedOperationException - if the store does not support this operation
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 Exception
Adds many trees at once to the store.

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:
Exception - if the operation fails as a whole for an unexpected error


Copyright © 2013. All Rights Reserved.