org.eclipse.ecf.core

## Class BaseContainer

- java.lang.Object
- - org.eclipse.ecf.core.AbstractContainer
  - - org.eclipse.ecf.core.BaseContainer

All Implemented Interfaces:
  org.eclipse.core.runtime.IAdaptable, IContainer, IIdentifiable

    public class BaseContainer
    extends AbstractContainer

Base implementation of IContainer. Subclasses may be created to fill out the behavior of this base implementation. Also, adapter factories may be created via adapterFactory extension point to allow adapters to be added to this BaseContainer implementation without the need to create a separate IContainer implementation class.

### Nested Class Summary

Nested Classes
`static class` `BaseContainer.Instantiator`

### Constructor Summary

Constructors
`protected` `BaseContainer(ID id)`
`protected` `BaseContainer(long idl)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `connect(ID targetID, IConnectContext connectContext)` Connect to a target remote process or process group.
`void` `disconnect()` Disconnect.
`ID` `getConnectedID()` Get the target ID that this container instance has connected to.
`Namespace` `getConnectNamespace()` Get the Namespace for creating a targetID suitable for use as the first parameter in subsequent calls to `IContainer.connect(ID, IConnectContext)`.
`ID` `getID()` Return the ID for this 'identifiable' object.
`String` `toString()`

### Methods inherited from class org.eclipse.ecf.core.AbstractContainer

`addListener, dispose, fireContainerEvent, getAdapter, getPasswordFromConnectContext, removeListener`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### BaseContainer

    protected BaseContainer(long idl)
                     throws ContainerCreateException

Throws:
  `ContainerCreateException`

#### BaseContainer

    protected BaseContainer(ID id)

### Method Detail

#### connect

    public void connect(ID targetID,
                        IConnectContext connectContext)
                 throws ContainerConnectException

Description copied from interface: `IContainer`
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 `IContainer.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.

#### disconnect

    public void disconnect()

Description copied from interface: `IContainer`
Disconnect. This operation will disconnect the local container instance from any previously joined target or group. Subsequent calls to getConnectedID() will return `null`.

#### getConnectNamespace

    public Namespace getConnectNamespace()

Description copied from interface: `IContainer`
Get the Namespace for creating a targetID suitable for use as the first parameter in subsequent calls to `IContainer.connect(ID, IConnectContext)`. If this method returns `null`, then it means that `null` is expected as a valid parameter in subsequent calls to `IContainer.connect(ID, IConnectContext)`. If this method returns a non-`null` Namespace, then the `targetID` parameter in `IContainer.connect(ID, IConnectContext)` must be non-`null` instance created of the returned Namespace.

Returns:
  Namespace the namespace associated with subsequent calls to `IContainer.connect(ID, IConnectContext)`. If `null`, then the `targetID` instances passed to `IContainer.connect(ID, IConnectContext)` may be `null`. If not `null`, then `targetID` instances passed to `IContainer.connect(ID, IConnectContext)` must be instances of the returned Namespace.

#### getConnectedID

    public ID getConnectedID()

Description copied from interface: `IContainer`
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.

#### getID

    public ID getID()

Description copied from interface: `IIdentifiable`
Return the ID for this 'identifiable' object. The returned ID should be unique within its namespace. May return `null`.

Returns:
  the ID for this identifiable object. May return `null`.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`