Package org.eclipse.spi.net4j

# Class Connector

java.lang.Object
org.eclipse.net4j.util.event.Notifier
org.eclipse.net4j.util.lifecycle.Lifecycle
org.eclipse.net4j.util.lifecycle.ShareableLifecycle
org.eclipse.net4j.util.container.Container<IChannel>
org.eclipse.spi.net4j.ChannelMultiplexer
org.eclipse.spi.net4j.Connector

All Implemented Interfaces:
  `IBufferProvider`, `IChannelMultiplexer`, `IConnector`, `ILocationAware`, `ITransportConfigAware`, `org.eclipse.net4j.util.collection.Closeable`, `org.eclipse.net4j.util.concurrent.IExecutorServiceProvider`, `org.eclipse.net4j.util.container.IContainer<IChannel>`, `org.eclipse.net4j.util.event.INotifier`, `org.eclipse.net4j.util.event.INotifier.INotifier2`, `org.eclipse.net4j.util.lifecycle.IDeactivateable`, `org.eclipse.net4j.util.lifecycle.ILifecycle`, `org.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivation`, `org.eclipse.net4j.util.properties.IPropertiesContainer`, `org.eclipse.net4j.util.security.INegotiatorAware`, `org.eclipse.net4j.util.security.IUserAware`, `InternalChannelMultiplexer`, `InternalConnector`, `InverseCloseable`

public abstract class Connector extends ChannelMultiplexer implements InternalConnector
If the meaning of this type isn't clear, there really should be more of a description here...

Since:
  2.0
Author:
  Eike Stepper

## Nested Class Summary

## Nested classes/interfaces inherited from class org.eclipse.net4j.util.event.Notifier

`org.eclipse.net4j.util.event.Notifier.Cancelation`

## Nested classes/interfaces inherited from interface org.eclipse.net4j.buffer.IBufferProvider

`IBufferProvider.Introspection, IBufferProvider.Notification`

## Nested classes/interfaces inherited from interface org.eclipse.net4j.util.container.IContainer

`org.eclipse.net4j.util.container.IContainer.Modifiable<E>, org.eclipse.net4j.util.container.IContainer.Persistable<E>, org.eclipse.net4j.util.container.IContainer.Persistence<E>`

## Nested classes/interfaces inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle

`org.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivation`

## Nested classes/interfaces inherited from interface org.eclipse.net4j.ILocationAware

`ILocationAware.Location`

## Nested classes/interfaces inherited from interface org.eclipse.net4j.util.event.INotifier

`org.eclipse.net4j.util.event.INotifier.INotifier2`

## Nested classes/interfaces inherited from interface org.eclipse.spi.net4j.InternalChannelMultiplexer

`InternalChannelMultiplexer.BufferMultiplexer`

## Field Summary

### Fields inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle

`USE_LABEL`

### Fields inherited from interface org.eclipse.net4j.channel.IChannelMultiplexer

`DEFAULT_OPEN_CHANNEL_TIMEOUT, NO_CHANNEL_TIMEOUT`

### Fields inherited from interface org.eclipse.net4j.connector.IConnector

`NO_TIMEOUT`

### Fields inherited from interface org.eclipse.spi.net4j.InternalChannelMultiplexer

`CONTEXT_MULTIPLEXER, RESERVED_CHANNEL`

## Constructor Summary

Constructors
Constructor
Description
`Connector()`

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
`void`
`connect()`
Synchronous connect with infinite timeout value.
`void`
`connect(long timeout)`
Synchronous connect.
`void`
`connectAsync()`
Asynchronous connect.
`protected abstract org.eclipse.net4j.util.security.INegotiationContext`
`createNegotiationContext()`
`protected void`
`deregisterChannelFromPeer(InternalChannel channel)`
`protected void`
`doActivate()`
`protected void`
`doBeforeActivate()`
`protected void`
`doBeforeOpenChannel(IProtocol<?> protocol)`
`protected void`
`doDeactivate()`
`short`
`getBufferCapacity()`
Returns the capacity of the buffers provided by `IBufferProvider.provideBuffer()` .
`ILocationAware.Location`
`getLocation()`
Returns the location of this object in a `client`/`server` scenario.
`org.eclipse.net4j.util.security.INegotiationContext`
`getNegotiationContext()`
`protected org.eclipse.net4j.util.security.NegotiationException`
`getNegotiationException()`
`org.eclipse.net4j.util.security.INegotiator`
`getNegotiator()`
`ConnectorState`
`getState()`
Returns the current state of this connector.
`String`
`getURL()`
`String`
`getUserID()`
`protected void`
`initChannel(InternalChannel channel, IProtocol<?> protocol)`
`boolean`
`isClient()`
Same as ``ILocationAware.getLocation()` == `ILocationAware.Location.CLIENT``.
`boolean`
`isClosed()`
`boolean`
`isConnected()`
Same as ``IConnector.getState()` == `ConnectorState.CONNECTED``.
`boolean`
`isConnecting()`
`boolean`
`isDeferredActivation()`
`boolean`
`isDisconnected()`
`boolean`
`isNegotiating()`
`boolean`
`isServer()`
Same as ``ILocationAware.getLocation()` == `ILocationAware.Location.SERVER``.
`protected void`
`leaveConnecting()`
`IBuffer`
`provideBuffer()`
Provides a buffer from this `BufferProvider`.
`void`
`retainBuffer(IBuffer buffer)`
Retains a buffer to this `BufferProvider`.
`protected void`
`setNegotiationException(org.eclipse.net4j.util.security.NegotiationException negotiationException)`
`void`
`setNegotiator(org.eclipse.net4j.util.security.INegotiator negotiator)`
`void`
`setState(ConnectorState newState)`
`void`
`setUserID(String userID)`
`void`
`waitForConnection(long timeout)`
Blocks until ``IConnector.isConnected()` == true` or the given timeout expired.

