|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.lang.Thread
|
+--com.adventnet.tl1.TL1Session
Instantiate TL1Session to send or receive TL1 messages from any TL1 peer. This class has to be instantiated,for any communication to take place between the Manager application and the TL1Agent.
After creating a TL1API instance and invoking start(),instantiate TL1Session by providing the TL1API instance as an argument to the constructor and use the method open(targetHost,targetPort) or open() to create the Socket for communication.
After successful creation of TL1Session , you may use the method send(TL1Message) or syncSend(TL1Message) in order to send messages to the TL1Agent.
TL1Message,
TL1InputMessage,
TL1ResponseMessage,
TL1AckMessage,
TL1AutonomousMessage, Serialized Form| Field Summary | |
(package private) java.lang.String |
ack
|
(package private) TL1API |
api
|
(package private) java.io.RandomAccessFile |
binFile
|
(package private) TL1TextBlock |
block
|
(package private) ConnectionHandler |
connectionHandler
|
(package private) ConnectionListener |
connectionListener
|
(package private) boolean |
connectStatus
|
(package private) boolean |
isAutonomousMsgRcvd
|
(package private) TL1KeepAlive |
keepAlive
|
(package private) java.io.RandomAccessFile |
logfile
|
(package private) boolean |
loopFlag
|
(package private) MessageFormatter |
messageFormatter
|
(package private) java.lang.Thread |
monThread
|
(package private) TL1Parser |
parser
|
(package private) TL1ParserOptions |
parserOptions
|
(package private) com.adventnet.tl1.transport.ProtocolOptions |
protocolOptions
|
(package private) java.lang.String |
recdMsgHolder
contains the received messages |
(package private) java.lang.Object |
sessionClassifier
|
(package private) boolean |
syncSendInProgress
|
(package private) java.lang.String |
textBlock
|
(package private) java.util.Vector |
timeouts
|
(package private) com.adventnet.tl1.transport.TL1TransportProvider |
transportProvider
|
(package private) java.lang.Class |
transportProviderClass
|
(package private) java.lang.String |
transportProviderClassName
|
(package private) java.lang.String |
transportProviderFileName
|
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY,
MIN_PRIORITY,
NORM_PRIORITY,
values |
| Constructor Summary | |
(package private) |
TL1Session()
Default Constructor. |
|
TL1Session(TL1API api)
Creates a new TL1Session object by taking the TL1API instance. |
|
TL1Session(TL1API api,
java.net.Socket sock)
Creates a new TL1Session object by taking the TL1API instance and the reference to the Socket. |
|
TL1Session(TL1API api,
TL1Parser parser)
Creates a new TL1Session object by taking the TL1API instance and TL1Parser instance. |
|
TL1Session(TL1API api,
TL1Parser parser,
java.net.Socket sock)
Creates a new TL1Session object by taking the TL1API instance, TL1Parser and the Socket instance. |
| Method Summary | |
void |
addTL1Client(TL1Client client)
This method is provided to subscribe for callbacks. |
java.lang.String[] |
checkResponses()
Checks for any outstanding responses that are still in the receive queue. |
boolean |
checkTimeout(java.lang.String Ctag)
Returns true if the request-ID given in the form of a C-Tag,is in the list of this session's timed out requests,and removes it from the list. |
void |
close()
Stops the thread and closes the socket. |
void |
enableTransportProvider(boolean flag)
If protocol other than default TCP is to be used, then this method should be used to set this flag to true. |
ConnectionHandler |
getConnectionHandler()
To get a reference to the ConnectionHandler object. |
ConnectionListener |
getConnectionListener()
To get reference to the ConnectionListener object. |
java.lang.String |
getLocalHost()
Get the local TL1 entity name or dotted IP address of TL1 entity. |
int |
getLocalPort()
Get the local TCP port on the peer that this session is used to communicate with. |
TL1Parser |
getParser()
This method returns the reference to the TL1Parser. |
com.adventnet.tl1.transport.ProtocolOptions |
getProtocolOptions()
This method will return the ProtocolOptions associated with this TL1Session. |
int |
getRetries()
Get number of retries before timeout. |
(package private) TL1Session |
getSession()
Returns the current TL1Session instance. |
java.lang.Object |
getSessionClassifier()
This method is used to get the Object value of session classifier set using setSessionClassifier(..) of this class. |
java.lang.String |
getTargetHost()
To get remote TL1 entity name or dotted IP address of TL1 entity. |
int |
getTargetPort()
Get the remote TCP port on the peer that this session is used to communicate with. |
TASClient |
getTASClient()
This method is internally called by our API's. |
int |
getTimeout()
To get the timeout value. |
TL1ParserOptions |
getTL1ParserOptions()
This method returns TL1ParserOptions for the user to set the options related to the parser. |
com.adventnet.tl1.transport.TL1TransportProvider |
getTransportProvider()
This method will return the TL1TransportProvider object associated with this TL1Session. |
java.lang.String |
getTransportProviderClassName()
To get the Transport Provider Class name. |
(package private) void |
initTransportProvider()
|
boolean |
isConnected()
To check the status of the session. |
boolean |
isIgnoreAutoMsg()
To check whether the session is ignoring the Autonomous message or not. |
boolean |
isSetPartialMesgAccumulation()
To get the mode of processing the partial messages. |
boolean |
isSetTransportProvider()
This method returns true if protocol used is other than the default protocol,which is TCP. |
void |
keepAlive(TL1Message tl1message,
int freq)
To maintain the connection with the device, when no message is being sent by the user for a long time. |
(package private) void |
monitorRequests()
Monitors user requests for timeouts |
void |
open()
|
void |
open(java.applet.Applet applet)
Opens TL1 Session to communicate with the TL1 peer through an Applet instance. |
void |
open(java.util.Hashtable params)
Opens TL1Session to communicate with a TL1 peer. |
void |
open(java.lang.String remoteHost,
int remotePort)
Opens TL1Session to communicate with the TL1 peer. |
void |
open(java.lang.String remoteHost,
int remotePort,
java.applet.Applet applet)
Opens TL1Session to communicate with the TL1 peer through an Applet instance. |
(package private) void |
receive()
receiver method which waits for incoming TL1Messages. |
TL1Message |
receive(java.lang.String ctag)
To receive the response received for a particular ctag value. |
void |
removeConnectionHandler()
Unsubscribe for ConnectionHandler. |
void |
removeConnectionListener()
Unsubscribe for ConnectionListener. |
void |
removeMessageFormatter()
This removes your MessageFormatter interface implementation from this session |
boolean |
removeTL1Client(TL1Client client)
This method is used to unsubscribe for callbacks. |
void |
run()
The run() method starts the receiver thread for the session. |
void |
send(byte[] toSend)
This method enables the application to send the TL1 message(raw/unparsed) on the given session, if message parsing is disabled. |
void |
send(TL1Message msg)
Send the TL1Message through the given session after encoding the message. |
void |
setAppletLogFile(java.io.DataOutputStream dos)
To Set the DataOutputStream with the given value. |
void |
setConnectionHandler(ConnectionHandler connHandler)
Subscribe for ConnectionHandler implementation. |
void |
setConnectionListener(ConnectionListener connListener)
To subscribe for ConnectionListener implementation. |
void |
setIgnoreAutoMsg(boolean flag)
To set the flag for ignoring the Autonomous message. |
void |
setLog(boolean log)
To set the debugging mode with the given boolean value. |
void |
setMessageFormatter(MessageFormatter mesgFormatter)
Set the implementation of the interface MessageFormatter. |
void |
setParser(TL1Parser par)
To set the parser instance to be used for parsing the messages received. |
void |
setPartialMesgAccumulation(boolean flag)
This method is used to specify how the message is to be handled, if the message is recieved in parts(that is the whole message is not received at the same time,but rather the message is received only in several pieces before the terminating semi-colon is received). |
void |
setProtocolOptions(com.adventnet.tl1.transport.ProtocolOptions tParam)
This associates the ProtocolOptions object with this TL1Session. |
void |
setRetries(int retries)
Set the number of retries before timeout. |
void |
setSessionClassifier(java.lang.Object obj)
This method is used for storing some application specific details. |
void |
setTimeout(int timeout)
Set the timeout value. |
void |
setTransportProvider(com.adventnet.tl1.transport.TL1TransportProvider provider)
To set the TL1TransportProvider implementation with the given value. |
void |
setTransportProviderClassName(java.lang.String className)
To set the Transport Provider Class name. |
void |
stopKeepAlive()
To stop the keep alive thread. |
TL1Message |
syncSend(TL1Message msg)
This method is used to send the TL1Message synchronously. |
| Methods inherited from class java.lang.Thread |
|
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
TL1API api
ConnectionHandler connectionHandler
ConnectionListener connectionListener
MessageFormatter messageFormatter
java.io.RandomAccessFile logfile
java.io.RandomAccessFile binFile
com.adventnet.tl1.transport.TL1TransportProvider transportProvider
java.lang.String transportProviderFileName
com.adventnet.tl1.transport.ProtocolOptions protocolOptions
java.lang.Class transportProviderClass
java.lang.String transportProviderClassName
boolean loopFlag
java.lang.String recdMsgHolder
TL1Parser parser
TL1KeepAlive keepAlive
boolean connectStatus
TL1ParserOptions parserOptions
java.lang.Object sessionClassifier
java.lang.String ack
java.lang.String textBlock
TL1TextBlock block
java.lang.Thread monThread
boolean isAutonomousMsgRcvd
boolean syncSendInProgress
java.util.Vector timeouts
| Constructor Detail |
TL1Session()
public TL1Session(TL1API api)
api - The instance of TL1APITL1API
public TL1Session(TL1API api,
TL1Parser parser)
api - The instance of TL1APIparser - TL1Parser instance.TL1Parser
public TL1Session(TL1API api,
java.net.Socket sock)
throws java.lang.Exception
api - The instance of TL1APIsock - The instance of Socket.
public TL1Session(TL1API api,
TL1Parser parser,
java.net.Socket sock)
throws java.lang.Exception
api - The instance of TL1APIparser - TL1Parser instance.sock - Instance of Socket.TL1API,
TL1Parser| Method Detail |
public void setAppletLogFile(java.io.DataOutputStream dos)
dos - DataOutputStreampublic void setLog(boolean log)
log - boolean value.public void setPartialMesgAccumulation(boolean flag)
flag - true if partial message is to be accumulated till the end
of the message,else false which means that the partial messages will
be sent to the application immediately,without waiting for the end of
the message.public boolean isSetPartialMesgAccumulation()
True - Partial messages get accumulated till the terminating character, that is,the semicolon is received,otherwise false. By default this flag will be true.
public TL1ParserOptions getTL1ParserOptions()
TL1ParserOptionsTL1Session getSession()
public void addTL1Client(TL1Client client)
client - TL1Client instance.TL1Clientpublic boolean removeTL1Client(TL1Client client)
client - TL1Client instance.TL1Clientpublic void setMessageFormatter(MessageFormatter mesgFormatter)
mesgFormatter - MessageFormatter instance.MessageFormatterpublic void removeMessageFormatter()
MessageFormatterpublic void setConnectionHandler(ConnectionHandler connHandler)
connHandler - ConnectionHandler instance.ConnectionHandlerpublic void removeConnectionHandler()
public ConnectionHandler getConnectionHandler()
ConnectionHandlerpublic void setConnectionListener(ConnectionListener connListener)
connListener - ConnectionListener instance.ConnectionListenerpublic void removeConnectionListener()
ConnectionListenerpublic ConnectionListener getConnectionListener()
ConnectionListenerpublic java.lang.String getTargetHost()
public int getTargetPort()
public java.lang.String getLocalHost()
public int getLocalPort()
public TASClient getTASClient()
void initTransportProvider()
throws java.lang.Exception
public void setProtocolOptions(com.adventnet.tl1.transport.ProtocolOptions tParam)
tParam - ProtocolOptions to be set.ProtocolOptionspublic com.adventnet.tl1.transport.ProtocolOptions getProtocolOptions()
public void enableTransportProvider(boolean flag)
flag - if the flag is false than the default protocol TCP is used.public boolean isSetTransportProvider()
public com.adventnet.tl1.transport.TL1TransportProvider getTransportProvider()
public void setTransportProvider(com.adventnet.tl1.transport.TL1TransportProvider provider)
provider - TL1TransportProvider implementation to set.
public void setTransportProviderClassName(java.lang.String className)
throws java.lang.Exception
className - The provider classnamepublic java.lang.String getTransportProviderClassName()
public void setSessionClassifier(java.lang.Object obj)
obj - Object instance.public java.lang.Object getSessionClassifier()
public void open()
throws java.lang.Exception
public void open(java.util.Hashtable params)
throws java.lang.Exception
params - Hashtable containing keys and value pairs that are
used for opening the session.
public void open(java.applet.Applet applet)
throws java.lang.Exception
applet - Applet instance.
public void open(java.lang.String remoteHost,
int remotePort)
throws java.lang.Exception
remoteHost - remote peer nameremotePort - port number
public void open(java.lang.String remoteHost,
int remotePort,
java.applet.Applet applet)
throws java.lang.Exception
remoteHost - host name as a string instance.remotePort - port number as an integer.applet - Applet instance.
public void keepAlive(TL1Message tl1message,
int freq)
throws java.lang.Exception
tl1message - TL1Message to be send to the device after particular
interval.freq - Time interval in seconds.public void stopKeepAlive()
public void run()
void receive()
throws java.lang.Exception
public void setParser(TL1Parser par)
par - TL1Parser instance.TL1Parserpublic TL1Parser getParser()
public java.lang.String[] checkResponses()
public TL1Message receive(java.lang.String ctag)
throws java.lang.Exception
ctag - CTag value of the response message.TL1Message,
checkResponses()
public void send(TL1Message msg)
throws java.lang.Exception
msg - The instance of TL1Message to be sentTL1Message
public void send(byte[] toSend)
throws TL1ParserException,
java.lang.Exception
session.getTL1ParserOptions().setTL1MessageParsing(false)
toSend - The byte array to be sent.public void setIgnoreAutoMsg(boolean flag)
flag - boolean value.public boolean isIgnoreAutoMsg()
public TL1Message syncSend(TL1Message msg)
throws java.lang.Exception
msg - The TL1MessageTL1Messagepublic boolean isConnected()
public void close()
throws java.lang.Exception
public int getRetries()
public void setRetries(int retries)
retries - The retries value to be used by the session.public int getTimeout()
public void setTimeout(int timeout)
timeout - The timeout value to be used for monitoring the requestTL1InputMessage.setTimeout(int),
TL1InputMessagevoid monitorRequests()
public boolean checkTimeout(java.lang.String Ctag)
Ctag - The string which acts as the request-ID.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||