KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > cli > jmx > util > 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-cli/cli-api/src/java/com/sun/cli/jmx/util/ObjectNameQueryMBeanImpl.java,v 1.3 2005/12/25 03:45:56 tcfujii Exp $
26  * $Revision: 1.3 $
27  * $Date: 2005/12/25 03:45:56 $
28  */

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