"WEBNMS_5 API Docs"

com.adventnet.nms.startclient
Class CustomClient

java.lang.Object
  extended by com.adventnet.nms.startclient.CustomClient
All Implemented Interfaces:
FailOverListener, SocketConnection
Direct Known Subclasses:
ListClient

public abstract class CustomClient
extends java.lang.Object
implements SocketConnection, FailOverListener


Field Summary
 boolean connected
           
protected  java.lang.String CUSTOMID
           
protected  byte[] data
           
protected  boolean DEBUG
           
protected  boolean errorFlag
          This flag will be set 'true' to indicate some error in response for a request sent to the server - Clarence The variable is used very sparsely we can make use of it in all error cases if needed.
protected  int filternumber
           
protected  boolean firstTime
           
protected  java.lang.String hostname
           
protected  int len
          Some necessary parameters used to pick up datagrams
protected  NmsCustomPanel nmscpanel
           
protected  int port
           
protected  java.lang.String remoteHost
           
protected  boolean showErrorDialog
          Variable added for setting whether to show the Error Dialog on ERROR received from the server.
 java.lang.String username
           
 
Constructor Summary
CustomClient(NmsCustomPanel app, java.lang.String customid)
           
CustomClient(NmsCustomPanel app, java.lang.String customid, boolean isRegister)
           
 
Method Summary
 void close()
          Close the Map session
 java.util.Properties convertFromCustomString(java.lang.String objPropString)
           
 java.lang.String convertToCustomizedString(java.util.Properties prop)
           
 void getFilteredObjects(java.util.Properties p, java.lang.String nameoffilter, boolean sync, boolean orderNeeded, java.lang.String sortedColumn, boolean sortedOrder)
           
 boolean getFilteredObjects(java.util.Properties p, java.lang.String nameoffilter, java.lang.String parentleaf, boolean sync, boolean orderNeeded, java.lang.String sortedColumn, boolean sortedOrder)
          The method to send a request for seeing only objects with certain properties
 boolean getFilteredObjects(java.util.Properties p, java.lang.String nameoffilter, java.lang.String parentleaf, boolean sync, boolean orderNeeded, java.lang.String sortedColumn, boolean sortedOrder, boolean isTabView)
           
 java.util.Properties getProps(java.lang.String s)
          Get the properties from a string - Properties.load() has problems
 void getTemporaryCustomViewObjects(java.lang.String viewId, java.lang.String direction, int viewLength, int startIndex, java.lang.String orderByColumn, boolean isAscending, java.util.Properties p)
           
 void getTemporaryFilteredObjects(java.lang.String type, java.lang.String direction, int viewLength, int startIndex, java.lang.String orderByColumn, boolean isAscending, java.util.Properties p)
           
abstract  java.lang.Object getTheObject(NmsTableModelEvent event)
           
abstract  java.util.Vector getTheObjectsVector(java.io.DataInputStream dis)
           
protected  void getTreeList(java.lang.String user)
           
 void getValidSortColumns()
           
 java.lang.String getViewId()
           
 boolean getViewProp(java.lang.String view, boolean sync)
           
 java.util.Properties getViewTableFields(java.lang.String view, boolean sync, java.lang.String user)
          This method sends a request to fetch the table fiedls for the tab custom view.
 void open()
           
 void postFailOverNotification(FailOverEvent failoverevent)
          This method will be invoked by the client frame work after completing process of FailOver Event.
 void preFailOverNotification(FailOverEvent failoverevent)
          This method will be invoked when communication failed occured between the client and FE server.
 java.lang.String readTok(char delim, java.lang.String s)
          Something to pick off tokens from properties string
 void receive(byte[] data)
          This method will be called whenever the session receives data from the server.
abstract  void receiveTheData(int requestnumber, java.io.DataInputStream dis)
           
 boolean renameTreeNode(java.lang.String nodeID, java.lang.String newTreeName)
          this method sends request to the server to change the filtername of the custom view.
