jSyncManager

org.jSyncManager.Transport
Class DebugTransport

java.lang.Object
  |
  +--org.jSyncManager.API.Transport.SLPTransportInterface
        |
        +--org.jSyncManager.Transport.DebugTransport
All Implemented Interfaces:
java.io.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.

Version:
$Revision: 1.7 $
Author:
Brad BARCLAY <bbarclay@jsyncmanager.org>
Last modified by: $Author: dingodave $ on $Date: 2003/06/18 05:32:16 $.
See Also:
Serialized Form

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  javax.swing.JPanel constructConfigPanel()
          Constructs this transports configuration panel.
 void flush()
          Flushes the input buffer of any remaining data.
 java.lang.String getResourceBundleName()
          Returns the fully-qualified classname for the resources package to use for this transport.
 java.lang.String getTransportDescription()
          Returns the description for this Transport Interface.
 java.lang.String getTransportExceptionText(TransportException ex)
          Retrieves error information for a given TransportInitException.
 java.lang.String getTransportName()
          Returns the name of this Transport Interface.
 void initialize()
          Initialize the port.
 void initialize(java.util.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(byte[] data)
          Write an array of bytes to the underlying data stream.
 
Methods inherited from class org.jSyncManager.API.Transport.SLPTransportInterface
getConfigPanel, getResourceBundle, isConnected, loadResourceBundle, setConnected
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

realTransport

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

count

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

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 Detail

close

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

flush

public void flush()
           throws TransportException
Flushes the input buffer of any remaining data.
Overrides:
flush in class SLPTransportInterface
Throws:
thrown - when a problem occurs with flushing the stream.

getTransportName

public java.lang.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 class SLPTransportInterface
Returns:
the name of this transport interface.

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 class SLPTransportInterface
Throws:
TransportException - any exception the underlying code may throw.

readByte

public byte readByte()
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 class SLPTransportInterface
Returns:
the byte that was read from the underlying transport.

writeBytes

public void writeBytes(byte[] data)
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 class SLPTransportInterface
Parameters:
data - the bytes to be written to the underlying stream.

constructConfigPanel

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

initialize

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

initialize

public void initialize(java.util.Properties properties,
                       int id)
                throws TransportException
Initialize the port.
Overrides:
initialize in class 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.

getTransportExceptionText

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

getResourceBundleName

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

getTransportDescription

public java.lang.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 class SLPTransportInterface
Returns:
the description for this transport interface.

jSyncManager

Copyright (c) 1999 - 2003 Brad BARCLAY and others. All Rights Reserved.