|
AdventNet Web NMS 4 API Specification | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.adventnet.nms.fe.common.CustomSessionBean
This class contains methods to deal with Custom Views. Custom View
is a filtering mechanism by which Objects can be filtered to view, from
a large collection of data, based on a given criteria.
This abstract class is extended by XXXSessionBean classes for individual
modules like Alert (AlertSessionBean), Event (EventSessionBean),
Topo (TopoSessionBean) and Performance (PerfSessionBean).
Handle for these objects, in same JVM as that of FE Server, can be got
from XXXFE classes (like AlertFE) for corresponding modules.
The following code snippet exhibits how to get the handle of CustomSessionBean
for Alert module.
import com.adventnet.nms.fe.common.CustomSessionBean;
import com.adventnet.nms.fe.alert.AlertSessionBean;
import com.adventnet.nms.fe.alert.AlertFE;
.
.
.
try
{
CustomSessionBean csb = AlertFE.getAlertSession();
System.out.println("Successfully got the handle for CustomSessionBean");
}
catch(ModuleNotInitializedException e)
{
System.out.println("Module AlertFE is not yet initialized");
}
If FE Server is deployed in EJB mode, then these functionalities can be
accessed from CustomSessionRemote.
CustomSessionRemote,
EventSessionBean,
AlertSessionBean,
TopoSessionBean,
PerfSessionBean| Field Summary | |
protected CommonAPI |
apihandle
Handle for ThinAPI of this module. |
protected CustomViewScopeAPI |
cvScopeAPI
|
protected com.adventnet.nms.fe.utils.CustomViewUtility |
cvu
CustomViewUtility object which has all Custom View related business logics. |
protected DBXmlUtility |
dbUtility
DBXmlUtility instance to deal with tree related operations of the custom views. |
protected JdbcAPI |
jdbcapi
JdbcAPI handle to be used to get database related information. |
protected boolean |
latest
This boolean value specifies whether the updates have to be sent when client is in top edge (i.e. |
protected LogAPI |
logapi
LogAPI handle to be used to log messages/error to FE Server's log files. |
protected java.lang.String |
module
Module name of the extending class. |
protected java.lang.String |
tableName
Module name to be stored in PanelTree table. |
| Constructor Summary | |
protected |
CustomSessionBean()
Constructs the session bean. |
| Method Summary | |
boolean |
createCustomView(java.lang.String userName,
java.lang.String viewId,
java.lang.String viewName,
java.lang.String nodeType,
TableColumn[] columns,
java.util.Properties panelProps,
java.util.Properties criteria)
Adds a new custom view for the given user. |
java.lang.String |
createCustomView(java.lang.String userName,
java.lang.String viewName,
java.lang.String nodeType,
TableColumn[] columns,
java.util.Properties panelProps,
java.util.Properties criteria)
Adds a new custom view for the given user and returns a unique ID representing the custom view. |
void |
error(java.lang.String str,
java.lang.Throwable thr)
Logs error messages to FE server's error file. |
java.util.Hashtable |
getAllViewIDsAndProps(java.lang.String userName)
Returns a Hashtable containing custom view ID vs CustomViewProperties for all CustomViews of the user userName belonging to this module. |
protected java.util.Properties |
getCriteriaProps(java.lang.String str)
Parses the given criteria in String form and returns as Properties object. |
ViewData |
getData(ViewCriteria criteria)
Fetches the properties of objects, which match the custom view criteria. |
protected abstract java.util.Properties |
getDefaultPanelProps()
Some of the additional properties of the custom view, represented by PanelProps in createCustomView(String, String, String,
String, TableColumn[], Properties, Properties) method, are
mandatory for Web NMS clients. |
java.lang.Object |
getInstance()
Returns the SessionBean instance. |
boolean |
getLatest()
Specifies whether views for this module always show the latest objects. |
protected abstract java.lang.String |
getModuleName()
Gets module of the extending class. |
java.util.Vector |
getObjectNamesWithProps(java.lang.String userName,
java.util.Properties p)
Returns a Vector of all the Persistent Object IDs matching the properties given in the argument. |
java.util.Properties |
getPropertiesOfObject(java.lang.String userName,
java.lang.String objectName)
Returns the Properties of the Persistent Object identified by the argument. |
protected TableColumn[] |
getTableColumnsArr(java.lang.String str)
Parses the given list of columns in String form and returns as TableColumn array. |
int |
getTotalCount(java.lang.String userName,
java.lang.String viewId)
Returns total number of Objects matching the custom view's criteria. |
int |
getTotalCount(java.lang.String userName,
java.lang.String viewId,
java.util.Properties criteria,
boolean performOR,
boolean appendCriteria)
Returns total number of Objects matching the given criteria. |
int |
getTotalCount(ViewCriteria viewCriteria)
Returns total number of Objects matching the given ViewCriteria. |
CustomViewProperties |
getViewProperties(java.lang.String userName,
java.lang.String viewId)
Gets all properties of the custom view for the user userName. |
void |
log(java.lang.String str)
Logs messages to FE server's out file with the VERBOSE logging level. |
boolean |
modifyCustomView(java.lang.String userName,
java.lang.String viewId,
TableColumn[] columns,
java.util.Properties panelProps,
java.util.Properties criteria)
Modifies the columns, criteria and panel properties of the custom view. |
boolean |
removeCustomView(java.lang.String userName,
java.lang.String viewId)
Removes an existing custom view referred by viewId of
the user userName. |
boolean |
renameCustomView(java.lang.String userName,
java.lang.String viewId,
java.lang.String newName)
Changes the display name (view name) of the custom view. |
boolean |
saveViewState(java.lang.String userName,
java.lang.String viewId,
int viewlength,
java.lang.String orderByColumn,
boolean isAscendingOrder,
TableColumn[] tableCol)
This method saves some of the important properties of custom view, like viewLength, orderByColumn, sort by Ascending or not and the order, width and display name of TableColumns, to the corresponding tables in the Database. |
void |
setAPI(CommonAPI obj)
SessionNarrowerInterfaceImpl method for setting the api to be used for the bean. |
void |
setCustomViewScopeAPI(CustomViewScopeAPI cvsAPI)
Sets CustomViewScopeAPI for getting the scope criteria for a user's customview. |
void |
setJdbcAPI(JdbcAPI api)
Sets JdbcAPI to be used by this class for getting all database related information. |
void |
setLogAPI(LogAPI api)
Sets LogAPI to be used by this class for all logging related services. |
void |
setSeverityAPI(com.adventnet.nms.fe.common.SeverityFEAPI sevAPI)
Sets SeverityFEAPI to be used by this class for getting Severity related information. |
protected void |
validate(java.lang.String varName,
java.lang.Object val,
boolean checkForEmpty)
Checks for the validity of the given object for the variable specified. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.adventnet.nms.fe.common.SessionNarrowerInterface |
setConnection |
| Field Detail |
protected java.lang.String module
protected CommonAPI apihandle
protected com.adventnet.nms.fe.utils.CustomViewUtility cvu
protected LogAPI logapi
protected JdbcAPI jdbcapi
protected DBXmlUtility dbUtility
protected java.lang.String tableName
protected CustomViewScopeAPI cvScopeAPI
protected boolean latest
| Constructor Detail |
protected CustomSessionBean()
| Method Detail |
public void setLogAPI(LogAPI api)
setLogAPI in interface SessionNarrowerInterfaceapi - a LogAPI instance.public void setAPI(CommonAPI obj)
setAPI in interface SessionNarrowerInterfacecom.adventnet.nms.fe.common.SessionNarrowerInterfacecomapi - a CommonAPI instance to be used by this Session Bean.public void setJdbcAPI(JdbcAPI api)
setJdbcAPI in interface SessionNarrowerInterfaceapi - a JdbcAPI instance.public void setSeverityAPI(com.adventnet.nms.fe.common.SeverityFEAPI sevAPI)
setSeverityAPI in interface SessionNarrowerInterfaceapi - a SeverityFEAPI instance.public void setCustomViewScopeAPI(CustomViewScopeAPI cvsAPI)
cvsAPI - a CustomViewScopeAPI instancepublic void log(java.lang.String str)
str - message to be logged into the file.
public void error(java.lang.String str,
java.lang.Throwable thr)
str - error message to be logged into the file.thr - the Throwable object that caused this error.
protected void validate(java.lang.String varName,
java.lang.Object val,
boolean checkForEmpty)
throws com.adventnet.nms.fe.common.CustomViewException
varName - Name of the variable to whom the validity has to be
checkedval - Value passedcheckForEmpty - true specifies that Exception should be thrown
if the object is emptycom.adventnet.nms.fe.common.CustomViewException - if the value is not valid for the
variable specified.
public java.lang.String createCustomView(java.lang.String userName,
java.lang.String viewName,
java.lang.String nodeType,
TableColumn[] columns,
java.util.Properties panelProps,
java.util.Properties criteria)
throws java.rmi.RemoteException,
com.adventnet.nms.fe.common.CustomViewException
viewId.
So client should retain this value.
Out of the given arguments, userName,
viewName and panelProps are mandatory and
should not be null.
userName - The name of the user, whom this custom view will be
associated with.viewName - The CustomView's display name.nodeType - The type of the node to be represented in the tree
like DEVICE-DATA, DEVICE-GROUP, DEVICE, LEVEL-1, LEVEL-2, etc.columns - List of columns that will be displayed in the client
while showing the properties of the objects. The method
getData(ViewCriteria) when invoked will return the
values for above listed columns. Some basic properties of the
objects will also be returned in addition to these selected columns.panelProps - This should contain a property with
the key as parent and value as the Node ID of the parent node
in the tree. Additional properties of the custom view can also be
mentioned here.criteria - Specifies the criteria. Objects matching these
criteria will only be returned while getting data. For more details about criteria,
refer to createCustomView(String, String, String, String, TableColumn[], Properties, Properties)java.rmi.RemoteException - if a RMI error occurscom.adventnet.nms.fe.common.CustomViewException - in any of the following cases,
(i) if Database related error occurs
(ii) any of userName, viewName,
or panelProps is null or invalid.createCustomView(String, String, String, String, TableColumn[], Properties, Properties),
getData(ViewCriteria)
public boolean createCustomView(java.lang.String userName,
java.lang.String viewId,
java.lang.String viewName,
java.lang.String nodeType,
TableColumn[] columns,
java.util.Properties panelProps,
java.util.Properties criteria)
throws java.rmi.RemoteException,
com.adventnet.nms.fe.common.CustomViewException
viewId.
So client should retain this value.
Out of the given arguments, userName, viewId,
viewName and panelProps are mandatory and
should not be null.
userName - The name of the user, whom this custom view will be
associated with.viewId - This ID will be used to uniquely identify the custom
view. This should be unique for a particular user. All further
queries regarding this custom view will be referenced with this ID.viewName - The CustomView's display name.nodeType - The type of the node to be represented in the tree
like DEVICE-GROUP, DEVICE, LEVEL-1, LEVEL-2, etc.columns - List of columns that will be displayed in the client
while showing the properties of the objects. The method
getData(ViewCriteria) when invoked will return the
values for above listed columns. Some basic properties of the
objects will also be returned in addition to these selected columns.panelProps - This should contain a property with
the key as parent and value as the Node ID of the parent node
in the tree. Additional properties of the custom view can also be
mentioned here.criteria - Specifies the criteria. Objects matching these
criteria will only be returned while getting data.
Special characters supported in criteria:
Character Description
* Wild card character, which substitutes for zero or more characters.
For example, M* will match Major and Minor.
! Not operator, which matches all the objects that doesn't satisfy the given critierian.
For example, !Major will match everything other than Major.
, Separates two values either of which has to match with the object's value.
Major,Minor will match objects with either Major or Minor values.
\, Escape sequence for comma.
Note: Wild card character, '?' is not supported.
true if successfully created, false otherwisejava.rmi.RemoteException - if a RMI error occurscom.adventnet.nms.fe.common.CustomViewException - in any of the following cases,
(i) if Database related error occurs
(ii) any of userName, viewId, viewName,
or panelProps is null or invalid.createCustomView(String, String, String, TableColumn[], Properties, Properties),
getData(ViewCriteria)
public boolean removeCustomView(java.lang.String userName,
java.lang.String viewId)
throws java.rmi.RemoteException,
com.adventnet.nms.fe.common.CustomViewException
viewId of
the user userName.userName - The name of the user to whom this custom view was assignedviewId - unique ID of the custom view which has to be removedjava.rmi.RemoteException - if a RMI related error occurscom.adventnet.nms.fe.common.CustomViewException - in any of the following cases,
(i) if Database related error occurs
(ii) if Custom view specified is not found
(iii) any of userName and viewId
is null or invalid
public boolean renameCustomView(java.lang.String userName,
java.lang.String viewId,
java.lang.String newName)
throws java.rmi.RemoteException,
com.adventnet.nms.fe.common.CustomViewException
userName - : The name of the user for whom this custom view was assignedviewId - : Custom view IDnewName - : new display name for this custom viewjava.rmi.RemoteException - if a RMI related error occurscom.adventnet.nms.fe.common.CustomViewException - if Database or Custom view related error occurs
or any of userName, viewId, newName is null or invalid
public boolean modifyCustomView(java.lang.String userName,
java.lang.String viewId,
TableColumn[] columns,
java.util.Properties panelProps,
java.util.Properties criteria)
throws java.rmi.RemoteException,
com.adventnet.nms.fe.common.CustomViewException
Out of the given arguments, userName,
viewId, and panelProps are mandatory and
should not be null.
userName - The name of the user, whom this custom view was
associated with.viewId - The unique ID which is used to refer a custom view.columns - List of columns that will be displayed in the client
while showing the properties of the objects. The method
getData(ViewCriteria) when invoked will return the
values for above listed columns. Some basic properties of the
objects will also be returned in addition to these selected columns.criteria - Specifies the criteria. Objects matching these criteria will only be
returned while getting data. For more details about criteria,
refer to createCustomView(String, String, String, String, TableColumn[], Properties, Properties)panelProps - Additional properties of this custom view that
needs to be stored for later use. If you want only the
properties specified in panelProps to be present and
all the old values to be deleted, then add an entry to
panelProps with the key
<UPDATE_ONLY> with a value false.
By default, only those key-value pairs specified in this Properties
object will be modified and other values will not be altered
i.e. value for <UPDATE_ONLY> is
true.
boolean value specifying whether the operation is successful or not.java.rmi.RemoteException - if a RMI related error occurscom.adventnet.nms.fe.common.CustomViewException - in any of the following cases,
(i) if Database related error occurs
(ii) if Custom view specified is not found
(iii) any of userName, viewId or
panelProps is null or invalidcreateCustomView(String, String, String, String, TableColumn[], Properties, Properties),
createCustomView(String, String, String, TableColumn[], Properties, Properties),
getData(ViewCriteria)
public ViewData getData(ViewCriteria criteria)
throws java.rmi.RemoteException,
com.adventnet.nms.fe.common.CustomViewException
ViewData object which is
containing the retrieved data.criteria - ViewCriteria object containing the information about the
custom view for which data has to be returned.
If the criteria specified in ViewCriteria is not null, then
that Properties object will be used as the criteria. Else criteria assigned for
the custom view during createCustomView will be taken.ViewData object containing the required data of the custom view.java.rmi.RemoteException - if a RMI related error occurscom.adventnet.nms.fe.common.CustomViewException - in any of the following cases,
(i) if Database related error occurs
(ii) if Custom view specified is not found
(iii) argument criteria is null
public int getTotalCount(java.lang.String userName,
java.lang.String viewId)
throws java.rmi.RemoteException,
com.adventnet.nms.fe.common.CustomViewException
TotalLength in ViewData
returned in getData method with criteria set to null
in ViewCriteria.userName - name of the user whom this custom view belongs toviewId - custom view idcom.adventnet.nms.fe.common.CustomViewException - if an error occurs
or any of userName, viewId is null or emptygetData(ViewCriteria)
public int getTotalCount(java.lang.String userName,
java.lang.String viewId,
java.util.Properties criteria,
boolean performOR,
boolean appendCriteria)
throws java.rmi.RemoteException,
com.adventnet.nms.fe.common.CustomViewException
TotalLength in ViewData
returned in getData method.
If appendCriteria is
true, then criteria will be added with the criteria for the
custom view viewId. If false, then only
criteria will be considered.
If performOR is true,
then this returns count of objects matching any of the properties given
in criteria. If false, then count of objects
matching all of the criteria mentioned in criteria will be
returned.
Note: This boolean performOR is applicable only to
criteria and has nothing to do with the criteria for the
custom view viewId.
userName - name of the user whom this custom view belongs toviewId - custom view idcriteria - matching criteria.performOR - If this is true, will return number of objects matching
any of the Properties in criteria, when set to false will
return number of objects matching all the matching Properties passed.appendCriteria - If true appends criteria
with the custom view viewId's criteria. Otherwise, only
criteria will be taken into account.com.adventnet.nms.fe.common.CustomViewException - if an error occurs or any of
userName, viewId or criteria is
null or invalid
public int getTotalCount(ViewCriteria viewCriteria)
throws java.rmi.RemoteException,
com.adventnet.nms.fe.common.CustomViewException
ViewCriteria.
If the temporaryCustomView is true in the viewCriteria
then the total returned will be based on the criteria set in the
viewCriteria alone and the values viewId and userName
in the viewCriteria will be ignored.
If temporaryCustomView is false in the viewCriteria,
then the criteria used for creating the custom view with id as viewId
for the user userName as specified by the in viewCriteria
will be taken in consideration and criteria if set in the
viewCriteria will be added to the base criteria based on the values of
appendCriteria and performOR.
viewCriteria - a ViewCriteria valuejava.rmi.RemoteException - if an error occurscom.adventnet.nms.fe.common.CustomViewException - if an error occurs or viewCriteria is nullgetData(ViewCriteria)
public CustomViewProperties getViewProperties(java.lang.String userName,
java.lang.String viewId)
throws java.rmi.RemoteException,
com.adventnet.nms.fe.common.CustomViewException
userName.userName - : The name of the user for whom this custom view was assignedviewId - : Custom view IDCustomViewProperties object containing the properties of custom view.java.rmi.RemoteException - if a RMI related error occurscom.adventnet.nms.fe.common.CustomViewException - if Database or Custom view related error occurs
public java.util.Hashtable getAllViewIDsAndProps(java.lang.String userName)
throws java.rmi.RemoteException,
com.adventnet.nms.fe.common.CustomViewException
userName belonging to this module.userName - : The name of the user whose custom views have to be returned.java.rmi.RemoteException - : if a RMI related error occurscom.adventnet.nms.fe.common.CustomViewException - : if Database or Custom view related error occurs
or userName is null or invalidCustomViewPropertiespublic java.lang.Object getInstance()
getInstance in interface SessionNarrowerInterfaceprotected java.util.Properties getCriteriaProps(java.lang.String str)
str - criteria represented in String form. It should be of the
form "key1=val1;key2=val2;..."protected TableColumn[] getTableColumnsArr(java.lang.String str)
str - list of columns represented in String form. It should be of the
form "displayName1=columnName1=width1;displayName2=columnName2=width2;..."protected abstract java.lang.String getModuleName()
protected abstract java.util.Properties getDefaultPanelProps()
createCustomView(String, String, String,
String, TableColumn[], Properties, Properties) method, are
mandatory for Web NMS clients. This method provides default Panel
Properties that can be used in createCustomView & modifyCustomView
methods if the corresponding value is not provided.
public java.util.Vector getObjectNamesWithProps(java.lang.String userName,
java.util.Properties p)
throws java.rmi.RemoteException
userName - a String value for authenticationa - Properties object specifying the criteria. For
possible special characters allowed in criteria, refer to createCustomView(String, String, String, String, TableColumn[],
Properties, Properties).Vector which contains the IDs of the
Persistant Objects. for alerts, this will contain list of entities
matching the criteria as specified in the arguments.java.rmi.RemoteException - if a RMI related error occurs
public java.util.Properties getPropertiesOfObject(java.lang.String userName,
java.lang.String objectName)
throws java.rmi.RemoteException
objectname is the
uniqueKey of that object.userName - a String value for authenticationobjectname - a unique key specifying the Objectobjectname.java.rmi.RemoteException - if an RMI related error occurspublic boolean getLatest()
true, that means
updates will be sent to clients, viewing latest objects, whenever a
new object is added.
public boolean saveViewState(java.lang.String userName,
java.lang.String viewId,
int viewlength,
java.lang.String orderByColumn,
boolean isAscendingOrder,
TableColumn[] tableCol)
throws java.rmi.RemoteException,
com.adventnet.nms.fe.common.CustomViewException
userName - name of the user, to whom the CustomView belongs.viewId - unique ID representing the custom viewviewlength - number of objects to be shown per pageorderByColumn - column by which the data has to be sortedisAscendingOrder - true specifies that data are
sort in the ascending ordertableCol - array specifying the display name, order and width
of columns to be shown in the clienttrue if saved, false otherwise.java.rmi.RemoteException - if a RMI error occurscom.adventnet.nms.fe.common.CustomViewException - in any of the following cases,
(i) if Database related error occurs
(ii) if the specified custom view doesn't exist
|
AdventNet Web NMS 4 API Specification | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||