Package uk.gov.gchq.gaffer.graph
Class GraphConfig
- java.lang.Object
-
- uk.gov.gchq.gaffer.graph.GraphConfig
-
public final class GraphConfig extends Object
GraphConfig
contains configuration for Graphs. This configuration is used along side aSchema
andStoreProperties
to create aGraph
. This configuration is made up of graph properties such as a graphId,GraphLibrary
, a graphView
andGraphHook
s. To create an instance of GraphConfig you can either use theGraphConfig.Builder
or a json file. If you wish to write a GraphHook in a separate json file and include it, you can do it by using theGraphHookPath
GraphHook and setting the path field within.- See Also:
GraphConfig.Builder
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GraphConfig.Builder
-
Constructor Summary
Constructors Constructor Description GraphConfig()
GraphConfig(String graphId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHook(GraphHook hook)
Adds the suppliedGraphHook
to the list of graph hooks.String
getDescription()
String
getGraphId()
List<GraphHook>
getHooks()
Returns a list of all the graph hooks.GraphLibrary
getLibrary()
Boolean
getOtelActive()
Is OpenTelemtery logging set to be activeView
getView()
boolean
hasHook(Class<? extends GraphHook> hookClass)
Checks the currentGraphHook
list to see if any of the hooks match the supplied class.void
initView(Schema schema)
Initialises theView
for the graph config based on supplied schema.void
setDescription(String description)
void
setGraphId(String graphId)
void
setHooks(List<GraphHook> hooks)
void
setLibrary(GraphLibrary library)
void
setOtelActive(Boolean otelActive)
Set OpenTelemetry logging to be activevoid
setView(View view)
String
toString()
void
validateAndUpdateGetFromCacheHook(Store store, Class<? extends Operation> operationClass, Class<? extends GetFromCacheHook> hookClass, String suffixFromProperties)
Extracts and compares the cache suffixes of the suppliedOperation
's handler andGetFromCacheHook
resolver hook, throwsGraphHookSuffixException
if mismatched as writing and reading to cache will not behave correctly.
-
-
-
Constructor Detail
-
GraphConfig
public GraphConfig()
-
GraphConfig
public GraphConfig(String graphId)
-
-
Method Detail
-
getGraphId
public String getGraphId()
-
setGraphId
public void setGraphId(String graphId)
-
getView
public View getView()
-
setView
public void setView(View view)
-
getLibrary
public GraphLibrary getLibrary()
-
setLibrary
public void setLibrary(GraphLibrary library)
-
getDescription
public String getDescription()
-
setDescription
public void setDescription(String description)
-
getHooks
public List<GraphHook> getHooks()
Returns a list of all the graph hooks.- Returns:
- List of graph hooks.
-
getOtelActive
public Boolean getOtelActive()
Is OpenTelemtery logging set to be active- Returns:
- True if active
-
setOtelActive
public void setOtelActive(Boolean otelActive)
Set OpenTelemetry logging to be active- Parameters:
otelActive
- is active
-
addHook
public void addHook(GraphHook hook)
Adds the suppliedGraphHook
to the list of graph hooks.- Parameters:
hook
- The hook to add.
-
hasHook
public boolean hasHook(Class<? extends GraphHook> hookClass)
Checks the currentGraphHook
list to see if any of the hooks match the supplied class. Will return true if list contains one or more matches.- Parameters:
hookClass
- Class to check for match.- Returns:
- True if hook with matching class found.
-
validateAndUpdateGetFromCacheHook
public void validateAndUpdateGetFromCacheHook(Store store, Class<? extends Operation> operationClass, Class<? extends GetFromCacheHook> hookClass, String suffixFromProperties)
Extracts and compares the cache suffixes of the suppliedOperation
's handler andGetFromCacheHook
resolver hook, throwsGraphHookSuffixException
if mismatched as writing and reading to cache will not behave correctly.Will attempt to add the supplied
GetFromCacheHook
to the graph config if not currently present.- Parameters:
store
- The Store the operationClass is foroperationClass
- The Operation requiring cache writehookClass
- The Hook requiring cache readingsuffixFromProperties
- The suffix from property
-
initView
public void initView(Schema schema)
Initialises theView
for the graph config based on supplied schema.- Parameters:
schema
- The schema to set the View from.
-
-