### Methods inherited from class org.eclipse.spi.net4j.ChannelMultiplexer

`closeChannel, createChannel, createProtocol, createProtocolFactoryKey, getChannel, getChannels, getConfig, getElements, getExecutorService, getOpenChannelTimeout, inverseClose, inverseCloseChannel, inverseOpenChannel, inverseOpenChannel, isEmpty, needsBufferProvider, openChannel, openChannel, openChannel, properties, registerChannelWithPeer, setConfig, setOpenChannelTimeout`

### Methods inherited from class org.eclipse.net4j.util.container.Container

`fireContainerEvent, fireContainerEvent, fireContainerEvent, fireElementAddedEvent, fireElementRemovedEvent, fireElementsAddedEvent, fireElementsRemovedEvent, fireEvent, newContainerEvent, newContainerEvent`

### Methods inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle

`activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doAfterActivate, doBeforeDeactivate, dump, getLifecycleState, isActive, toString`

### Methods inherited from class org.eclipse.net4j.util.event.Notifier

`addListener, addUniqueListener, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListener, hasListeners, lastListenerRemoved, listenerAdded, listenerRemoved, removeListener`

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

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

### Methods inherited from interface org.eclipse.net4j.channel.IChannelMultiplexer

`getChannels, getOpenChannelTimeout, openChannel, openChannel, openChannel, setOpenChannelTimeout`

### Methods inherited from interface org.eclipse.net4j.util.container.IContainer

`getElements, isEmpty`

### Methods inherited from interface org.eclipse.net4j.util.event.INotifier

`addListener, getListeners, hasListeners, removeListener`

### Methods inherited from interface org.eclipse.spi.net4j.InternalChannelMultiplexer

`closeChannel, multiplexChannel, needsBufferProvider`

### Methods inherited from interface org.eclipse.net4j.util.properties.IPropertiesContainer

`properties`

### Methods inherited from interface org.eclipse.net4j.ITransportConfigAware

`getConfig, setConfig`

## Constructor Details

### Connector

public Connector()

## Method Details

### getNegotiator

public org.eclipse.net4j.util.security.INegotiator getNegotiator()

Specified by:
  `getNegotiator` in interface `org.eclipse.net4j.util.security.INegotiatorAware`

### setNegotiator

public void setNegotiator(org.eclipse.net4j.util.security.INegotiator negotiator)

Specified by:
  `setNegotiator` in interface `org.eclipse.net4j.util.security.INegotiatorAware`

### getNegotiationContext

public org.eclipse.net4j.util.security.INegotiationContext getNegotiationContext()

### isClient

public boolean isClient()
Description copied from interface: `ILocationAware`
Same as ``ILocationAware.getLocation()` == `ILocationAware.Location.CLIENT``.

Specified by:
  `isClient` in interface `ILocationAware`

### isServer

public boolean isServer()
Description copied from interface: `ILocationAware`
Same as ``ILocationAware.getLocation()` == `ILocationAware.Location.SERVER``.

Specified by:
  `isServer` in interface `ILocationAware`

### getUserID

public String getUserID()

Specified by:
  `getUserID` in interface `org.eclipse.net4j.util.security.IUserAware`

### setUserID

public void setUserID(String userID)

### getState

public ConnectorState getState()
Description copied from interface: `IConnector`
Returns the current state of this connector.

Specified by:
  `getState` in interface `IConnector`

### setState

public void setState(ConnectorState newState) throws ConnectorException

Throws:
  `ConnectorException`

### isDisconnected

public boolean isDisconnected()

### isConnecting

public boolean isConnecting()

### isNegotiating

public boolean isNegotiating()

### isConnected

public boolean isConnected()
Description copied from interface: `IConnector`
Same as ``IConnector.getState()` == `ConnectorState.CONNECTED``.

