Class FinkGremlinRecipies
- java.lang.Object
-
- com.Lomikel.Januser.GremlinRecipies
-
- com.astrolabsoftware.FinkBrowser.Januser.FinkGremlinRecipies
-
public class FinkGremlinRecipies extends GremlinRecipies
FinkGremlinRecipies
provides various recipies to handle and modify Gremlin Graphs for Fink.- Author:
- J.Hrivnac
-
-
Field Summary
Fields Modifier and Type Field Description private FinkHBaseClient
_fhclient
private java.lang.String
_fhclientUrl
private java.lang.String
_now
private static java.lang.String
FINK_ANOMALY_WS
private static java.lang.String
FINK_LATESTS_WS
private static java.lang.String
FINK_OBJECTS_WS
private static org.apache.logging.log4j.Logger
log
Logging .
-
Constructor Summary
Constructors Constructor Description FinkGremlinRecipies(ModifyingGremlinClient client)
Create and attach toModifyingGremlinClient
.FinkGremlinRecipies(GraphTraversalSource g)
Create and attach toGraphTraversalSource
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assembleAlertsOfInterest(Classifiers classifier)
Assemble AlertsOfInterest from all existing alerts.void
assembleAlertsOfInterest(Classifiers classifier, Vertex alert)
Assemble AlertsOfInterest from an alert.void
classifySource(Classifiers classifier, java.lang.String oid, java.lang.String hbaseUrl, boolean enhance, java.lang.String columns)
Classify source and expand them to alerts (if requested).void
cleanSourcesOfInterest(Classifiers classifier, java.lang.String cls)
Clean tree under SourcesOfInterest.void
enhanceSource(Classifiers classifier, Vertex source, java.lang.String[] jds, java.lang.String columns)
Expand tree under source with alerts filled with requested HBase columns.void
enhanceSourcesOfInterest(Classifiers classifier, java.lang.String columns)
Expand tree under all SourcesOfInterest with alerts filled with requested HBase columns.void
enhanceSourcesOfInterest(Classifiers classifier, java.lang.String cls, java.lang.String columns)
Expand tree under SourcesOfInterest with alerts filled with requested HBase columns.private FinkHBaseClient
fhclient()
Get existingFinkHBaseClient
.private FinkHBaseClient
fhclient(java.lang.String hbaseUrl)
Create a newFinkHBaseClient
.void
fillSourcesOfInterest(Classifiers classifier, java.lang.String hbaseUrl, int nLimit, int timeLimit, java.lang.String[] clss, boolean enhance, java.lang.String columns)
Fill graph with SourcesOfInterest and expand them to alerts (if requested).void
generateAlertsOfInterestCorrelations(Classifiers classifier)
Generate overlaps Edges between AlertsOfInterest and SourcesOfInterest.void
generateCorrelations(Classifiers... classifiers)
Generate overlaps Edges between AlertsOfInterest and SourcesOfInterest.void
generateSourcesOfInterestCorrelations(Classifiers classifier)
Generate overlaps Edges between SourcesOfInterest Vertices.void
processSourcesOfInterest(java.lang.String classifierName, java.lang.String hbaseUrl, int nLimit, int timeLimit, java.lang.String[] clss, boolean enhance, java.lang.String columns)
Execute full chain of new sources correlations analyses.void
registerSourcesOfInterest(Classifiers classifier, java.lang.String cls, java.lang.String objectId, double weight, java.lang.String instancesS, java.lang.String hbaseUrl, boolean enhance, java.lang.String columns)
Register source in SourcesOfInterest.void
registerSourcesOfInterest(Classifiers classifier, java.lang.String cls, java.lang.String objectId, double weight, java.util.Set<java.lang.Double> instances, java.lang.String hbaseUrl, boolean enhance, java.lang.String columns)
Register source in SourcesOfInterest.-
Methods inherited from class com.Lomikel.Januser.GremlinRecipies
addEdge, addEdge, addEdge, attachDataLink, checkEdge, client, commit, created, createMetaSchema, drop, g, getEdge, getOrCreate, getOrCreate, gimme, graph, structurise
-
-
-
-
Field Detail
-
_fhclient
private FinkHBaseClient _fhclient
-
_fhclientUrl
private java.lang.String _fhclientUrl
-
_now
private java.lang.String _now
-
FINK_OBJECTS_WS
private static java.lang.String FINK_OBJECTS_WS
-
FINK_LATESTS_WS
private static java.lang.String FINK_LATESTS_WS
-
FINK_ANOMALY_WS
private static java.lang.String FINK_ANOMALY_WS
-
log
private static org.apache.logging.log4j.Logger log
Logging .
-
-
Constructor Detail
-
FinkGremlinRecipies
public FinkGremlinRecipies(GraphTraversalSource g)
Create and attach toGraphTraversalSource
.- Parameters:
g
- The attachedGraphTraversalSource
.
-
FinkGremlinRecipies
public FinkGremlinRecipies(ModifyingGremlinClient client)
Create and attach toModifyingGremlinClient
.- Parameters:
client
- The attachedModifyingGremlinClient
.
-
-
Method Detail
-
processSourcesOfInterest
public void processSourcesOfInterest(java.lang.String classifierName, java.lang.String hbaseUrl, int nLimit, int timeLimit, java.lang.String[] clss, boolean enhance, java.lang.String columns) throws LomikelException
Execute full chain of new sources correlations analyses.- Parameters:
classifierName
- The name of theClassifier
to be used.hbaseUrl
- The url of HBase with alerts as ip:port:table:schema.nLimit
- The maximal number of alerts getting from HBase or Fink Portal.timeLimit
- How far into the past the search should search (in minutes).clss
- An array of classes taken fromFPC
, if contains Anomaly, get anomalies fromFPC
, if null, analyse sources from HBase database.enhance
- Whether expand tree under all SourcesOfInterest with alerts possibly filled with requested HBase columns.columns
- HBase columns to be copied into graph alerts. May be null.- Throws:
LomikelException
- If anhything fails.
-
fillSourcesOfInterest
public void fillSourcesOfInterest(Classifiers classifier, java.lang.String hbaseUrl, int nLimit, int timeLimit, java.lang.String[] clss, boolean enhance, java.lang.String columns) throws LomikelException
Fill graph with SourcesOfInterest and expand them to alerts (if requested).- Parameters:
classifier
- TheClassifier
to be used.hbaseUrl
- The url of HBase with alerts as ip:port:table:schema.nLimit
- The maximal number of alerts getting from HBase or Fink Portal.timeLimit
- How far into the past the search should search (in minutes).clss
- An array of classes taken fromFPC
, if contains Anomaly, get anomalies fromFPC
, if null, analyse sources from HBase database.enhance
- Whether expand tree under all SourcesOfInterest with alerts possibly filled with requested HBase columns.columns
- The HBase columns to be copied into graph alerts. May be null.- Throws:
LomikelException
- If anything fails.
-
classifySource
public void classifySource(Classifiers classifier, java.lang.String oid, java.lang.String hbaseUrl, boolean enhance, java.lang.String columns) throws LomikelException
Classify source and expand them to alerts (if requested).- Parameters:
classifier
- TheClassifier
to be used.oid
- The objectId of source to be added.hbaseUrl
- The url of HBase with alerts as ip:port:table:schema.enhance
- Whether expand tree under all SourcesOfInterest with alerts possibly filled with requested HBase columns.columns
- The HBase columns to be copied into graph alerts. May be null.- Throws:
LomikelException
- If anything fails.
-
registerSourcesOfInterest
public void registerSourcesOfInterest(Classifiers classifier, java.lang.String cls, java.lang.String objectId, double weight, java.lang.String instancesS, java.lang.String hbaseUrl, boolean enhance, java.lang.String columns)
Register source in SourcesOfInterest.- Parameters:
classifier
- TheClassifier
to be used.cls
- The type (class) of SourcesOfInterestVertex
. It will be created if not yet exists.objectId
- The objectId of the new SourceVertex
. It will be created if not yet exists.weight
- The weight of the connection. Usualy the number of Alerts of this type.instanceS
- The jd of related Alerts as strings separated by comma. Potential square brackets are removed.hbaseUrl
- The url of the HBase carrying full Alert data as ip:port:table:schema.enhance
- Whether expand tree under all SourcesOfInterest with alerts possibly filled with requested HBase columns.columns
- The HBase columns to be filled into alerts. May be null. Ignored if enhancement not requested.
-
registerSourcesOfInterest
public void registerSourcesOfInterest(Classifiers classifier, java.lang.String cls, java.lang.String objectId, double weight, java.util.Set<java.lang.Double> instances, java.lang.String hbaseUrl, boolean enhance, java.lang.String columns)
Register source in SourcesOfInterest.- Parameters:
classifier
- TheClassifier
to be used.cls
- The type (class) of SourcesOfInterestVertex
. It will be created if not yet exists.objectId
- The objectId of the new SourceVertex
. It will be created if not yet exists.weight
- The weight of the connection. Usualy the number of Alerts of this type.instances
- The jd of related Alerts.hbaseUrl
- The url of the HBase carrying full Alert data as ip:port:table:schema.enhance
- Whether expand tree under all SourcesOfInterest with alerts filled with requested HBase columns.columns
- The HBase columns to be filled into alerts. May be null. Ignored if enhancement not requested.
-
enhanceSourcesOfInterest
public void enhanceSourcesOfInterest(Classifiers classifier, java.lang.String columns) throws LomikelException
Expand tree under all SourcesOfInterest with alerts filled with requested HBase columns.- Parameters:
classifier
- TheClassifier
to be used.columns
- The HBase columns to be filled into alerts. May be null.- Throws:
LomikelException
- If anything goes wrong.
-
enhanceSourcesOfInterest
public void enhanceSourcesOfInterest(Classifiers classifier, java.lang.String cls, java.lang.String columns) throws LomikelException
Expand tree under SourcesOfInterest with alerts filled with requested HBase columns.- Parameters:
classifier
- TheClassifier
to be used.cls
- The type (class) of SourcesOfInterest.columns
- The HBase columns to be filled into alerts. May be null.- Throws:
LomikelException
- If anything goes wrong.
-
enhanceSource
public void enhanceSource(Classifiers classifier, Vertex source, java.lang.String[] jds, java.lang.String columns) throws LomikelException
Expand tree under source with alerts filled with requested HBase columns. It also assembles related AlertsOfInterest.- Parameters:
classifier
- TheClassifier
to be used.source
- The source.jds
- The jd of related Alerts.columns
- The HBase columns to be filled into alerts. May be null.- Throws:
LomikelException
- If anything goes wrong.
-
cleanSourcesOfInterest
public void cleanSourcesOfInterest(Classifiers classifier, java.lang.String cls) throws LomikelException
Clean tree under SourcesOfInterest. Drop alerts. Alerts are dropped even if they have otherEdge
s.- Parameters:
classifier
- TheClassifier
to be used.cls
- The type (class) of SourcesOfInterest.- Throws:
LomikelException
- If anything goes wrong.
-
generateSourcesOfInterestCorrelations
public void generateSourcesOfInterestCorrelations(Classifiers classifier)
Generate overlaps Edges between SourcesOfInterest Vertices.- Parameters:
classifier
- TheClassifier
to be used.
-
assembleAlertsOfInterest
public void assembleAlertsOfInterest(Classifiers classifier)
Assemble AlertsOfInterest from all existing alerts.- Parameters:
classifier
- TheClassifier
to be used.
-
assembleAlertsOfInterest
public void assembleAlertsOfInterest(Classifiers classifier, Vertex alert)
Assemble AlertsOfInterest from an alert.- Parameters:
classifier
- TheClassifier
to be used.alert
- The existing alert.
-
generateCorrelations
public void generateCorrelations(Classifiers... classifiers)
Generate overlaps Edges between AlertsOfInterest and SourcesOfInterest. Possibly between twoClassifier
s.- Parameters:
classifiers
- TheClassifier
s to be used.
-
generateAlertsOfInterestCorrelations
public void generateAlertsOfInterestCorrelations(Classifiers classifier)
Generate overlaps Edges between AlertsOfInterest and SourcesOfInterest.- Parameters:
classifier
- TheClassifier
to be used.
-
fhclient
private FinkHBaseClient fhclient(java.lang.String hbaseUrl) throws LomikelException
Create a newFinkHBaseClient
. Singleton when url unchanged.- Parameters:
hbaseUrl
- The HBase url as ip:port:table[:schema].- Returns:
- The corresponding
FinkHBaseClient
, created and initialised if needed. - Throws:
LomikelException
- If cannot be created.
-
fhclient
private FinkHBaseClient fhclient() throws LomikelException
Get existingFinkHBaseClient
.- Returns:
- The corresponding
FinkHBaseClient
. - Throws:
LomikelException
- If not yet created.
-
-