Interface IContainer

    • Method Detail

      • connect

        void connect​(ID targetID,
                     IConnectContext connectContext)
              throws ContainerConnectException
        Connect to a target remote process or process group. The target identified by the first parameter (targetID) is connected the implementation class. If authentication information is required, the required information is given via via the second parameter (connectContext). Callers note that depending upon the provider implementation this method may block. It is suggested that callers use a separate thread to call this method. This method provides an implementation independent way for container implementations to connect, authenticate, and communicate with a remote service or group of services. Providers are responsible for implementing this operation in a way appropriate to the given remote service (or group) via expected protocol.
        Parameters:
        targetID - the ID of the remote server or group to connect to. See getConnectNamespace() for a explanation of the constraints upon this parameter.
        connectContext - any required context to allow this container to authenticate. May be null if underlying provider does not have any authentication requirements for connection.
        Throws:
        ContainerConnectException - thrown if communication cannot be established with remote service. Causes can include network connection failure, authentication failure, server error, or if container is already connected.
      • getConnectedID

        ID getConnectedID()
        Get the target ID that this container instance has connected to. Returns null if not connected.
        Returns:
        ID of the target we are connected to. Returns null if container not connected.
      • disconnect

        void disconnect()
        Disconnect. This operation will disconnect the local container instance from any previously joined target or group. Subsequent calls to getConnectedID() will return null.
      • getAdapter

        <T> T getAdapter​(Class<T> serviceType)
        This specialization of IAdaptable.getAdapter() returns additional services supported by this container. A container that supports additional services over and above the methods on IContainer should return them using this method. It is recommended that clients use this method rather than instanceof checks and downcasts to find out about the capabilities of a specific container.

        Typically, after obtaining an IContainer, a client would use this method as a means to obtain a more meaningful interface to the container. This interface may or may not extend IContainer. For example, a client could use the following code to obtain an instance of ISharedObjectContainer:

         IContainer newContainer = ContainerFactory.createContainer(type);
         ISharedObjectContainer soContainer = (ISharedObjectContainer) newContainer
                        .getAdapter(ISharedObjectContainer.class);
         if (soContainer == null)
                throw new ContainerCreateException(message);
         

        Implementations of this method should delegate to IAdapterManager.loadAdapter() if the service cannot be provided directly to ensure extensibility by third-party plug-ins.

        Specified by:
        getAdapter in interface org.eclipse.core.runtime.IAdaptable
        Parameters:
        serviceType - the service type to look up
        Returns:
        the service instance castable to the given class, or null if this container does not support the given service
      • dispose

        void dispose()
        Dispose this IContainer instance. The container instance will be made inactive after the completion of this method and will be unavailable for subsequent usage.
      • addListener

        void addListener​(IContainerListener listener)
        Add listener to IContainer. The listener's handleEvent method will be synchronously called when container methods are called. Minimally, the events delivered to the listener are as follows
        Container Events
        container action Event
        connect start IContainerConnectingEvent
        connect complete IContainerConnectedEvent
        disconnect start IContainerDisconnectingEvent
        disconnect complete IContainerDisconnectedEvent
        Parameters:
        listener - the IContainerListener to add
      • removeListener

        void removeListener​(IContainerListener listener)
        Remove listener from IContainer.
        Parameters:
        listener - the IContainerListener to remove