public class BasicServiceInvocationHandler extends java.lang.Object implements java.lang.reflect.InvocationHandler, ISwitchCall
Modifier and Type | Field and Description |
---|---|
protected IInternalAccess |
comp
The internal access.
|
protected java.util.List<IServiceInvocationInterceptor> |
interceptors
The list of interceptors.
|
protected java.util.logging.Logger |
logger
The logger for errors/warnings.
|
protected static java.util.Map<java.lang.Object,IService> |
pojoproxies
The pojo service map (pojo -> proxy).
|
static java.lang.String |
PROXYTYPE_DECOUPLED
The (default) decoupled proxy type (decouples from caller thread to component thread).
|
static java.lang.String |
PROXYTYPE_DIRECT
The direct proxy type (supports custom interceptors, but uses caller thread).
|
static java.lang.String |
PROXYTYPE_RAW
The raw proxy type (i.e.
|
protected boolean |
required
The flag if the proxy is required (provided otherwise).
|
protected java.lang.Object |
service
The service.
|
protected IServiceIdentifier |
sid
The service identifier.
|
protected boolean |
switchcall
The flag if a switchcall should be done.
|
Constructor and Description |
---|
BasicServiceInvocationHandler(IInternalAccess comp,
IServiceIdentifier sid,
java.util.logging.Logger logger,
boolean required)
Create a new invocation handler.
|
BasicServiceInvocationHandler(IInternalAccess comp,
IService service,
java.util.logging.Logger logger,
boolean required)
Create a new invocation handler.
|
BasicServiceInvocationHandler(IInternalAccess comp,
ServiceInfo service,
java.util.logging.Logger logger)
Create a new invocation handler.
|
Modifier and Type | Method and Description |
---|---|
void |
addFirstServiceInterceptor(IServiceInvocationInterceptor interceptor)
Add an interceptor.
|
static void |
addPojoServiceProxy(java.lang.Object pojo,
IService proxy)
Add a service proxy.
|
protected static void |
addProvidedInterceptors(BasicServiceInvocationHandler handler,
java.lang.Object service,
IServiceInvocationInterceptor[] ics,
IInternalAccess ia,
java.lang.String proxytype,
boolean monitoring,
IServiceIdentifier sid)
Add the standard and custom interceptors.
|
void |
addServiceInterceptor(IServiceInvocationInterceptor interceptor)
Add an interceptor.
|
void |
addServiceInterceptor(IServiceInvocationInterceptor interceptor,
int pos)
Add an interceptor.
|
static IInternalService |
createDelegationProvidedServiceProxy(IInternalAccess ia,
IServiceIdentifier sid,
RequiredServiceInfo info,
RequiredServiceBinding binding,
java.lang.ClassLoader classloader,
boolean realtime)
Static method for creating a delegation service proxy for
provided service that is not offered by the component itself.
|
protected static BasicServiceInvocationHandler |
createProvidedHandler(java.lang.String name,
IInternalAccess ia,
java.lang.Class<?> type,
java.lang.Object service,
ProvidedServiceInfo info,
ServiceScope scope)
Create a basic invocation handler.
|
static IInternalService |
createProvidedServiceProxy(IInternalAccess ia,
java.lang.Object service,
java.lang.String name,
java.lang.Class<?> type,
java.lang.String proxytype,
IServiceInvocationInterceptor[] ics,
boolean monitoring,
ProvidedServiceInfo info,
ServiceScope scope)
Static method for creating a standard service proxy for a provided service.
|
static IService |
createRequiredServiceProxy(IInternalAccess ia,
IService service,
IRequiredServiceFetcher fetcher,
RequiredServiceInfo info,
RequiredServiceBinding binding,
boolean realtime)
Static method for creating a standard service proxy for a required service.
|
boolean |
equals(java.lang.Object obj)
Test if two objects are equal.
|
java.lang.Object |
getDomainService()
Get the domain service.
|
IServiceInvocationInterceptor[] |
getInterceptors()
Get interceptors.
|
static IService |
getPojoServiceProxy(java.lang.Object pojo)
Get the proxy of a pojo service.
|
java.lang.Object |
getService()
Get the service.
|
IServiceIdentifier |
getServiceIdentifier()
Get the sid.
|
int |
hashCode()
Return the hash code.
|
java.lang.Object |
invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
A proxy method has been invoked.
|
static boolean |
isProvidedServiceProxy(java.lang.Object service)
Test if a service is a provided service proxy.
|
boolean |
isRequired()
Check if the handler is for a required service proxy.
|
static boolean |
isRequiredServiceProxy(java.lang.Object service)
Test if a service is a required service proxy.
|
boolean |
isSwitchCall()
Check if a switch call should be done.
|
static void |
removePojoServiceProxy(IServiceIdentifier sid)
Remove a pojo - proxy pair.
|
void |
removeServiceInterceptor(IServiceInvocationInterceptor interceptor)
Remove an interceptor.
|
java.lang.String |
toString()
Get a string representation.
|
public static final java.lang.String PROXYTYPE_RAW
public static final java.lang.String PROXYTYPE_DIRECT
public static final java.lang.String PROXYTYPE_DECOUPLED
protected IInternalAccess comp
protected IServiceIdentifier sid
protected java.lang.Object service
protected java.util.logging.Logger logger
protected java.util.List<IServiceInvocationInterceptor> interceptors
protected boolean required
protected boolean switchcall
protected static java.util.Map<java.lang.Object,IService> pojoproxies
public BasicServiceInvocationHandler(IInternalAccess comp, IServiceIdentifier sid, java.util.logging.Logger logger, boolean required)
public BasicServiceInvocationHandler(IInternalAccess comp, IService service, java.util.logging.Logger logger, boolean required)
public BasicServiceInvocationHandler(IInternalAccess comp, ServiceInfo service, java.util.logging.Logger logger)
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
invoke
in interface java.lang.reflect.InvocationHandler
java.lang.Throwable
public IServiceIdentifier getServiceIdentifier()
public java.lang.Object getService()
public java.lang.Object getDomainService()
public void addFirstServiceInterceptor(IServiceInvocationInterceptor interceptor)
public void addServiceInterceptor(IServiceInvocationInterceptor interceptor, int pos)
public void addServiceInterceptor(IServiceInvocationInterceptor interceptor)
public void removeServiceInterceptor(IServiceInvocationInterceptor interceptor)
public IServiceInvocationInterceptor[] getInterceptors()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static IInternalService createProvidedServiceProxy(IInternalAccess ia, java.lang.Object service, java.lang.String name, java.lang.Class<?> type, java.lang.String proxytype, IServiceInvocationInterceptor[] ics, boolean monitoring, ProvidedServiceInfo info, ServiceScope scope)
protected static BasicServiceInvocationHandler createProvidedHandler(java.lang.String name, IInternalAccess ia, java.lang.Class<?> type, java.lang.Object service, ProvidedServiceInfo info, ServiceScope scope)
protected static void addProvidedInterceptors(BasicServiceInvocationHandler handler, java.lang.Object service, IServiceInvocationInterceptor[] ics, IInternalAccess ia, java.lang.String proxytype, boolean monitoring, IServiceIdentifier sid)
public static IInternalService createDelegationProvidedServiceProxy(IInternalAccess ia, IServiceIdentifier sid, RequiredServiceInfo info, RequiredServiceBinding binding, java.lang.ClassLoader classloader, boolean realtime)
public static IService createRequiredServiceProxy(IInternalAccess ia, IService service, IRequiredServiceFetcher fetcher, RequiredServiceInfo info, RequiredServiceBinding binding, boolean realtime)
public static void addPojoServiceProxy(java.lang.Object pojo, IService proxy)
pojo
- The pojo.proxy
- The proxy.public static void removePojoServiceProxy(IServiceIdentifier sid)
sid
- The service identifier.public static IService getPojoServiceProxy(java.lang.Object pojo)
pojo
- The pojo service.public boolean isSwitchCall()
isSwitchCall
in interface ISwitchCall
public boolean isRequired()
public static boolean isRequiredServiceProxy(java.lang.Object service)
service
- The service.public static boolean isProvidedServiceProxy(java.lang.Object service)
service
- The service.