Package uk.gov.gchq.gaffer.graph
Class GraphConfig
- java.lang.Object
-
- uk.gov.gchq.gaffer.graph.GraphConfig
-
public final class GraphConfig extends Object
GraphConfigcontains configuration for Graphs. This configuration is used along side aSchemaandStorePropertiesto create aGraph. This configuration is made up of graph properties such as a graphId,GraphLibrary, a graphViewandGraphHooks. To create an instance of GraphConfig you can either use theGraphConfig.Builderor a json file. If you wish to write a GraphHook in a separate json file and include it, you can do it by using theGraphHookPathGraphHook and setting the path field within.- See Also:
GraphConfig.Builder
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGraphConfig.Builder
-
Constructor Summary
Constructors Constructor Description GraphConfig()GraphConfig(String graphId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddHook(GraphHook hook)Adds the suppliedGraphHookto the list of graph hooks.StringgetDescription()StringgetGraphId()List<GraphHook>getHooks()Returns a list of all the graph hooks.GraphLibrarygetLibrary()BooleangetOtelActive()Is OpenTelemtery logging set to be activeViewgetView()booleanhasHook(Class<? extends GraphHook> hookClass)Checks the currentGraphHooklist to see if any of the hooks match the supplied class.voidinitView(Schema schema)Initialises theViewfor the graph config based on supplied schema.voidsetDescription(String description)voidsetGraphId(String graphId)voidsetHooks(List<GraphHook> hooks)voidsetLibrary(GraphLibrary library)voidsetOtelActive(Boolean otelActive)Set OpenTelemetry logging to be activevoidsetView(View view)StringtoString()voidvalidateAndUpdateGetFromCacheHook(Store store, Class<? extends Operation> operationClass, Class<? extends GetFromCacheHook> hookClass, String suffixFromProperties)Extracts and compares the cache suffixes of the suppliedOperation's handler andGetFromCacheHookresolver hook, throwsGraphHookSuffixExceptionif 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 suppliedGraphHookto the list of graph hooks.- Parameters:
hook- The hook to add.
-
hasHook
public boolean hasHook(Class<? extends GraphHook> hookClass)
Checks the currentGraphHooklist 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 andGetFromCacheHookresolver hook, throwsGraphHookSuffixExceptionif mismatched as writing and reading to cache will not behave correctly.Will attempt to add the supplied
GetFromCacheHookto 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 theViewfor the graph config based on supplied schema.- Parameters:
schema- The schema to set the View from.
-
-