com.adventnet.html.dynamic
Class DynamicHtml

java.lang.Object
  extended by com.adventnet.html.dynamic.DynamicHtml

public class DynamicHtml
extends java.lang.Object

This class helps to generate run time or dynamic html pages for the instrumented MBeans. This class has certain methods like generateIndexFile(), generateDomainIndexFile() etc. the user should invoke these methods from the DynamicMain Class. This class is actually used to perform the following tasks: 1) Gets the required data from the DataProvider class. 2) Gives the data to the HtmlCreation class.

See Also:
com.adventnet.html.dynamic;

Field Summary
static int CANCEL
          If cancel button is invoked from the client
static int DELETE_ROW
           
static int DO_GET
          If get or refresh button is invoked from the client
static int DO_OPER
          If Get Operation is performed on the Attribute
 int endIndex
           
static int ERR
           
static int NEW_ROW
          If new row button is invoked from the client
static int NEXT_ROW
           
(package private)  boolean nextRowFlag
           
static int OPER_ERROR
           
 java.lang.String page
           
static int POST_ERROR
          If any error in the post
static int PREV_NEXT
           
static int PREV_ROW
           
(package private)  boolean prevRowFlag
           
static int REFRESH
          If refresh button is invoked from the client
static int REGISTER
           
 int stIndex
           
static int UNREGISTER
           
static long viewId
           
 
Constructor Summary
DynamicHtml(ServerOperations serverOp)
          Default constructor to initialize the object parameters.
 
Method Summary
 java.lang.String generateAboutUsFile()
          This method is used for generating the About us page
 java.lang.String generateAdminFile()
          This method generates Admin page.
 java.lang.String generateAttrbArrayHtmlFile(java.lang.String objName, java.lang.String searchAttrbName, boolean addRow, boolean ischkBox, java.lang.String viewName)
          This method generates the html page for an attribute in a MBean which has some operations associated with it.
 java.lang.String generateDeleteView(java.util.Hashtable table)
           
 java.lang.String generateDomainIndexFile(java.lang.String file)
          This method generates the Index pages of the registered domains.
 java.lang.String generateHashtableHtmlFile(java.lang.String objName, java.lang.String searchAttrbName, java.lang.String viewName)
          This method generates the html page for an attribute in a MBean which has some operations associated with it.
 java.lang.String generateIndexFile(java.lang.String file, boolean isauthentication, boolean isAdminUser, java.util.Hashtable viewTable)
          This method is the method that generates the initial page of the dynamic html generation.
 java.lang.String generateLoginPage(boolean chLogin)
          Generates the login page
 java.lang.String generateNewRowHtmlFile(java.lang.String objName, java.lang.String viewName)
          This method generates the html page for adding a new row in a table.
 java.lang.String generateNewView()
          Generates the html page for creating a new view for the users.This page is only for the administrator.
 java.lang.String generateNotificationFile(int stIndex, int endIndex)
          This method generates the Notifications
 java.lang.String generateOperationsHtmlFile(java.lang.String objName, java.lang.String viewName)
          This method generates the html page for Operations associated with an MBean.
 java.lang.String generateOperationsPageForValues(javax.management.ObjectName objName, java.lang.String actionName, java.lang.Object obj, java.lang.String[] signature, java.lang.String viewName)
          This function will take the MBean's ObjectName as input and generate the corresponding runtime html page with necessary information.
 java.lang.String generateOptionsHtmlFile()
           
 java.lang.String generatePageProperties()
           
 java.lang.String generateRegisterFile()
           
 java.lang.String generateScalarHtmlFile(java.lang.String objName, java.lang.String viewName)
          This method generates the html page for an MBean which is registered as a Scalar..
 java.lang.String generateSearchFile()
          This method generates the Search page.
 java.lang.String generateSessionExpirePage()
          Generates the Session Expire page
 java.lang.String generateTableHtmlFile(java.lang.String objName, java.lang.String viewName)
          This method generates the html page for a MBean which is a Table.
 java.lang.String generateUnRegisterFile()
           
 java.lang.String generateUserDefinedTypeHtmlFile(java.lang.String objName, java.lang.String searchAttrbName, java.lang.String viewName, java.lang.String className)
          This method generates the html page for an attribute in a MBean which has some operations associated with it.
 java.lang.String generateUserInfoFile()
          Generates the User Information html page.This page is only for the administrator to view.This page lists the Page Properties and the HtmlAuth MBean registered with the server if authentication is enabled.
 java.lang.String generateVectorHtmlFile(java.lang.String objName, java.lang.String searchAttrbName, java.lang.String viewName)
          This method generates the html page for an attribute in a MBean which has some operations associated with it.
 java.lang.String generateViewForViewName(java.lang.String viewName, java.util.Hashtable table)
           
 java.lang.String generateViewOptions()
          Generates the html page for creating, modifying, deleting views for the users.This page is only for the administrator.
 HtmlPageProp getHtmlPageProp()
           
 boolean isTable(java.lang.String ObjName)
          This method checks whether a particular mbean is a table or a scalar.
 void processAdminRequest(java.util.Hashtable table)
          This method is used to process the Admin request, namely register/unregister an MBean.Depending on the file requested, the correspoing action is taken.If the file requested is register.html, then a MBean is registered, Otherwise if the file requested is unregister.html, then a MBean is unregistered.
 boolean processDeleteView(java.util.Hashtable table, java.util.Hashtable viewTable)
           
 java.lang.String processNewView(java.util.Hashtable table)
           
 HtmlPageProp processPageProperties(java.util.Hashtable table)
           
 boolean processSaveView(java.util.Hashtable table, java.util.Hashtable viewTable)
           
 java.lang.String processSearchRequest(java.util.Hashtable table, boolean isAdminUser)
          This method generates the html page for a search done in the server.
 int setAttributeValue(java.util.Hashtable table)
          It is used to set the attributes value received from the client(browser).
 void setEndIndex(int value)
          Sets the End Index of a row in a table.
 void setHtmlInterface(HtmlInterface htmlIntf)
          Sets the HtmlInterface.
 void setHtmlPageProp(HtmlPageProp htmlPageProp)
          Sets the HtmlPageProp.
 void setNextRowFlag(boolean value)
          Sets the Next row flag for a table.
 void setPrevRowFlag(boolean value)
          Sets the Previous row flag for a table.
 void setStartIndex(int value)
          Sets the Start Index of a row in a table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CANCEL

public static int CANCEL
If cancel button is invoked from the client


DO_GET

public static int DO_GET
If get or refresh button is invoked from the client


NEW_ROW

public static int NEW_ROW
If new row button is invoked from the client


REFRESH

public static int REFRESH
If refresh button is invoked from the client


OPER_ERROR

public static int OPER_ERROR

REGISTER

public static int REGISTER

UNREGISTER

public static int UNREGISTER

ERR

public static int ERR

viewId

public static long viewId

POST_ERROR

public static int POST_ERROR
If any error in the post


DO_OPER

public static int DO_OPER
If Get Operation is performed on the Attribute


page

public java.lang.String page

DELETE_ROW

public static int DELETE_ROW

NEXT_ROW

public static int NEXT_ROW

PREV_ROW

public static int PREV_ROW

PREV_NEXT

public static int PREV_NEXT

nextRowFlag

boolean nextRowFlag

prevRowFlag

boolean prevRowFlag

stIndex

public int stIndex

endIndex

public int endIndex
Constructor Detail

DynamicHtml

public DynamicHtml(ServerOperations serverOp)
Default constructor to initialize the object parameters.

Method Detail

setHtmlInterface

public void setHtmlInterface(HtmlInterface htmlIntf)
Sets the HtmlInterface.

Parameters:
HtmlInterface - htmlIntf

setHtmlPageProp

public void setHtmlPageProp(HtmlPageProp htmlPageProp)
Sets the HtmlPageProp.

Parameters:
HtmlPageProp - htmlPageProp

getHtmlPageProp

public HtmlPageProp getHtmlPageProp()

setStartIndex

public void setStartIndex(int value)
Sets the Start Index of a row in a table.

Parameters:
value - an integer specifying the starting row.

setEndIndex

public void setEndIndex(int value)
Sets the End Index of a row in a table.

Parameters:
value - an integer specifying the ending row.

setNextRowFlag

public void setNextRowFlag(boolean value)
Sets the Next row flag for a table.

Parameters:
value - a boolean true if next row flag needed or false otherwise

setPrevRowFlag

