KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > appserv > management > base > QueryMgr


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 package com.sun.appserv.management.base;
24
25 import java.util.Set JavaDoc;
26
27 import javax.management.ObjectName JavaDoc;
28 import javax.management.AttributeNotFoundException JavaDoc;
29 import javax.management.InstanceNotFoundException JavaDoc;
30 import javax.management.ReflectionException JavaDoc;
31 import javax.management.MBeanException JavaDoc;
32
33 import com.sun.appserv.management.base.XTypes;
34 import com.sun.appserv.management.base.AMX;
35
36 /**
37     Supports various types of queries to find s based on various Attributes.
38  */

39 public interface QueryMgr extends AMX, Utility, Singleton
40 {
41 /** The j2eeType as returned by {@link com.sun.appserv.management.base.AMX#getJ2EEType}. */
42     public static final String JavaDoc J2EE_TYPE = XTypes.QUERY_MGR;
43
44
45     /**
46         Calls getJ2EETypeSet( j2eeTypeValue ) and extracts the single result.
47         Throws an exception if more than one object is found.
48         
49         @param j2eeTypeValue the value for the j2eeType property
50         @return ObjectName or null if not found
51         @throws exception if not found
52      */

53     public <T extends AMX> T querySingletonJ2EEType( String JavaDoc j2eeTypeValue );
54     
55     
56     
57     
58     /**
59         Return all {@link AMX} whose j2eeType is equal to any specified in
60         'j2eeTypes'.
61         
62         @param j2eeTypes Set of String (j2eeType values).
63         @return Set of AMX or empty Set if none
64      */

65     public <T extends AMX> Set JavaDoc<T> queryJ2EETypesSet( Set JavaDoc<String JavaDoc> j2eeTypes );
66     
67     /**
68         @see #queryJ2EETypesSet
69      */

70     public Set JavaDoc<ObjectName JavaDoc> queryJ2EETypesObjectNameSet( Set JavaDoc<String JavaDoc> j2eeTypes );
71     
72     
73     /**
74         Return all {@link AMX} whose j2eeType is equal to 'j2eeTypeValue.
75         Legal values include those defined in
76         {@link com.sun.appserv.management.j2ee.J2EETypes} and those
77         defined in {@link com.sun.appserv.management.base.XTypes}
78         
79         @param j2eeTypeValue the value for the j2eeType property
80         @return Set of AMX or empty Set if none
81      */

82     public <T extends AMX> Set JavaDoc<T> queryJ2EETypeSet( String JavaDoc j2eeTypeValue );
83     
84     /**
85         @return Set of ObjectName
86      */

87     public Set JavaDoc<ObjectName JavaDoc> queryJ2EETypeObjectNameSet( String JavaDoc j2eeTypeValue );
88     
89
90     /**
91         Return all {@link AMX} whose name is equal to 'nameValue'.
92         
93         @param nameValue the value for the j2eeType property
94         @return Set of AMX or empty Set if none
95      */

96     public <T extends AMX> Set JavaDoc<T> queryJ2EENameSet( String JavaDoc nameValue );
97     
98     /**
99         @return Set of ObjectName
100      */

101     public Set JavaDoc<ObjectName JavaDoc> queryJ2EENameObjectNameSet( String JavaDoc nameValue );
102     
103     /**
104         Calls queryJ2EETypeSet( j2eeTypeValue ), then creates an array consisting
105         of the names of each of the resulting objects. Note that some names could
106         be identical.
107         
108         @param j2eeType the value for the j2eeType property
109         @return array of names
110      */

111     public String JavaDoc[] queryJ2EETypeNames( String JavaDoc j2eeType );
112     
113     
114     /**
115         @return Set<AMX> containing all items that have the matching j2eeType and name
116      */

117     public <T extends AMX> Set JavaDoc<T> queryJ2EETypeNameSet( String JavaDoc j2eeType, String JavaDoc name );
118     
119     /**
120         @return Set<ObjectName> containing all items that have the matching j2eeType and name
121      */

122     public Set JavaDoc<ObjectName JavaDoc> queryJ2EETypeNameObjectNameSet( String JavaDoc j2eeType, String JavaDoc name );
123     
124
125     /**
126         Return all AMX whose ObjectName matches the supplied
127         ObjectName pattern, as defined by the JMX specification.
128         <p>
129         This can be a relatively expensive operation if care is not taken to use
130         a suitably constrained pattern. For example, querying for "*:*" will return
131         every available AMX.
132         
133         @param pattern an ObjectName containing a pattern as defined by JMX
134         @return Set of AMX or empty Set if none
135      */

136     public <T extends AMX> Set JavaDoc<T> queryPatternSet( ObjectName JavaDoc pattern );
137     
138     /**
139         @return Set of ObjectName
140      */

141     public Set JavaDoc<ObjectName JavaDoc> queryPatternObjectNameSet( ObjectName JavaDoc pattern );
142     
143     
144     /**
145         Makes an ObjectName pattern, then calls queryPatternSet( pat )
146         
147         @param domain the domain or "*" for all
148         @param props a comma-separated Properties string
149         @return Set of AMX or empty Set if none
150      */

151     public <T extends AMX> Set JavaDoc<T> queryPatternSet( String JavaDoc domain, String JavaDoc props );
152     
153     /**
154         @return Set of ObjectName
155      */

156     public Set JavaDoc<ObjectName JavaDoc> queryPatternObjectNameSet( String JavaDoc domain, String JavaDoc props );
157     
158     /**
159         Return all objects that match the specified properties in the JMX domain
160         governed by this QueryMgr.
161         
162         @param props a String containing one or more name/value properties
163      */

164     public <T extends AMX> Set JavaDoc<T> queryPropsSet( String JavaDoc props );
165     
166     /**
167         @return Set of ObjectName
168      */

169     public Set JavaDoc<ObjectName JavaDoc> queryPropsObjectNameSet( String JavaDoc props );
170     
171     
172     /**
173         Return all {@link AMX} whose whose ObjectName matches all property
174         expressions. Each property expression consists of a key expression, and a value
175         expression; an expression which is null is considered a "*" (match all).
176         <p>
177         Both key and value expressions may be wildcarded with the
178         "*" character, which matches 0 or more characters.
179         <p>
180         Each property expression is matched in turn against the ObjectName. If a match
181         fails, the ObjectName is not included in the result. If all matches succeed, then
182         the ObjectName is included.
183         <p>
184         Caution should be used in choosing the element type of the returned set. Unless
185         certain that a uniform type will be produced, Set&lt;AMX> is usually the most
186         appropriate type eg:
187         <code>Set&lt;AMX> result = queryWildSet(...);</code>
188         
189         @param wildKeys one or more name expressions, null means all
190         @param wildValues one or more value expressions, null means all
191         @return Set of AMX or empty Set if none
192      */

193     public <T extends AMX> Set JavaDoc<T> queryWildSet( String JavaDoc[] wildKeys, String JavaDoc[] wildValues );
194     
195     /**
196         @return Set of ObjectName
197      */

198     public Set JavaDoc<ObjectName JavaDoc> queryWildObjectNameSet( String JavaDoc[] wildKeys, String JavaDoc[] wildValues );
199     
200     
201     /**
202         Return all {@link AMX} that implement the specified interface,
203         which may be any interface. This is the same as querying for all s
204         for their interfaces, then returning the set for which the
205         interface extends the specified interface.
206         
207         @param interfaceName classname of the desired interface
208         @param candidateObjectNames optional (may be null) Set of ObjectName to which the search is limited
209         @return Set of AMX or empty Set if none
210      */

211     public <T extends AMX> Set JavaDoc<T>
212     queryInterfaceSet( String JavaDoc interfaceName, Set JavaDoc<ObjectName JavaDoc> candidateObjectNames);
213                     
214     /**
215         @return Set of ObjectName
216      */

217     public Set JavaDoc<ObjectName JavaDoc>
218         queryInterfaceObjectNameSet( String JavaDoc interfaceName,
219             Set JavaDoc<ObjectName JavaDoc> candidateObjectNames);
220     
221     /**
222         @return Set of all AMX
223         @see #queryAllObjectNameSet
224      */

225     public Set JavaDoc<AMX> queryAllSet( );
226     
227     /**
228         @return Set of ObjectName of all AMX
229         @see #queryAllSet
230      */

231     public Set JavaDoc<ObjectName JavaDoc> queryAllObjectNameSet( );
232 }
233
234
235
236
237
Popular Tags