KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdl > ui > actions > NameGenerator


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 /*
21  * Created on May 18, 2005
22  *
23  * To change the template for this generated file go to
24  * Window - Preferences - Java - Code Generation - Code and Comments
25  */

26 package org.netbeans.modules.xml.wsdl.ui.actions;
27
28 import java.util.Collection JavaDoc;
29 import java.util.HashSet JavaDoc;
30 import java.util.Iterator JavaDoc;
31 import java.util.List JavaDoc;
32 import java.util.Set JavaDoc;
33
34 import javax.xml.namespace.QName JavaDoc;
35
36 import org.netbeans.api.project.FileOwnerQuery;
37 import org.netbeans.api.project.Project;
38 import org.netbeans.api.project.ProjectInformation;
39 import org.netbeans.api.project.ProjectUtils;
40 import org.netbeans.modules.xml.wsdl.model.Binding;
41 import org.netbeans.modules.xml.wsdl.model.BindingFault;
42 import org.netbeans.modules.xml.wsdl.model.BindingOperation;
43 import org.netbeans.modules.xml.wsdl.model.Definitions;
44 import org.netbeans.modules.xml.wsdl.model.ExtensibilityElement;
45 import org.netbeans.modules.xml.wsdl.model.Fault;
46 import org.netbeans.modules.xml.wsdl.model.Input;
47 import org.netbeans.modules.xml.wsdl.model.Message;
48 import org.netbeans.modules.xml.wsdl.model.Operation;
49 import org.netbeans.modules.xml.wsdl.model.Output;
50 import org.netbeans.modules.xml.wsdl.model.Part;
51 import org.netbeans.modules.xml.wsdl.model.Port;
52 import org.netbeans.modules.xml.wsdl.model.PortType;
53 import org.netbeans.modules.xml.wsdl.model.Service;
54 import org.netbeans.modules.xml.wsdl.model.WSDLComponent;
55 import org.netbeans.modules.xml.wsdl.model.WSDLModel;
56 import org.netbeans.modules.xml.wsdl.ui.netbeans.module.Utility;
57 import org.netbeans.modules.xml.wsdl.ui.netbeans.module.WSDLDataObject;
58 import org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent;
59 import org.openide.util.NbBundle;
60 import org.w3c.dom.Attr JavaDoc;
61 import org.w3c.dom.NamedNodeMap JavaDoc;
62
63
64 /**
65  * @author radval
66  *
67  * To change the template for this generated type comment go to
68  * Window - Preferences - Java - Code Generation - Code and Comments
69  */

