TPTP 4.1.0 Platform Project
Public API Specification

org.eclipse.hyades.collection.framework.channel
Class DataChannelImpl

java.lang.Object
  extended byorg.eclipse.hyades.collection.framework.channel.DataChannelImpl
All Implemented Interfaces:
IDataChannel

public class DataChannelImpl
extends java.lang.Object
implements IDataChannel


Field Summary
protected  java.io.OutputStream _dc_outputStream
           
protected  boolean _isFlushing
           
protected  boolean _isWriting
           
protected static int DC_TYPE_FILLABLE
           
protected static int DC_TYPE_FLUSHABLE
           
protected static int FLUSH_TYPE_ASCII_FILE
           
protected static int FLUSH_TYPE_BINARY_FILE
           
protected static int FLUSH_TYPE_OUTPUT_STREAM
           
protected static int FLUSH_TYPE_PIPED_OUTPUT_STREAM
           
protected static int FLUSH_TYPE_RAC_FILE
           
protected static int FLUSH_TYPE_SOCKET
           
 
Constructor Summary
DataChannelImpl()
          Create a DataChannel object
 
Method Summary
 void connect()
          Connects to the data channel.
 void create()
          Creates the data channel.
 void destroy()
          Destroys the data channel.
 void disconnect()
          Disconnects from the data channel.
 java.lang.String getFileName()
          Retrieve the name of the file name to flush to.
 int getFlushType()
          Retrieve the type of descriptor that describes the destination of the data.
 int getHandle()
          Retrieve the handle of the data channel buffer.
 java.net.InetAddress getInetAddress()
          Retrieve the name of the file name to flush to.
 java.io.InputStream getInputStream()
          Returns an input stream that can be used to read from the data channel.
 java.lang.String getName()
          Retrieve the name of the data channel buffer
 java.io.OutputStream getOutputStream()
          Returns an output stream that can be used to write to the data channel.
protected  java.io.InputStream getPInputStream()
           
 int getPort()
          Retrieve the client port to flush to.
protected  java.io.PipedOutputStream getPOutputStream()
           
 int getSize()
          Retrieve the size of the data channel buffer.
protected  void hc_destroyDCBuffer(int bufferhandle)
          Native delegate of destroy()
protected  void hc_detachFromDCBuffer(int bufferhandle)
          Native delegate of disconnect() or detach from data channel buffer
protected  int hc_flushASCIIDCBufferToFile(int bufferhandle, java.lang.String filename)
          Native method to start flushing an ASCII only data channel buffer to a file
protected  int hc_flushBinaryDCBufferToFile(int bufferhandle, java.lang.String filename)
          Native method to start flushing a Binary only data channel buffer to a file
protected  int hc_flushDCBufferToSocket(int bufferhandle, byte[] inetaddess, int port)
          Native method to start flushing the data channel buffer to a socket
protected  int hc_flushDCBufferToStream(int bufferhandle, java.io.OutputStream outstr)
          Native method to start flushing the data channel buffer to an OutputStream - this should probably throw an IOException
protected  int hc_flushRACDCBufferToFile(int bufferhandle, java.lang.String filename)
          Native method to start flushing a Agent Controller data channel buffer to a file
protected  int hc_writeToDCBuffer(int bufferhandle, byte[] databytes, int numBytes)
          Native method to write an array of bytes to the data channel buffer
 boolean isDCBufferCreated()
          Returns whether or not the data channel has been created.
 boolean isFillable()
          Tests whether the application can fill this data channel.
 boolean isFlushable()
          Tests whether the application can flush this data channel.
 boolean isFlushing()
          Returns whether or not the data channel is being flushed.
 void setFillable()
          Sets this data channel as fillable.
 void setFlushable()
          Sets this data channel as flushable.
 void setInputStream(java.io.InputStream instr)
          Sets the input stream that acts as the input to the data channel.
 void setName(java.lang.String name)
          Set the name of the data channel buffer
 void setOutputStream(java.io.OutputStream outstr)
          Sets the output stream that acts as the destination for the data on the data channel.
 void setSize(int size)
          Set the size of the data channel buffer.
 void startFlushingToFile(java.lang.String flushtofilename)
          Start flushing the data channel to a file
 void startFlushingToSocket(java.net.InetAddress flushtosocketaddress, int flushtosocketport)
          Start flushing the data channel to a socket
 void startFlushingToStream(java.io.OutputStream outStr)
          Start flushing the data channel to a stream
 void startFlushingToStream(java.io.PipedOutputStream outStr)
          Start flushing the data channel to a piped output stream
 void stopFlushing()
          Stop flushing the data channel
 void write(byte[] bytes)
          Writes bytestream.length bytes from the specified byte array to this data channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_isFlushing

protected boolean _isFlushing

_isWriting

protected boolean _isWriting

FLUSH_TYPE_PIPED_OUTPUT_STREAM

protected static final int FLUSH_TYPE_PIPED_OUTPUT_STREAM
See Also:
Constant Field Values

FLUSH_TYPE_OUTPUT_STREAM

protected static final int FLUSH_TYPE_OUTPUT_STREAM
See Also:
Constant Field Values

FLUSH_TYPE_BINARY_FILE

protected static final int FLUSH_TYPE_BINARY_FILE
See Also:
Constant Field Values

FLUSH_TYPE_ASCII_FILE

protected static final int FLUSH_TYPE_ASCII_FILE
See Also:
Constant Field Values

FLUSH_TYPE_RAC_FILE

protected static final int FLUSH_TYPE_RAC_FILE
See Also:
Constant Field Values

FLUSH_TYPE_SOCKET

protected static final int FLUSH_TYPE_SOCKET
See Also:
Constant Field Values

DC_TYPE_FLUSHABLE

protected static int DC_TYPE_FLUSHABLE

DC_TYPE_FILLABLE

protected static int DC_TYPE_FILLABLE

_dc_outputStream

protected java.io.OutputStream _dc_outputStream
Constructor Detail

DataChannelImpl

public DataChannelImpl()
Create a DataChannel object

Method Detail

create

public void create()
            throws DataChannelCreationException
Creates the data channel.

Specified by:
create in interface IDataChannel
Throws:
DataChannelCreationException

destroy

public void destroy()
Destroys the data channel.

Specified by:
destroy in interface IDataChannel

connect

public void connect()
             throws DataChannelConnectionException
Connects to the data channel.

Specified by:
connect in interface IDataChannel
Throws:
DataChannelConnectionException

disconnect

public void disconnect()
Disconnects from the data channel.

Specified by:
disconnect in interface IDataChannel

write

public void write(byte[] bytes)
           throws java.io.IOException,
                  InvalidDataChannelAccessException
Writes bytestream.length bytes from the specified byte array to this data channel.

Parameters:
bytes - byte []
Throws:
java.io.IOException
InvalidDataChannelAccessException

setOutputStream

public void setOutputStream(java.io.OutputStream outstr)
                     throws InvalidDataChannelAccessException,
                            DataChannelNotInitializedException
Sets the output stream that acts as the destination for the data on the data channel. This is set by the flusher of the data channel.

Parameters:
outstr - java.io.OutputStream
Throws:
InvalidDataChannelAccessException
DataChannelNotInitializedException

getPOutputStream

protected java.io.PipedOutputStream getPOutputStream()

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws InvalidDataChannelAccessException,
                                            DataChannelNotInitializedException
Returns an output stream that can be used to write to the data channel. This is called by the filler of the data channel.

Specified by:
getOutputStream in interface IDataChannel
Returns:
java.io.OutputStream
Throws:
InvalidDataChannelAccessException
DataChannelNotInitializedException

setInputStream

public void setInputStream(java.io.InputStream instr)
                    throws InvalidDataChannelAccessException,
                           DataChannelNotInitializedException
Sets the input stream that acts as the input to the data channel. This is set by the writer of the data channel. This method blocks until all the data is read from the InputStream.

Parameters:
instr - java.io.InputStream
Throws:
InvalidDataChannelAccessException
DataChannelNotInitializedException

getPInputStream

protected java.io.InputStream getPInputStream()

getInputStream

public java.io.InputStream getInputStream()
                                   throws InvalidDataChannelAccessException,
                                          DataChannelNotInitializedException
Returns an input stream that can be used to read from the data channel. This is called by the flusher of the data channel.

Specified by:
getInputStream in interface IDataChannel
Returns:
java.io.InputStream
Throws:
InvalidDataChannelAccessException
DataChannelNotInitializedException

startFlushingToFile

public void startFlushingToFile(java.lang.String flushtofilename)
Start flushing the data channel to a file

Parameters:
flushtofilename - java.lang.String - the name of the file to flush the data in the channel to

startFlushingToSocket

public void startFlushingToSocket(java.net.InetAddress flushtosocketaddress,
                                  int flushtosocketport)
Start flushing the data channel to a socket

Parameters:
flushtosocketaddress - java.net.InetAddress - the address of the client to flush the data in the channel to
flushtosocketport - int - the port number of the client to flush the data in the channel to

startFlushingToStream

public void startFlushingToStream(java.io.PipedOutputStream outStr)
Start flushing the data channel to a piped output stream

Parameters:
outStr - java.io.PipedOutputStream - the PipedOutputStream to flush the data in the channel to

startFlushingToStream

public void startFlushingToStream(java.io.OutputStream outStr)
Start flushing the data channel to a stream

Parameters:
outStr - java.io.OutputStream - the OutputStream to flush the data in the channel to

stopFlushing

public void stopFlushing()
Stop flushing the data channel


setFlushable

public void setFlushable()
                  throws InvalidDataChannelAccessException
Sets this data channel as flushable.

Specified by:
setFlushable in interface IDataChannel
Throws:
InvalidDataChannelAccessException

isFlushable

public boolean isFlushable()
Tests whether the application can flush this data channel.

Specified by:
isFlushable in interface IDataChannel
Returns:
boolean

setFillable

public void setFillable()
                 throws InvalidDataChannelAccessException
Sets this data channel as fillable.

Specified by:
setFillable in interface IDataChannel
Throws:
InvalidDataChannelAccessException

isFillable

public boolean isFillable()
Tests whether the application can fill this data channel.

Specified by:
isFillable in interface IDataChannel
Returns:
boolean

hc_destroyDCBuffer

protected void hc_destroyDCBuffer(int bufferhandle)
Native delegate of destroy()

Parameters:
bufferhandle - int - handle of data channel buffer

hc_detachFromDCBuffer

protected void hc_detachFromDCBuffer(int bufferhandle)
Native delegate of disconnect() or detach from data channel buffer

Parameters:
bufferhandle - int - handle of data channel buffer

hc_flushRACDCBufferToFile

protected int hc_flushRACDCBufferToFile(int bufferhandle,
                                        java.lang.String filename)
Native method to start flushing a Agent Controller data channel buffer to a file

Parameters:
bufferhandle - int - handle of data channel buffer
filename - java.lang.String - name of file to flush to
Returns:
int - return code (negative if error occurs)

hc_flushASCIIDCBufferToFile

protected int hc_flushASCIIDCBufferToFile(int bufferhandle,
                                          java.lang.String filename)
Native method to start flushing an ASCII only data channel buffer to a file

Parameters:
bufferhandle - int - handle of data channel buffer
filename - java.lang.String - name of file to flush to
Returns:
int - return code (negative if error occurs)

hc_flushBinaryDCBufferToFile

protected int hc_flushBinaryDCBufferToFile(int bufferhandle,
                                           java.lang.String filename)
Native method to start flushing a Binary only data channel buffer to a file

Parameters:
bufferhandle - int - handle of data channel buffer
filename - java.lang.String - name of file to flush to
Returns:
int - return code (negative if error occurs)

hc_flushDCBufferToSocket

protected int hc_flushDCBufferToSocket(int bufferhandle,
                                       byte[] inetaddess,
                                       int port)
Native method to start flushing the data channel buffer to a socket

Parameters:
bufferhandle - int - handle of data channel buffer
port - int - port to flush to
Returns:
int - return code (negative if error occurs)

hc_flushDCBufferToStream

protected int hc_flushDCBufferToStream(int bufferhandle,
                                       java.io.OutputStream outstr)
Native method to start flushing the data channel buffer to an OutputStream - this should probably throw an IOException

Parameters:
bufferhandle - int - handle of data channel buffer
outstr - java.io.OutputStream - OutputStream to flush to
Returns:
int - return code (negative if error occurs)

hc_writeToDCBuffer

protected int hc_writeToDCBuffer(int bufferhandle,
                                 byte[] databytes,
                                 int numBytes)
Native method to write an array of bytes to the data channel buffer

Parameters:
bufferhandle - int - handle of data channel buffer
databytes - byte[] - byte array of data write
numBytes - int - number of bytes of data to write
Returns:
int - return code (negative if error occurs) Error codes: -1 data channel buffer has not been created yet -2 invalid parameter -99 memory allocation error

getName

public java.lang.String getName()
Retrieve the name of the data channel buffer

Specified by:
getName in interface IDataChannel
Returns:
java.lang.String

getFlushType

public int getFlushType()
Retrieve the type of descriptor that describes the destination of the data.

Returns:
int

getSize

public int getSize()
Retrieve the size of the data channel buffer.

Specified by:
getSize in interface IDataChannel
Returns:
int

getHandle

public int getHandle()
Retrieve the handle of the data channel buffer.

Returns:
int

getFileName

public java.lang.String getFileName()
Retrieve the name of the file name to flush to.

Returns:
java.lang.String

getInetAddress

public java.net.InetAddress getInetAddress()
Retrieve the name of the file name to flush to.

Returns:
java.lang.String

getPort

public int getPort()
Retrieve the client port to flush to.

Returns:
int

isFlushing

public boolean isFlushing()
Returns whether or not the data channel is being flushed.


isDCBufferCreated

public boolean isDCBufferCreated()
Returns whether or not the data channel has been created.


setName

public void setName(java.lang.String name)
Set the name of the data channel buffer

Specified by:
setName in interface IDataChannel
Parameters:
name - java.lang.String

setSize

public void setSize(int size)
Set the size of the data channel buffer.

Specified by:
setSize in interface IDataChannel
Parameters:
size - int

TPTP 4.1.0 Platform Project
Public API Specification