protected  boolean send(byte[] bytes)
           
 void sendBytes(int id, byte[] data)
           
 boolean sendOneString(int id, java.lang.String s)
          This method sends a String as data to the server Asynchronously
 boolean sendRemoveFilter(java.lang.String view, boolean sync)
           
 boolean sendRemoveFilter(java.lang.String view, boolean isTabView, boolean sync)
           
 void sendReqForFreezeUpdates(boolean freezeUpdates, java.lang.String viewId)
           
 void sendReqForSoManyMaps(java.lang.String type, java.lang.String direction, int noofmaps, int startIndex, java.lang.String orderByColumn, boolean isAscending)
           
 void sendReqForSoManyMaps(java.lang.String type, java.lang.String direction, int noofmaps, int startIndex, java.lang.String orderByColumn, boolean isAscending, java.util.Properties prop)
           
 void sendReqForSoManyMaps(java.lang.String type, java.lang.String arg, java.lang.String direction, int noofmaps)
           
 boolean sendSaveFilter(java.lang.String view, boolean sync)
           
 boolean sendSaveFilterState(java.lang.String viewName, int viewLength, java.lang.String orderByColumn, boolean isAscending, java.lang.String tableColumns, boolean sync)
           
protected  byte[] syncSend(byte[] bytes)
           
 byte[] syncSendOneString(int id, java.lang.String s)
          This method will send one String Synchronously
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hostname

protected java.lang.String hostname

port

protected int port

nmscpanel

protected NmsCustomPanel nmscpanel

filternumber

protected int filternumber

firstTime

protected boolean firstTime

username

public java.lang.String username

connected

public boolean connected

CUSTOMID

protected java.lang.String CUSTOMID

DEBUG

protected boolean DEBUG

len

protected int len
Some necessary parameters used to pick up datagrams


data

protected byte[] data

remoteHost

protected java.lang.String remoteHost

showErrorDialog

protected boolean showErrorDialog
Variable added for setting whether to show the Error Dialog on ERROR received from the server. - Clarence


errorFlag

protected boolean errorFlag
This flag will be set 'true' to indicate some error in response for a request sent to the server - Clarence The variable is used very sparsely we can make use of it in all error cases if needed.

Constructor Detail

CustomClient

public CustomClient(NmsCustomPanel app,
                    java.lang.String customid)

CustomClient

public CustomClient(NmsCustomPanel app,
                    java.lang.String customid,
                    boolean isRegister)
Method Detail

receiveTheData

public abstract void receiveTheData(int requestnumber,
                                    java.io.DataInputStream dis)

getTheObjectsVector

public abstract java.util.Vector getTheObjectsVector(java.io.DataInputStream dis)

getTheObject

public abstract java.lang.Object getTheObject(NmsTableModelEvent event)

open

public void open()

send

protected boolean send(byte[] bytes)

sendOneString

public boolean sendOneString(int id,
                             java.lang.String s)
This method sends a String as data to the server Asynchronously

Parameters:
id - The request id to be sent to the server.
s - The String that has to be sent to the server
Returns:
Returns true if the request was successfully sent else false

syncSendOneString

public byte[] syncSendOneString(int id,
                                java.lang.String s)
This method will send one String Synchronously

Parameters:
id - The module id which has requested
s - The request String
Returns:
The reply as an array of byte.

sendBytes

public void sendBytes(int id,
                      byte[] data)

getTreeList

protected void getTreeList(java.lang.String user)

sendRemoveFilter

public boolean sendRemoveFilter(java.lang.String view,
                                boolean sync)

sendRemoveFilter

public boolean sendRemoveFilter(java.lang.String view,
                                boolean isTabView,
                                boolean sync)

sendSaveFilter

public boolean sendSaveFilter(java.lang.String view,
                              boolean sync)

sendSaveFilterState

public boolean sendSaveFilterState(java.lang.String viewName,
                                   int viewLength,
                                   java.lang.String orderByColumn,
                                   boolean isAscending,
                                   java.lang.String tableColumns,
                                   boolean sync)

getViewProp

public boolean getViewProp(java.lang.String view,
                           boolean sync)

getViewTableFields

public java.util.Properties getViewTableFields(java.lang.String view,
                                               boolean sync,
                                               java.lang.String user)
This method sends a request to fetch the table fiedls for the tab custom view.

Parameters:
view - which is the customview id for which the columns has to be fetched.
sync - whether this should be synchronous / asynchronous call
user - userName
Returns:
Properties returns a properties object with the displayname as the key and the field name as the value for each field.

getFilteredObjects

public void getFilteredObjects(java.util.Properties p,
                               java.lang.String nameoffilter,
                               boolean sync,
                               boolean orderNeeded,
                               java.lang.String sortedColumn,
                               boolean sortedOrder)

getTemporaryFilteredObjects

