Class ProvidedServiceFeature
java.lang.Object
jadex.providedservice.impl.service.ProvidedServiceFeature
- All Implemented Interfaces:
jadex.execution.impl.ILifecycle,IProvidedServiceFeature
public abstract class ProvidedServiceFeature
extends Object
implements jadex.execution.impl.ILifecycle, IProvidedServiceFeature
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe pojo service map (pojo -> proxy).protected jadex.core.impl.Componentprotected Map<IServiceIdentifier, ProvidedServiceInfo> The map of provided service infos.protected Map<IServiceIdentifier, MethodListenerHandler> The map of provided service infos.protected Map<Class<?>, Collection<IInternalService>> The map of platform services. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMethodInvocationListener(IServiceIdentifier sid, jadex.common.MethodInfo mi, IMethodInvocationListener listener) Add a method invocation handler.static voidaddPojoServiceProxy(Object pojo, IService proxy) Add a service proxy.voidaddProvidedInterceptors(AbstractServiceInvocationHandler handler, Object service, IServiceInvocationInterceptor[] ics, jadex.core.impl.Component ia, String proxytype, IServiceIdentifier sid) Add the standard and custom interceptors.protected voidaddService(IInternalService service, ProvidedServiceInfo info) Add a service.protected static ServiceInvocationHandlercreateProvidedHandler(String name, jadex.core.impl.Component ia, Class<?> type, Object service, ProvidedServiceInfo info) Create a basic invocation handler for a provided service.createProvidedServiceProxy(jadex.core.impl.Component ia, Object service, String name, Class<?> type, IServiceInvocationInterceptor[] ics, ProvidedServiceInfo info) Static method for creating a standard service proxy for a provided service.jadex.future.IFuture<Object> createServiceImplementation(ProvidedServiceInfo info, jadex.common.IValueFetcher fetcher) Create a service implementation from description.protected Collection<IInternalService> Get all services in a single collection.jadex.core.impl.Componentstatic IServicegetPojoServiceProxy(Object pojo) Get the proxy of a pojo service.Get the provided service implementation object by id.<T> TgetProvidedService(Class<T> clazz) Get provided (declared) service.getProvidedService(String name) Get provided (declared) service.protected ProvidedServiceInfoGet the provided service info for a service.Get the provided service implementation object by id.<T> TgetProvidedServiceRawImpl(Class<T> clazz) Get the raw implementation of the provided service.Get the provided service implementation object by name.<T> T[]getProvidedServices(Class<T> clazz) Get provided (declared) service.booleanhasMethodListeners(IServiceIdentifier sid, jadex.common.MethodInfo mi) Test if service and method has listeners.protected jadex.future.IFuture<Void> Init a service, i.e.protected jadex.future.IFuture<Void> initServices(Iterator<IInternalService> services) Init the services one by one.static booleanisProvidedServiceProxy(Object service) Test if a service is a provided service proxy.voidnotifyMethodListeners(IServiceIdentifier sid, boolean start, Object proxy, Method method, Object[] args, Object callid, ServiceInvocationContext context) Notify listeners that a service method has been called.jadex.future.IFuture<Void> onEnd()Called when the feature is shutdowned.jadex.future.IFuture<Void> onStart()voidremoveMethodInvocationListener(IServiceIdentifier sid, jadex.common.MethodInfo mi, IMethodInvocationListener listener) Remove a method invocation handler.static voidRemove a pojo - proxy pair.protected voidremoveService(IInternalService service) Remove a service.jadex.future.IFuture<Void> serviceShutdowned(IInternalService service) Called after a service has been shutdowned.jadex.future.IFuture<Void> serviceStarted(IInternalService service) Called after a service has been started.protected jadex.future.IFuture<Void> shutdownServices(Iterator<IInternalService> services) Shutdown the services one by one.
-
Field Details
-
self
protected jadex.core.impl.Component self -
services
The map of platform services. -
serviceinfos
The map of provided service infos. (sid -> provided service info) -
servicelisteners
The map of provided service infos. (sid -> method listener) -
pojoproxies
The pojo service map (pojo -> proxy).
-
-
Constructor Details
-
ProvidedServiceFeature
protected ProvidedServiceFeature(jadex.core.impl.Component self)
-
-
Method Details
-
loadModel
-
onStart
- Specified by:
onStartin interfacejadex.execution.impl.ILifecycle
-
onEnd
Called when the feature is shutdowned.- Specified by:
onEndin interfacejadex.execution.impl.ILifecycle
-
shutdownServices
Shutdown the services one by one. -
removeService
Remove a service.- Parameters:
service- The service object.info- The service info.
-
serviceShutdowned
Called after a service has been shutdowned. todo!!! -
createServiceImplementation
public jadex.future.IFuture<Object> createServiceImplementation(ProvidedServiceInfo info, jadex.common.IValueFetcher fetcher) Create a service implementation from description. -
addService
Add a service.- Parameters:
service- The service object.info- The service info.
-
getAllServices
Get all services in a single collection. -
initServices
Init the services one by one. -
initService
Init a service, i.e. set the component (internal access) and call startService. -
serviceStarted
Called after a service has been started. -
getProvidedServices
Get provided (declared) service.- Specified by:
getProvidedServicesin interfaceIProvidedServiceFeature- Parameters:
clazz- The interface.- Returns:
- The service.
-
getProvidedService
Get provided (declared) service.- Specified by:
getProvidedServicein interfaceIProvidedServiceFeature- Parameters:
name- The service name.- Returns:
- The service.
-
getProvidedService
Get the provided service implementation object by id.- Specified by:
getProvidedServicein interfaceIProvidedServiceFeature- Parameters:
name- The service identifier.- Returns:
- The service.
-
getProvidedServiceRawImpl
Get the provided service implementation object by name.- Specified by:
getProvidedServiceRawImplin interfaceIProvidedServiceFeature- Parameters:
name- The service name.- Returns:
- The service.
-
getProvidedServiceRawImpl
Get the raw implementation of the provided service.- Specified by:
getProvidedServiceRawImplin interfaceIProvidedServiceFeature- Parameters:
clazz- The class.- Returns:
- The raw object.
-
getProvidedService
Get provided (declared) service.- Specified by:
getProvidedServicein interfaceIProvidedServiceFeature- Parameters:
clazz- The interface.- Returns:
- The service.
-
getProvidedServiceRawImpl
Get the provided service implementation object by id.- Specified by:
getProvidedServiceRawImplin interfaceIProvidedServiceFeature- Parameters:
name- The service identifier.- Returns:
- The service.
-
getProvidedServiceInfo
Get the provided service info for a service.- Parameters:
sid- The service identifier.- Returns:
- The provided service info.
-
getComponent
public jadex.core.impl.Component getComponent() -
addMethodInvocationListener
public void addMethodInvocationListener(IServiceIdentifier sid, jadex.common.MethodInfo mi, IMethodInvocationListener listener) Add a method invocation handler.- Specified by:
addMethodInvocationListenerin interfaceIProvidedServiceFeature- Parameters:
sid- The service identifier.mi- The method info.listener- The method listener.
-
removeMethodInvocationListener
public void removeMethodInvocationListener(IServiceIdentifier sid, jadex.common.MethodInfo mi, IMethodInvocationListener listener) Remove a method invocation handler.- Specified by:
removeMethodInvocationListenerin interfaceIProvidedServiceFeature- Parameters:
sid- The service identifier.mi- The method info.listener- The method listener.
-
notifyMethodListeners
public void notifyMethodListeners(IServiceIdentifier sid, boolean start, Object proxy, Method method, Object[] args, Object callid, ServiceInvocationContext context) Notify listeners that a service method has been called. -
hasMethodListeners
Test if service and method has listeners. -
addPojoServiceProxy
Add a service proxy.- Parameters:
pojo- The pojo.proxy- The proxy.
-
removePojoServiceProxy
Remove a pojo - proxy pair.- Parameters:
sid- The service identifier.
-
getPojoServiceProxy
Get the proxy of a pojo service.- Parameters:
pojo- The pojo service.- Returns:
- The proxy of the service.
-
isProvidedServiceProxy
Test if a service is a provided service proxy.- Parameters:
service- The service.- Returns:
- True, if is provided service proxy.
-
createProvidedServiceProxy
public IInternalService createProvidedServiceProxy(jadex.core.impl.Component ia, Object service, String name, Class<?> type, IServiceInvocationInterceptor[] ics, ProvidedServiceInfo info) Static method for creating a standard service proxy for a provided service. -
addProvidedInterceptors
public void addProvidedInterceptors(AbstractServiceInvocationHandler handler, Object service, IServiceInvocationInterceptor[] ics, jadex.core.impl.Component ia, String proxytype, IServiceIdentifier sid) Add the standard and custom interceptors. -
createProvidedHandler
protected static ServiceInvocationHandler createProvidedHandler(String name, jadex.core.impl.Component ia, Class<?> type, Object service, ProvidedServiceInfo info) Create a basic invocation handler for a provided service.
-