2008-07-29 1.1.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.1.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, history, inputMessageCount, INTERRUPT_BEFORE_WRITE_RESOURCE, INVALID_MESSAGE_RESOURCE, INVALID_SEQUENCE_RESOURCE, LF, logLevel, MESSAGE_FILTERED_RESOURCE, MESSAGE_RECEIVED_EXCEPTION_RESOURCE, MESSAGE_RECEIVED_RESOURCE, MESSAGE_SENT_RESOURCE, NACK_RECEIVED_RESOURCE, NO_ACTIVITY_RESOURCE, NO_ACTIVITY_STATUS_ERROR, NO_ACTIVITY_STATUS_MESSAGE_SENT, NO_ACTIVITY_STATUS_UNKNOWN, noActivityTimeout, notificationService, prefixMetrics, prefixStatus, 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, stateChangeCount, TRANSMIT_RETRIES_DEFAULT, 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, 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
 
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)
          Return the string resource.
protected  java.net.DatagramSocket getSocket()
          Gets the DatagramSocket socket property value.
 void processInput()
          Perform the processInput action method.
 void setLocalhost(java.lang.String localhost)
           
 void setLocalport(int localport)
           
 void setPacketsize(int packetsize)
           
protected  void setReadTimeout(int readTimeout)
          Sets the readTimeout property.
 void setRemotehost(java.lang.String remotehost)
           
 void setRemoteport(int remoteport)
           
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)
          Write (send) the specified bytes.
 
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
addHistory, addInterest, addTransportListener, broadcastMetrics, broadcastStatus, configure, createController, exit, fireErrorOccurred, fireMessageReceived, fireTransportChanged, getConfigurationInformation, getConfigurationInformation, getConfigurationService, getConnection, getController, getErrorCount, getHistory, getInformation, getInputMessageCount, getInterestMask, getKey, getLogDetails4, getLogDetails5, getLogLevel, getNoActivityTimeout, getNotificationPriority, getNotificationService, getPrefix, getPriority, getProperties, getQualifiedKey, getRetryTime, getSentMessageCount, getState, getStateChangeCount, getString, getStyle, getTransmitRetries, getTransportListener, handleError, hasListeners, isActive, isEcho, isReceivingData, isReceivingGoodData, isReceivingInput, isStarted, log, noActivityProcessing, noActivityProcessingMessage, prependPrefix, prependPrefix, putConfigurationInformation, read, removeInterest, removeTransportListener, restart, restartProcessing, send, send, setActive, setConfigurationInformation, setController, setEcho, setErrorCount, setHistory, setInformation, setInputMessageCount, setInterestMask, setLogLevel, setNoActivityTimeout, setNotificationService, setReceivingData, setReceivingData, setReceivingGoodData, setReceivingGoodData, setReceivingInput, setReceivingInput, setRetryTime, setSentMessageCount, setState, setStateChangeCount, setStyle, setTransmitRetries, 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, createLong, createLongTable, createNumber, format, getBoolean, getCurrentTimestamp, getDefaultLogService, getDefaultResource, getFloat, getId, getIdName, getInt, getLoadLibraryName, getLogDetails, getLogDetails0, getLogDetails1, getLogDetails2, getLogDetails3, getLogDetails6, getLogDetails7, getLogService, getLong, getObject, getOutputName, getReadOnlyEmptyCollection, getReadOnlyEmptyList, getReadOnlyEmptyMap, getSimpleClassName, getStaticBoolean, getStaticFloat, getStaticInt, getStaticLong, getStaticObject, getStaticString, getTraceLevel, getVmLibraryVersion, handleError, handleError, handleError, handleErrorInternal, handleStaticError, handleStaticException, isDebug, isLogging, isTrace, loadService, log, 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.

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 - 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 - 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 - 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:
LogService

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)
Description copied from class: EscObject
Return the string resource.

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 - Exception.
See Also:
ThreadTransport.handleNoInput(), ThreadTransport.processInput(byte[],int), ThreadTransport.processInput(int)

setLocalhost

public void setLocalhost(java.lang.String localhost)
Parameters:
localhost - The localhost (String) parameter.
See Also:
getLocalhost()

setLocalport

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

setPacketsize

public void setPacketsize(int packetsize)
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)
Parameters:
remotehost - The remotehost (String) parameter.
See Also:
getRemotehost()

setRemoteport

public void setRemoteport(int remoteport)
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
Description copied from class: Transport
Write (send) the specified bytes. Normally, specific implementation of a transport service should not override this method. byte[]

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

2008-07-29 1.1.0

Copyright (c) 1999, 2008 IBM and others. See license in Legal section. OSGi Framework Version 3.4.0.v20080605-1900