KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > appserv > management > util > jmx > ObjectNameQueryMBeanImpl


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23  
24 /*
25  * $Header: /cvs/glassfish/admin-core/mbeanapi/src/java/com/sun/appserv/management/util/jmx/ObjectNameQueryMBeanImpl.java,v 1.4 2006/03/09 20:30:32 llc Exp $
26  * $Revision: 1.4 $
27  * $Date: 2006/03/09 20:30:32 $
28  */

29 package com.sun.appserv.management.util.jmx;
30
31 import java.util.Set JavaDoc;
32
33 import javax.management.StandardMBean JavaDoc;
34 import javax.management.ObjectName JavaDoc;
35 import javax.management.MBeanServer JavaDoc;
36 import javax.management.MBeanServerConnection JavaDoc;
37 import javax.management.NotCompliantMBeanException JavaDoc;
38
39 import javax.management.MalformedObjectNameException JavaDoc;
40 import javax.management.MBeanRegistration JavaDoc;
41
42 /**
43     An MBean implementing ObjectNameQueryMBean
44  */

45 public class ObjectNameQueryMBeanImpl
46     extends StandardMBean JavaDoc
47     implements ObjectNameQueryMBean, MBeanRegistration JavaDoc
48 {
49     private MBeanServerConnection JavaDoc mConn;
50     private ObjectNameQueryImpl mImpl;
51     
52         public
53     ObjectNameQueryMBeanImpl()
54         throws NotCompliantMBeanException JavaDoc
55     {
56         super( ObjectNameQueryMBean.class );
57     }
58     
59         public Set JavaDoc<ObjectName JavaDoc>
60     matchAll( ObjectName JavaDoc startingSetPattern, String JavaDoc [] regexNames, String JavaDoc [] regexValues )
61                 throws MalformedObjectNameException JavaDoc, java.io.IOException JavaDoc
62     {
63         final Set JavaDoc<ObjectName JavaDoc> candidates = JMXUtil.queryNames( mConn, startingSetPattern, null );
64         
65         return( mImpl.matchAll( candidates, regexNames, regexValues ) );
66     }
67     
68         public Set JavaDoc<ObjectName JavaDoc>
69     matchAll( Set JavaDoc<ObjectName JavaDoc> startingSet, String JavaDoc [] regexNames, String JavaDoc [] regexValues )
70     {
71         return( mImpl.matchAll( startingSet, regexNames, regexValues ) );
72     }
73                 
74         public Set JavaDoc<ObjectName JavaDoc>
75     matchAny( ObjectName JavaDoc startingSetPattern, String JavaDoc [] regexNames, String JavaDoc [] regexValues )
76                 throws MalformedObjectNameException JavaDoc, java.io.IOException JavaDoc
77     {
78         final Set JavaDoc<ObjectName JavaDoc> candidates = JMXUtil.queryNames( mConn, startingSetPattern, null );
79         
80         return( mImpl.matchAny( candidates, regexNames, regexValues ) );
81     }
82                 
83         public Set JavaDoc<ObjectName JavaDoc>
84     matchAny( Set JavaDoc<ObjectName JavaDoc> startingSet, String JavaDoc [] regexNames, String JavaDoc [] regexValues )
85     {
86         return( mImpl.matchAny( startingSet, regexNames, regexValues ) );
87     }
88     
89     
90     
91         public ObjectName JavaDoc
92     preRegister( final MBeanServer JavaDoc server, final ObjectName JavaDoc name)
93     {
94         mConn = server;
95         
96         mImpl = new ObjectNameQueryImpl( );
97         return( name );
98     }
99     
100         public void
101     postRegister( Boolean JavaDoc registrationDone )
102     {
103     }
104     
105         public void
106     preDeregister()
107     {
108         // nothing to do
109
}
110         public void
111     postDeregister()
112     {
113         // nothing to do
114
}
115
116 }
117
118
119
120
121
122
123
Popular Tags