com.adventnet.agent.tl1
Class CraftInterface

java.lang.Object
  |
  +--com.adventnet.agent.tl1.CraftInterface

class CraftInterface
extends java.lang.Object
implements com.adventnet.tl1.transport.TL1TransportProvider

This class implements TL1TransportProvider. At the begging the craft connection is established by the call to open(). Then a seperate thread will take cae of maintaing it in read() mode. If something is read and the response is there then write() will be called.


Field Summary
(package private)  java.io.DataInputStream in
           
(package private)  java.io.OutputStream out
           
(package private)  java.net.Socket socket
           
 
Constructor Summary
CraftInterface()
           
 
Method Summary
 void close()
          Closes the transport interface after the communication is over.
 void open(java.util.Hashtable params)
          Opens the transport interface over which the data is sent/received.
 void processControlAction(java.util.Properties prop)
          This method may be invoked by getting the transport provider instance from TL1Session(using getTransportProvider() in TL1Session) for the user to perform some control actions.
 int read(com.adventnet.tl1.transport.TL1TransportPacket transportPacket)
          Receives data from the peer over the transport interface.
 void write(com.adventnet.tl1.transport.TL1TransportPacket tPacket)
          Sends data to the peer over the transport interface.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

socket

java.net.Socket socket

out

java.io.OutputStream out

in

java.io.DataInputStream in
Constructor Detail

CraftInterface

public CraftInterface()
               throws java.lang.Exception
Method Detail

open

public void open(java.util.Hashtable params)
          throws java.io.IOException
Description copied from interface: com.adventnet.tl1.transport.TL1TransportProvider
Opens the transport interface over which the data is sent/received.
Specified by:
open in interface com.adventnet.tl1.transport.TL1TransportProvider
Tags copied from interface: com.adventnet.tl1.transport.TL1TransportProvider
Parameters:
params - Hashtable containing keys and value pairs that are used for opening the session.
Throws:
java.io.IOException - Signals that an exception occurred while opening the transport interface.

write

public void write(com.adventnet.tl1.transport.TL1TransportPacket tPacket)
           throws java.io.IOException,
                  java.lang.Exception
Description copied from interface: com.adventnet.tl1.transport.TL1TransportProvider
Sends data to the peer over the transport interface.
Specified by:
write in interface com.adventnet.tl1.transport.TL1TransportProvider
Tags copied from interface: com.adventnet.tl1.transport.TL1TransportProvider
Parameters:
buf - The transport packet that contains the destination information and the TL1Message to be sent.
Throws:
java.io.IOException - Signals that an exception occurred during the Input/Output operation,i.e., while sending the packet.
java.lang.Exception - Signals that an exception occured while sending the packet.

read

public int read(com.adventnet.tl1.transport.TL1TransportPacket transportPacket)
         throws java.io.IOException,
                com.adventnet.tl1.transport.IOTimeoutException,
                com.adventnet.tl1.transport.ConnectException
Description copied from interface: com.adventnet.tl1.transport.TL1TransportProvider
Receives data from the peer over the transport interface.
Specified by:
read in interface com.adventnet.tl1.transport.TL1TransportProvider
Tags copied from interface: com.adventnet.tl1.transport.TL1TransportProvider
Parameters:
buf - Transport packet containing the packet buffer in which the bytes will be read.
Returns:
Number of bytes actually read from the transport interface.
Throws:
java.io.IOException - Signals that an exception was encountered while receiving the packet.
com.adventnet.tl1.transport.IOTimeoutException - Signals that the whole data could not be received because of delay in the arrival of the data.

close

public void close()
           throws java.io.IOException
Description copied from interface: com.adventnet.tl1.transport.TL1TransportProvider
Closes the transport interface after the communication is over.
Specified by:
close in interface com.adventnet.tl1.transport.TL1TransportProvider
Tags copied from interface: com.adventnet.tl1.transport.TL1TransportProvider
Throws:
java.io.IOException - Signals an error during closing.

processControlAction

public void processControlAction(java.util.Properties prop)
                          throws java.lang.Exception
Description copied from interface: com.adventnet.tl1.transport.TL1TransportProvider
This method may be invoked by getting the transport provider instance from TL1Session(using getTransportProvider() in TL1Session) for the user to perform some control actions.
Specified by:
processControlAction in interface com.adventnet.tl1.transport.TL1TransportProvider
Tags copied from interface: com.adventnet.tl1.transport.TL1TransportProvider
Parameters:
actionCmd - Properties for processing some actions.
Throws:
java.lang.Exception - Signals that something unexpected occurred while this method was in progress.
See Also:
TL1Session.getTransportProvider()