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 String
FEDERATED_STORE_SYSTEM_USER
The 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 void
addGraph(GraphSerialisable graph, GraphAccess graphAccess)
Add a new graph so that it is available to this federated store.void
changeGraphId(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.GraphSerialisable
getGraph(String graphId)
Get theGraphSerialisable
from a given graph ID.GraphAccess
getGraphAccess(String graphId)
Get theGraphAccess
from the given graph ID.org.apache.commons.lang3.tuple.Pair<GraphSerialisable,GraphAccess>
getGraphAccessPair(String graphId)
Schema
getSchema()
Get this Store's internalSchema
.Schema
getSchema(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.void
initialise(String graphId, Schema unused, StoreProperties properties)
void
removeGraph(String graphId)
Remove a graph from the scope of this store.void
setDefaultGraphIds(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 theGraphSerialisable
from a given graph ID. The graph must obviously be known to this federated store to be returned.- Parameters:
graphId
- The graph ID- Returns:
- The
GraphSerialisable
relating to the ID. - Throws:
CacheOperationException
- If issue getting from cache.IllegalArgumentException
- If graph not found.
-
getGraphAccess
public GraphAccess getGraphAccess(String graphId) throws CacheOperationException
Get theGraphAccess
from the given graph ID. The graph must obviously be known to this federated store to be returned.- Parameters:
graphId
- The graph ID- Returns:
- The
GraphAccess
relating 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
Pair
relating 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
Pair
s containing theGraphSerialisable
andGraphAccess
-
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.
-
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:
initialise
in classStore
- Throws:
StoreException
-
-