All Superinterfaces:
ParameterConfigurerProvider, ServiceBase
All Known Subinterfaces:
GenericMultiTypeService, MonitoringService, UpdatingMonitoringService
All Known Implementing Classes:
AbstractDelegatingMultiService, AbstractDelegatingService, AbstractProcessService, AbstractPythonProcessService, AbstractRestProcessService, AbstractRunnablesService, AbstractService, AbstractStringProcessService, ConnectorServiceWrapper, DefaultServiceImpl, FamilyServiceStub, MockingConnectorServiceWrapper, MockingMultiConnectorServiceWrapper, MultiConnectorServiceWrapper, PythonAsyncProcessService, PythonSyncProcessService, PythonWsProcessService, ServiceStub, TraceToAasService

public interface Service extends ParameterConfigurerProvider, ServiceBase
Defines the (administrative) interface of an IIP-Ecosphere service.
Author:
Holger Eichelberger, SSE
  • Method Details

    • getName

      String getName()
      The name of the service.
      Returns:
      the name
    • getVersion

      de.iip_ecosphere.platform.support.Version getVersion()
      The version of the service.
      Returns:
      the version
    • getDescription

      String getDescription()
      The description of the service.
      Returns:
      the description, may be empty
    • isDeployable

      boolean isDeployable()
      Returns whether the service is deployable in distributable manner or fixed in deployment location.
      Returns:
      true for deployable, false for fixed
    • isTopLevel

      boolean isTopLevel()
      Returns whether the service is a top-level service.
      Returns:
      true for top-level, false for nested
    • getKind

      ServiceKind getKind()
      Returns the service kind.
      Returns:
      the service kind
    • getNetMgtKeyAddress

      default de.iip_ecosphere.platform.support.ServerAddress getNetMgtKeyAddress()
      Returns the resolved network address of the netMgtKey specified in the service descriptor.
      Returns:
      the resolved address, may be null in particular if no key was specified in the service descriptor
    • migrate

      void migrate(String resourceId) throws ExecutionException
      Migrates a service. However, it may be required to migrate/move the containing artifact. [adaptation]
      Parameters:
      resourceId - the target resource id, e.g., a device
      Throws:
      ExecutionException - if migration fails
    • update

      void update(URI location) throws ExecutionException
      Updates the service by the service in the given location. This operation is responsible for stopping the running service (if needed), replacing it, starting the new service.
      Parameters:
      location - the location of the new service, e.g., an URL
      Throws:
      ExecutionException - if the given service cannot be updated for some reason, e.g., because the replacement service is not an evolved version of the running service
    • switchTo

      void switchTo(String targetId) throws ExecutionException
      Switches to an interface-compatible service. This method cares for stopping the old service, performing a handover if adequate, starting the target service. [adaptation]
      Parameters:
      targetId - the id of the target service
      Throws:
      ExecutionException - if switching the service cannot be performed for some reason
    • activate

      void activate() throws ExecutionException
      Activates the service. [adaptation]
      Throws:
      ExecutionException - in case that activating fails, e.g., because the service is already active
    • passivate

      void passivate() throws ExecutionException
      Passivates the service. [adaptation]
      Throws:
      ExecutionException - in case that passivating fails, e.g., because the service is already passive
    • reconfigure

      void reconfigure(Map<String,String> values) throws ExecutionException
      Reconfigures the service. [adaptation]
      Parameters:
      values - the (service-specific) name-value mapping that shall lead to a reconfiguration of the service; values come either as primitive values or as JSON structures complying with the parameter descriptor. The service is responsible for correct JSON de-serialization according to the respective descriptor.
      Throws:
      ExecutionException - if reconfiguration fails
    • getParameterConfigurer

      default ParameterConfigurer<?> getParameterConfigurer(String paramName)
      Description copied from interface: ParameterConfigurerProvider
      Returns the parameter configurer for a given parameter. We need this generic approach to ease code generation and initial setting of parameter values.
      Specified by:
      getParameterConfigurer in interface ParameterConfigurerProvider
      Parameters:
      paramName - the name of the parameter
      Returns:
      the associated parameter configurer or null if there is none
    • getParameterNames

      default Set<String> getParameterNames()
      Description copied from interface: ParameterConfigurerProvider
      The set of parameter names.
      Specified by:
      getParameterNames in interface ParameterConfigurerProvider
      Returns:
      the parameter names, may be null for none
    • addTypeSubstitution

      default <T> void addTypeSubstitution(Class<? super T> cls, Class<T> actCls, Supplier<T> creator)
      Sets a type mapping, usually a substitution of more generic to more specific output types.
      Type Parameters:
      T - the actual type
      Parameters:
      cls - the original class to apply the mapping for
      actCls - the actual class that the supplier will create an instance of
      creator - the creator supplier that creates an instance of the substitute
    • getSubstitutedType

      default <T> Class<? extends T> getSubstitutedType(Class<T> cls)
      Returns the actual (output) type, may be a substitute.
      Type Parameters:
      T - the actual type
      Parameters:
      cls - the original class to return the creator for
      Returns:
      the type, may be cls
      See Also:
    • getTypeSubstitutions

      default Map<Class<?>,Class<?>> getTypeSubstitutions()
      Returns the actual (output) type substitutions.
      Returns:
      the type substitutions
      See Also:
    • createType

      default <T> T createType(Class<T> cls)
      Returns an instance a certain (output) type, may be a substitute.
      Type Parameters:
      T - the actual type
      Parameters:
      cls - the original class create the type for
      Returns:
      a constructor supplier, may be null
      See Also:
    • createType

      default <T> T createType(Class<T> cls, Supplier<T> creator)
      Returns an instance a certain (output) type, may be a substitute.
      Type Parameters:
      T - the actual type
      Parameters:
      cls - the original class create the type for
      creator - the default creator supplier if none is registered
      Returns:
      a constructor supplier, may be null
      See Also:
    • getTypeCreator

      default <T> Supplier<T> getTypeCreator(Class<T> cls, Supplier<T> creator)
      Returns the creator for a certain (output) type, may be a substitute.
      Type Parameters:
      T - the actual type
      Parameters:
      cls - the original class to return the creator for
      creator - the default creator supplier if none is registered
      Returns:
      a constructor supplier or creator if there is none
      See Also: