1.0.0

org.eclipse.soda.dk.udp.transport
Class UdpTransport

java.lang.Object
  extended by org.eclipse.soda.dk.core.EscObject
      extended by org.eclipse.soda.dk.transport.Transport
          extended by org.eclipse.soda.dk.transport.ThreadTransport
              extended by org.eclipse.soda.dk.udp.transport.UdpTransport
All Implemented Interfaces:
java.lang.Runnable, ConfigurationService, TransportService, UdpTransportService
Direct Known Subclasses:
MulticastTransport

public class UdpTransport
extends ThreadTransport
implements TransportService, UdpTransportService

User Diagram Protocol (UDP) Transport.

The devicekit properties keys and default values.

The list of exported services:

Version:
1.0.0
See Also:
UdpTransportService, TransportService

Field Summary
static java.lang.String CLASS_NAME
          Defines the class name.
protected static int DEFAULT_LOCALPORT
          Define the default local port (int) constant.
protected  int localPortNum
          Define the local port num (int) field.
protected  java.net.InetAddress remoteHostAddress
          Define the remote host (InetAddress) field.
static int SOCKET_CONNECT_EXCEPTION_RESOURCE
          Define the socket connect exception resource (int) constant.
static int UNKNOWN_HOST_EXCEPTION_RESOURCE
          Define the unknown host exception resource (int) constant.
 
Fields inherited from class org.eclipse.soda.dk.transport.Transport
BAD_CHECKSUM_RESOURCE, CLONE_EXCEPTION_RESOURCE, CLOSE_EXCEPTION_RESOURCE, CONFIGURATION_ERROR_RESOURCE, CONFIGURATION_MISMATCH_RESOURCE, CONNECTION_IN_USE_EXCEPTION_RESOURCE, CR, DEFAULT_NO_ACTIVITY_TIMEOUT, DEFAULT_RETRY_TIME, ERROR_OCCURRED_EXCEPTION_RESOURCE, ERROR_ON_BUS_RESOURCE, errorCount, EXCEPTION_NO_RESPONSE_RESOURCE, inputMessageCount, INTERRUPT_BEFORE_WRITE_RESOURCE, INVALID_MESSAGE_RESOURCE, INVALID_SEQUENCE_RESOURCE, LF, MESSAGE_FILTERED_RESOURCE, MESSAGE_RECEIVED_EXCEPTION_RESOURCE, MESSAGE_RECEIVED_RESOURCE, MESSAGE_SENT_RESOURCE, NACK_RECEIVED_RESOURCE, NO_ACTIVITY_RESOURCE, noActivityTimeout, notificationService, PROCESS_INPUT_EXCEPTION_RESOURCE, QUEUE_TOO_BIG_RESOURCE, RECONNECT_RESOURCE, retryTime, RUN_EXCEPTION_RESOURCE, SEND_EXCEPTION_RESOURCE, SEND_NOT_STARTED_EXCEPTION_RESOURCE, sentMessageCount, SHUTDOWN_EXCEPTION_RESOURCE, STARTUP_EXCEPTION_RESOURCE, STARTUP_MESSAGE_RECEIVED_RESOURCE, STATE_STRINGS, stateChanaged, TRANSPORT_ACTIVE_STATE_RESOURCE, TRANSPORT_ALIVE_STATE_RESOURCE, TRANSPORT_CHANGED_EXCEPTION_RESOURCE, TRANSPORT_CONNECTED_STATE_RESOURCE, TRANSPORT_CREATED_STATE_RESOURCE, TRANSPORT_DEAD_STATE_RESOURCE, TRANSPORT_ERROR_RESOURCE, TRANSPORT_STARTED_STATE_RESOURCE, TRANSPORT_STARTUP_EXCEPTION_RESOURCE, TRANSPORT_STATE_RESOURCE_TABLE, UNABLE_TO_CONNECTION_TO_BUS_RESOURCE, UNKNOWN_ERROR, WRITE_EXCEPTION_RESOURCE, WRITE_INTERRUPT_PENDING_RESOURCE, WRITE_INTERRUPT_RESOURCE
 
Fields inherited from class org.eclipse.soda.dk.core.EscObject
EMPTY_BYTES, EMPTY_STRING, 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.udp.transport.service.UdpTransportService
FACTORY_SERVICE_NAME, LOCALHOST_KEY, LOCALPORT_KEY, MANAGED_SERVICE_NAME, PACKETSIZE_KEY, REMOTEHOST_KEY, REMOTEPORT_KEY, SERVICE_NAME
 
Constructor Summary
UdpTransport()
          Constructs a new instance of the UdpTransport class.
UdpTransport(java.lang.String remoteHostString, int remotePortNum, java.lang.String localHostString, int localPortNum, int packetSize, int readTimeout)
          Constructs an UdpTransport object using the input parameter(s).
 
Method Summary
protected  boolean attemptRecoveryFromError(int errorNumber, java.lang.Throwable error)
          Attempt recovery from error.
 void close()
          Perform the close action method.
 void connect()
          Perform the connect action method.
protected  java.net.DatagramSocket createSocket()
          Perform the createSocket method and return the DatagramSocket result.
protected  void finalize()
          Perform the finalize action method.
protected  int getErrorSeverity(int errorNumber, java.lang.Throwable error)
          Gets the error severity based on the error number and error input parameters.
 java.lang.String getLocalhost()
          Gets the value of localhost custom parameter.
 int getLocalport()
          Gets the value of localport custom parameter.
 int getPacketsize()
          Gets the value of packetsize custom parameter.
protected  int getReadTimeout()
          Gets the int readTimeout property value.
 java.lang.String getRemotehost()
          Gets the value of remotehost custom parameter.
 int getRemoteport()
          Gets the value of remoteport custom parameter.
 java.lang.String getResource(int resourceId)
          Gets the string resource using the supplied resourceId.
protected  java.net.DatagramSocket getSocket()
          Gets the DatagramSocket socket property value.
 void processInput()
          Perform the processInput action method.
 void setLocalhost(java.lang.String localhost)
          Sets the value of localhost custom parameter.
 void setLocalport(int localport)
          Sets the value of localport custom parameter.
 void setPacketsize(int packetsize)
          Sets the value of packetsize custom parameter.
protected  void setReadTimeout(int readTimeout)
          Sets the readTimeout property.
 void setRemotehost(java.lang.String remotehost)
          Sets the value of remotehost custom parameter.
 void setRemoteport(int remoteport)
          Sets the value of remoteport custom parameter.
protected  void setSocket(java.net.DatagramSocket socket)
          Sets the socket property.
 void setup()
          Sets user-defined varables to use in the test.
 void write(byte[] sendBytes)
          Perform the send action method.
 
Methods inherited from class org.eclipse.soda.dk.transport.ThreadTransport
getBufferSize, getShutdownTimeout, getThread, handleNoData, handleNoInput, isRunning, processInput, processInput, run, setRunning, setThread, shutdown, start, stop
 
Methods inherited from class org.eclipse.soda.dk.transport.Transport
addInterest, addTransportListener, broadcastStatus, configure, createController, exit, fireErrorOccurred, fireMessageReceived, fireTransportChanged, getConfigurationInformation, getConfigurationInformation, getConfigurationService, getConnection, getController, getErrorCount, getInformation, getInputMessageCount, getInterestMask, getKey, getLogDetails4, getLogDetails5, getNoActivityTimeout, getNotificationPriority, getNotificationService, getPriority, getProperties, getQualifiedKey, getRetryTime, getSentMessageCount, getState, getString, getStyle, getTransportListener, handleError, hasListeners, isActive, isEcho, isReceivingData, isReceivingGoodData, isReceivingInput, isStarted, log, noActivityProcessing, noActivityProcessingMessage, putConfigurationInformation, read, removeInterest, removeTransportListener, restart, restartProcessing, send, send, setActive, setConfigurationInformation, setController, setEcho, setErrorCount, setInformation, setInputMessageCount, setInterestMask, setNoActivityTimeout, setNotificationService, setReceivingData, setReceivingData, setReceivingGoodData, setReceivingGoodData, setReceivingInput, setReceivingInput, setRetryTime, setSentMessageCount, setState, setStyle, setTransportListener, setupCustom, start, startup, startupMessageReceived, toString, updateErrorCount, updateInputMessageCount, updateSentMessageCount, waitStateChange, waitStateChange, write, writeAndReport, writeAndReport
 
Methods inherited from class org.eclipse.soda.dk.core.EscObject
createDefaultLogService, createException, createException, createInteger, createIntegerTable, createNumber, format, getBoolean, getCurrentTimestamp, getDefaultLogService, getDefaultResource, getFloat, getInt, getLoadLibraryName, getLogDetails, getLogDetails0, getLogDetails1, getLogDetails2, getLogDetails3, getLogDetails6, getLogDetails7, getLogService, getLong, getObject, getOutputName, getSimpleClassName, getStaticBoolean, getStaticFloat, getStaticInt, getStaticLong, getStaticObject, getStaticString, getTraceLevel, getVmLibraryVersion, handleError, handleError, handleStaticError, handleStaticException, isDebug, isTrace, loadService, log, report, report, report, report, report, report, reportError, reportSystemInfo, setDebug, setDefaultLogService, setLogService, setTraceLevel, shouldLog, sleep, startupEscStatic, 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.core.service.ConfigurationService
getBoolean, getFloat, getInt, getLong, getObject
 

Field Detail

CLASS_NAME

public static final java.lang.String CLASS_NAME
Defines the class name.

See Also:
Constant Field Values

DEFAULT_LOCALPORT

protected static final int DEFAULT_LOCALPORT
Define the default local port (int) constant.

See Also:
Constant Field Values

SOCKET_CONNECT_EXCEPTION_RESOURCE

public static final int SOCKET_CONNECT_EXCEPTION_RESOURCE
Define the socket connect exception resource (int) constant.

See Also:
Constant Field Values

UNKNOWN_HOST_EXCEPTION_RESOURCE

public static final int UNKNOWN_HOST_EXCEPTION_RESOURCE
Define the unknown host exception resource (int) constant.

See Also:
Constant Field Values

localPortNum

protected int localPortNum
Define the local port num (int) field.


remoteHostAddress

protected java.net.InetAddress remoteHostAddress
Define the remote host (InetAddress) field.

Constructor Detail

UdpTransport

public UdpTransport()
Constructs a new instance of the UdpTransport class.

See Also:
UdpTransport(String,int,String,int,int,int)

UdpTransport

public UdpTransport(java.lang.String remoteHostString,
                    int remotePortNum,
                    java.lang.String localHostString,
                    int localPortNum,
                    int packetSize,
                    int readTimeout)
             throws java.lang.RuntimeException
Constructs an UdpTransport object using the input parameter(s). java.lang.String int java.lang.String int int The read timeout (int) parameter. Runtime Exception.

Parameters:
remoteHostString - The remote host string (String) parameter.
remotePortNum - The remote port num (int) parameter.
localHostString - The local host string (String) parameter.
localPortNum - The local port num (int) parameter.
packetSize - The packet size (int) parameter.
readTimeout - The read timeout (int) parameter.
Throws:
java.lang.RuntimeException - Runtime Exception.
See Also:
UdpTransport()
Method Detail

attemptRecoveryFromError

protected boolean attemptRecoveryFromError(int errorNumber,
                                           java.lang.Throwable error)
Description copied from class: Transport
Attempt recovery from error.

Overrides:
attemptRecoveryFromError in class Transport
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()
Perform the close action method.

Overrides:
close in class Transport

connect

public void connect()
             throws java.lang.Exception
Perform the connect action method.

Overrides:
connect in class Transport
Throws:
java.lang.Exception

createSocket

protected java.net.DatagramSocket createSocket()
                                        throws java.io.IOException
Perform the createSocket method and return the DatagramSocket result. href="java.io.IOException.html">IOException Thrown if the IOException exception condition occurs.

Returns:
Results of the create socket (DatagramSocket) value.
Throws:
java.io.IOException
See Also:
getSocket(), setSocket(DatagramSocket)

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 Transport
Throws:
java.lang.Throwable
See Also:
Object.finalize()

getErrorSeverity

protected int getErrorSeverity(int errorNumber,
                               java.lang.Throwable error)
Description copied from class: Transport
Gets the error severity based on the error number and error input parameters.

Overrides:
getErrorSeverity in class Transport
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.

getLocalhost

