Index Changes

Difference between version and version     

Back to Test Alert Notification Listener In Java, or Test Alert Notification Listener In Java Info


At line 12 removed 1 line.
import java.util.ArrayList;
At line 14 removed 1 line.
import java.util.List;
At line 30 changed 1 line.
String dashostname;
String dasHostName;
At line 33 changed 2 lines.
AlertsManagementService managementService;
AlertNotificationService notifService;
AlertsManagementService alertsManagementService;
AlertNotificationService alertNotificationService;
At line 37 changed 2 lines.
List idList = new ArrayList();
Map filterMap = new HashMap();
Map<String/*AlertNotificationFilterElementType*/, String /*value*/> filterMap = new HashMap<String/*AlertNotificationFilterElementType*/, String /*value*/>();
At line 41 changed 2 lines.
* @throws ExtendedManagementRemoteException
*
* No argumant Constructor
At line 44 changed 2 lines.
public TestAlertNotificationListener() throws ExtendedManagementRemoteException {
init();
public TestAlertNotificationListener() {
At line 48 changed 1 line.
public boolean init() throws ExtendedManagementRemoteException {
/**
*
* @return
* @throws ExtendedManagementRemoteException
*/
public boolean initialize() throws ExtendedManagementRemoteException {
At line 50 changed 6 lines.
dashostname = getUserInput(" enter DAS host name <localhost> :",
"localhost");
dasPort = getUserInput(" enter DAS http port <4848> :", "4848");
dasUser = getUserInput(" enter user name <admin> :", "admin");
dasPassword = getUserInput(" enter user password <adminadmin> :",
"adminadmin");
dasHostName = getUserInput("Enter DAS host name <localhost> :", "localhost");
dasPort = getUserInput("Enter DAS http administration port <4848> :", "4848");
dasUser = getUserInput("Enter user name <admin> :", "admin");
dasPassword = getUserInput("Enter user password <adminadmin> :", "adminadmin");
At line 57 changed 2 lines.
client = ExtendedManagementClientFactory.getInstance(dashostname, port,
dasUser, dasPassword);
client = ExtendedManagementClientFactory.getInstance(dasHostName, port, dasUser, dasPassword);
At line 62 changed 3 lines.
managementService = client.getService(org.glassfish.openesb.extended.management.api.alerts.AlertsManagementService.class);
notifService = managementService.getAlertNotificationService();
if (notifService == null) {
alertsManagementService = client.getService(org.glassfish.openesb.extended.management.api.alerts.AlertsManagementService.class);
alertNotificationService = alertsManagementService.getAlertNotificationService();
if (alertNotificationService == null) {
At line 72 added 6 lines.
/**
*
* @param message
* @param defaultValue
* @return
*/
At line 76 changed 1 line.
String returnvalue = "";
String returnValue = "";
At line 79 changed 3 lines.
returnvalue = new BufferedReader(new InputStreamReader(System.in)).readLine();
if (returnvalue.length() == 0) {
returnvalue = defaultValue;
returnValue = new BufferedReader(new InputStreamReader(System.in)).readLine();
if (returnValue.length() == 0) {
returnValue = defaultValue;
At line 88 changed 1 line.
return returnvalue;
return returnValue;
At line 92 changed 4 lines.
public void subscribe(String[] targets) throws Exception {
subscriptionID = notifService.subscribe(new HashMap<String, String>(),
targets, this, "eventProcessCallBack", new Boolean(true), this,
"exceptionProcessCallBack");
/**
*
* @param targets
* @throws Exception
*/
public void subscribe(String[] targets) throws ExtendedManagementRemoteException {
subscriptionID = alertNotificationService.subscribe(filterMap,
targets,
this,
"onEventCallback",
new Boolean(true),
this,
"onExceptionCallback");
At line 99 changed 1 line.
public void eventProcessCallBack(Alert alert) {
/**
*
* @param anAlert
*/
public void onEventCallback(Alert anAlert) {
At line 101 changed 16 lines.
System.out.println("alert date :" + alert.getAlertDateString());
System.out.println("alert severity :" + alert.getAlertSeverity());
System.out.println("alert message code :" + alert.getAlertMessageCode());
System.out.println("alert server name :" + alert.getAlertServer());
System.out.println("alert message details :" + alert.getAlertMessageDetails());
System.out.println("alert component name :" + alert.getAlertComponentName());
System.out.println("alert component project path :" + alert.getAlertComponentProjectPath());
System.out.println("alert component type :" + alert.getAlertComponentType());
System.out.println("alert deployment :" + alert.getAlertDeployment());
System.out.println("alert environment :" + alert.getAlertEnvironment());
System.out.println("alert logical host :" + alert.getAlertLogicalHost());
System.out.println("alert physical host :" + alert.getAlertPhysicalHost());
System.out.println("alert server type :" + alert.getAlertServerType());
System.out.println("alert state :" + alert.getAlertState());
System.out.println("alert status :" + alert.getAlertStatus());
System.out.println("alert type :" + alert.getAlertType());
System.out.println("alert date :" + anAlert.getAlertDateString());
System.out.println("alert severity :" + anAlert.getAlertSeverity());
System.out.println("alert message code :" + anAlert.getAlertMessageCode());
System.out.println("alert server name :" + anAlert.getAlertServer());
System.out.println("alert message details :" + anAlert.getAlertMessageDetails());
System.out.println("alert component name :" + anAlert.getAlertComponentName());
System.out.println("alert component project path :" + anAlert.getAlertComponentProjectPath());
System.out.println("alert component type :" + anAlert.getAlertComponentType());
System.out.println("alert deployment :" + anAlert.getAlertDeployment());
System.out.println("alert environment :" + anAlert.getAlertEnvironment());
System.out.println("alert logical host :" + anAlert.getAlertLogicalHost());
System.out.println("alert physical host :" + anAlert.getAlertPhysicalHost());
System.out.println("alert server type :" + anAlert.getAlertServerType());
System.out.println("alert state :" + anAlert.getAlertState());
System.out.println("alert status :" + anAlert.getAlertStatus());
System.out.println("alert type :" + anAlert.getAlertType());
At line 119 changed 3 lines.
public void exceptionProcessCallBack(Exception e) {
System.out.println("exception details :\n");
e.printStackTrace();
/**
*
* @param processCallbackException
*/
public void onExceptionCallback(Exception processCallbackException) {
System.out.println("Process Callback Exception Details :\n");
processCallbackException.printStackTrace();
At line 146 added 3 lines.
/**
*
*/
At line 129 changed 1 line.
String[] SubscriptionIDs = {subscriptionID};
String[] subscriptionIDs = {subscriptionID};
At line 131 changed 1 line.
notifService.unsubscribe((String[]) SubscriptionIDs);
alertNotificationService.unsubscribe((String[]) subscriptionIDs);
At line 143 changed 1 line.
private void execCommand(String cmd) throws Exception {
/**
*
* @param aCommand
* @throws Exception
*/
private void executeCommand(String aCommand) throws Exception {
At line 145 changed 1 line.
if (cmd.toLowerCase().equals("reg")) {
if (aCommand.equalsIgnoreCase("reg")) {
At line 147 changed 1 line.
} else if (cmd.toLowerCase().equals("unreg")) {
} else if (aCommand.equalsIgnoreCase("unreg")) {
At line 191 added 5 lines.
/**
*
* @return
* @throws Exception
*/
At line 163 changed 2 lines.
String cmd = "";
init();
String theCommand = "";
System.out.println("");
initialize();
At line 167 changed 1 line.
System.out.println("valid opeartions:\n" + " REG - subscribe client for notification no filter and targets optional (comma delimited string) (can be called multiple time -return ID for each) \n" + " UNREG - unsubscribe client from receiving notification\n" + " EX - to exit the program ");
System.out.println("Valid Operations:\n" +
" REG - subscribe client for receiving event notifications with no filters and optional targets (comma delimited string) (can be called multiple times - returns the subscription ID for each) \n" +
" UNREG - unsubscribe client from receiving notifications\n" +
" EX - to exit the program ");
At line 170 changed 2 lines.
cmd = new BufferedReader(new InputStreamReader(System.in)).readLine();
String[] validOption = {"reg", "unreg", "ex"};
theCommand = new BufferedReader(new InputStreamReader(System.in)).readLine();
String[] validOptions = {"reg", "unreg", "ex"};
At line 173 changed 3 lines.
for (String option : validOption) {
String testCmd = cmd.toLowerCase();
if (testCmd.startsWith(option)) {
for (String option : validOptions) {
String testCommand = theCommand.toLowerCase();
if (testCommand.startsWith(option)) {
At line 181 changed 1 line.
if (valid == false) {
if (!valid) {
At line 189 changed 1 line.
System.out.println("the command is = " + cmd);
System.out.println("The command is = " + theCommand);
At line 192 changed 1 line.
if (cmd.equalsIgnoreCase("ex")) {
if (theCommand.equalsIgnoreCase("ex")) {
At line 196 changed 1 line.
execCommand(cmd);
executeCommand(theCommand);
At line 211 removed 1 line.
// TODO Auto-generated catch block

JSPWiki v2.4.100
[RSS]
« Home Index Changes Prefs
This page (revision-4) was last changed on 04-Feb-10 23:40 PM, -0800 by newacct