1.0.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.0.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 static int WRITE_BYTES_RESOURCE
          Define the write bytes resource (int) constant.
 
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, 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, 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)
          Get default resource with the specified resource id parameter and return the String result.
protected  int getErrorSeverity(int errorNumber, java.lang.Throwable error)
          Return the error severity of the specified error number.
 java.lang.String getResource(int resourceId)
          Gets the string resource using the supplied resourceId.
 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)
          Sets the open value.
 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, getLogDetails4, getLogDetails5, getLogDetails6, getLogDetails7, getLogService, getLong, getObject, getOutputName, getSimpleClassName, getStaticBoolean, getStaticFloat, getStaticInt, getStaticLong, getStaticObject, getStaticString, getString, getTraceLevel, getVmLibraryVersion, handleError, handleError, handleError, handleStaticError, handleStaticException, isDebug, isTrace, loadService, log, log, report, report, report, report, report, report, reportError, reportSystemInfo, setDebug, setDefaultLogService, setLogService, setTraceLevel, shouldLog, sleep, startupEscStatic, toString, toStringConfigurationKeys, toStringInfo
 
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.

Constructor Detail

Connection

public Connection()
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. The resource id (int) parameter.

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.
See Also:
The error number (int) parameter. The error (Throwable) parameter.

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
See Also:
ConnectionService.close()

exit

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

Specified by:
exit in interface ConnectionService
Throws:
IOException.
java.io.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

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

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:
The error number (int) parameter. The error (Throwable) parameter.

getResource

public java.lang.String getResource(int resourceId)
Gets the string resource using the supplied resourceId. The resource id (int) parameter.

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

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
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
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)
Sets the open value. The open (boolean) parameter.

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

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
See Also:
ConnectionService.write(byte[],int,int)

1.0.0

Copyright (c) 1999, 2007 IBM