Package jadex.bridge.service.component
Class ServiceInvocationContext
- java.lang.Object
-
- jadex.bridge.service.component.ServiceInvocationContext
-
public class ServiceInvocationContext extends java.lang.ObjectContext 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>>argumentsThe invocation arguments.protected IComponentIdentifiercallerThe caller component.protected static java.util.Map<IComponentIdentifier,java.util.Map<java.lang.reflect.Method,java.lang.Integer>>callsService calls per method, calculated separately per platform.protected ServiceCallcurrentcallThe current service call (to be reestablished after call).protected IServiceInvocationInterceptor[]interceptorsThe service interceptors.protected java.util.List<java.lang.reflect.Method>methodThe method to be called.protected ServiceCallnextcallThe next service call (will be current during call and last after call).protected java.util.List<java.lang.Object>objectThe object.protected IComponentIdentifierplatformThe platform identifier.static longPRINT_DELAYPrint every 10 seconds.static booleanPROFILINGEnable call profiling.protected java.lang.ObjectproxyThe origin (proxy object).protected java.util.List<java.lang.Object>resultThe call result.static java.lang.ThreadLocal<ServiceInvocationContext>SICSprotected IServiceIdentifiersidprotected java.util.List<java.lang.Integer>usedThe 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.IComponentIdentifiergetCaller()Get the caller.ServiceCallgetCurrentServiceCall()Get the last service call.java.lang.reflect.MethodgetMethod()Get the method.IServiceInvocationInterceptorgetNextInterceptor()Get the next interceptor.ServiceCallgetNextServiceCall()Get the service call.java.lang.ObjectgetObject()Get the object.java.lang.ObjectgetProxy()Get the proxy.java.lang.ObjectgetResult()Get the result.IServiceIdentifiergetServiceIdentifier()Get the service id.java.lang.ObjectgetTargetObject()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.booleanisRemoteCall()Test if a call is remote.protected voidpop()Pop delete the top most set of values.protected voidpush(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.voidsetArguments(java.util.List<java.lang.Object> args)Set the arguments.voidsetMethod(java.lang.reflect.Method method)Set the method.voidsetNextCall(ServiceCall call)Set the lastcall.voidsetObject(java.lang.Object object)Set the object.voidsetProxy(java.lang.Object proxy)Set the proxy.voidsetResult(java.lang.Object result)Set the result.voidsetServiceIdentifier(IServiceIdentifier sid)Set the service id.java.lang.StringtoString()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:
toStringin 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.
-
-