Class ProvidedServicesComponentFeature

    • Constructor Detail

      • ProvidedServicesComponentFeature

        public ProvidedServicesComponentFeature​(IInternalAccess component,
                                                ComponentCreationInfo cinfo)
        Factory method constructor for instance level.
    • Method Detail

      • hasUserBody

        public boolean hasUserBody()
        Check if the feature potentially executed user code in body. Allows blocking operations in user bodies by using separate steps for each feature. Non-user-body-features are directly executed for speed. If unsure just return true. ;-)
        Specified by:
        hasUserBody in interface IComponentFeature
        Overrides:
        hasUserBody in class AbstractComponentFeature
      • addService

        protected void addService​(IInternalService service,
                                  ProvidedServiceInfo info)
        Add a service.
        Parameters:
        service - The service object.
        info - The service info.
      • getProvidedServiceInfo

        protected ProvidedServiceInfo getProvidedServiceInfo​(IServiceIdentifier sid)
        Get the provided service info for a service.
        Parameters:
        sid - The service identifier.
        Returns:
        The provided service info.
      • removeService

        protected void removeService​(IInternalService service)
        Remove a service.
        Parameters:
        service - The service object.
        info - The service info.
      • createServiceImplementation

        public jadex.commons.future.IFuture<java.lang.Object> createServiceImplementation​(ProvidedServiceInfo info,
                                                                                          jadex.commons.IValueFetcher fetcher)
        Create a service implementation from description.
      • getAllServices

        protected java.util.Collection<IInternalService> getAllServices()
        Get all services in a single collection.
      • initServices

        protected jadex.commons.future.IFuture<java.lang.Void> initServices​(java.util.Iterator<IInternalService> services)
        Init the services one by one.
      • initService

        protected jadex.commons.future.IFuture<java.lang.Void> initService​(IInternalService is)
        Init a service, i.e. set the component (internal access) and call startService.
      • serviceStarted

        public jadex.commons.future.IFuture<java.lang.Void> serviceStarted​(IInternalService service)
        Called after a service has been started.
      • serviceShutdowned

        public jadex.commons.future.IFuture<java.lang.Void> serviceShutdowned​(IInternalService service)
        Called after a service has been shutdowned.
      • getPublishService

        public static jadex.commons.future.IFuture<IPublishService> getPublishService​(IInternalAccess instance,
                                                                                      java.lang.String type,
                                                                                      ServiceScope scope,
                                                                                      java.util.Iterator<IPublishService> services)
        Get the publish service for a publish type (e.g. web service).
        Parameters:
        type - The type.
        services - The iterator of publish services (can be null).
        Returns:
        The publish service.
      • shutdownServices

        protected jadex.commons.future.IFuture<java.lang.Void> shutdownServices​(java.util.Iterator<IInternalService> services)
        Shutdown the services one by one.
      • getProvidedServiceRawImpl

        public <T> T getProvidedServiceRawImpl​(java.lang.Class<T> clazz)
        Get the raw implementation of the provided service.
        Specified by:
        getProvidedServiceRawImpl in interface IProvidedServicesFeature
        Parameters:
        clazz - The class.
        Returns:
        The raw object.
      • getProvidedServiceRawImpl

        public java.lang.Object getProvidedServiceRawImpl​(java.lang.String name)
        Get the provided service implementation object by name.
        Specified by:
        getProvidedServiceRawImpl in interface IProvidedServicesFeature
        Parameters:
        name - The service name.
        Returns:
        The service.
      • getProvidedServices

        public <T> T[] getProvidedServices​(java.lang.Class<T> clazz)
        Get provided (declared) service.
        Specified by:
        getProvidedServices in interface IProvidedServicesFeature
        Parameters:
        clazz - The interface.
        Returns:
        The service.
      • getProvidedService

        public <T> T getProvidedService​(java.lang.Class<T> clazz)
        Get provided (declared) service.
        Specified by:
        getProvidedService in interface IProvidedServicesFeature
        Parameters:
        clazz - The interface.
        Returns:
        The service.
      • getServices

        public java.util.Map<java.lang.Class<?>,​java.util.Collection<IInternalService>> getServices()
        Get the services.
        Returns:
        The services.
      • addService

        public jadex.commons.future.IFuture<java.lang.Void> addService​(java.lang.String name,
                                                                       java.lang.Class<?> type,
                                                                       java.lang.Object service)
        Add a service to the platform. If under the same name and type a service was contained, the old one is removed and shutdowned.
        Specified by:
        addService in interface IExternalProvidedServicesFeature
        Parameters:
        type - The public service interface.
        service - The service.
        Returns:
        A future that is done when the service has completed starting.
      • addService

        public jadex.commons.future.IFuture<java.lang.Void> addService​(java.lang.String name,
                                                                       java.lang.Class<?> type,
                                                                       java.lang.Object service,
                                                                       java.lang.String proxytype)
        Add a service to the platform. If under the same name and type a service was contained, the old one is removed and shutdowned.
        Specified by:
        addService in interface IExternalProvidedServicesFeature
        Parameters:
        type - The public service interface.
        service - The service.
        type - The proxy type (@see{BasicServiceInvocationHandler}).
      • addService

        public jadex.commons.future.IFuture<java.lang.Void> addService​(java.lang.String name,
                                                                       java.lang.Class<?> type,
                                                                       java.lang.Object service,
                                                                       PublishInfo pi,
                                                                       ServiceScope scope)
        Add a service to the platform. If under the same name and type a service was contained, the old one is removed and shutdowned.
        Specified by:
        addService in interface IExternalProvidedServicesFeature
        Parameters:
        type - The public service interface.
        service - The service.
        scope - The service scope.
      • addService

        public jadex.commons.future.IFuture<java.lang.Void> addService​(java.lang.String name,
                                                                       java.lang.Class<?> type,
                                                                       java.lang.Object service,
                                                                       ProvidedServiceInfo info)
        Add a service to the platform. If under the same name and type a service was contained, the old one is removed and shutdowned.
        Specified by:
        addService in interface IExternalProvidedServicesFeature
        Parameters:
        type - The public service interface.
        info - The config settings.
      • setTags

        public jadex.commons.future.IFuture<java.lang.Void> setTags​(IServiceIdentifier sid,
                                                                    java.lang.String... tags)
        Sets the tags of a service.
        Specified by:
        setTags in interface IExternalProvidedServicesFeature
        Parameters:
        sid - The Service identifier.
        tags - The tags.
        Returns:
        New service identifier.
      • removeService

        public jadex.commons.future.IFuture<java.lang.Void> removeService​(IServiceIdentifier sid)
        Removes a service from the platform (shutdowns also the service).
        Specified by:
        removeService in interface IExternalProvidedServicesFeature
        Parameters:
        service - The service.
        Returns:
        A future that is done when the service has completed its shutdown.
      • getServiceTypes

        public jadex.commons.future.IFuture<java.util.Collection<java.lang.Class<?>>> getServiceTypes​(IServiceIdentifier sid)
      • getServiceType

        public jadex.commons.future.IFuture<java.lang.Class<?>> getServiceType​(IServiceIdentifier sid)
      • addService

        public jadex.commons.future.IFuture<java.lang.Void> addService​(java.lang.String name,
                                                                       java.lang.Class<?> type,
                                                                       IServiceInvocationInterceptor[] ics,
                                                                       java.lang.Object service,
                                                                       ProvidedServiceInfo info)
        Add a service to the component.
        Parameters:
        type - The service interface.
        service - The service.
        proxytype - The proxy type (@see{BasicServiceInvocationHandler}).
      • addInterceptor

        public void addInterceptor​(IServiceInvocationInterceptor interceptor,
                                   java.lang.Object service,
                                   int pos)
        Add a service interceptor.
        Specified by:
        addInterceptor in interface IProvidedServicesFeature
        Parameters:
        interceptor - The interceptor.
        service - The service.
        pos - The position (0=first, -1=last-1, i.e. one before method invocation).