2009-01-09 1.2.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:
StreamConnection, TraceConnection

public abstract class Connection
extends EscObject
implements ConnectionService

The Connection class implements the ConnectionService interface.

Since:
1.0
Version:
1.2.0
See Also:
ConnectionService

Field Summary
protected static int CHANNEL_ACTIVE_STATE_RESOURCE
          Define the channel active state resource (int) constant.
static int CHANNEL_ALIVE_STATE_RESOURCE
          Define the channel alive resource (int) constant.
static int CHANNEL_CLOSED_RESOURCE
          Define the channel closed resource (int) constant.
static int CHANNEL_CONNECTED_STATE_RESOURCE
          Define the channel connected resource (int) constant.
protected static int CHANNEL_CREATED_STATE_RESOURCE
          Define the channel created state resource (int) constant.
protected static int CHANNEL_DEAD_STATE_RESOURCE
          Define the channel dead state resource (int) constant.
protected static int CHANNEL_OPEN
          Define the read bytes resource (int) constant.
static int CHANNEL_OPENFAILED_RESOURCE
          Define the channel open failed resource (int) constant.
protected static int CHANNEL_READ_BYTES_RESOURCE
          Define the read bytes resource (int) constant.
protected static int CHANNEL_STARTED_STATE_RESOURCE
          Define the channel started state resource (int) constant.
protected static int CHANNEL_WRITE_BYTES_RESOURCE
          Define the write bytes resource (int) constant.
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  int logLevel
          Define the log level (int) 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, ID_NAME_KEY, INTEGER_TABLE, INTEGER_TABLE_SIZE, KEY_KEY, LOG_DEBUG, LOG_DEFAULT, LOG_ERROR, LOG_INFO, LOG_LEVEL_KEY, LOG_TRACE, LOG_WARNING, LONG_TABLE, LONG_TABLE_SIZE, PREFIX_KEY, READONLY_EMPTY_COLLECTION, READONLY_EMPTY_LIST, READONLY_EMPTY_MAP, 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, Unmodifiable
 
Fields inherited from interface org.eclipse.soda.dk.connection.service.ConnectionService
CONNECTION_DEFAULT, CONNECTION_KEY, CONNECTION_TYPE, DEFAULT_CONNECTION, SERVICE_NAME
 
Constructor Summary
protected Connection()
          Constructs an instance of this class.
protected Connection(ConfigurationService configuration)
          Constructs an instance of this class from the specified configuration parameter.
protected Connection(java.util.Dictionary properties)
          Constructs an instance of this class from the specified properties parameter.
 
Method Summary
protected  boolean attemptRecoveryFromError(int errorNumber, java.lang.Throwable error)
          Attempt recovery from error with the specified error number and error parameters and return the boolean result.
 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)
          Get default resource with the specified resource ID parameter and return the String result.
protected  int getErrorSeverity(int errorNumber, java.lang.Throwable error)
          Get error severity with the specified error number and error parameters and return the int result.
 java.lang.Object getLogDetails4()
          Gets the log details4 (Object) value.
 java.lang.Object getLogDetails5()
          Gets the log details5 (Object) value.
 int getLogLevel()
          Gets the log level (int) value.
 long getReadByteCount()
          Gets the read byte count (long) value.
 java.lang.String getResource(int resourceId)
          Get resource with the specified resource ID parameter and return the String result.
 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 setConfigurationInformation(java.util.Dictionary configurationInformation)
          Sets the configuration information value.
 void setConfigurationService(ConfigurationService configurationService)
          Sets the configuration service value.
 void setLogLevel(int logLevel)
          Sets the log level value.
 void setOpen(boolean open)
          Sets the open value.
 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
createBoolean, createDefaultLogService, createException, createException, createInteger, createIntegerTable, createLong, createLongTable, createNumber, format, getBoolean, getByte, getChar, getCurrentTimestamp, getDefaultLogService, getDouble, getFloat, getId, getIdName, getInt, getLoadLibraryName, getLogDetails, getLogDetails, getLogDetails0, getLogDetails1, getLogDetails2, getLogDetails3, getLogDetails6, getLogDetails7, getLogService, getLong, getObject, getOutputName, getReadOnlyEmptyCollection, getReadOnlyEmptyList, getReadOnlyEmptyMap, getShort, getSimpleClassName, getStaticBoolean, getStaticByte, getStaticChar, getStaticDouble, getStaticFloat, getStaticInt, getStaticLong, getStaticObject, getStaticShort, getStaticString, getString, getTraceLevel, getVmLibraryVersion, handleError, handleError, handleError, handleError, handleErrorInternal, handleStaticError, handleStaticException, isBackward, isDebug, isLogging, isTrace, isUnmodifiable, loadService, log, log, log, report, report, report, report, report, report, report, reportError, reportSystemInfo, setBackward, setDebug, setDefaultLogService, setLogService, setTraceLevel, setUnmodifiable, 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

