Interface ADEPT2StubFactory<S>

  • Type Parameters:
    S - The (super) type of services this factory creates stubs for (e. g. set S to ADEPT2Service to limit stub creation to remote ADEPT2 services).

    public interface ADEPT2StubFactory<S>
    Submodules of the CommunicationService defined by this interface are responsible for creating stubs which represent the corresponding remote services/callback objects on remote side.
    Author:
    Markus Lauer
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <T extends S>
      InvocationHandler
      getInvocationHandler​(URI remoteObjectIdentifier, Class<T> remoteIface, boolean create)
      Returns the InvocationHandler for the remote service/callback object that is associated with the designated remote object identifier and the designated remote interface.
      <T extends S>
      T
      getServiceStub​(URI remoteObjectIdentifier, Class<T> remoteInterface)
      Returns the stub ready to invoke operations remotely on the service or callback object described by the given URI.
      void removeStub​(URI remoteObjectIdentifier)
      Removes the stub with the designated identifier if it is cached.
    • Method Detail

      • getServiceStub

        <T extends S> T getServiceStub​(URI remoteObjectIdentifier,
                                       Class<T> remoteInterface)
        Returns the stub ready to invoke operations remotely on the service or callback object described by the given URI.
        Type Parameters:
        T - The type (interface) of the service/callback object that must be a sub type of that type this factory .
        Parameters:
        remoteObjectIdentifier - The Identifier of the service/callback object instance to create a stub for.
        remoteInterface - The interface used to access the remote service/the callback object.
        Returns:
        The stub representing the specified service/callback object on the remote host.
        Throws:
        IllegalArgumentException - If the stub can not handle the communication required by the URI.
      • getInvocationHandler

        <T extends SInvocationHandler getInvocationHandler​(URI remoteObjectIdentifier,
                                                             Class<T> remoteIface,
                                                             boolean create)
        Returns the InvocationHandler for the remote service/callback object that is associated with the designated remote object identifier and the designated remote interface. If the invocation handler does not exist, it will be created if appropriate.
        Parameters:
        remoteObjectIdentifier - The identifier of the requested remote service/callback object.
        remoteIface - The interface of the requested remote service/callback object.
        create - Whether the invocation handler should be created. Only let it create if you remove it later.
        Returns:
        The InvocationHandler associated with the given remoteObjectIdentifier or null if no InvocationHandler exists for the given remoteObjectIdentifier.
      • removeStub

        void removeStub​(URI remoteObjectIdentifier)
        Removes the stub with the designated identifier if it is cached. This is usually used for callbacks but not for (sub-)services since services are singleton.
        Parameters:
        remoteObjectIdentifier - The identifier of the service or callback object to remove the stub from.