org.eclipse.net4j.connector

## Interface IConnector

- All Superinterfaces:
    Closeable, IChannelMultiplexer, IContainer<IChannel>, ILocationAware, INotifier, IUserAware
  All Known Subinterfaces:
    IHTTPConnector, IJVMConnector, InternalConnector, IServerConnector, ITCPConnector
  All Known Implementing Classes:
    Connector

      public interface IConnector
      extends IChannelMultiplexer, IUserAware, Closeable

  One endpoint of a physical connection of arbitrary nature between two communicating parties. A `IConnector` encapsulates the process of establishing and closing such connections and has a `location` of `CLIENT` or `SERVER` with respect to this process. Once a connection is established either party can use its connector to open multiple `IChannel`s to asynchronously exchange `IBuffer`s.

  This interface is not intended to be implemented by clients. Providers of connectors for new physical connection types have to implement org.eclipse.internal.net4j.connector.InternalConnector.

  Author:
    Eike Stepper
  No Implement
    This interface is not intended to be implemented by clients.

- - ### Nested Class Summary

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

      `ILocationAware.Location`

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

      `IContainer.Modifiable<E>, IContainer.Persistable<E>, IContainer.Persistence<E>`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static long` | `NO_TIMEOUT`

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

      `DEFAULT_OPEN_CHANNEL_TIMEOUT, NO_CHANNEL_TIMEOUT`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `connect()` Synchronous connect with infinite timeout value.
    `void` | `connect(long timeout)` Synchronous connect.
    `void` | `connectAsync()` Asynchronous connect.
    `ConnectorState` | `getState()` Returns the current state of this connector.
    `java.lang.String` | `getURL()`
    `boolean` | `isConnected()` Same as ``getState()` == `ConnectorState.CONNECTED``.
    `void` | `waitForConnection(long timeout)` Blocks until ``isConnected()` == true` or the given timeout expired.

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

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

    - ### Methods inherited from interface org.eclipse.net4j.ILocationAware

      `getLocation, isClient, isServer`

    - ### 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.net4j.util.security.IUserAware

      `getUserID`

    - ### Methods inherited from interface org.eclipse.net4j.util.collection.Closeable

      `close, isClosed`

- - ### Field Detail

    - #### NO_TIMEOUT

          static final long NO_TIMEOUT

      Since:
        2.0
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getURL

          java.lang.String getURL()

    - #### getState

          ConnectorState getState()

      Returns the current state of this connector.

    - #### isConnected

          boolean isConnected()

      Same as ``getState()` == `ConnectorState.CONNECTED``.

    - #### connect

          void connect()
                throws ConnectorException

      Synchronous connect with infinite timeout value. Same as `connect(NO_TIMEOUT)`.
      Throws:
        `ConnectorException`
      Since:
        4.0

    - #### connect

          void connect(long timeout)
                throws ConnectorException

      Synchronous connect. Blocks until ``isConnected()` == true` or the given timeout expired.
      Parameters:
        `timeout` - The maximum number of milli seconds to block or `NO_TIMEOUT` to block indefinetely in case no connection occurs.
      Throws:
        `ConnectorException`
      Since:
        4.0

    - #### connectAsync

          void connectAsync()
                     throws ConnectorException

      Asynchronous connect. May leave this `IConnector` in a state where ``isConnected()` == false` .
      Throws:
        `ConnectorException`
      See Also:
        `waitForConnection(long)`, `connect(long)`

    - #### waitForConnection

          void waitForConnection(long timeout)
                          throws ConnectorException

      Blocks until ``isConnected()` == true` or the given timeout expired.
      Parameters:
        `timeout` - The maximum number of milli seconds to block or `NO_TIMEOUT` to block indefinetely in case no connection occurs.
      Throws:
        `ConnectorException`
      Since:
        4.0

Copyright (c) 2014 Eike Stepper (Berlin, Germany) and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html