Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## cnrg.itx.datax
Class Connection

    java.lang.Object
      |
      +--java.util.Observable
            |
            +--cnrg.itx.datax.Connection

Direct Known Subclasses:
  AudioConnection

public abstract class Connection
extends java.util.Observable
implements Statistics, java.lang.Runnable, Properties

Abstract class for creating and managing an endpoint of communication. Each Connection has two different "channels" an input channel and an output channel. Both channels collect data from sources and pipe it to destinations. The input channel is intended to "collect" data while the output channel is intended to distribute data. However, it is possible not to follow these conventions with the system still functioning. We distinguish between input and output for naming reasons only -- they have the same functionality.

Constructor Summary
`Connection(Channel input, Channel output)` Creates a connection.

Method Summary
`void` | `close()` Stops sending data in the channel.
`Channel` | `getInputChannel()` Interface to get the input channel.
`Channel` | `getOutputChannel()` Interface to get the output channel.
`PropertiesCollection` | `getProperties()` Gets the properties for this audioConnection
`Stats` | `getStatistics()` Interface to get the statistics for the connection.
`void` | `open()` Begins sending data in the channel.
`void` | `run()` Method to implement the connection thread.
`void` | `setInputChannel(Channel c)` Sets a new input channel.
`void` | `setOutputChannel(Channel c)` Sets a new output channel.
`void` | `setPeerProperties(PropertiesCollection pc)` Interface to set the given properties collection into the device.
`void` | `setProperties(PropertiesCollection pc)` Sets the properties for this audioConnection

Methods inherited from class java.util.Observable
`addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Connection

    public Connection(Channel input,
                      Channel output)

  Creates a connection.
  Parameters:
    `input` - The channel which is inteded to collect data.
    `output` - The channel which distributes data.

Method Detail

### getInputChannel

    public Channel getInputChannel()

  Interface to get the input channel.
  Returns:
    Channel the input channel

### getOutputChannel

    public Channel getOutputChannel()

  Interface to get the output channel.
  Returns:
    Channel the output channel

### setInputChannel

    public void setInputChannel(Channel c)

  Sets a new input channel.

  The old channel should be closed to free its resources.

  Parameters:
    `c` - The new input channel

### setOutputChannel

    public void setOutputChannel(Channel c)

  Sets a new output channel. The old channel should be closed to free its resources.
  Parameters:
    `c` - The new output channel

### getStatistics

    public Stats getStatistics()

  Interface to get the statistics for the connection.
  Specified by:
    getStatistics in interface Statistics
  Returns:
    Stats the statistics corresponding to the channel

### getProperties

    public PropertiesCollection getProperties()

  Gets the properties for this audioConnection
  Specified by:
    getProperties in interface Properties
  Returns:
    the ProertiesCollection

### setProperties

    public void setProperties(PropertiesCollection pc)

  Sets the properties for this audioConnection
  Specified by:
    setProperties in interface Properties

### setPeerProperties

    public void setPeerProperties(PropertiesCollection pc)
                           throws DataException

  Interface to set the given properties collection into the device. WOrks under the assumption that this is the properties collection of the peer.
  Specified by:
    setPeerProperties in interface Properties

### run

    public void run()

  Method to implement the connection thread.
  Specified by:
    run in interface java.lang.Runnable

### open

    public void open()
              throws DataException

  Begins sending data in the channel. Calls open on both channels, which will call open on all devices attached to the channel.
  Throws:
    DataException - thrown after reopening a device that has already been closed.

### close

    public void close()

  Stops sending data in the channel. Calls close on both channels, which closes all devices attached to the channel. Note: Once a devide has been closed, it cannot be reopened.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD