2008-02-07 1.1.0

org.eclipse.soda.dk.connection
Class Connection

java.lang.Object
  extended by org.eclipse.soda.dk.core.EscObject
      extended by org.eclipse.soda.dk.connection.Connection
All Implemented Interfaces:
ConnectionService
Direct Known Subclasses:
EchoConnection, RandomAccessFileConnection, StreamConnection, TraceConnection

public abstract class Connection
extends EscObject
implements ConnectionService

The Connection class implements the ConnectionService interface.

Version:
1.1.0
See Also:
ConnectionService

Field Summary
protected static int CLIENT_WAIT_RESOURCE
          Define the client wait resource (int) constant.
protected static int CLOSE_RESOURCE
          Define the close resource (int) constant.
protected static int CLOSED_RESOURCE
          Define the closed resource (int) constant.
protected  ConfigurationService configurationService
          Define the port configuration (SerialPortConfiguration) field.
protected static int OPEN_RESOURCE
          Define the open resource (int) constant.
protected static int OPENFAILED_RESOURCE
          Define the openfailed resource (int) constant.
protected static int READ_BYTES_RESOURCE
          Define the read bytes resource (int) constant.
protected  long readByteCount
          Define the read byte count (long) field.
protected static int WRITE_BYTES_RESOURCE
          Define the write bytes resource (int) constant.
protected  long writeByteCount
          Define the write byte count (long) field.
 
Fields inherited from class org.eclipse.soda.dk.core.EscObject
CLONE_EXCEPTION_RESOURCE, EMPTY_BYTES, EMPTY_STRING, ERROR_OCCURRED_EXCEPTION_RESOURCE, ID_FILTER_KEY, ID_KEY, ID_KEY_ANY, INTEGER_TABLE, INTEGER_TABLE_SIZE, KEY_KEY, LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_TRACE, LOG_WARNING, PREFIX_KEY, RESOURCE_BUNDLE, SLEEP_EXCEPTION_RESOURCE, SYSTEM_INFO_RESOURCE, TO_STRING_CONFIGURATION_KEYS, TRACE_LEVEL_HIGH, TRACE_LEVEL_LOW, TRACE_LEVEL_MAX, TRACE_LEVEL_MIN, TRACE_LEVEL_NONE, TRACE_LEVEL_NORMAL, TRACELEVEL_KEY, UNKNOWN_ERROR_RESOURCE
 
Fields inherited from interface org.eclipse.soda.dk.connection.service.ConnectionService
CONNECTION_KEY, CONNECTION_TYPE, DEFAULT_CONNECTION, SERVICE_NAME
 
Constructor Summary
Connection()
           
 
Method Summary
protected  boolean attemptRecoveryFromError(int errorNumber, java.lang.Throwable error)
          Returns true if attempt recovery from error.
 void close()
          Perform the close action method.
 void exit()
          Exit.
protected  void finalize()
          Perform the finalize action method.
 void flush()
          Flush any data to be written.
 ConfigurationService getConfigurationService()
          Gets the configuration service value.
static java.lang.String getDefaultResource(int resourceId)
           
protected  int getErrorSeverity(int errorNumber, java.lang.Throwable error)
          Return the error severity of the specified error number.
 java.lang.Object getLogDetails4()
          Gets the log details4 (Object) value.
 java.lang.Object getLogDetails5()
          Gets the log details5 (Object) value.
 long getReadByteCount()
          Gets the read byte count (long) value.
 java.lang.String getResource(int resourceId)
          Return the string resource.
 long getWriteByteCount()
          Gets the write byte count (long) value.
 boolean isOpen()
          Gets the boolean open property value.
 void open()
          Perform the open action method.
 int read(byte[] bytes)
          Read bytes.
 void setConfigurationService(ConfigurationService configurationService)
          Sets the configuration service value.
 void setOpen(boolean open)
           
 void setReadByteCount(long readCount)
          Sets the read byte count value.
 void setWriteByteCount(long writeCount)
          Sets the write byte count value.
 void toStringInfo(java.lang.StringBuffer buffer)
          To string info with the specified buffer parameter.
 void updateReadByteCount(long readCount)
          Update read byte count with the specified read count parameter.
 void updateWriteByteCount(long writeCount)
          Update write byte count with the specified write count parameter.
 void write(byte[] bytes)
          Writes count bytes from the byte array buffer starting at offset.
 
Methods inherited from class org.eclipse.soda.dk.core.EscObject
createDefaultLogService, createException, createException, createInteger, createIntegerTable, createNumber, format, getBoolean, getCurrentTimestamp, getDefaultLogService, getFloat, getInt, getLoadLibraryName, getLogDetails, getLogDetails0, getLogDetails1, getLogDetails2, getLogDetails3, getLogDetails6, getLogDetails7, getLogService, getLong, getObject, getOutputName, getSimpleClassName, getStaticBoolean, getStaticFloat, getStaticInt, getStaticLong, getStaticObject, getStaticString, getString, getTraceLevel, getVmLibraryVersion, handleError, handleError, handleError, handleErrorInternal, handleStaticError, handleStaticException, isDebug, isTrace, loadService, log, log, report, report, report, report, report, report, reportError, reportSystemInfo, setDebug, setDefaultLogService, setLogService, setTraceLevel, shouldLog, sleep, startupEscStatic, toString, toStringConfigurationKeys
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.soda.dk.connection.service.ConnectionService
read, write
 

Field Detail

OPEN_RESOURCE

protected static final int OPEN_RESOURCE
Define the open resource (int) constant.

See Also:
Constant Field Values

CLOSE_RESOURCE

protected static final int CLOSE_RESOURCE
Define the close resource (int) constant.

See Also:
Constant Field Values

CLOSED_RESOURCE

protected static final int CLOSED_RESOURCE
Define the closed resource (int) constant.

See Also:
Constant Field Values

OPENFAILED_RESOURCE

protected static final int OPENFAILED_RESOURCE
Define the openfailed resource (int) constant.

See Also:
Constant Field Values

READ_BYTES_RESOURCE

protected static final int READ_BYTES_RESOURCE
Define the read bytes resource (int) constant.

See Also:
Constant Field Values

WRITE_BYTES_RESOURCE

protected static final int WRITE_BYTES_RESOURCE
Define the write bytes resource (int) constant.

See Also:
Constant Field Values

CLIENT_WAIT_RESOURCE

protected static final int CLIENT_WAIT_RESOURCE
Define the client wait resource (int) constant.

See Also:
Constant Field Values

configurationService

protected ConfigurationService configurationService
Define the port configuration (SerialPortConfiguration) field.


readByteCount

protected long readByteCount
Define the read byte count (long) field.


writeByteCount

protected long writeByteCount
Define the write byte count (long) field.

Constructor Detail

Connection

public Connection()
Method Detail

getDefaultResource

public static java.lang.String getDefaultResource(int resourceId)
Parameters:
resourceId - The resource id (int) parameter.
Returns:
Results of the get default resource (String) value.

attemptRecoveryFromError

protected boolean attemptRecoveryFromError(int errorNumber,
                                           java.lang.Throwable error)
Description copied from class: EscObject
Returns true if attempt recovery from error.

Overrides:
attemptRecoveryFromError in class EscObject
Parameters:
errorNumber - The error number (int) parameter.
error - The error (Throwable) parameter.
Returns:
Results of the attempt recovery from error (boolean) value.

close

public void close()
           throws java.io.IOException
Perform the close action method. href="java.io.IOException.html">IOException Thrown if the IOException exception condition occurs.

Specified by:
close in interface ConnectionService
Throws:
java.io.IOException - IOException.
See Also:
ConnectionService.close()

exit

public void exit()
          throws java.io.IOException
Exit.

Specified by:
exit in interface ConnectionService
Throws:
java.io.IOException - IOException.

finalize

protected void finalize()
                 throws java.lang.Throwable
Perform the finalize action method. href="java.lang.Throwable.html">Throwable Thrown if the Throwable exception condition occurs.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable - Throwable.

flush

public void flush()
           throws java.io.IOException
Flush any data to be written. an error occurs attempting to flush this Writer.

Specified by:
flush in interface ConnectionService
Throws:
java.io.IOException - IOException.

getConfigurationService

public ConfigurationService getConfigurationService()
Gets the configuration service value.

Overrides:
getConfigurationService in class EscObject
Returns:
The configuration service (ConfigurationService) value.
See Also:
setConfigurationService(ConfigurationService)

getErrorSeverity

protected int getErrorSeverity(int errorNumber,
                               java.lang.Throwable error)
Description copied from class: EscObject
Return the error severity of the specified error number.

Overrides:
getErrorSeverity in class EscObject
Parameters:
errorNumber - The error number (int) parameter.
error - The error (Throwable) parameter.
Returns:
Results of the get error severity (int) value.
See Also:
LogService

getLogDetails4

public java.lang.Object getLogDetails4()
Gets the log details4 (Object) value.

Overrides:
getLogDetails4 in class EscObject
Returns:
The log details4 (Object) value.

getLogDetails5

public java.lang.Object getLogDetails5()
Gets the log details5 (Object) value.

Overrides:
getLogDetails5 in class EscObject
Returns:
The log details5 (Object) value.

getReadByteCount

public long getReadByteCount()
Gets the read byte count (long) value.

Returns:
The read byte count (long) value.
See Also:
setReadByteCount(long), updateReadByteCount(long)

getResource

public java.lang.String getResource(int resourceId)
Description copied from class: EscObject
Return the string resource.

Overrides:
getResource in class EscObject
Parameters:
resourceId - The resource id (int) parameter.
Returns:
Results of the get resource (String) value.
See Also:
getDefaultResource(int)

getWriteByteCount

public long getWriteByteCount()
Gets the write byte count (long) value.

Returns:
The write byte count (long) value.
See Also:
setWriteByteCount(long), updateWriteByteCount(long)

isOpen

public boolean isOpen()
Gets the boolean open property value.

Specified by:
isOpen in interface ConnectionService
Returns:
Results of the is open (boolean) value.
See Also:
ConnectionService.isOpen(), setOpen(boolean)

open

public void open()
          throws java.io.IOException
Perform the open action method. href="java.io.IOException.html">IOException Thrown if the IOException exception condition occurs.

Specified by:
open in interface ConnectionService
Throws:
java.io.IOException - IOException.
See Also:
ConnectionService.open()

read

public int read(byte[] bytes)
         throws java.io.IOException
Read bytes. the byte array in which to store the read bytes.

Specified by:
read in interface ConnectionService
Parameters:
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:
ConnectionService.read(byte[],int,int)

setConfigurationService

public void setConfigurationService(ConfigurationService configurationService)
Sets the configuration service value. The configuration service (ConfigurationService) parameter.

Parameters:
configurationService - The configuration service (ConfigurationService) parameter.
See Also:
getConfigurationService()

setOpen

public void setOpen(boolean open)
Parameters:
open - The open (boolean) parameter.
See Also:
isOpen()

setReadByteCount

public void setReadByteCount(long readCount)
Sets the read byte count value.

Parameters:
readCount - The read count (long) parameter.
See Also:
getReadByteCount(), updateReadByteCount(long)

setWriteByteCount

public void setWriteByteCount(long writeCount)
Sets the write byte count value.

Parameters:
writeCount - The write count (long) parameter.
See Also:
getWriteByteCount(), updateWriteByteCount(long)

toStringInfo

public void toStringInfo(java.lang.StringBuffer buffer)
To string info with the specified buffer parameter.

Overrides:
toStringInfo in class EscObject
Parameters:
buffer - The buffer (StringBuffer) parameter.

updateReadByteCount

public void updateReadByteCount(long readCount)
Update read byte count with the specified read count parameter.

Parameters:
readCount - The read count (long) parameter.
See Also:
getReadByteCount(), setReadByteCount(long)

updateWriteByteCount

public void updateWriteByteCount(long writeCount)
Update write byte count with the specified write count parameter.

Parameters:
writeCount - The write count (long) parameter.
See Also:
getWriteByteCount(), setWriteByteCount(long)

write

public void write(byte[] bytes)
           throws java.io.IOException
Writes count bytes from the byte array buffer starting at offset. the buffer to be written an error occurs attempting to write to this OutputStream. If offset or count are outside of bounds.

Specified by:
write in interface ConnectionService
Parameters:
bytes - The bytes (byte[]) parameter.
Throws:
java.io.IOException - IOException.
See Also:
ConnectionService.write(byte[],int,int)

2008-02-07 1.1.0

Copyright (c) 1999, 2008 IBM and others. See license in Legal section. OSGi Framework Version 3.3.1.R33x_v20070828