public java.lang.String getLocalhost()
Gets the value of localhost custom parameter.

Returns:
Results of the get localhost (String) value.
See Also:
setLocalhost(String)

getLocalport

public int getLocalport()
Gets the value of localport custom parameter.

Returns:
Results of the get localport (int) value.
See Also:
setLocalport(int)

getPacketsize

public int getPacketsize()
Gets the value of packetsize custom parameter.

Returns:
Results of the get packetsize (int) value.
See Also:
setPacketsize(int)

getReadTimeout

protected int getReadTimeout()
Gets the int readTimeout property value.

Returns:
Results of the get read timeout (int) value.
See Also:
setReadTimeout(int)

getRemotehost

public java.lang.String getRemotehost()
Gets the value of remotehost custom parameter.

Returns:
Results of the get remotehost (String) value.
See Also:
setRemotehost(String)

getRemoteport

public int getRemoteport()
Gets the value of remoteport custom parameter.

Returns:
Results of the get remoteport (int) value.
See Also:
setRemoteport(int)

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 Transport
Parameters:
resourceId - The resource id (int) parameter.
Returns:
Results of the get resource (String) value.
See Also:
EscObject.getDefaultResource(int)

getSocket

protected java.net.DatagramSocket getSocket()
Gets the DatagramSocket socket property value.

Returns:
Results of the get socket (DatagramSocket) value.
See Also:
createSocket(), setSocket(DatagramSocket)

processInput

public void processInput()
                  throws java.lang.Exception
Perform the processInput action method.

Overrides:
processInput in class ThreadTransport
Throws:
java.lang.Exception
See Also:
ThreadTransport.handleNoInput(), ThreadTransport.processInput(byte[],int), ThreadTransport.processInput(int)

setLocalhost

public void setLocalhost(java.lang.String localhost)
Sets the value of localhost custom parameter. The localhost (String) parameter.

Parameters:
localhost - The localhost (String) parameter.
See Also:
getLocalhost()

setLocalport

public void setLocalport(int localport)
Sets the value of localport custom parameter. The localport (int) parameter.

Parameters:
localport - The localport (int) parameter.
See Also:
getLocalport()

setPacketsize

public void setPacketsize(int packetsize)
Sets the value of packetsize custom parameter. The packetsize (int) parameter.

Parameters:
packetsize - The packetsize (int) parameter.
See Also:
getPacketsize()

setReadTimeout

protected void setReadTimeout(int readTimeout)
Sets the readTimeout property. The new property value (int).

Parameters:
readTimeout - The read timeout (int) parameter.
See Also:
getReadTimeout()

setRemotehost

public void setRemotehost(java.lang.String remotehost)
Sets the value of remotehost custom parameter. The remotehost (String) parameter.

Parameters:
remotehost - The remotehost (String) parameter.
See Also:
getRemotehost()

setRemoteport

public void setRemoteport(int remoteport)
Sets the value of remoteport custom parameter. The remoteport (int) parameter.

Parameters:
remoteport - The remoteport (int) parameter.
See Also:
getRemoteport()

setSocket

protected void setSocket(java.net.DatagramSocket socket)
Sets the socket property. The new property value (java.net.DatagramSocket).

Parameters:
socket - The socket (DatagramSocket) parameter.
See Also:
createSocket(), getSocket()

setup

public void setup()
Sets user-defined varables to use in the test.

User defined properties and default values.

udptransport.remotehost
udptransport.remoteport
udptransport.localhost
udptransport.localport
udptransport.packetsize
retrytime DEFAULT_RETRY_TIME
noactivitytimeout DEFAULT_NO_ACTIVITY_TIMEOUT
udptransport.remotehost= udptransport.remoteport= udptransport.localhost= udptransport.localport= udptransport.packetsize=

Overrides:
setup in class Transport
See Also:
Transport.setup()

write

public void write(byte[] sendBytes)
           throws java.lang.Exception
Perform the send action method. The send bytes (byte[]) parameter.

Specified by:
write in interface TransportService
Overrides:
write in class Transport
Parameters:
sendBytes - The send bytes (byte[]) parameter.
Throws:
java.lang.Exception
See Also:
Transport.write(MessageService)

1.0.0

Copyright (c) 1999, 2007 IBM