Specified by:
  `isConnected` in interface `IConnector`

### connectAsync

public void connectAsync() throws ConnectorException
Description copied from interface: `IConnector`
Asynchronous connect. May leave this `IConnector` in a state where ``IConnector.isConnected()` == false` .

Specified by:
  `connectAsync` in interface `IConnector`
Throws:
  `ConnectorException`
See Also:
  - `IConnector.waitForConnection(long)`
  - `IConnector.connect(long)`

### waitForConnection

public void waitForConnection(long timeout) throws ConnectorException
Description copied from interface: `IConnector`
Blocks until ``IConnector.isConnected()` == true` or the given timeout expired.

Specified by:
  `waitForConnection` in interface `IConnector`
Parameters:
  `timeout` - The maximum number of milli seconds to block or `IConnector.NO_TIMEOUT` to block indefinetely in case no connection occurs.
Throws:
  `ConnectorException`
Since:
  4.0

### connect

public void connect(long timeout) throws ConnectorException
Description copied from interface: `IConnector`
Synchronous connect. Blocks until ``IConnector.isConnected()` == true` or the given timeout expired.

Specified by:
  `connect` in interface `IConnector`
Parameters:
  `timeout` - The maximum number of milli seconds to block or `IConnector.NO_TIMEOUT` to block indefinetely in case no connection occurs.
Throws:
  `ConnectorException`
Since:
  4.0

### connect

public void connect() throws ConnectorException
Description copied from interface: `IConnector`
Synchronous connect with infinite timeout value. Same as `connect(NO_TIMEOUT)`.

Specified by:
  `connect` in interface `IConnector`
Throws:
  `ConnectorException`
Since:
  4.0

### close

public void close()

Specified by:
  `close` in interface `org.eclipse.net4j.util.collection.Closeable`

### isClosed

public boolean isClosed()

Specified by:
  `isClosed` in interface `org.eclipse.net4j.util.collection.Closeable`

### getBufferCapacity

public short getBufferCapacity()
Description copied from interface: `IBufferProvider`
Returns the capacity of the buffers provided by `IBufferProvider.provideBuffer()` .

Specified by:
  `getBufferCapacity` in interface `IBufferProvider`

### provideBuffer

public IBuffer provideBuffer()
Description copied from interface: `IBufferProvider`
Provides a buffer from this `BufferProvider`.

Specified by:
  `provideBuffer` in interface `IBufferProvider`

### retainBuffer

public void retainBuffer(IBuffer buffer)
Description copied from interface: `IBufferProvider`
Retains a buffer to this `BufferProvider`.

Specified by:
  `retainBuffer` in interface `IBufferProvider`

### leaveConnecting

protected void leaveConnecting()

### createNegotiationContext

protected abstract org.eclipse.net4j.util.security.INegotiationContext createNegotiationContext()

Specified by:
  `createNegotiationContext` in class `ChannelMultiplexer`

### getNegotiationException

protected org.eclipse.net4j.util.security.NegotiationException getNegotiationException()

### setNegotiationException

protected void setNegotiationException(org.eclipse.net4j.util.security.NegotiationException negotiationException)

### initChannel

protected void initChannel(InternalChannel channel, IProtocol<?> protocol)

Overrides:
  `initChannel` in class `ChannelMultiplexer`

### deregisterChannelFromPeer

protected void deregisterChannelFromPeer(InternalChannel channel) throws ChannelException

Specified by:
  `deregisterChannelFromPeer` in class `ChannelMultiplexer`
Throws:
  `ChannelException`

### getLocation

public ILocationAware.Location getLocation()
Description copied from interface: `ILocationAware`
Returns the location of this object in a `client`/`server` scenario.

Specified by:
  `getLocation` in interface `ILocationAware`

### getURL

public String getURL()

Specified by:
  `getURL` in interface `IConnector`

### isDeferredActivation

public boolean isDeferredActivation()

Specified by:
  `isDeferredActivation` in interface `org.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivation`
Overrides:
  `isDeferredActivation` in class `org.eclipse.net4j.util.lifecycle.Lifecycle`
Since:
  4.1

### doBeforeOpenChannel

protected void doBeforeOpenChannel(IProtocol<?> protocol)

Overrides:
  `doBeforeOpenChannel` in class `ChannelMultiplexer`

### doBeforeActivate

protected void doBeforeActivate() throws Exception

Overrides:
  `doBeforeActivate` in class `org.eclipse.net4j.util.lifecycle.Lifecycle`
Throws:
  `Exception`

### doActivate

protected void doActivate() throws Exception

Overrides:
  `doActivate` in class `org.eclipse.net4j.util.lifecycle.Lifecycle`
Throws:
  `Exception`

### doDeactivate

protected void doDeactivate() throws Exception

Overrides:
  `doDeactivate` in class `ChannelMultiplexer`
Throws:
  `Exception`