Package jadex.bridge.service.component
Class ServiceInvocationContext
- java.lang.Object
-
- jadex.bridge.service.component.ServiceInvocationContext
-
public class ServiceInvocationContext extends java.lang.Object
Context for service invocations. Contains all method call information. Invariants that must hold before, during and after a service call for the NEXT/CUR/LAST service calls caller callee before next = null || user defined cur = actual call during next = null (set in ServiceInvocContext) cur = next cur = cur (same as in before) (set in MethodInvocationInterceptor) after next = null cur = cur (same as in before) last = next (set in MethodInvocationInterceptor)
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<java.util.List<java.lang.Object>>
arguments
The invocation arguments.protected IComponentIdentifier
caller
The caller component.protected static java.util.Map<IComponentIdentifier,java.util.Map<java.lang.reflect.Method,java.lang.Integer>>
calls
Service calls per method, calculated separately per platform.protected ServiceCall
currentcall
The current service call (to be reestablished after call).protected IServiceInvocationInterceptor[]
interceptors
The service interceptors.protected java.util.List<java.lang.reflect.Method>
method
The method to be called.protected ServiceCall
nextcall
The next service call (will be current during call and last after call).protected java.util.List<java.lang.Object>
object
The object.protected IComponentIdentifier
platform
The platform identifier.static long
PRINT_DELAY
Print every 10 seconds.static boolean
PROFILING
Enable call profiling.protected java.lang.Object
proxy
The origin (proxy object).protected java.util.List<java.lang.Object>
result
The call result.static java.lang.ThreadLocal<ServiceInvocationContext>
SICS
protected IServiceIdentifier
sid
protected java.util.List<java.lang.Integer>
used
The stack of used interceptors.
-
Constructor Summary
Constructors Constructor Description ServiceInvocationContext(ServiceInvocationContext context)
Create a copied context.ServiceInvocationContext(java.lang.Object proxy, java.lang.reflect.Method method, IServiceInvocationInterceptor[] interceptors, IComponentIdentifier platform, IServiceIdentifier sid)
Create a new context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object[]
getArgumentArray()
Get the args.java.util.List<java.lang.Object>
getArguments()
Get the args.IComponentIdentifier
getCaller()
Get the caller.ServiceCall
getCurrentServiceCall()
Get the last service call.java.lang.reflect.Method
getMethod()
Get the method.IServiceInvocationInterceptor
getNextInterceptor()
Get the next interceptor.ServiceCall
getNextServiceCall()
Get the service call.java.lang.Object
getObject()
Get the object.java.lang.Object
getProxy()
Get the proxy.java.lang.Object
getResult()
Get the result.IServiceIdentifier
getServiceIdentifier()
Get the service id.java.lang.Object
getTargetObject()
Get the real target object.IFuture<java.lang.Void>
invoke()
Invoke the next interceptor.IFuture<java.lang.Void>
invoke(java.lang.Object object, java.lang.reflect.Method method, java.util.List<java.lang.Object> args)
Invoke the next interceptor.boolean
isRemoteCall()
Test if a call is remote.protected void
pop()
Pop delete the top most set of values.protected void
push(java.lang.Object o, java.lang.reflect.Method m, java.util.List<java.lang.Object> args, java.lang.Object res)
Push saves and copies the current set of values.void
setArguments(java.util.List<java.lang.Object> args)
Set the arguments.void
setMethod(java.lang.reflect.Method method)
Set the method.void
setNextCall(ServiceCall call)
Set the lastcall.void
setObject(java.lang.Object object)
Set the object.void
setProxy(java.lang.Object proxy)
Set the proxy.void
setResult(java.lang.Object result)
Set the result.void
setServiceIdentifier(IServiceIdentifier sid)
Set the service id.java.lang.String
toString()
String representation.
-
-
-
Field Detail
-
SICS
public static final java.lang.ThreadLocal<ServiceInvocationContext> SICS
-
PROFILING
public static final boolean PROFILING
Enable call profiling.- See Also:
- Constant Field Values
-
PRINT_DELAY
public static final long PRINT_DELAY
Print every 10 seconds.- See Also:
- Constant Field Values
-
calls
protected static java.util.Map<IComponentIdentifier,java.util.Map<java.lang.reflect.Method,java.lang.Integer>> calls
Service calls per method, calculated separately per platform.
-
proxy
protected java.lang.Object proxy
The origin (proxy object).
-
object
protected java.util.List<java.lang.Object> object
The object.
-
method
protected java.util.List<java.lang.reflect.Method> method
The method to be called.
-
arguments
protected java.util.List<java.util.List<java.lang.Object>> arguments
The invocation arguments.
-
result
protected java.util.List<java.lang.Object> result
The call result.
-
interceptors
protected IServiceInvocationInterceptor[] interceptors
The service interceptors.
-
used
protected java.util.List<java.lang.Integer> used
The stack of used interceptors.
-
nextcall
protected ServiceCall nextcall
The next service call (will be current during call and last after call).
-
currentcall
protected ServiceCall currentcall
The current service call (to be reestablished after call).
-
caller
protected IComponentIdentifier caller
The caller component.
-
platform
protected IComponentIdentifier platform
The platform identifier.
-
sid
protected IServiceIdentifier sid
-
-
Constructor Detail
-
ServiceInvocationContext
public ServiceInvocationContext(java.lang.Object proxy, java.lang.reflect.Method method, IServiceInvocationInterceptor[] interceptors, IComponentIdentifier platform, IServiceIdentifier sid)
Create a new context.
-
ServiceInvocationContext
public ServiceInvocationContext(ServiceInvocationContext context)
Create a copied context.
-
-
Method Detail
-
getProxy
public java.lang.Object getProxy()
Get the proxy.- Returns:
- The proxy.
-
setProxy
public void setProxy(java.lang.Object proxy)
Set the proxy.- Parameters:
proxy
- The proxy to set.
-
getObject
public java.lang.Object getObject()
Get the object.- Returns:
- the object.
-
setObject
public void setObject(java.lang.Object object)
Set the object.- Parameters:
object
- The object to set.
-
getMethod
public java.lang.reflect.Method getMethod()
Get the method.- Returns:
- the method.
-
setMethod
public void setMethod(java.lang.reflect.Method method)
Set the method.- Parameters:
method
- The method to set.
-
getArguments
public java.util.List<java.lang.Object> getArguments()
Get the args.- Returns:
- the args.
-
getArgumentArray
public java.lang.Object[] getArgumentArray()
Get the args.- Returns:
- the args.
-
setArguments
public void setArguments(java.util.List<java.lang.Object> args)
Set the arguments.- Parameters:
args
- The arguments to set.
-
getResult
public java.lang.Object getResult()
Get the result.- Returns:
- the result.
-
setResult
public void setResult(java.lang.Object result)
Set the result.- Parameters:
result
- The result to set.
-
invoke
public IFuture<java.lang.Void> invoke(java.lang.Object object, java.lang.reflect.Method method, java.util.List<java.lang.Object> args)
Invoke the next interceptor.
-
getNextInterceptor
public IServiceInvocationInterceptor getNextInterceptor()
Get the next interceptor.
-
invoke
public IFuture<java.lang.Void> invoke()
Invoke the next interceptor.
-
push
protected void push(java.lang.Object o, java.lang.reflect.Method m, java.util.List<java.lang.Object> args, java.lang.Object res)
Push saves and copies the current set of values.
-
pop
protected void pop()
Pop delete the top most set of values.
-
isRemoteCall
public boolean isRemoteCall()
Test if a call is remote.
-
getTargetObject
public java.lang.Object getTargetObject()
Get the real target object. Returns domain service in case of service info.
-
getCaller
public IComponentIdentifier getCaller()
Get the caller.- Returns:
- The caller.
-
toString
public java.lang.String toString()
String representation.- Overrides:
toString
in classjava.lang.Object
-
getNextServiceCall
public ServiceCall getNextServiceCall()
Get the service call.- Returns:
- The service call.
-
getCurrentServiceCall
public ServiceCall getCurrentServiceCall()
Get the last service call.- Returns:
- The last service call.
-
setNextCall
public void setNextCall(ServiceCall call)
Set the lastcall.- Parameters:
currentcall
- The lastcall to set.
-
getServiceIdentifier
public IServiceIdentifier getServiceIdentifier()
Get the service id.
-
setServiceIdentifier
public void setServiceIdentifier(IServiceIdentifier sid)
Set the service id.
-
-