org.gcube.data.speciesplugin.store
Class SpeciesNeoStore

java.lang.Object
  extended by org.gcube.data.speciesplugin.store.SpeciesNeoStore
All Implemented Interfaces:
Serializable, SpeciesStore

public class SpeciesNeoStore
extends Object
implements SpeciesStore, Serializable

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

Field Summary
protected  org.gcube.data.tr.neo.NeoStore neoStore
           
protected static QName STORE_ID
           
 
Constructor Summary
SpeciesNeoStore(String storeId)
           
 
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 tree)
          Adds a tree to the store.
 long cardinality()
          Returns the cardinality of the store.
protected  org.gcube.data.trees.data.Tree cloneTree(org.gcube.data.trees.data.Tree tree, String newId)
           
 void delete()
          Deletes a store, stopping it if it has been started.
protected  org.gcube.data.trees.data.Tree fromStoreToService(org.gcube.data.trees.data.Tree storeTree)
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STORE_ID

protected static final QName STORE_ID

neoStore

protected org.gcube.data.tr.neo.NeoStore neoStore
Constructor Detail

SpeciesNeoStore

public SpeciesNeoStore(String storeId)
                throws IllegalStateException
Throws:
IllegalStateException
Method Detail

id

public String id()
Returns the store identifier.

Specified by:
id in interface SpeciesStore
Returns:
the identifier

location

public File location()
Returns the location of the store.

Specified by:
location in interface SpeciesStore
Returns:
the location

cardinality

public long cardinality()
Returns the cardinality of the store.

Specified by:
cardinality in interface SpeciesStore
Returns:
the cardinality

start

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

Specified by:
start in interface SpeciesStore
Parameters:
storageLocation - the location

stop

public void stop()
Stops a started store.

Specified by:
stop in interface SpeciesStore

delete

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

Specified by:
delete in interface SpeciesStore

get

public 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
Returns a tree in the store with a given identifier, after pruning it with a given pattern.

Specified by:
get in interface SpeciesStore
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

get

public 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.

Specified by:
get in interface SpeciesStore
Parameters:
pattern - the pattern
Returns:
a stream of matching and pruned trees

add

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

Specified by:
add in interface SpeciesStore
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)

add

public 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.

Specified by:
add in interface SpeciesStore
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

fromStoreToService

protected org.gcube.data.trees.data.Tree fromStoreToService(org.gcube.data.trees.data.Tree storeTree)

cloneTree

protected org.gcube.data.trees.data.Tree cloneTree(org.gcube.data.trees.data.Tree tree,
                                                   String newId)


Copyright © 2014. All Rights Reserved.