Class FederatedStore
- java.lang.Object
-
- uk.gov.gchq.gaffer.store.Store
-
- uk.gov.gchq.gaffer.federated.simple.FederatedStore
-
public class FederatedStore extends Store
-
-
Field Summary
Fields Modifier and Type Field Description static StringFEDERATED_STORE_SYSTEM_USERThe system user account name, this user is essentially an admin for this store.Map<Class<? extends Operation>,OperationHandler<?>>storeHandlers
-
Constructor Summary
Constructors Constructor Description FederatedStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddGraph(GraphSerialisable graph, GraphAccess graphAccess)Add a new graph so that it is available to this federated store.voidchangeGraphAccess(String graphId, GraphAccess newAccess)Updates a graph access by overwriting the access for that graph stored in the cache.voidchangeGraphId(String graphToUpdateId, String newGraphId)Change the graph's ID for the specified graph.Iterable<org.apache.commons.lang3.tuple.Pair<GraphSerialisable,GraphAccess>>getAllGraphsAndAccess()Returns all the graphs and their access available to this store.List<String>getDefaultGraphIds()Get the default list of graph IDs for this federated store.GraphSerialisablegetGraph(String graphId)Get theGraphSerialisablefrom a given graph ID.GraphAccessgetGraphAccess(String graphId)Get theGraphAccessfrom the given graph ID.org.apache.commons.lang3.tuple.Pair<GraphSerialisable,GraphAccess>getGraphAccessPair(String graphId)SchemagetSchema()Get this Store's internalSchema.SchemagetSchema(List<GraphSerialisable> graphs)Gets a merged schema based on the graphs specified.Set<Class<? extends Operation>>getStoreSpecificOperations()Access to getting the operations that have handlers specific to this store e.g.voidinitialise(String graphId, Schema unused, StoreProperties properties)voidremoveGraph(String graphId)Remove a graph from the scope of this store.voidsetDefaultGraphIds(List<String> defaultGraphIds)Set the default list of graph IDs for this federated store.-
Methods inherited from class uk.gov.gchq.gaffer.store.Store
addOperationChainOptimisers, addOperationHandler, addOperationHandler, createContext, createStore, createStore, execute, execute, executeJob, executeJob, getCaches, getCreatedTime, getGraphId, getGraphLibrary, getJobTracker, getNextOperations, getOperationChainOptimisers, getOperationChainValidator, getOperationHandler, getOriginalSchema, getProperties, getSupportedOperations, handleOperation, isSupported, optimiseSchema, populateElement, runAsync, setGraphLibrary, setOriginalSchema, updateJsonSerialiser, updateJsonSerialiser, validateSchemas
-
-
-
-
Field Detail
-
FEDERATED_STORE_SYSTEM_USER
public static final String FEDERATED_STORE_SYSTEM_USER
The system user account name, this user is essentially an admin for this store.- See Also:
- Constant Field Values
-
storeHandlers
public final Map<Class<? extends Operation>,OperationHandler<?>> storeHandlers
-
-
Method Detail
-
addGraph
public void addGraph(GraphSerialisable graph, GraphAccess graphAccess)
Add a new graph so that it is available to this federated store.- Parameters:
graph- The serialisable instance of the graph.graphAccess- The graph access.- Throws:
IllegalArgumentException- If there is already a graph with the supplied ID
-
removeGraph
public void removeGraph(String graphId)
Remove a graph from the scope of this store.- Parameters:
graphId- The graph ID of the graph to remove.- Throws:
IllegalArgumentException- If graph does not exist.
-
getGraph
public GraphSerialisable getGraph(String graphId) throws CacheOperationException
Get theGraphSerialisablefrom a given graph ID. The graph must obviously be known to this federated store to be returned.- Parameters:
graphId- The graph ID- Returns:
- The
GraphSerialisablerelating to the ID. - Throws:
CacheOperationException- If issue getting from cache.IllegalArgumentException- If graph not found.
-
getGraphAccess
public GraphAccess getGraphAccess(String graphId) throws CacheOperationException
Get theGraphAccessfrom the given graph ID. The graph must obviously be known to this federated store to be returned.- Parameters:
graphId- The graph ID- Returns:
- The
GraphAccessrelating to the ID. - Throws:
CacheOperationException- If issue getting from cache.IllegalArgumentException- If graph not found.
-
getGraphAccessPair
public org.apache.commons.lang3.tuple.Pair<GraphSerialisable,GraphAccess> getGraphAccessPair(String graphId) throws CacheOperationException
- Parameters:
graphId- The graph ID- Returns:
- The
Pairrelating to the graph ID. - Throws:
CacheOperationException- If issue getting from cache.IllegalArgumentException- If graph not found.
-
getAllGraphsAndAccess
public Iterable<org.apache.commons.lang3.tuple.Pair<GraphSerialisable,GraphAccess>> getAllGraphsAndAccess()
Returns all the graphs and their access available to this store.- Returns:
- Iterable of
Pairs containing theGraphSerialisableandGraphAccess
-
getDefaultGraphIds
public List<String> getDefaultGraphIds()
Get the default list of graph IDs for this federated store.- Returns:
- The default list.
-
setDefaultGraphIds
public void setDefaultGraphIds(List<String> defaultGraphIds)
Set the default list of graph IDs for this federated store.- Parameters:
defaultGraphIds- Default list to set.
-
changeGraphId
public void changeGraphId(String graphToUpdateId, String newGraphId) throws StoreException, CacheOperationException
Change the graph's ID for the specified graph.- Parameters:
graphToUpdateId- The graph that is to have its ID updated.newGraphId- The new graph ID.- Throws:
StoreException- If the accumulo table cannot be renamed.CacheOperationException- If issue getting existing graph from cache.
-
changeGraphAccess
public void changeGraphAccess(String graphId, GraphAccess newAccess) throws CacheOperationException
Updates a graph access by overwriting the access for that graph stored in the cache.- Parameters:
graphId- The graph ID to update.newAccess- The new graph access.- Throws:
CacheOperationException- If issue updating the cache.
-
getSchema
public Schema getSchema(List<GraphSerialisable> graphs)
Gets a merged schema based on the graphs specified.- Parameters:
graphs- The graphs to get the schemas from.- Returns:
- A merged
Schema
-
getStoreSpecificOperations
public Set<Class<? extends Operation>> getStoreSpecificOperations()
Access to getting the operations that have handlers specific to this store e.g. operations that should always be handled specially.- Returns:
- The Operation classes handled by this store.
-
initialise
public void initialise(String graphId, Schema unused, StoreProperties properties) throws StoreException
- Overrides:
initialisein classStore- Throws:
StoreException
-
-