Class ProvidedServicesComponentFeature

    • Constructor Detail

      • ProvidedServicesComponentFeature

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

      • init

        public IFuture<java.lang.Void> init()
        Initialize the feature.
        Specified by:
        init in interface IComponentFeature
        Overrides:
        init in class jadex.bridge.component.impl.AbstractComponentFeature
      • 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 jadex.bridge.component.impl.AbstractComponentFeature
      • shutdown

        public IFuture<java.lang.Void> shutdown()
        Called when the feature is shutdowned.
        Specified by:
        shutdown in interface IComponentFeature
        Overrides:
        shutdown in class jadex.bridge.component.impl.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 IFuture<java.lang.Object> createServiceImplementation​(ProvidedServiceInfo info,
                                                                     IValueFetcher fetcher)
        Create a service implementation from description.
      • getAllServices

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

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

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

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

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

        public static 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 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 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 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 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 IFuture<java.lang.Void> addService​(java.lang.String name,
                                                  java.lang.Class<?> type,
                                                  java.lang.String proxytype,
                                                  IServiceInvocationInterceptor[] ics,
                                                  java.lang.Object service,
                                                  ProvidedServiceInfo info,
                                                  ServiceScope scope)
        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).