Interface GlobalServiceExport


  • public interface GlobalServiceExport
    The GlobalServiceExport allows services that may not be directly exported, for instance due to firewall restrictions, to export them indirectly. They register as callbacks while the global service export provides the exported interface. All requests to such an exported interface are forwarded to the corresponding callback.
    • Method Detail

      • prepareServiceExport

        URI[] prepareServiceExport​(SessionToken session,
                                   String clusterName,
                                   String serviceTypeName,
                                   String simpleServiceName,
                                   Class<? extends ADEPT2Service> serviceInterface,
                                   String peerId)
                            throws WrongClusterException
        Prepares the specified service for being globally exported and creates a remote object identifiers of type URI for all communication protocols this global service exports services. Since the service needs a globally unique name, the designated peer ID will be appended to the service name before exporting.
        Parameters:
        session - The session which is used to check for access rights on this method.
        clusterName - The name of the cluster in which to prepare the service export.
        serviceTypeName - 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.
        peerId - The ID of the remote peer exporting the designated service. This allows to make the service name globally unique.
        Returns:
        The remote object identifiers identifying the service instance and the communication protocols to use for remote access or null in case no export services are configured or succeeded. In case of null, no preparation will have been done.
        Throws:
        WrongClusterException - If the provided cluster name is different from the cluster name of this registry, a WrongClusterException will be thrown.
      • exportService

        Throwable[] exportService​(SessionToken session,
                                  URI[] serviceURIs,
                                  Class<? extends ADEPT2Service> serviceInterface,
                                  ADEPT2Service service)
                           throws AbortServiceException
        Enables the designated service identified by the designated URI to be called globally via this global service export service.

        Before the service could be globally exported, it must be prepared for export by calling prepareExport. The designated URIs have to be ones received by the prepareExport call. The length of the array has to match under all circumstances. However, the designated array here may contain null values. In this case, the corresponding communication service will be ignored for the export.

        Parameters:
        session - The session which is used to check for access rights on this method.
        serviceURIs - The URIs under which the service should be exported. This array may only contain values returned by the service export preparation. However, there need not be all URIs that have been prepared.
        serviceInterface - The remote interface used to access the exported service remotely.
        service - The service to export registered as callback.
        Returns:
        The exceptions occurred when exporting the service for the designated URIs. The positions match the positions of the URIs. In case no exception occurred, null will be returned.
        Throws:
        AbortServiceException - If the designated service export has not been prepared or the service has been unregistered from export, an AbortServiceException will be thrown.
      • unregisterService

        void unregisterService​(SessionToken session,
                               ADEPT2Service service)
        Unregisters the designated service (callback) which removes the export of the designated service. Unregistering an unexported service is a no-op.
        Parameters:
        session - The session which is used to check for access rights on this method.
        service - The service (callback) to be unregistered and removed from the exported services.
      • isRegisteredService

        boolean[] isRegisteredService​(URI[] serviceUris)
        Gets whether the designated service URIs are registered at the corresponding export services.
        Parameters:
        serviceUris - The URIs which to check for whether they are registered. Each URI corresponds to one of the export services of this global service export. The length of the array has to correspond to the amount of export services of this global service export.
        Returns:
        Whether the designated service URI (at the same array position) is registered at the corresponding export service of this global service export.