org.jSyncManager.Transport

Class DebugTransport

Implemented Interfaces:
Serializable

public class DebugTransport
extends SLPTransportInterface

A transport wrapper used for debugging purposes. This wrapper can be used by the SLP protocol stack to wrap the data I/O routines to dump the incoming and outgoing byte data to stdout. Note that applications shouldn't try to instantiate this class -- it won't work.

Field Summary

protected int
count
A value to hold the incoming byte count.
protected SLPTransportInterface
realTransport
A handle to the transport class we're wrapping.

Fields inherited from class org.jSyncManager.API.Transport.SLPTransportInterface

configPanel, connected

Constructor Summary

DebugTransport(SLPTransportInterface transport)
Constructs a new Debug Transport.

Method Summary

void
close()
Closes the implemented transport.
protected JPanel
constructConfigPanel()
Constructs this transports configuration panel.
void
flush()
Flushes the input buffer of any remaining data.
String
getResourceBundleName()
Returns the fully-qualified classname for the resources package to use for this transport.
String
getTransportDescription()
Returns the description for this Transport Interface.
String
getTransportExceptionText(TransportException ex)
Retrieves error information for a given TransportInitException.
String
getTransportName()
Returns the name of this Transport Interface.
void
initialize()
Initialize the port.
void
initialize(Properties properties, int id)
Initialize the port.
void
open()
Opens a read/write connection to the implemented transport.
byte
readByte()
Read a single byte from the underlying data stream.
void
writeBytes(data[] )
Write an array of bytes to the underlying data stream.

Methods inherited from class org.jSyncManager.API.Transport.SLPTransportInterface

close, constructConfigPanel, flush, getConfigPanel, getResourceBundle, getResourceBundleName, getTransportDescription, getTransportExceptionText, getTransportName, initialize, initialize, isConnected, loadResourceBundle, open, readByte, setConnected, writeBytes

Field Details

count

protected int count
A value to hold the incoming byte count.

realTransport

protected SLPTransportInterface realTransport
A handle to the transport class we're wrapping.

Constructor Details

DebugTransport

public DebugTransport(SLPTransportInterface transport)
            throws TransportException
Constructs a new Debug Transport.
Throws:
TransportException - thrown by the parent class if there is an initialization error.

Method Details

close

public void close()
            throws TransportException
Closes the implemented transport. This method should close the transport device being implemented.
Overrides:
close in interface SLPTransportInterface
Throws:
TransportException - throws any required exception.

constructConfigPanel

protected JPanel constructConfigPanel()
Constructs this transports configuration panel.
Overrides:
constructConfigPanel in interface SLPTransportInterface
Returns:
a null object -- this class doesn't provide a configuration JPanel.

flush

public void flush()
            throws TransportException
Flushes the input buffer of any remaining data.
Overrides:
flush in interface SLPTransportInterface

getResourceBundleName

public String getResourceBundleName()
Returns the fully-qualified classname for the resources package to use for this transport. class here.
Overrides:
getResourceBundleName in interface SLPTransportInterface
Returns:
a String object containing the fully qualified classname for a ResoureBundle class to use for this transport.

getTransportDescription

public String getTransportDescription()
Returns the description for this Transport Interface. This method will return a string containing the description for this transport interface.
Overrides:
getTransportDescription in interface SLPTransportInterface
Returns:
the description for this transport interface.

getTransportExceptionText

public String getTransportExceptionText(TransportException ex)
Retrieves error information for a given TransportInitException.
Overrides:
getTransportExceptionText in interface SLPTransportInterface
Parameters:
ex - the TransportInitException to be inspected.
Returns:
a String object containing a text explaination for the exception.

getTransportName

public String getTransportName()
Returns the name of this Transport Interface. This method will return a string containing the name of this transport interface. This is used when searching for and selecting from one of many available transport interfaces that are installed on the system.
Overrides:
getTransportName in interface SLPTransportInterface
Returns:
the name of this transport interface.

initialize

public void initialize()
            throws TransportException
Initialize the port.
Overrides:
initialize in interface SLPTransportInterface
Throws:
TransportException - thrown if there isn't sufficient info to setup the transport, or if another exception has occurred.

initialize

public void initialize(Properties properties,
                       int id)
            throws TransportException
Initialize the port.
Overrides:
initialize in interface SLPTransportInterface
Parameters:
properties - a reference to the properties file containing configuration information.
id - the transport ID number to load data for.
Throws:
TransportException - if there is a problem initializing the transport.

open

public void open()
            throws TransportException
Opens a read/write connection to the implemented transport. This method should open the transport device being implemented using default parameters.
Overrides:
open in interface SLPTransportInterface
Throws:
TransportException - any exception the underlying code may throw.

readByte

public byte readByte()
            throws TransportException
Read a single byte from the underlying data stream. This method call should abstract the underlying data connection stream to allow the SLP protocol to read a single byte from the stream.
Overrides:
readByte in interface SLPTransportInterface
Returns:
the byte that was read from the underlying transport.
Throws:
TransportException - thrown if the underlying transport throws this exception.

writeBytes

public void writeBytes(data[] )
            throws TransportException
Write an array of bytes to the underlying data stream. This method call should abstract the underlying data connection stream to allow the SLP protocol to write an array of bytes to the stream.
Overrides:
writeBytes in interface SLPTransportInterface
Parameters:
Throws:
TransportException - thrown if the underlying transport throws this exception.