 |
package org.glassfish.extended.management.sample.impl.performance;
import com.sun.esb.management.api.performance.PerformanceMeasurementService;
import com.sun.esb.management.client.ManagementClient;
import com.sun.esb.management.client.ManagementClientFactory;
import com.sun.esb.management.common.ManagementRemoteException;
import com.sun.esb.management.common.data.FrameworkStatisticsData;
import com.sun.esb.management.common.data.helper.FrameworkStatisticsDataReader;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.parsers.ParserConfigurationException;
import org.glassfish.openesb.management.ServerConnectionFactory;
import org.xml.sax.SAXException;
/**
*
* @author gopalan
*/
public class TestJBIFrameworkStatistics {
/** * @param args */
public static void main(String[] args) {
String host = ServerConnectionFactory.LOCALHOST,
user = ServerConnectionFactory.ADMIN_USERNAME,
password = ServerConnectionFactory.ADMINADMIN_PASSWORD;
int port = ServerConnectionFactory.RMI_ADMIN_PORT;
String targetName = ServerConnectionFactory.SERVER_TARGET;
String rawXMLData = null;
// Get an instance of Management Client
try {
ManagementClient client = ManagementClientFactory.getInstance(host, port, user, password);
// Get an instance of the Performance Measurement Service
PerformanceMeasurementService measurementService = client.getPerformanceMeasurementService();
rawXMLData = measurementService.getFrameworkStatistics(targetName);
} catch (ManagementRemoteException ex) {
Logger.getLogger(TestJBIFrameworkStatistics.class.getName()).log(Level.SEVERE, null, ex);
}
if (rawXMLData != null) {
try {
Map<String /* instanceName */, FrameworkStatisticsData> targetToDataMap =
FrameworkStatisticsDataReader.parseFromXMLData(rawXMLData);
if (targetToDataMap != null) {
for (FrameworkStatisticsData x : targetToDataMap.values()) {
System.out.println(x.getDisplayString());
}
}
} catch (MalformedURLException ex) {
Logger.getLogger(TestJBIFrameworkStatistics.class.getName()).log(Level.SEVERE, null, ex);
} catch (ParserConfigurationException ex) {
Logger.getLogger(TestJBIFrameworkStatistics.class.getName()).log(Level.SEVERE, null, ex);
} catch (SAXException ex) {
Logger.getLogger(TestJBIFrameworkStatistics.class.getName()).log(Level.SEVERE, null, ex);
} catch (URISyntaxException ex) {
Logger.getLogger(TestJBIFrameworkStatistics.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(TestJBIFrameworkStatistics.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}
Quick Navigation Links
Number of visits: 6
This page (revision-2) was last changed on
27-Jan-10 02:35 AM, -0800
by newacct.
This page was created on
28-Oct-09 06:54 AM, -0700 by Gopalan Suresh Raj.
More info...
| Version |
Date |
Author |
Size |
Changes ... |
|
2
|
27-Jan-10 02:35 AM, -0800
|
newacct |
4238 |
to previous
|
|
1
|
28-Oct-09 06:54 AM, -0700
|
Gopalan Suresh Raj |
4336 |
to last
|