public void getTemporaryFilteredObjects(java.lang.String type,
                                        java.lang.String direction,
                                        int viewLength,
                                        int startIndex,
                                        java.lang.String orderByColumn,
                                        boolean isAscending,
                                        java.util.Properties p)

getTemporaryCustomViewObjects

public void getTemporaryCustomViewObjects(java.lang.String viewId,
                                          java.lang.String direction,
                                          int viewLength,
                                          int startIndex,
                                          java.lang.String orderByColumn,
                                          boolean isAscending,
                                          java.util.Properties p)

getFilteredObjects

public boolean getFilteredObjects(java.util.Properties p,
                                  java.lang.String nameoffilter,
                                  java.lang.String parentleaf,
                                  boolean sync,
                                  boolean orderNeeded,
                                  java.lang.String sortedColumn,
                                  boolean sortedOrder)
The method to send a request for seeing only objects with certain properties


getFilteredObjects

public boolean getFilteredObjects(java.util.Properties p,
                                  java.lang.String nameoffilter,
                                  java.lang.String parentleaf,
                                  boolean sync,
                                  boolean orderNeeded,
                                  java.lang.String sortedColumn,
                                  boolean sortedOrder,
                                  boolean isTabView)

getValidSortColumns

public void getValidSortColumns()

sendReqForFreezeUpdates

public void sendReqForFreezeUpdates(boolean freezeUpdates,
                                    java.lang.String viewId)

sendReqForSoManyMaps

public void sendReqForSoManyMaps(java.lang.String type,
                                 java.lang.String direction,
                                 int noofmaps,
                                 int startIndex,
                                 java.lang.String orderByColumn,
                                 boolean isAscending)

sendReqForSoManyMaps

public void sendReqForSoManyMaps(java.lang.String type,
                                 java.lang.String direction,
                                 int noofmaps,
                                 int startIndex,
                                 java.lang.String orderByColumn,
                                 boolean isAscending,
                                 java.util.Properties prop)

sendReqForSoManyMaps

public void sendReqForSoManyMaps(java.lang.String type,
                                 java.lang.String arg,
                                 java.lang.String direction,
                                 int noofmaps)

renameTreeNode

public boolean renameTreeNode(java.lang.String nodeID,
                              java.lang.String newTreeName)
this method sends request to the server to change the filtername of the custom view.

Parameters:
oldNodeID - the string containing the present filtername of the custom view.
newNodeID - the string containing the new filtername.
Returns:
returns true if sucessfull else returns false

receive

public void receive(byte[] data)
Description copied from interface: SocketConnection
This method will be called whenever the session receives data from the server. The data received for this session will be passed as a byte array. The implementing session class can process the data and perform the necessary operations. It is suggested to not to perform any UI updations in the context of the same thread as it might cause some undesirable effects as JFC is not thread safe. Please use the recommended javax.swing.SwingUtilities.invokeLater(Runnable) method for UI updations.

Specified by:
receive in interface SocketConnection
Parameters:
data - The byte array received from the server will be passed.

close

public void close()
Close the Map session

Specified by:
close in interface SocketConnection

getProps

public java.util.Properties getProps(java.lang.String s)
Get the properties from a string - Properties.load() has problems


readTok

public java.lang.String readTok(char delim,
                                java.lang.String s)
Something to pick off tokens from properties string


convertFromCustomString

public java.util.Properties convertFromCustomString(java.lang.String objPropString)

convertToCustomizedString

public java.lang.String convertToCustomizedString(java.util.Properties prop)

preFailOverNotification

public void preFailOverNotification(FailOverEvent failoverevent)
Description copied from interface: FailOverListener
This method will be invoked when communication failed occured between the client and FE server. Each listener has to stop the process for placing the request to FE server.

Specified by:
preFailOverNotification in interface FailOverListener

postFailOverNotification

public void postFailOverNotification(FailOverEvent failoverevent)
Description copied from interface: FailOverListener
This method will be invoked by the client frame work after completing process of FailOver Event. Each listener should complete the hand shaking process with their respective session existing in FE server , after receiving this intimation.

Specified by:
postFailOverNotification in interface FailOverListener

syncSend

protected byte[] syncSend(byte[] bytes)

getViewId

public java.lang.String getViewId()

"WEBNMS_5 API Docs"

Copyright © 2011 ZOHO Corp., All Rights Reserved.