01: package com.sun.portal.rproxy.monitoring;
02:
03: import com.sun.portal.monitoring.Subsystem;
04: import com.sun.portal.monitoring.MonitoringException;
05: import com.sun.portal.monitoring.utilities.ActivityTime;
06: import com.sun.portal.monitoring.statistics.*;
07: import com.sun.portal.util.SRAEvent;
08:
09: import javax.management.NotCompliantMBeanException;
10: import javax.management.MBeanRegistrationException;
11: import javax.management.MalformedObjectNameException;
12: import javax.management.InstanceAlreadyExistsException;
13:
14: /**
15: * author: Noble Paul
16: * Date: Feb 9, 2005, 4:05:10 PM
17: */
18: public class SSOOperationStatistic extends RProxyStatisticBase {
19: public static final String VALIDATION_TIME = "ValidateToken";
20: public static final String SET_PROPERTY = "SetProperty";
21: private static RollingAvgTimeStatisticImpl validationTime = new RollingAvgTimeStatisticImpl();
22: private static RollingAvgTimeStatisticImpl setproperty = new RollingAvgTimeStatisticImpl();
23: private static ActivityTime activityTime = new ActivityTime();
24:
25: public SSOOperationStatistic(Subsystem subsystem) {
26: super (subsystem);
27: }
28:
29: protected String getMbeanType() {
30: return "SSOOperation";
31: }
32:
33: protected String[] getMBeanNames() {
34: return new String[] { VALIDATION_TIME, SET_PROPERTY };
35: }
36:
37: protected StatisticImpl[] getStatistics() {
38: return new StatisticImpl[] { validationTime, setproperty };
39: }
40:
41: protected StatisticWrapper getStatistic(String name) {
42: return getRAStatistic(name);
43: }
44:
45: public void handleEvent(SRAEvent event, Object obj) {
46: if (event == SRAEvent.SSO_VALIDATION_START) {
47: activityTime.mark();
48: } else if (event == SRAEvent.SSO_VALIDATION_END) {
49: validationTime.setTime(activityTime.measure());
50: } else if (event == SRAEvent.SSO_SET_PROPERTY_START) {
51: activityTime.mark();
52: } else if (event == SRAEvent.SSO_SET_PROPERTY_END) {
53: setproperty.setTime(activityTime.measure());
54: }
55: }
56:
57: public SRAEvent[] getInterestedEvents() {
58: return new SRAEvent[] { SRAEvent.SSO_VALIDATION_START,
59: SRAEvent.SSO_VALIDATION_END,
60: SRAEvent.SSO_SET_PROPERTY_START,
61: SRAEvent.SSO_SET_PROPERTY_END };
62: }
63: }
|