KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > j2ee > deployment > RefContext


1 /**
2  *
3  * Copyright 2004 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.geronimo.j2ee.deployment;
18
19 import java.net.URI JavaDoc;
20 import java.net.URISyntaxException JavaDoc;
21 import java.util.HashMap JavaDoc;
22 import java.util.List JavaDoc;
23 import java.util.Map JavaDoc;
24 import java.util.Set JavaDoc;
25 import javax.management.MalformedObjectNameException JavaDoc;
26 import javax.management.ObjectName JavaDoc;
27 import javax.naming.Reference JavaDoc;
28 import javax.xml.namespace.QName JavaDoc;
29
30 import org.apache.geronimo.common.AmbiguousEJBRefException;
31 import org.apache.geronimo.common.DeploymentException;
32 import org.apache.geronimo.common.UnknownEJBRefException;
33 import org.apache.geronimo.common.UnresolvedEJBRefException;
34 import org.apache.geronimo.deployment.DeploymentContext;
35 import org.apache.geronimo.gbean.GBeanData;
36 import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
37 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
38 import org.apache.geronimo.kernel.Kernel;
39
40
41 /**
42  * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
43  */

44 public class RefContext {
45
46     private final EJBReferenceBuilder ejbReferenceBuilder;
47     private final ResourceReferenceBuilder resourceReferenceBuilder;
48     private final ServiceReferenceBuilder serviceReferenceBuilder;
49     private final Kernel kernel;
50
51     private final Map JavaDoc ejbRemoteIndex;
52     private final Map JavaDoc ejbLocalIndex;
53     private final Map JavaDoc ejbInterfaceIndex;
54
55     private final Map JavaDoc resourceAdapterIndex;
56     private final Map JavaDoc connectionFactoryIndex;
57     private final Map JavaDoc adminObjectIndex;
58
59     private final Map JavaDoc resourceModuleDataMap;
60
61
62     public RefContext(EJBReferenceBuilder ejbReferenceBuilder, ResourceReferenceBuilder resourceReferenceBuilder, ServiceReferenceBuilder serviceReferenceBuilder, Kernel kernel) {
63         assert ejbReferenceBuilder != null: "ejbReferenceBuilder is null";
64         assert resourceReferenceBuilder != null: "resourceReferenceBuilder is null";
65         assert serviceReferenceBuilder != null: "serviceReferenceBuilder is null";
66
67         ejbRemoteIndex = new HashMap JavaDoc();
68         ejbLocalIndex = new HashMap JavaDoc();
69         ejbInterfaceIndex = new HashMap JavaDoc();
70         resourceAdapterIndex = new HashMap JavaDoc();
71         connectionFactoryIndex = new HashMap JavaDoc();
72         adminObjectIndex = new HashMap JavaDoc();
73         resourceModuleDataMap = new HashMap JavaDoc();
74         this.ejbReferenceBuilder = ejbReferenceBuilder;
75         this.resourceReferenceBuilder = resourceReferenceBuilder;
76         this.serviceReferenceBuilder = serviceReferenceBuilder;
77         this.kernel = kernel;
78     }
79
80     public static RefContext derivedClientRefContext(RefContext refContext, EJBReferenceBuilder ejbReferenceBuilder, ResourceReferenceBuilder resourceReferenceBuilder, ServiceReferenceBuilder serviceReferenceBuilder) {
81         return new RefContext(refContext, ejbReferenceBuilder, resourceReferenceBuilder, serviceReferenceBuilder);
82     }
83
84     private RefContext(RefContext refContext, EJBReferenceBuilder ejbReferenceBuilder, ResourceReferenceBuilder resourceReferenceBuilder, ServiceReferenceBuilder serviceReferenceBuilder) {
85         assert ejbReferenceBuilder != null: "ejbReferenceBuilder is null";
86         assert resourceReferenceBuilder != null: "resourceReferenceBuilder is null";
87         assert refContext != null: "ejbRefContext is null";
88
89         this.ejbReferenceBuilder = ejbReferenceBuilder;
90         this.resourceReferenceBuilder = resourceReferenceBuilder;
91         this.serviceReferenceBuilder = serviceReferenceBuilder;
92         this.kernel = refContext.kernel;
93         this.ejbRemoteIndex = refContext.ejbRemoteIndex;
94         this.ejbLocalIndex = new HashMap JavaDoc();//no local ejb refs
95
this.ejbInterfaceIndex = refContext.ejbInterfaceIndex;
96         resourceAdapterIndex = new HashMap JavaDoc();
97         this.connectionFactoryIndex = new HashMap JavaDoc();
98         this.adminObjectIndex = new HashMap JavaDoc();
99         this.resourceModuleDataMap = new HashMap JavaDoc();
100     }
101
102     public EJBReferenceBuilder getEjbReferenceBuilder() {
103         return ejbReferenceBuilder;
104     }
105
106     public Map JavaDoc getEJBRemoteIndex() {
107         return ejbRemoteIndex;
108     }
109
110     public Map JavaDoc getEJBLocalIndex() {
111         return ejbLocalIndex;
112     }
113
114     public Map JavaDoc getConnectionFactoryIndex() {
115         return connectionFactoryIndex;
116     }
117
118     public Map JavaDoc getAdminObjectIndex() {
119         return adminObjectIndex;
120     }
121
122     public void addEJBRemoteId(URI JavaDoc modulePath, String JavaDoc name, String JavaDoc containerId, boolean isSession, String JavaDoc home, String JavaDoc remote) throws DeploymentException {
123         Map JavaDoc references = (Map JavaDoc) ejbRemoteIndex.get(name);
124         if (references == null || references.isEmpty()) {
125             references = new HashMap JavaDoc();
126             ejbRemoteIndex.put(name, references);
127         }
128
129         EJBRefInfo ejbRefInfo = new EJBRefInfo(false, isSession, home, remote);
130         Map JavaDoc interfacesReferences = (Map JavaDoc) ejbInterfaceIndex.get(ejbRefInfo);
131         if (interfacesReferences == null || interfacesReferences.isEmpty()) {
132             interfacesReferences = new HashMap JavaDoc();
133             ejbInterfaceIndex.put(ejbRefInfo, interfacesReferences);
134         }
135
136         addEJBId(modulePath, name, containerId, references, interfacesReferences);
137     }
138
139     public void addEJBLocalId(URI JavaDoc modulePath, String JavaDoc name, String JavaDoc containerId, boolean isSession, String JavaDoc localHome, String JavaDoc local) throws DeploymentException {
140         Map JavaDoc references = (Map JavaDoc) ejbLocalIndex.get(name);
141         if (references == null || references.isEmpty()) {
142             references = new HashMap JavaDoc();
143             ejbLocalIndex.put(name, references);
144         }
145
146         EJBRefInfo ejbRefInfo = new EJBRefInfo(true, isSession, localHome, local);
147         Map JavaDoc interfacesReferences = (Map JavaDoc) ejbInterfaceIndex.get(ejbRefInfo);
148         if (interfacesReferences == null || interfacesReferences.isEmpty()) {
149             interfacesReferences = new HashMap JavaDoc();
150             ejbInterfaceIndex.put(ejbRefInfo, interfacesReferences);
151         }
152
153         addEJBId(modulePath, name, containerId, references, interfacesReferences);
154     }
155
156     private void addEJBId(URI JavaDoc modulePath, String JavaDoc name, String JavaDoc containerId, Map JavaDoc references, Map JavaDoc interfacesReferences) throws DeploymentException {
157         try {
158             URI JavaDoc ejbURI = new URI JavaDoc(null, null, modulePath.getPath(), name);
159             references.put(ejbURI, containerId);
160             URI JavaDoc moduleURI = new URI JavaDoc(null, null, modulePath.getPath(), null);
161             interfacesReferences.put(moduleURI, containerId);
162         } catch (URISyntaxException JavaDoc e) {
163             throw new DeploymentException(e);
164         }
165     }
166
167     public void addResourceAdapterId(URI JavaDoc modulePath, String JavaDoc name, String JavaDoc containerId) throws DeploymentException {
168         Map JavaDoc references = (Map JavaDoc) resourceAdapterIndex.get(name);
169         if (references == null || references.isEmpty()) {
170             references = new HashMap JavaDoc();
171             resourceAdapterIndex.put(name, references);
172         }
173
174         try {
175             URI JavaDoc cfURI = new URI JavaDoc(null, null, modulePath.getPath(), name);
176             references.put(cfURI, containerId);
177         } catch (URISyntaxException JavaDoc e) {
178             throw new DeploymentException(e);
179         }
180     }
181
182     public void addConnectionFactoryId(URI JavaDoc modulePath, String JavaDoc name, String JavaDoc containerId) throws DeploymentException {
183         Map JavaDoc references = (Map JavaDoc) connectionFactoryIndex.get(name);
184         if (references == null || references.isEmpty()) {
185             references = new HashMap JavaDoc();
186             connectionFactoryIndex.put(name, references);
187         }
188
189         try {
190             URI JavaDoc cfURI = new URI JavaDoc(null, null, modulePath.getPath(), name);
191             references.put(cfURI, containerId);
192         } catch (URISyntaxException JavaDoc e) {
193             throw new DeploymentException(e);
194         }
195     }
196
197
198     public void addAdminObjectId(URI JavaDoc modulePath, String JavaDoc name, String JavaDoc containerId) throws DeploymentException {
199         Map JavaDoc references = (Map JavaDoc) adminObjectIndex.get(name);
200         if (references == null || references.isEmpty()) {
201             references = new HashMap JavaDoc();
202             adminObjectIndex.put(name, references);
203         }
204
205         try {
206             URI JavaDoc cfURI = new URI JavaDoc(null, null, modulePath.getPath(), name);
207             references.put(cfURI, containerId);
208         } catch (URISyntaxException JavaDoc e) {
209             throw new DeploymentException(e);
210         }
211     }
212
213
214
215     //lookup methods
216

217     public Reference JavaDoc getEJBRemoteRef(String JavaDoc objectName, boolean isSession, String JavaDoc home, String JavaDoc remote) throws DeploymentException {
218         return ejbReferenceBuilder.createEJBRemoteReference(objectName, isSession, home, remote);
219     }
220
221     public Reference JavaDoc getCORBARemoteRef(URI JavaDoc corbaURL, String JavaDoc objectName, ObjectName JavaDoc containerName, String JavaDoc home) throws DeploymentException {
222         return ejbReferenceBuilder.createCORBAReference(corbaURL, objectName, containerName, home);
223     }
224
225     public Reference JavaDoc getEJBLocalRef(String JavaDoc objectName, boolean isSession, String JavaDoc localHome, String JavaDoc local) throws DeploymentException {
226         return ejbReferenceBuilder.createEJBLocalReference(objectName, isSession, localHome, local);
227     }
228
229     public Object JavaDoc getHandleDelegateReference() throws DeploymentException {
230         return ejbReferenceBuilder.createHandleDelegateReference();
231     }
232
233     public Reference JavaDoc getEJBRemoteRef(URI JavaDoc module, String JavaDoc ejbLink, boolean isSession, String JavaDoc home, String JavaDoc remote) throws DeploymentException {
234         String JavaDoc name = ejbLink.substring(ejbLink.lastIndexOf('#') + 1);
235         String JavaDoc containerId = getContainerId(module, ejbLink, (Map JavaDoc) ejbRemoteIndex.get(name));
236         return getEJBRemoteRef(containerId, isSession, home, remote);
237     }
238
239     public Reference JavaDoc getEJBLocalRef(URI JavaDoc module, String JavaDoc ejbLink, boolean isSession, String JavaDoc localHome, String JavaDoc local) throws DeploymentException {
240         String JavaDoc name = ejbLink.substring(ejbLink.lastIndexOf('#') + 1);
241         String JavaDoc containerId = getContainerId(module, ejbLink, (Map JavaDoc) ejbLocalIndex.get(name));
242         return getEJBLocalRef(containerId, isSession, localHome, local);
243     }
244
245     public Reference JavaDoc getConnectionFactoryRef(String JavaDoc containerId, Class JavaDoc iface) throws DeploymentException {
246         return resourceReferenceBuilder.createResourceRef(containerId, iface);
247     }
248
249     public String JavaDoc getResourceAdapterContainerId(URI JavaDoc module, String JavaDoc resourceLink, J2eeContext j2eeContext) throws DeploymentException, UnknownEJBRefException {
250         String JavaDoc name = resourceLink.substring(resourceLink.lastIndexOf('#') + 1);
251         try {
252             return getContainerId(module, resourceLink, (Map JavaDoc) resourceAdapterIndex.get(name));
253         } catch (UnknownEJBRefException e) {
254             ObjectName JavaDoc query = null;
255             try {
256                 query = NameFactory.getComponentRestrictedQueryName(null, null, name, NameFactory.JCA_RESOURCE_ADAPTER, j2eeContext);
257             } catch (MalformedObjectNameException JavaDoc e1) {
258                 throw new DeploymentException("Could not construct resource adapter object name query", e);
259             }
260             ObjectName JavaDoc containerName = locateUniqueName(query, "resource");
261             return containerName.getCanonicalName();
262         }
263     }
264
265     public String JavaDoc getConnectionFactoryContainerId(URI JavaDoc module, String JavaDoc resourceLink, String JavaDoc type, J2eeContext j2eeContext, DeploymentContext context) throws DeploymentException, UnknownEJBRefException {
266         String JavaDoc name = resourceLink.substring(resourceLink.lastIndexOf('#') + 1);
267         try {
268             return getContainerId(module, resourceLink, (Map JavaDoc) connectionFactoryIndex.get(name));
269         } catch (UnknownEJBRefException e) {
270
271             ObjectName JavaDoc query = null;
272             try {
273                 query = NameFactory.getComponentNameQuery(null, null, null, name, type, j2eeContext);
274             } catch (MalformedObjectNameException JavaDoc e1) {
275                 throw new DeploymentException("Could not construct connection factory object name query", e);
276             }
277             Set JavaDoc matches = context.listGBeans(query);
278             if (matches.size() > 1) {
279                 throw new DeploymentException("More than one match for query " + matches);
280             }
281             if (matches.size() == 1) {
282                 return ((ObjectName JavaDoc) matches.iterator().next()).getCanonicalName();
283             }
284             try {
285                 query = NameFactory.getComponentRestrictedQueryName(null, null, name, type, j2eeContext);
286             } catch (MalformedObjectNameException JavaDoc e1) {
287                 throw new DeploymentException("Could not construct connection factory object name query", e);
288             }
289             ObjectName JavaDoc containerName = locateUniqueName(query, "resource");
290             return containerName.getCanonicalName();
291         }
292     }
293
294     public Reference JavaDoc getAdminObjectRef(String JavaDoc containerId, Class JavaDoc iface) throws DeploymentException {
295         return resourceReferenceBuilder.createAdminObjectRef(containerId, iface);
296     }
297
298     public String JavaDoc getAdminObjectContainerId(URI JavaDoc module, String JavaDoc resourceLink, J2eeContext j2eeContext) throws DeploymentException, UnknownEJBRefException {
299         String JavaDoc name = resourceLink.substring(resourceLink.lastIndexOf('#') + 1);
300         try {
301             return getContainerId(module, resourceLink, (Map JavaDoc) adminObjectIndex.get(name));
302         } catch (UnknownEJBRefException e) {
303             ObjectName JavaDoc query = null;
304             try {
305                 query = NameFactory.getComponentRestrictedQueryName(null, null, name, NameFactory.JCA_ADMIN_OBJECT, j2eeContext);
306             } catch (MalformedObjectNameException JavaDoc e1) {
307                 throw new DeploymentException("Could not construct admin object object name query", e);
308             }
309             ObjectName JavaDoc containerName = locateUniqueName(query, "resource");
310             return containerName.getCanonicalName();
311         }
312     }
313
314     public Object JavaDoc getServiceReference(Class JavaDoc serviceInterface, URI JavaDoc wsdlURI, URI JavaDoc jaxrpcMappingURI, QName JavaDoc serviceQName, Map JavaDoc portComponentRefMap, List JavaDoc handlerInfos, Map JavaDoc portLocationMap, Map JavaDoc credentialsNameMap, DeploymentContext deploymentContext, Module module, ClassLoader JavaDoc classLoader) throws DeploymentException {
315         return serviceReferenceBuilder.createService(serviceInterface, wsdlURI, jaxrpcMappingURI, serviceQName, portComponentRefMap, handlerInfos, portLocationMap, credentialsNameMap, deploymentContext, module, classLoader);
316     }
317
318     private String JavaDoc getContainerId(URI JavaDoc module, String JavaDoc ejbLink, Map JavaDoc references) throws AmbiguousEJBRefException, UnknownEJBRefException {
319         if (references == null || references.isEmpty()) {
320             throw new UnknownEJBRefException(ejbLink);
321         }
322
323         // is this an absolute reference ../relative/path/Module#EJBName
324
if (ejbLink.indexOf('#') >= 0) {
325             URI JavaDoc ejbURI = module.resolve(ejbLink).normalize();
326             String JavaDoc ejbRef = (String JavaDoc) references.get(ejbURI);
327             if (ejbRef == null) {
328                 throw new UnknownEJBRefException(ejbLink);
329             }
330             return ejbRef;
331         }
332
333         //
334
// relative reference
335
//
336

337         // if there is only one ejb with that name, use it
338
if (references.size() == 1) {
339             String JavaDoc ejbRef = (String JavaDoc) references.values().iterator().next();
340             if (ejbRef == null) {
341                 throw new UnknownEJBRefException(ejbLink);
342             }
343             return ejbRef;
344         }
345
346         // We got more then one ejb with that name. Try to find an ejb in the current module with that name
347
String JavaDoc ejbRef = (String JavaDoc) references.get(module.resolve("#" + ejbLink));
348         if (ejbRef != null) {
349             return ejbRef;
350         }
351
352         // there is more then one ejb with the specifiec name
353
throw new AmbiguousEJBRefException(ejbLink);
354     }
355
356     public Reference JavaDoc getImplicitEJBRemoteRef(URI JavaDoc module, String JavaDoc refName, boolean isSession, String JavaDoc home, String JavaDoc remote) throws DeploymentException {
357         EJBRefInfo ejbRefInfo = new EJBRefInfo(false, isSession, home, remote);
358         String JavaDoc containerId = getImplicitContainerId(module, refName, ejbRefInfo);
359         return getEJBRemoteRef(containerId, isSession, home, remote);
360     }
361
362     public Reference JavaDoc getImplicitEJBLocalRef(URI JavaDoc module, String JavaDoc refName, boolean isSession, String JavaDoc localHome, String JavaDoc local) throws DeploymentException {
363         EJBRefInfo ejbRefInfo = new EJBRefInfo(true, isSession, localHome, local);
364         String JavaDoc containerId = getImplicitContainerId(module, refName, ejbRefInfo);
365         return getEJBLocalRef(containerId, isSession, localHome, local);
366     }
367
368     private String JavaDoc getImplicitContainerId(URI JavaDoc module, String JavaDoc refName, EJBRefInfo ejbRefInfo) throws DeploymentException {
369         Map JavaDoc references = (Map JavaDoc) ejbInterfaceIndex.get(ejbRefInfo);
370
371         // if we didn't find any ejbs that implement that interface... give up
372
if (references == null || references.isEmpty()) {
373             throw new UnresolvedEJBRefException(refName, ejbRefInfo.isLocal(), ejbRefInfo.isSession(), ejbRefInfo.getHomeIntf(), ejbRefInfo.getBeanIntf(), false);
374         }
375
376         // if there is only one matching ejb, use it
377
if (references.size() == 1) {
378             return (String JavaDoc) references.values().iterator().next();
379         }
380
381         // We got more then one matching ejb. Try to find an ejb in the current module
382
String JavaDoc ejbRef = (String JavaDoc) references.get(module);
383         if (ejbRef != null) {
384             return ejbRef;
385         }
386
387         // there is more then one ejb that implements that interface... give up
388
throw new UnresolvedEJBRefException(refName, ejbRefInfo.isLocal(), ejbRefInfo.isSession(), ejbRefInfo.getHomeIntf(), ejbRefInfo.getBeanIntf(), true);
389     }
390
391     //Resource adapter/activationspec support
392

393     public void addResourceAdapterModuleInfo(ObjectName JavaDoc resourceModuleName, GBeanData resourceModuleData) throws DeploymentException {
394         Object JavaDoc old = resourceModuleDataMap.put(resourceModuleName, resourceModuleData);
395         if (old != null) {
396             throw new DeploymentException("Duplicate resource adapter module name: " + resourceModuleName);
397         }
398     }
399
400     public GBeanData getResourceAdapterGBeanData(ObjectName JavaDoc resourceAdapterModuleName) throws DeploymentException {
401         GBeanData resourceModuleData = (GBeanData) resourceModuleDataMap.get(resourceAdapterModuleName);
402         if (resourceModuleData != null) {
403             return (GBeanData) resourceModuleData.getAttribute("resourceAdapterGBeanData");
404         }
405         return resourceReferenceBuilder.locateResourceAdapterGBeanData(resourceAdapterModuleName);
406     }
407
408     public GBeanData getActivationSpecInfo(ObjectName JavaDoc resourceAdapterModuleName, String JavaDoc messageListenerInterfaceName) throws DeploymentException {
409         GBeanData resourceModuleData = (GBeanData) resourceModuleDataMap.get(resourceAdapterModuleName);
410         if (resourceModuleData != null) {
411             Map JavaDoc activationSpecInfoMap = (Map JavaDoc) resourceModuleData.getAttribute("activationSpecInfoMap");
412             return (GBeanData) activationSpecInfoMap.get(messageListenerInterfaceName);
413         }
414         return resourceReferenceBuilder.locateActivationSpecInfo(resourceAdapterModuleName, messageListenerInterfaceName);
415     }
416
417     public GBeanData getAdminObjectInfo(ObjectName JavaDoc resourceAdapterModuleName, String JavaDoc adminObjectInterfaceName) throws DeploymentException {
418         GBeanData resourceModuleData = (GBeanData) resourceModuleDataMap.get(resourceAdapterModuleName);
419         if (resourceModuleData != null) {
420             Map JavaDoc adminObjectInfoMap = (Map JavaDoc) resourceModuleData.getAttribute("adminObjectInfoMap");
421             return (GBeanData) adminObjectInfoMap.get(adminObjectInterfaceName);
422         }
423         return resourceReferenceBuilder.locateAdminObjectInfo(resourceAdapterModuleName, adminObjectInterfaceName);
424     }
425
426     public GBeanData getConnectionFactoryInfo(ObjectName JavaDoc resourceAdapterModuleName, String JavaDoc connectionFactoryInterfaceName) throws DeploymentException {
427         GBeanData resourceModuleData = (GBeanData) resourceModuleDataMap.get(resourceAdapterModuleName);
428         if (resourceModuleData != null) {
429             Map JavaDoc managedConnectionFactoryInfoMap = (Map JavaDoc) resourceModuleData.getAttribute("managedConnectionFactoryInfoMap");
430             return (GBeanData) managedConnectionFactoryInfoMap.get(connectionFactoryInterfaceName);
431         }
432         return resourceReferenceBuilder.locateConnectionFactoryInfo(resourceAdapterModuleName, connectionFactoryInterfaceName);
433     }
434
435     public GBeanData getResourceAdapterModuleData(ObjectName JavaDoc resourceAdapterModuleName) {
436         return (GBeanData) resourceModuleDataMap.get(resourceAdapterModuleName);
437     }
438
439     public String JavaDoc getMEJBName() throws DeploymentException {
440         ObjectName JavaDoc query = null;
441         try {
442             query = ObjectName.getInstance("*:name=ejb/mgmt/MEJB,*");
443         } catch (MalformedObjectNameException JavaDoc e) {
444             throw new DeploymentException("We built this name...");
445         }
446         ObjectName JavaDoc mejbName = locateUniqueName(query, "Management EJB");
447         return mejbName.getCanonicalName();
448     }
449
450     private ObjectName JavaDoc locateUniqueName(ObjectName JavaDoc query, String JavaDoc type) throws DeploymentException {
451         Set JavaDoc names = kernel.listGBeans(query);
452         if (names.size() != 1) {
453             throw new DeploymentException("Unknown or ambiguous " + type + " name query: " + query + " match count: " + names.size());
454         }
455         return (ObjectName JavaDoc) names.iterator().next();
456     }
457
458 }
459
Popular Tags