public void setPrevRowFlag(boolean value)
Sets the Previous row flag for a table.

Parameters:
value - a boolean true if previous row flag needed or false otherwise

generateIndexFile

public java.lang.String generateIndexFile(java.lang.String file,
                                          boolean isauthentication,
                                          boolean isAdminUser,
                                          java.util.Hashtable viewTable)
This method is the method that generates the initial page of the dynamic html generation.

Parameters:
file - - a String
Returns:
String consisting of Html Tags.

isTable

public boolean isTable(java.lang.String ObjName)
                throws java.lang.Exception
This method checks whether a particular mbean is a table or a scalar.

Parameters:
ObjName - - the ObjectName in String
Returns:
boolean - true if the mbean is a table, false otherwise.
Throws:
java.lang.Exception

generateSearchFile

public java.lang.String generateSearchFile()
This method generates the Search page.

Returns:
String that consists of the Search page details

generateAboutUsFile

public java.lang.String generateAboutUsFile()
This method is used for generating the About us page

Returns:
String that consists of the About us page details

generateAdminFile

public java.lang.String generateAdminFile()
This method generates Admin page.

Returns:
String that consists of the Admin page details

generateRegisterFile

public java.lang.String generateRegisterFile()

generateUnRegisterFile

public java.lang.String generateUnRegisterFile()

generateNotificationFile

public java.lang.String generateNotificationFile(int stIndex,
                                                 int endIndex)
This method generates the Notifications

Parameters:
stIndex - specifies the Start Index
endIndex - specifies the End Index
Returns:
String that consists of the Notification page details

generateDomainIndexFile

public java.lang.String generateDomainIndexFile(java.lang.String file)
This method generates the Index pages of the registered domains.

Parameters:
file - specifies whether the file is to create the Adaptors index page or domain index page.
Returns:
String that consists of the list of MBeans of a particular Domain.

generateScalarHtmlFile

public java.lang.String generateScalarHtmlFile(java.lang.String objName,
                                               java.lang.String viewName)
This method generates the html page for an MBean which is registered as a Scalar..

Parameters:
ObjName - A String specifying the ObjectName with which the MBean was registered..
Returns:
String that consists of the list of attributes of a particular MBean.

generateOperationsHtmlFile

public java.lang.String generateOperationsHtmlFile(java.lang.String objName,
                                                   java.lang.String viewName)
This method generates the html page for Operations associated with an MBean.

Parameters:
ObjName - A String specifying the ObjectName with which the MBean was registered..
Returns:
String that consists of the list of operations of a particular MBean.

generateUserDefinedTypeHtmlFile

public java.lang.String generateUserDefinedTypeHtmlFile(java.lang.String objName,
                                                        java.lang.String searchAttrbName,
                                                        java.lang.String viewName,
                                                        java.lang.String className)
This method generates the html page for an attribute in a MBean which has some operations associated with it.

Parameters:
ObjName - A String specifying the ObjectName with which the MBean was registered.
Returns:
String that consists of the list of operations of a particular MBean.

generateHashtableHtmlFile

public java.lang.String generateHashtableHtmlFile(java.lang.String objName,
                                                  java.lang.String searchAttrbName,
                                                  java.lang.String viewName)
This method generates the html page for an attribute in a MBean which has some operations associated with it.

Parameters:
ObjName - A String specifying the ObjectName with which the MBean was registered.
Returns:
String that consists of the list of operations of a particular MBean.

generateVectorHtmlFile

public java.lang.String generateVectorHtmlFile(java.lang.String objName,
                                               java.lang.String searchAttrbName,
                                               java.lang.String viewName)
This method generates the html page for an attribute in a MBean which has some operations associated with it.

Parameters:
ObjName - A String specifying the ObjectName with which the MBean was registered.
Returns:
String that consists of the list of operations of a particular MBean.

generateAttrbArrayHtmlFile

public java.lang.String generateAttrbArrayHtmlFile(java.lang.String objName,
                                                   java.lang.String searchAttrbName,
                                                   boolean addRow,
                                                   boolean ischkBox,
                                                   java.lang.String viewName)
This method generates the html page for an attribute in a MBean which has some operations associated with it.

Parameters:
ObjName - A String specifying the ObjectName with which the MBean was registered.
Returns:
String that consists of the list of operations of a particular MBean.