70 public class NameGenerator {
71     
72     private static NameGenerator mInstance;
73     
74     private static final String JavaDoc MESSAGE_NAME_PREFIX = NbBundle.getMessage(NameGenerator.class, "NameGenerator_MESSAGE_PREFIX") ;
75     
76     private static final String JavaDoc MESSAGE_PART_NAME_PREFIX = NbBundle.getMessage(NameGenerator.class, "NameGenerator_PART_PREFIX") ;
77     
78     private static final String JavaDoc PORTTYPE_NAME_PREFIX = NbBundle.getMessage(NameGenerator.class, "NameGenerator_PORTTYPE_PREFIX") ;
79     
80     private static final String JavaDoc OPERATION_NAME_PREFIX = NbBundle.getMessage(NameGenerator.class, "NameGenerator_OPERATION_PREFIX") ;
81     
82     private static final String JavaDoc OPERATION_INPUT_NAME_PREFIX = NbBundle.getMessage(NameGenerator.class, "NameGenerator_INPUT") ;
83     
84     private static final String JavaDoc OPERATION_OUTPUT_NAME_PREFIX = NbBundle.getMessage(NameGenerator.class, "NameGenerator_OUTPUT") ;
85     
86     private static final String JavaDoc OPERATION_FAULT_NAME_PREFIX = NbBundle.getMessage(NameGenerator.class, "NameGenerator_FAULT_PREFIX") ;
87     
88     private static final String JavaDoc BINDING_NAME_PREFIX = NbBundle.getMessage(NameGenerator.class, "NameGenerator_BINDING_PREFIX") ;
89     
90     private static final String JavaDoc BINDING_OPERATION_FAULT_NAME_PREFIX = NbBundle.getMessage(NameGenerator.class, "NameGenerator_BINDING_OPERATION_FAULT_PREFIX") ;
91     
92     private static final String JavaDoc SERVICE_NAME_PREFIX = NbBundle.getMessage(NameGenerator.class, "NameGenerator_SERVICE_PREFIX") ;
93     
94     private static final String JavaDoc PORT_NAME_PREFIX = NbBundle.getMessage(NameGenerator.class, "NameGenerator_PORT_PREFIX") ;
95     
96     private static int counterStart = 1;
97     
98     private NameGenerator() {
99         
100     }
101     
102     public static NameGenerator getInstance() {
103         if(mInstance == null) {
104             mInstance = new NameGenerator();
105         }
106     
107         return mInstance;
108     }
109     
110     public String JavaDoc generateUniqueMessageName(WSDLModel document) {
111         int counter = counterStart;
112         String JavaDoc messageName = MESSAGE_NAME_PREFIX + counter;
113         while(isMessageExists(messageName, document)) {
114             counter++;
115             messageName = MESSAGE_NAME_PREFIX + counter;
116         }
117         
118         return messageName;
119     }
120     
121     public String JavaDoc generateUniqueInputMessageName(String JavaDoc operationName, WSDLModel document) {
122         int counter = counterStart;
123         String JavaDoc messageName = operationName + "Request";
124         while(isMessageExists(messageName, document)) {
125             messageName = messageName + counter;
126             counter++;
127         }
128         
129         return messageName;
130     }
131     
132     public String JavaDoc generateUniqueOutputMessageName(String JavaDoc operationName, WSDLModel document) {
133         int counter = counterStart;
134         String JavaDoc messageName = operationName + "Reply";
135         while(isMessageExists(messageName, document)) {
136             messageName = messageName + counter;
137             counter++;
138         }
139         
140         return messageName;
141     }
142     
143     public String JavaDoc generateUniqueFaultMessageName(String JavaDoc operationName, WSDLModel document) {
144         int counter = counterStart;
145         String JavaDoc messageName = operationName + "Fault";
146         while(isMessageExists(messageName, document)) {
147             messageName = messageName + counter;
148             counter++;
149         }
150         
151         return messageName;
152     }
153     
154     public boolean isMessageExists(String JavaDoc name, WSDLModel document) {
155         boolean exists = false;
156         Collection JavaDoc messages = document.getDefinitions().getMessages();
157         
158         Iterator JavaDoc it = messages.iterator();
159         while(it.hasNext()) {
160             Message message = (Message) it.next();
161             if(name.equals(message.getName())) {
162                 exists = true;
163                 break;
164             }
165         }
166         
167         return exists;
168     }
169     
170     public String JavaDoc generateUniqueMessagePartName(Message message) {
171         int counter = counterStart;
172         String JavaDoc messagePartName = MESSAGE_PART_NAME_PREFIX + counter;
173         
174         while(isMessagePartExists(messagePartName, message)) {
175             counter++;
176             messagePartName = MESSAGE_PART_NAME_PREFIX + counter;
177         }
178         
179         return messagePartName;
180     }
181     
182     public boolean isMessagePartExists(String JavaDoc name, Message message) {
183         boolean exists = false;
184         Collection JavaDoc parts = message.getParts();
185         
186         Iterator JavaDoc it = parts.iterator();
187         while(it.hasNext()) {
188             Part part = (Part) it.next();
189             if(name.equals(part.getName())) {
190                 exists = true;
191                 break;
192             }
193         }
194         
195         return exists;
196     }
197     
198     public String JavaDoc generateUniquePortTypeName(WSDLModel document) {
199         int counter = counterStart;
200         String JavaDoc messageName = PORTTYPE_NAME_PREFIX + counter;
201         
202         while(isPortTypeExists(messageName, document)) {
203             counter++;
204             messageName = PORTTYPE_NAME_PREFIX + counter;
205         }
206         
207         return messageName;
208     }
209     
210     public String JavaDoc generateUniquePortTypeName(WSDLModel document, String JavaDoc portTypePrefix) {
211         int counter = counterStart;
212         String JavaDoc portTypeName = portTypePrefix;
213         
214         while(isPortTypeExists(portTypeName, document)) {
215             portTypeName = portTypePrefix + counter;
216             counter++;
217         }
218         
219         return portTypeName;
220     }
221     
222     public boolean isPortTypeExists(String JavaDoc name, WSDLModel document) {
223         boolean exists = false;
224         Collection JavaDoc portTypes = document.getDefinitions().getPortTypes();
225         
226         Iterator JavaDoc it = portTypes.iterator();
227         while(it.hasNext()) {
228             PortType portType = (PortType) it.next();
229             if(name.equals(portType.getName())) {
230                 exists = true;
231                 break;
232             }
233         }
234         
235         return exists;
236     }
237     
238     public String JavaDoc generateUniqueOperationName(PortType portType) {
239         int counter = counterStart;
240         String JavaDoc messageName = OPERATION_NAME_PREFIX + counter;
241         while(isOperationExists(messageName, portType)) {
242             counter++;
243             messageName = OPERATION_NAME_PREFIX + counter;
244         }
245         
246         return messageName;
247     }
248     
249     public boolean isOperationExists(String JavaDoc name, PortType portType) {
250         boolean exists = false;
251         Collection JavaDoc operations = portType.getOperations();
252         
253         Iterator JavaDoc it = operations.iterator();
254         while(it.hasNext()) {
255             Operation operation = (Operation) it.next();
256             if(name.equals(operation.getName())) {
257                 exists = true;
258                 break;
259             }
260         }
261         
262         return exists;
263     }
264     
265     public String JavaDoc generateUniqueOperationInputName(Operation operation) {
266         Set JavaDoc inputNames = getAllInputs(operation);
267         int counter = counterStart;
268         String JavaDoc operationInputName = OPERATION_INPUT_NAME_PREFIX + counter;
269         while(inputNames.contains(operationInputName)) {
270             counter++;
271             operationInputName = OPERATION_INPUT_NAME_PREFIX + counter;
272         }
273         return operationInputName;
274     }
275     
276     public Set JavaDoc<String JavaDoc> getAllInputs(Operation operation) {
277         Set JavaDoc<String JavaDoc> hashSet = new HashSet JavaDoc<String JavaDoc>();
278         PortType portType = (PortType) operation.getParent();
279         Collection JavaDoc operations = portType.getOperations();
280         if (operations != null) {
281             Iterator JavaDoc operIter = operations.iterator();
282             while (operIter.hasNext()) {
283                 Operation oper = (Operation) operIter.next();
284                 if (oper.getInput() != null) {
285                     hashSet.add(oper.getInput().getName());
286                 }
287             }
288         }
289         return hashSet;
290     }
291     
292     public boolean isOperationInputExists(Operation operation) {
293         boolean exists = false;
294         
295         
296         Input operationInput = operation.getInput();
297         
298         if(operationInput != null) {
299             exists = true;
300         }
301         return exists;
302     }
303     
304     public String JavaDoc generateUniqueOperationOutputName(Operation operation) {
305         Set JavaDoc outputNames = getAllOutputs(operation);
306         int counter = counterStart;
307         String JavaDoc operationOutputName = OPERATION_OUTPUT_NAME_PREFIX + counter;
308         while(outputNames.contains(operationOutputName)) {
309             counter++;
310             operationOutputName = OPERATION_OUTPUT_NAME_PREFIX + counter;
311         }
312         return operationOutputName;
313     }
314     
315     public Set JavaDoc<String JavaDoc> getAllOutputs(Operation operation) {
316         Set JavaDoc<String JavaDoc> hashSet = new HashSet JavaDoc<String JavaDoc>();
317         PortType portType = (PortType) operation.getParent();
318         Collection JavaDoc operations = portType.getOperations();
319         if (operations != null) {
320             Iterator JavaDoc operIter = operations.iterator();
321             while (operIter.hasNext()) {
322                 Operation oper = (Operation) operIter.next();
323                 if (oper.getOutput() != null) {
324                     hashSet.add(oper.getOutput().getName());
325                 }
326             }
327         }
328         return hashSet;
329     }
330     
331     public boolean isOperationOutputExists(Operation operation) {
332         boolean exists = false;
333         Output operationOutput = operation.getOutput();
334         
335         if(operationOutput != null) {
336             exists = true;
337         }
338         return exists;
339     }
340     
341     public String JavaDoc generateUniqueOperationFaultName(Operation operation) {
342         int counter = counterStart;
343         String JavaDoc messageName = OPERATION_FAULT_NAME_PREFIX + counter;
344         while(isOperationFaultExists(messageName, operation)) {
345             counter++;
346             messageName = OPERATION_FAULT_NAME_PREFIX + counter;
347         }
348         
349         return messageName;
350     }
351     
352     private boolean isOperationFaultExists(String JavaDoc name, Operation operation) {
353         boolean exists = false;
354         Collection JavaDoc faults = operation.getFaults();
355         
356         Iterator JavaDoc it = faults.iterator();
357         while(it.hasNext()) {
358             Fault fault = (Fault) it.next();
359             if(name.equals(fault.getName())) {
360                 exists = true;
361                 break;
362             }
363         }
364         
365         return exists;
366     }
367     
368     public String JavaDoc generateUniqueBindingName(WSDLModel document) {
369         int counter = counterStart;
370         String JavaDoc messageName = BINDING_NAME_PREFIX + counter;
371         while(isBindingExists(messageName, document)) {
372             counter++;
373             messageName = BINDING_NAME_PREFIX + counter;
374         }
375         
376         return messageName;
377     }
378     
379     public String JavaDoc generateUniqueBindingName(WSDLModel document, String JavaDoc appendage) {
380         int counter = counterStart;
381         String JavaDoc prefix = BINDING_NAME_PREFIX + "_" + appendage;
382         String JavaDoc messageName = prefix + counter;
383         while(isBindingExists(messageName, document)) {
384             counter++;
385             messageName = BINDING_NAME_PREFIX + counter;
386         }
387         
388         return messageName;
389     }
390     
391     public String JavaDoc generateUniqueBindingName(String JavaDoc prefix, WSDLModel document) {
392         if (prefix == null) {
393             return generateUniqueBindingName(document);
394         }
395         int counter = counterStart;
396         String JavaDoc messageName = prefix + counter;
397         while(isBindingExists(messageName, document)) {
398             counter++;
399             messageName = BINDING_NAME_PREFIX + counter;
400         }
401         
402         return messageName;
403     }
404     
405     public boolean isBindingExists(String JavaDoc name, WSDLModel document) {
406         boolean exists = false;
407         Collection JavaDoc bindings = document.getDefinitions().getBindings();
408         
409         Iterator JavaDoc it = bindings.iterator();
410         while(it.hasNext()) {
411             Binding binding = (Binding) it.next();
412             if(name.equals(binding.getName())) {
413                 exists = true;
414                 break;
415             }
416         }
417         
418         return exists;
419     }
420     
421     
422     public String JavaDoc generateUniqueBindingOperationFaultName(BindingOperation bo) {
423         int counter = counterStart;
424         String JavaDoc faultName = BINDING_OPERATION_FAULT_NAME_PREFIX + counter;
425         while(isBindingOperationFaultExists(faultName, bo)) {
426             counter++;
427             faultName = BINDING_OPERATION_FAULT_NAME_PREFIX + counter;
428         }
429         
430         return faultName;
431     }
432     
433     public boolean isBindingOperationFaultExists(String JavaDoc name, BindingOperation bo) {
434         boolean exists = false;
435         Collection JavaDoc faults = bo.getBindingFaults();
436         
437         Iterator JavaDoc it = faults.iterator();
438         while(it.hasNext()) {
439             BindingFault bindingFault = (BindingFault) it.next();
440             if(name.equals(bindingFault.getName())) {
441                 exists = true;
442                 break;
443             }
444         }
445         
446         return exists;
447     }
448     
449     public String JavaDoc generateUniqueServiceName(WSDLModel document) {
450         int counter = counterStart;
451         String JavaDoc messageName = SERVICE_NAME_PREFIX + counter;
452         while(isServiceExists(messageName, document)) {
453             counter++;
454             messageName = SERVICE_NAME_PREFIX + counter;
455         }
456         
457         return messageName;
458     }
459     
460     public boolean isServiceExists(String JavaDoc name, WSDLModel document) {
461         boolean exists = false;
462         Collection JavaDoc services = document.getDefinitions().getServices();
463         
464         Iterator JavaDoc it = services.iterator();
465         while(it.hasNext()) {
466             Service service = (Service) it.next();
467             if(name.equals(service.getName())) {
468                 exists = true;
469                 break;
470             }
471         }
472         
473         return exists;
474     }
475     
476     public String JavaDoc generateUniqueServicePortName(Service service) {
477         int counter = counterStart;
478         String JavaDoc messageName = PORT_NAME_PREFIX + counter;
479         while(isServicePortExists(messageName, service)) {
480             counter++;
481             messageName = PORT_NAME_PREFIX + counter;
482         }
483         
484         return messageName;
485     }
486     
487     public String JavaDoc generateUniqueServicePortName(String JavaDoc prefix, Service service) {
488         int counter = counterStart;
489         String JavaDoc messageName = prefix + counter;
490         while(isServicePortExists(messageName, service)) {
491             counter++;
492             messageName = prefix + counter;
493         }
494         
495         return messageName;
496     }
497     
498     public boolean isServicePortExists(String JavaDoc name, Service service) {
499         boolean exists = false;
500         Collection JavaDoc ports = service.getPorts();
501         
502         Iterator JavaDoc it = ports.iterator();
503         while(it.hasNext()) {
504             Port port = (Port) it.next();
505             if(name.equals(port.getName())) {
506                 exists = true;
507                 break;
508             }
509         }
510         
511         return exists;
512     }
513
514     public String JavaDoc generateNamespacePrefix(String JavaDoc optionalPrefixNameString, WSDLComponent element) {
515         return generateNamespacePrefix(optionalPrefixNameString, element.getModel());
516     }
517
518     /**
519      * Generate a unique namespace prefix for the given model. This is
520      * the same as generateNamespacePrefix(String, WSDLModel, int) with
521      * a value of zero for the counter parameter.
522      *
523      * @param prefix the desired prefix for the namespace prefix;
524      * if null, a default of "ns" will be used.
525      * @param model model in which to find unique prefix.
526      * @return the unique namespace prefix (e.g. "ns0").
527      */

528     public String JavaDoc generateNamespacePrefix(String JavaDoc prefix, WSDLModel model) {
529         return generateNamespacePrefix(prefix, model, 0);
530     }
531
532     /**
533      * Generate a unique namespace prefix for the given model.
534      *
535      * @param prefix the desired prefix for the namespace prefix;
536      * if null, a default of "ns" will be used.
537      * @param model model in which to find unique prefix.
538      * @param counter minimum number to use as suffix (results in a
539      * prefix such as "ns" plus the value of counter).
540      * @return the unique namespace prefix (e.g. "ns0").
541      */

542     public String JavaDoc generateNamespacePrefix(String JavaDoc prefix, WSDLModel model,
543             int counter) {
544         if (prefix == null) {
545             prefix = NbBundle.getMessage(NameGenerator.class,
546                     "NameGenerator_DEFAULT_PREFIX");
547         }
548         String JavaDoc generated = prefix + counter;
549         while (isPrefixExist(generated, model)) {
550             counter++;
551             generated = prefix + counter;
552         }
553         return generated;
554     }
555
556     public boolean isPrefixExist(String JavaDoc prefix, WSDLModel model) {
557         return Utility.getNamespaceURI(prefix, model) != null ? true : false;
558     }
559     
560     public boolean isAttributeExists(String JavaDoc attrQName, WSDLComponent element) {
561         if(attrQName == null) {
562             return false;
563         }
564         
565         boolean result = false;
566         
567         
568         /*XMLAttribute[]*/////.getXmlAttributes();*/
569
NamedNodeMap JavaDoc attrs = ((AbstractDocumentComponent) element).getPeer().getAttributes();
570         //Collection attrs = element.getChildren(Attribute.class);
571

572         if(attrs != null) {
573             for (int i = 0; i < attrs.getLength();i++) {
574                 Attr JavaDoc attr = (Attr JavaDoc) attrs.item(i);
575                 if(attrQName.equals(attr.getName())) { //TODO:SKINIgetQualifiedName())) {
576
return true;
577                 }
578                 
579             }
580         }
581         
582 /* TODO:SKINI
583          Map otherAttrMap = element.getOtherAttributes();
584         if(otherAttrMap != null) {
585             if(otherAttrMap.get(attrQName) != null) {
586                 result = true;
587             }
588         }*/

589         
590         
591         return result;
592         
593     }
594     
595     public static String JavaDoc createNewTargetNamespace (WSDLModel model, WSDLDataObject dObj) {
596         Definitions definitions = model.getDefinitions();
597         
598         String JavaDoc targetNamespaceStr = null;
599
600             StringBuffer JavaDoc targetNamespace = new StringBuffer JavaDoc("http://localhost/");
601
602             Project project = FileOwnerQuery.getOwner(dObj.getPrimaryFile());
603             if(project != null) {
604                     ProjectInformation pi = ProjectUtils.getInformation(project);
605                     if(pi != null) {
606                             targetNamespace.append(pi.getDisplayName());
607                             targetNamespace.append("/");
608                     }
609             }
610
611             targetNamespace.append(dObj.getName());
612             targetNamespaceStr = targetNamespace.toString();
613             
614         
615         return targetNamespaceStr;
616     }
617     
618     
619     public static String JavaDoc generateUniqueValueForKeyAttribute(WSDLComponent component, String JavaDoc attributeName, QName JavaDoc qname, String JavaDoc prefix) {
620         WSDLComponent parent = component.getParent();
621         HashSet JavaDoc<String JavaDoc> set = new HashSet JavaDoc<String JavaDoc>();
622         List JavaDoc<ExtensibilityElement> list = parent.getExtensibilityElements();
623         if (list != null) {
624             for (ExtensibilityElement element : list) {
625                 if (element.getQName().equals(qname) && element != component) {
626                     if (element.getAttribute(attributeName) != null) {
627                         set.add(element.getAttribute(attributeName));
628                     }
629                 }
630             }
631         }
632         
633         int counter = counterStart;
634         String JavaDoc messageName = prefix + counter;
635         while(set.contains(messageName)) {
636             counter++;
637             messageName = prefix + counter;
638         }
639         
640         return messageName;
641     }
642     
643     public static String JavaDoc generateUniquePartnerLinkType(String JavaDoc partnerLinkTypeNamePrefix, QName JavaDoc partnerLinkTypeElementQName, WSDLModel document) {
644         int counter = counterStart;
645         String JavaDoc partnerLinkTypeName = null;
646         if (partnerLinkTypeNamePrefix == null)
647             partnerLinkTypeNamePrefix = "new";
648         
649         String JavaDoc partnerLinkType = partnerLinkTypeNamePrefix + counter;
650         partnerLinkTypeName = partnerLinkType;
651         while(isParterLinkTypeExists(partnerLinkTypeName, partnerLinkTypeElementQName, document)) {
652             counter++;
653             partnerLinkTypeName = partnerLinkType + counter;
654         }
655         
656         return partnerLinkTypeName;
657     }
658     
659     private static boolean isParterLinkTypeExists(String JavaDoc partnerLinkTypeName, QName JavaDoc partnerLinkTypeElementQName, WSDLModel document) {
660         return findExtensibilityElementByQName(partnerLinkTypeName, partnerLinkTypeElementQName, document.getDefinitions()) != null;
661     }
662     
663     private static WSDLComponent findExtensibilityElementByQName(String JavaDoc name, QName JavaDoc elementQName, WSDLComponent component) {
664         if(name == null || elementQName == null || elementQName.getNamespaceURI() == null || elementQName.getLocalPart() == null || component == null) {
665             return null;
666         }
667     
668         List JavaDoc<ExtensibilityElement> elements = component.getExtensibilityElements();
669         Iterator JavaDoc<ExtensibilityElement> it = elements.iterator();
670         
671         while(it.hasNext()) {
672             ExtensibilityElement ee = it.next();
673             QName JavaDoc eeQName = ee.getQName();
674             String JavaDoc eeNamespace = eeQName.getNamespaceURI();
675             String JavaDoc eeLocalPart = eeQName.getLocalPart();
676             
677             if(elementQName.getNamespaceURI().equals(eeNamespace) && elementQName.getLocalPart().equals(eeLocalPart)) {
678                 String JavaDoc eeName = ee.getAttribute("name");
679                 if(eeName != null && eeName.equals(name)) {
680                     return ee;
681                 }
682             }
683         }
684         
685         return null;
686     }
687 }
688
Popular Tags