AdventNet Web NMS 4 API Specification

This class is for internal purpose only and is subjected to change. Developers are recommended not to use this API


com.adventnet.nms.commonfe
Class GenericFESession

java.lang.Object
  |
  +--com.adventnet.nms.commonfe.GenericFESession
All Implemented Interfaces:
DBXMLNodeListener, java.util.Observer, java.lang.Runnable, java.io.Serializable, SocketSessionConnectionFE

public class GenericFESession
extends java.lang.Object
implements SocketSessionConnectionFE, java.lang.Runnable, DBXMLNodeListener, java.util.Observer

This is the Generic Session class. This session will handle all the generic requests from the Client.

See Also:
Serialized Form

Field Summary
protected  DBXmlUtility dbUtility
           
protected  java.lang.String userName
           
 
Constructor Summary
GenericFESession(MainSocketSessionFE mss)
           
 
Method Summary
 void close()
          This method is invoked when the client closes the connection with the server.
 boolean receive(java.lang.String uid, byte[] data)
          This method is invoked when there is a request from this module's client counterpart.
 void run()
           
protected  void sendDataToClient(java.lang.String customid, java.lang.String uniqueid, byte[] barr)
           
 void setProcessingRequest(boolean flag)
          Sets the processing request flag.
 void update(java.util.Observable source, java.lang.Object notificationObj)
           
 void update(java.lang.String userName, int type, java.lang.String id, java.lang.String parent)
          Updates the client with the information received.
 void update(java.lang.String userName, int type, java.lang.String id, java.lang.String parent, java.util.Properties props)
          Updates the client with the information received.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dbUtility

protected DBXmlUtility dbUtility

userName

protected java.lang.String userName
Constructor Detail

GenericFESession

public GenericFESession(MainSocketSessionFE mss)
Method Detail

setProcessingRequest

public void setProcessingRequest(boolean flag)
Sets the processing request flag. This will be used while sending the updates etc., to the client. The updates are sent to the client only when this flag is unset.

receive

public boolean receive(java.lang.String uid,
                       byte[] data)
Description copied from interface: SocketSessionConnectionFE
This method is invoked when there is a request from this module's client counterpart. The uid is a uniqueID the client sends when ever it wants a synchronous response. The server should respond with the same uid to the client so that client can identify the thread from which the synchronous request was made. If the request has to be forwarded to Backend server this method will return false. else it will process the message and return true. The Front-End server modules' processes are supposed to handle all the database view requests or read requests from the client while all the database commit or write requests are forwarded to the Backend. The module sessions based on the above criteria might ideally return true for receiving any read requests from the client and false for any write requests.
Specified by:
receive in interface SocketSessionConnectionFE
Following copied from interface: com.adventnet.nms.startnms.SocketSessionConnectionFE
Parameters:
uid - the unique ID associated with this request.
data - the actual data (request) sent by the client.
Returns:
true if this module session is able to process the received data successfully,false if this session is unable to handle the request and it has to be forwarded to this module's Backend counterpart for processing.

update

public void update(java.lang.String userName,
                   int type,
                   java.lang.String id,
                   java.lang.String parent)
Updates the client with the information received.
Specified by:
update in interface DBXMLNodeListener
Following copied from interface: com.adventnet.nms.db.util.DBXMLNodeListener
Parameters:
userName - the user for whom the node has been updated.
type - the type of operation perfomed on the node.
nodeId - the id of the node.
parent - the parent of the node modified.

update

public void update(java.lang.String userName,
                   int type,
                   java.lang.String id,
                   java.lang.String parent,
                   java.util.Properties props)
Updates the client with the information received.

update

public void update(java.util.Observable source,
                   java.lang.Object notificationObj)
Specified by:
update in interface java.util.Observer

run

public void run()
Specified by:
run in interface java.lang.Runnable

close

public void close()
Description copied from interface: SocketSessionConnectionFE
This method is invoked when the client closes the connection with the server. All resources used by the module for the particular client connection should be cleaned up when this method is invoked.
Specified by:
close in interface SocketSessionConnectionFE

sendDataToClient

protected void sendDataToClient(java.lang.String customid,
                                java.lang.String uniqueid,
                                byte[] barr)

AdventNet Web NMS 4 API Specification