generateTableHtmlFile

public java.lang.String generateTableHtmlFile(java.lang.String objName,
                                              java.lang.String viewName)
This method generates the html page for a MBean which is a Table.

Parameters:
ObjName - A String specifying the ObjectName with which the MBean was registered.
Returns:
String that consists of the list of attrbitues of a particular MBean in a Table format.

generateNewRowHtmlFile

public java.lang.String generateNewRowHtmlFile(java.lang.String objName,
                                               java.lang.String viewName)
This method generates the html page for adding a new row in a table.

Parameters:
ObjName - A String specifying the ObjectName with which the MBean was registered.
Returns:
String that consists of the list of attrbitues of a particular MBean for which a new row is to to be created.

setAttributeValue

public int setAttributeValue(java.util.Hashtable table)
It is used to set the attributes value received from the client(browser).

Parameters:
table - the hash table cotains param and its value.
Returns:
CANCEL - if cancel button is pressed,
NEW_ROW - if new Row button is pressed,
REFRESH - if refresh button is pressed and
DO_GET - if set is success, and to reurn the modified html page. NEXT_ROW - if Next Button is Pressed in the case of Tables. PREV_ROW - if Previous button is pressed in case of Tables.

processAdminRequest

public void processAdminRequest(java.util.Hashtable table)
This method is used to process the Admin request, namely register/unregister an MBean.Depending on the file requested, the correspoing action is taken.If the file requested is register.html, then a MBean is registered, Otherwise if the file requested is unregister.html, then a MBean is unregistered.

Parameters:
table - the Hashtable consists of data provided by the client.

processSearchRequest

public java.lang.String processSearchRequest(java.util.Hashtable table,
                                             boolean isAdminUser)
This method generates the html page for a search done in the server.

Parameters:
table - hashtable consists of the search String from the client and other informations like whether the search request is for a table or for a scalar.
Returns:
String that consists of the list of MBeans that matched the search request.

generateOperationsPageForValues

public java.lang.String generateOperationsPageForValues(javax.management.ObjectName objName,
                                                        java.lang.String actionName,
                                                        java.lang.Object obj,
                                                        java.lang.String[] signature,
                                                        java.lang.String viewName)
This function will take the MBean's ObjectName as input and generate the corresponding runtime html page with necessary information. If the given ObjectName is invalid then empty string will be returned.

Parameters:
objName - the objectName of the registered MBean.
actionName - the operation to be invoked.
obj - the object returned by the operation
signature - the information about the parameters.
Returns:
the resultant html page.

generateLoginPage

public java.lang.String generateLoginPage(boolean chLogin)
Generates the login page

Parameters:
chLogin - if false creates the whole page starting from frames, otherwise creates the main page alone.

generateSessionExpirePage

public java.lang.String generateSessionExpirePage()
Generates the Session Expire page

Parameters:
name - chLogin if false creates the whole page starting from frames, otherwise creates the main page alone.

generateUserInfoFile

public java.lang.String generateUserInfoFile()
Generates the User Information html page.This page is only for the administrator to view.This page lists the Page Properties and the HtmlAuth MBean registered with the server if authentication is enabled.

Returns:
the resultant html page

generateViewOptions

public java.lang.String generateViewOptions()
Generates the html page for creating, modifying, deleting views for the users.This page is only for the administrator.

Returns:
the resultant html page

generateNewView

public java.lang.String generateNewView()
Generates the html page for creating a new view for the users.This page is only for the administrator.

Returns:
the resultant html page

generateDeleteView

public java.lang.String generateDeleteView(java.util.Hashtable table)

processNewView

public java.lang.String processNewView(java.util.Hashtable table)

processSaveView

public boolean processSaveView(java.util.Hashtable table,
                               java.util.Hashtable viewTable)

generateViewForViewName

public java.lang.String generateViewForViewName(java.lang.String viewName,
                                                java.util.Hashtable table)

processDeleteView

public boolean processDeleteView(java.util.Hashtable table,
                                 java.util.Hashtable viewTable)

generatePageProperties

public java.lang.String generatePageProperties()

processPageProperties

public HtmlPageProp processPageProperties(java.util.Hashtable table)

generateOptionsHtmlFile

public java.lang.String generateOptionsHtmlFile()