Interface ADEPT2ServiceExport


  • public interface ADEPT2ServiceExport
    This submodule of the CommunicationService is responsible for publishing services, i. e. to enable them to be called remotely.
    • Method Detail

      • prepareServiceExport

        URI prepareServiceExport​(String serviceType,
                                 String simpleServiceName,
                                 Class<? extends ADEPT2Service> serviceInterface)
                          throws AbortServiceException
        Prepares the specified service for being exported and creates a remote object identifier of type URI valid for the communication protocol this communication factory supports.
        Parameters:
        serviceType - The identifier of the ADEPT2 service type the specified service is an instance of.
        simpleServiceName - The name assigned to the service to export by the registry.
        serviceInterface - The remote interface used to access the exported service remotely.
        Returns:
        The remote object identifier identifying the service instance and the communication protocol to use for remote access.
        Throws:
        AbortServiceException - If the preparation of the service export fails, an AbortServiceException will be thrown.
      • exportService

        boolean exportService​(URI serviceURI,
                              Class<? extends ADEPT2Service> serviceInterface,
                              ADEPT2Service service)
                       throws AbortServiceException
        Enables the designated service identified by the designated URI to be called remotely through the designated service interface.

        Before the service could be exported, it must be prepared for export by calling prepareExport. The returned URI must match the URI returned by the prepareExport call.

        Parameters:
        serviceURI - The URI under which the service should be exported.
        serviceInterface - The remote interface used to access the exported service remotely.
        service - The service to export.
        Returns:
        Whether the user should be informed of the URI of the (locally) exported service. Usually only the globally exported URIs should be disclosed but specific communication service may want that, too, for instance the web service export.
        Throws:
        AbortServiceException - If the exporting the service fails, an AbortServiceException will be thrown.
      • unregisterService

        @Deprecated
        void unregisterService​(URI serviceURI)
        Deprecated.
        Unregisters the service with the designated URI to release resources. In case the designated URI is not registered, this is a no-op.
        Parameters:
        serviceURI - The URI of the service to be unregistered and not exported any more.
      • unregisterService

        void unregisterService​(String serviceName)
        Unregisters the designated service to release resources. In case the designated service is not registered, this is a no-op.
        Parameters:
        serviceName - The hierarchical name of the exported service.
      • getExportedService

        @Deprecated
        default ADEPT2Service getExportedService​(URI remoteObjectIdentifier)
        Deprecated.
        Returns the service associated with the given remote object identifier.

        Implementations have to provide getService(URI) instead!

        Parameters:
        remoteObjectIdentifier - The remote object identifier identifying the requested remote service.
        Returns:
        The remote service identified by the given remoteObjectIdentifier.
      • getRemoteInterfaceForExportedService

        @Deprecated
        default Class<?> getRemoteInterfaceForExportedService​(URI remoteObjectIdentifier)
        Deprecated.
        Returns the remote interface to be used to access the service associated with the given remote object identifier.

        Implementations have to provide getService(URI) instead!

        Parameters:
        remoteObjectIdentifier - The remote object identifier identifying the requested remote service.
        Returns:
        The remote interface that must be used to access the service identified by the given remoteObjectIdentifier.
      • getService

        default Pair<Class<?>,​ADEPT2Service> getService​(URI roi)
        Gets the remote interface and the service associated with the designated remote object identifier.
        Parameters:
        roi - The remote object identifier of the requested remote service.
        Returns:
        The remote interface and the remote service identified by the designated remote object identifier.
      • isExportPrepared

        boolean isExportPrepared​(URI remoteObjectIdentifier)
        Returns whether the specified service identifier has been prepared by this service export but has not been exported yet.
        Parameters:
        remoteObjectIdentifier - The identifier to check.
        Returns:
        Whether the designated identifier has been prepared for service export but not exported yet.
      • isRegisteredService

        boolean isRegisteredService​(URI remoteObjectIdentifier)
        Returns if the specified service identifier is known to this service export, that is whether this URI has been exported.
        Parameters:
        remoteObjectIdentifier - The identifier to check.
        Returns:
        if the passed service identifier is exported by this service export TRUE is returned else FALSE is returned.