CHANNEL_DEAD_STATE_RESOURCE

protected static final int CHANNEL_DEAD_STATE_RESOURCE
Define the channel dead state resource (int) constant.

See Also:
Constant Field Values

CHANNEL_CREATED_STATE_RESOURCE

protected static final int CHANNEL_CREATED_STATE_RESOURCE
Define the channel created state resource (int) constant.

See Also:
Constant Field Values

CHANNEL_ALIVE_STATE_RESOURCE

public static final int CHANNEL_ALIVE_STATE_RESOURCE
Define the channel alive resource (int) constant.

See Also:
Constant Field Values

CHANNEL_CONNECTED_STATE_RESOURCE

public static final int CHANNEL_CONNECTED_STATE_RESOURCE
Define the channel connected resource (int) constant.

See Also:
Constant Field Values

CHANNEL_ACTIVE_STATE_RESOURCE

protected static final int CHANNEL_ACTIVE_STATE_RESOURCE
Define the channel active state resource (int) constant.

See Also:
Constant Field Values

CHANNEL_STARTED_STATE_RESOURCE

protected static final int CHANNEL_STARTED_STATE_RESOURCE
Define the channel started state resource (int) constant.

See Also:
Constant Field Values

CHANNEL_OPENFAILED_RESOURCE

public static final int CHANNEL_OPENFAILED_RESOURCE
Define the channel open failed resource (int) constant.

See Also:
Constant Field Values

CHANNEL_CLOSED_RESOURCE

public static final int CHANNEL_CLOSED_RESOURCE
Define the channel closed resource (int) constant.

See Also:
Constant Field Values

CHANNEL_OPEN

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

See Also:
Constant Field Values

CHANNEL_READ_BYTES_RESOURCE

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

See Also:
Constant Field Values

CHANNEL_WRITE_BYTES_RESOURCE

protected static final int CHANNEL_WRITE_BYTES_RESOURCE
Define the write bytes 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.


logLevel

protected int logLevel
Define the log level (int) field.

Constructor Detail

Connection

protected Connection()
Constructs an instance of this class.

See Also:
Connection(ConfigurationService), Connection(Dictionary)

Connection

protected Connection(ConfigurationService configuration)
Constructs an instance of this class from the specified configuration parameter.

Parameters:
configuration - The configuration (ConfigurationService) parameter.
See Also:
Connection(), Connection(Dictionary)

Connection

protected Connection(java.util.Dictionary properties)
Constructs an instance of this class from the specified properties parameter.

Parameters:
properties - The properties (Dictionary) parameter.
See Also:
Connection(), Connection(ConfigurationService)
Method Detail

getDefaultResource

public static java.lang.String getDefaultResource(int resourceId)
Get default resource with the specified resource ID parameter and return the String result.

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)
Attempt recovery from error with the specified error number and error parameters and return the boolean result.

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.

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.

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)
Get error severity with the specified error number and error parameters and return the int result.

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.

getLogLevel

public int getLogLevel()
Gets the log level (int) value.

Overrides:
getLogLevel in class EscObject
Returns:
The log level (int) value.
See Also:
setLogLevel(int)

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)
Get resource with the specified resource ID parameter and return the String result.

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.

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.

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)

setConfigurationInformation

public void setConfigurationInformation(java.util.Dictionary configurationInformation)
Sets the configuration information value.

Specified by:
setConfigurationInformation in interface ConnectionService
Parameters:
configurationInformation - The configuration information (Dictionary) parameter.

setConfigurationService

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

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

setLogLevel

public void setLogLevel(int logLevel)
Sets the log level value.

Parameters:
logLevel - The log level (int) parameter.
See Also:
getLogLevel()

setOpen

public void setOpen(boolean open)
Sets the open value.

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.

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

2009-01-09 1.2.0

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