01: /*
02: * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.monitoring.statistics;
06:
07: import javax.management.MBeanRegistration;
08: import javax.management.MBeanServer;
09: import javax.management.ObjectName;
10: import java.util.Map;
11:
12: public class OpenStatisticMBeanRegistration extends OpenStatistic
13: implements MBeanRegistration {
14: private Map registry;
15: private ObjectName objectName;
16:
17: public ObjectName getObjectName() {
18: return objectName;
19: }
20:
21: public OpenStatisticMBeanRegistration(Map registry,
22: StatisticWrapper statisticWrapper) {
23: super (statisticWrapper);
24: this .registry = registry;
25: }
26:
27: public ObjectName preRegister(MBeanServer mBeanServer,
28: ObjectName objectName) throws Exception {
29: this .objectName = objectName;
30: return objectName;
31: }
32:
33: public void postRegister(Boolean registrationSuccess) {
34: if (registrationSuccess.booleanValue()) {
35: registry.put(objectName, this );
36: }
37: }
38:
39: public void preDeregister() throws Exception {
40: }
41:
42: public void postDeregister() {
43: registry.remove(objectName);
44: }
45: }
|