BeanMonitorTaskpublic abstract class BeanMonitorTask extends MonitorTask
Fields Summary |
---|
String | appName | String | ejbName | String | beanName |
Methods Summary |
---|
abstract boolean | checkIfBeanExists(java.util.Map ejbModuleMap)
| private java.lang.String | getAvailableFilterMessage(java.lang.String[] appModuleFilters, java.lang.String[] ejbModuleFilters)
StringBuffer sb = new StringBuffer();
sb.append(localStrings.getString("commands.monitor.more_than_one_monitoring_elements"));
if (ejbModuleFilters.length > 0)
{
sb.append(localStrings.getString("commands.monitor.available_ejbmodule_elements"));
for (String ejbmodule : ejbModuleFilters)
{
sb.append(" ");
sb.append(ejbmodule);
sb.append("\n");
}
}
if (appModuleFilters.length > 0)
{
sb.append(localStrings.getString("commands.monitor.available_appmodule_elements"));
for (String appmodule: appModuleFilters)
{
sb.append(" ");
sb.append(appmodule);
sb.append("\n");
}
}
return sb.toString();
| abstract java.util.List | getBeansInEjbModule(java.lang.String appName, java.util.Map ejbModuleMap)
| void | getDefaultFilter()If filter option is not specified, then this method will
get the default filter value.
String[] appModuleFilters = possibleAppModuleFilters();
String[] ejbModuleFilters = possibleEjbModuleFilters();
if (ejbModuleFilters.length < 1 && appModuleFilters.length < 1)
{
throw new MonitorTaskException(localStrings.getString("command.monitor.no_value_to_monitor"));
}
else if (ejbModuleFilters.length == 1 && appModuleFilters.length < 1)
{
filter = ejbModuleFilters[0];
final StringTokenizer st = new StringTokenizer(filter, ":");
ejbName = st.nextToken();
beanName = st.nextToken();
}
else if (ejbModuleFilters.length < 1 && appModuleFilters.length == 1)
{
filter = appModuleFilters[0];
final StringTokenizer st = new StringTokenizer(filter, ":");
appName = st.nextToken();
ejbName = st.nextToken();
beanName = st.nextToken();
}
else
{
final String msg = getAvailableFilterMessage(appModuleFilters, ejbModuleFilters);
throw new MonitorTaskException(msg);
}
| java.lang.String[] | possibleAppModuleFilters()Returns all the possible ejbmodules in all the application.
The return format is ::
final Map<String,ApplicationMonitor> appModuleMap = srm.getApplicationMonitorMap();
List<String> possibleFilters = new Vector<String>();
if (appModuleMap != null && appModuleMap.size() > 0)
{
//search through all application and check for the ejbs
final String[] appModules = MapUtil.getKeyStrings(appModuleMap);
for (String appModule : appModules)
{
ApplicationMonitor am = (ApplicationMonitor)appModuleMap.get(appModule);
//search for the ejb in the appmodule
final Map<String,EJBModuleMonitor> innerEjbModuleMap = am.getEJBModuleMonitorMap();
possibleFilters.addAll(getBeansInEjbModule(appModule, innerEjbModuleMap));
}
}
return (String[])possibleFilters.toArray(new String[0]);
| java.lang.String[] | possibleEjbModuleFilters()Returns all the possible servlets in all the ejbmodules.
The return format is :
final Map<String,EJBModuleMonitor> ejbModuleMap = srm.getEJBModuleMonitorMap();
List<String> possibleFilters = getBeansInEjbModule(null, ejbModuleMap);
return (String[])possibleFilters.toArray(new String[0]);
| void | verifyFilterValue()
if (appName != null)
{
final Map<String,ApplicationMonitor> appModuleMap = srm.getApplicationMonitorMap();
if (appModuleMap.containsKey(appName))
{
final ApplicationMonitor am = appModuleMap.get(appName);
final Map<String,EJBModuleMonitor> innerEJBModuleMap = am.getEJBModuleMonitorMap();
final boolean exist = checkIfBeanExists(innerEJBModuleMap);
if (!exist)
throw new MonitorTaskException(localStrings.getString("commands.monitor.does_not_exist_in2", new Object[] {beanName, appName, ejbName}));
}
else {
throw new MonitorTaskException(localStrings.getString("commands.monitor.does_not_exist", new Object[] {appName}));
}
}
else
{
final Map<String,EJBModuleMonitor> ejbModuleMap = srm.getEJBModuleMonitorMap();
final boolean exist = checkIfBeanExists(ejbModuleMap);
if (!exist)
throw new MonitorTaskException(localStrings.getString("commands.monitor.does_not_exist_in1", new Object[] {beanName, ejbName}));
}
|
|