Class GraphingRequestInterceptor
- java.lang.Object
-
- com.c12e.cortex.profiles.intercept.GraphingRequestInterceptor
-
- All Implemented Interfaces:
CortexInterceptor
,org.aopalliance.aop.Advice
,org.aopalliance.intercept.Interceptor
,org.aopalliance.intercept.MethodInterceptor
public class GraphingRequestInterceptor extends java.lang.Object implements CortexInterceptor
Intercepts proxied methods by scope and generates a dot notated request plan.
Cortex options specific to this interceptor: "spark.cortex.test.intercept.graphing.outfile", seeCORTEX_OUTPUT_FILENAME_OPTION
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CORTEX_OUTPUT_FILENAME_OPTION
Key in Cortex config options for specifying the filename the call graph should be written too.static java.lang.String
GUICE_ENHANCED
GraphPlan
plan
static java.util.List<java.util.function.Function<java.lang.Integer,java.lang.Boolean>>
scopes
-
Constructor Summary
Constructors Constructor Description GraphingRequestInterceptor()
Creates an interceptor instance with a newGraphPlan
instance and default method access modifier scope ofAny
GraphingRequestInterceptor(GraphPlan plan)
Creates an interceptor instance with the givenGraphPlan
and default method access modifier scope ofAny
GraphingRequestInterceptor(GraphPlan plan, java.lang.Integer modifier)
Create an interceptor instance with graph plan and trace method access modifier scope, eitherPublic -> Protected -> Any
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
invoke(org.aopalliance.intercept.MethodInvocation invocation)
protected java.lang.Boolean
isTracingScope(java.lang.reflect.Method method)
void
postIntercept(java.util.Map<java.lang.String,java.lang.String> cortexSessionOptions)
Saves the call graph to an output file based on the given session options.java.util.Map<java.lang.String,java.lang.String>
suggestedOptions(java.lang.String value)
Suggests default options for the interceptor.
-
-
-
Field Detail
-
CORTEX_OUTPUT_FILENAME_OPTION
public static final java.lang.String CORTEX_OUTPUT_FILENAME_OPTION
Key in Cortex config options for specifying the filename the call graph should be written too.- See Also:
- Constant Field Values
-
GUICE_ENHANCED
public static final java.lang.String GUICE_ENHANCED
- See Also:
- Constant Field Values
-
scopes
public static java.util.List<java.util.function.Function<java.lang.Integer,java.lang.Boolean>> scopes
-
plan
public GraphPlan plan
-
-
Constructor Detail
-
GraphingRequestInterceptor
public GraphingRequestInterceptor(GraphPlan plan, java.lang.Integer modifier)
Create an interceptor instance with graph plan and trace method access modifier scope, eitherPublic -> Protected -> Any
.- Parameters:
plan
- The CortexSession scoped planmodifier
- Method access modifier to check (seeModifier
)
-
GraphingRequestInterceptor
public GraphingRequestInterceptor(GraphPlan plan)
Creates an interceptor instance with the givenGraphPlan
and default method access modifier scope ofAny
- Parameters:
plan
- The CortexSession scoped plan
-
GraphingRequestInterceptor
public GraphingRequestInterceptor()
Creates an interceptor instance with a newGraphPlan
instance and default method access modifier scope ofAny
-
-
Method Detail
-
isTracingScope
protected java.lang.Boolean isTracingScope(java.lang.reflect.Method method)
-
invoke
public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation) throws java.lang.Throwable
- Specified by:
invoke
in interfaceorg.aopalliance.intercept.MethodInterceptor
- Throws:
java.lang.Throwable
-
suggestedOptions
public java.util.Map<java.lang.String,java.lang.String> suggestedOptions(java.lang.String value)
Description copied from interface:CortexInterceptor
Suggests default options for the interceptor.- Specified by:
suggestedOptions
in interfaceCortexInterceptor
- Parameters:
value
- context dependent value for customization- Returns:
- suggested default options
-
postIntercept
public void postIntercept(java.util.Map<java.lang.String,java.lang.String> cortexSessionOptions)
Saves the call graph to an output file based on the given session options. AnIllegalArgumentException
will be raised if the option "spark.cortex.test.intercept.graphing.outfile" is not present in session options.- Specified by:
postIntercept
in interfaceCortexInterceptor
- Parameters:
cortexSessionOptions
- Configuration options from the CortexSession
-
-