2009-01-09 1.2.0

org.eclipse.soda.dk.multiplex.connection.service
Interface MultiplexConnectionService

All Superinterfaces:
ConnectionService
All Known Implementing Classes:
TraceConnection

public interface MultiplexConnectionService
extends ConnectionService

The MultiplexConnectionService interface defines the MultiplexConnectionService concept. A MultiplexConnectionService is an encapsulation of a pair of streams, one input and one output. A user of a channel can open and close a channel, get each stream, and test if a stream is open. Generally, after opening a MultiplexConnectionService, and getting the streams, a MultiplexConnectionService user will read and write to the streams, closing the MultiplexConnectionService when finished.

Since:
1.2
Version:
1.2.0

Field Summary
static java.lang.String SERVICE_NAME
          Define the OSGi service name.
 
Fields inherited from interface org.eclipse.soda.dk.connection.service.ConnectionService
CONNECTION_DEFAULT, CONNECTION_KEY, CONNECTION_TYPE, DEFAULT_CONNECTION
 
Method Summary
 ChannelService getChannel(java.lang.String channelId)
          Get channel with the specified id parameter and return the ChannelRef result.
 java.util.Map getChannels()
          Gets the channels (Map) value.
 MultiplexConnectionListener getConnectionListener()
          Gets the connection listener (MultiplexConnectionListener) value.
 ChannelService openChannel(java.util.Map parameters)
          Open channel with the specified channel spec parameter and return the ChannelService result.
 void processEvents()
          Process events.
 int read(ChannelService channel, byte[] bytes)
          Read data into the bytes specified.
 int read(ChannelService channel, byte[] bytes, int offset, int length)
          Read data into the bytes specified.
 void setConnectionListener(MultiplexConnectionListener connectionListener)
          Sets the channel listener value.
 void write(ChannelService channel, byte[] bytes)
          Writes the bytes from the byte array.
 void write(ChannelService channel, byte[] bytes, int offset, int count)
          Writes count bytes from the byte array buffer starting at offset.
 
Methods inherited from interface org.eclipse.soda.dk.connection.service.ConnectionService
close, exit, flush, isOpen, open, read, read, setConfigurationInformation, write, write
 

Field Detail

SERVICE_NAME

static final java.lang.String SERVICE_NAME
Define the OSGi service name.

Method Detail

getChannel

ChannelService getChannel(java.lang.String channelId)
Get channel with the specified id parameter and return the ChannelRef result.

Parameters:
channelId - The channel ID (String) parameter.
Returns:
Results of the get connection (ChannelRef) value.
See Also:
openChannel(Map)

getChannels

java.util.Map getChannels()
Gets the channels (Map) value.

Returns:
The channels (Map) value.

getConnectionListener

MultiplexConnectionListener getConnectionListener()
Gets the connection listener (MultiplexConnectionListener) value.

Returns:
The connection listener (MultiplexConnectionListener) value.
See Also:
setConnectionListener(MultiplexConnectionListener)

openChannel

ChannelService openChannel(java.util.Map parameters)
                           throws java.io.IOException
Open channel with the specified channel spec parameter and return the ChannelService result.

Parameters:
parameters - The parameters (Map) parameter.
Returns:
Results of the open channel (ChannelService) value.
Throws:
java.io.IOException - IOException.
See Also:
getChannel(String)

processEvents

void processEvents()
                   throws java.lang.Exception
Process events.

Throws:
java.lang.Exception - Exception.

read

int read(ChannelService channel,
         byte[] bytes)
         throws java.io.IOException
Read data into the bytes specified.

Parameters:
channel - The channel (ChannelService) parameter.
bytes - The bytes (byte[]) parameter.
Returns:
the number of bytes actually read or -1 if end of stream. If the stream is already closed or another IOException occurs.
Throws:
java.io.IOException - IOException.
See Also:
read(ChannelService,byte[],int,int)

read

int read(ChannelService channel,
         byte[] bytes,
         int offset,
         int length)
         throws java.io.IOException
Read data into the bytes specified. the byte array in which to store the read bytes.

Parameters:
channel - The channel (ChannelService) parameter.
bytes - The bytes (byte[]) parameter.
offset - The offset (int) parameter.
length - The length (int) parameter.
Returns:
the number of bytes actually read or -1 if end of stream. If the stream is already closed or another IOException occurs.
Throws:
java.io.IOException - IOException.
See Also:
read(ChannelService,byte[])

setConnectionListener

void setConnectionListener(MultiplexConnectionListener connectionListener)
Sets the channel listener value.

Parameters:
connectionListener - The connection listener (MultiplexConnectionListener) parameter.
See Also:
getConnectionListener()

write

void write(ChannelService channel,
           byte[] bytes)
           throws java.io.IOException
Writes the bytes from the byte array.

Parameters:
channel - The channel (ChannelService) parameter.
bytes - The bytes (byte[]) parameter.
Throws:
java.io.IOException - IOException.
See Also:
write(ChannelService,byte[],int,int)

write

void write(ChannelService channel,
           byte[] bytes,
           int offset,
           int count)
           throws java.io.IOException
Writes count bytes from the byte array buffer starting at offset.

Parameters:
channel - The channel (ChannelService) parameter.
bytes - The bytes (byte[]) parameter.
offset - The offset (int) parameter.
count - The count (int) parameter.
Throws:
java.io.IOException - IOException.
See Also:
write(ChannelService,byte[])

2009-01-09 1.2.0

Copyright (c) 2009 IBM. See license in Legal section.