01: package com.sun.portal.admin.server;
02:
03: import com.sun.jdmk.JdmkMBeanServer;
04: import com.sun.jdmk.interceptor.MBeanServerInterceptor;
05: import com.sun.cacao.agent.DomainDispatcher;
06: import com.sun.portal.admin.common.util.AdminUtil;
07:
08: import javax.management.MBeanServer;
09: import javax.management.MBeanServerFactory;
10: import javax.management.ObjectName;
11: import java.util.Collection;
12: import java.util.ArrayList;
13:
14: /**
15: * Portal Domain Dispatcher
16: */
17: public class PortalDomainDispatcher implements DomainDispatcher {
18: private ArrayList interceptorList;
19:
20: public PortalDomainDispatcher(MBeanServer mbs) {
21: // create another private JDMK mbean server just for our mbeans
22: // so that we can have our own interceptor
23: JdmkMBeanServer privateMBeanServer = (JdmkMBeanServer) MBeanServerFactory
24: .newMBeanServer();
25:
26: // register our own audit interceptor with the
27: // JdmkMBeanServer we just created using its APIs.
28:
29: MBeanServerInterceptor auditInterceptor = new PortalServerLoggingInterceptor(
30: privateMBeanServer.getMBeanServerInterceptor(), null);
31:
32: privateMBeanServer.setMBeanServerInterceptor(auditInterceptor);
33: // provide the collection of interceptors for our domain
34: interceptorList = new ArrayList(1);
35: interceptorList.add(auditInterceptor);
36: }
37:
38: public Collection getInterceptors(ObjectName objectName) {
39: return interceptorList;
40: }
41:
42: public String getDomain() {
43: return AdminUtil.JMX_DOMAIN;
44: }
45: }
|