001: /*
002: * The contents of this file are subject to the terms of the Common Development
003: * and Distribution License (the License). You may not use this file except in
004: * compliance with the License.
005: *
006: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007: * or http://www.netbeans.org/cddl.txt.
008: *
009: * When distributing Covered Code, include this CDDL Header Notice in each file
010: * and include the License file at http://www.netbeans.org/cddl.txt.
011: * If applicable, add the following below the CDDL Header, with the fields
012: * enclosed by brackets [] replaced by your own identifying information:
013: * "Portions Copyrighted [year] [name of copyright owner]"
014: *
015: * The Original Software is NetBeans. The Initial Developer of the Original
016: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017: * Microsystems, Inc. All Rights Reserved.
018: */
019: package org.netbeans.modules.xslt.tmap.model.impl;
020:
021: import java.util.Collection;
022: import java.util.LinkedList;
023: import java.util.List;
024: import java.util.concurrent.atomic.AtomicReference;
025: import org.netbeans.modules.xml.wsdl.model.Message;
026: import org.netbeans.modules.xml.wsdl.model.Operation;
027: import org.netbeans.modules.xml.wsdl.model.Part;
028: import org.netbeans.modules.xml.wsdl.model.PortType;
029: import org.netbeans.modules.xml.wsdl.model.ReferenceableWSDLComponent;
030: import org.netbeans.modules.xml.wsdl.model.WSDLModel;
031: import org.netbeans.modules.xml.wsdl.model.extensions.bpel.PartnerLinkType;
032: import org.netbeans.modules.xml.wsdl.model.extensions.bpel.Role;
033: import org.netbeans.modules.xml.xam.Component;
034: import org.netbeans.modules.xml.xam.Nameable;
035: import org.netbeans.modules.xml.xam.Reference;
036: import org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent;
037: import org.netbeans.modules.xml.xam.dom.Attribute;
038: import org.netbeans.modules.xml.xam.dom.NamedComponentReference;
039: import org.netbeans.modules.xslt.tmap.model.api.ExNamespaceContext;
040: import org.netbeans.modules.xslt.tmap.model.spi.ExternalModelRetriever;
041: import org.netbeans.modules.xslt.tmap.model.api.Param;
042: import org.netbeans.modules.xslt.tmap.model.api.PartnerLinkTypeReference;
043: import org.netbeans.modules.xslt.tmap.model.api.TMapComponent;
044: import org.netbeans.modules.xslt.tmap.model.api.TMapModel;
045: import org.netbeans.modules.xslt.tmap.model.api.Transform;
046: import org.netbeans.modules.xslt.tmap.model.api.Variable;
047: import org.netbeans.modules.xslt.tmap.model.api.VariableReference;
048: import org.netbeans.modules.xslt.tmap.model.api.WSDLReference;
049: import org.openide.util.Lookup;
050: import org.openide.util.Lookup.Result;
051:
052: /**
053: *
054: * @author Vitaly Bychkov
055: * @version 1.0
056: */
057: public class WSDLReferenceBuilder {
058:
059: private static final WSDLReferenceBuilder INSTANCE = new WSDLReferenceBuilder();
060: private static Collection<? extends ExternalModelRetriever> myRetrievers;
061: private Collection<WSDLReferenceFactory> myCollection;
062:
063: private WSDLReferenceBuilder() {
064: Result<ExternalModelRetriever> result = Lookup.getDefault()
065: .lookup(
066: new Lookup.Template<ExternalModelRetriever>(
067: ExternalModelRetriever.class));
068: myRetrievers = result.allInstances();
069:
070: myCollection = new LinkedList<WSDLReferenceFactory>();
071: myCollection.add(new PartnerLinkTypeResolver());
072: myCollection.add(new RoleResolver());
073: myCollection.add(new OperationResolver());
074: myCollection.add(new PartResolver());
075: }
076:
077: public static WSDLReferenceBuilder getInstance() {
078: return INSTANCE;
079: }
080:
081: public <T extends ReferenceableWSDLComponent> WSDLReference<T> build(
082: Class<T> clazz, TMapComponentAbstract entity, Attribute attr) {
083: WSDLReference<T> ref = build(clazz, entity, entity
084: .getAttribute(attr));
085: // TODO m | r
086: // if ( ref instanceof MappedReference ){
087: // ((MappedReference)ref).setAttribute( attr );
088: // }
089: return ref;
090: }
091:
092: public <T extends ReferenceableWSDLComponent> WSDLReference<T> build(
093: Class<T> clazz, AbstractDocumentComponent entity,
094: String refString) {
095: if (refString == null) {
096: return null;
097: }
098: for (WSDLReferenceFactory resolver : myCollection) {
099: if (resolver.isApplicable(clazz)) {
100: return resolver.createUnresolvedReference(clazz,
101: entity, refString);
102: }
103: }
104: return null;
105: }
106:
107: public <T extends ReferenceableWSDLComponent> WSDLReference<T> build(
108: T target, Class<T> clazz, AbstractDocumentComponent entity) {
109: for (WSDLReferenceFactory resolver : myCollection) {
110: if (resolver.isApplicable(clazz)) {
111: return resolver.create(target, clazz, entity);
112: }
113: }
114: return null;
115: }
116:
117: @SuppressWarnings("unchecked")
118: public AttributesType.AttrType getAttributeType(Attribute attr) {
119: Class clazz = null;
120: if (List.class.isAssignableFrom(attr.getType())) {
121: clazz = attr.getMemberType();
122: } else {
123: clazz = attr.getType();
124: }
125: for (WSDLReferenceFactory resolver : myCollection) {
126: if (resolver.isApplicable(clazz)) {
127: return resolver.getAttributeType();
128: }
129: }
130: assert false;
131: return null;
132: }
133:
134: // public void setAttribute( WSDLReference ref , Attribute attr ) {
135: // ref.setAttribute( attr );
136: // }
137:
138: static Collection<WSDLModel> getWSDLModels(
139: AbstractDocumentComponent entity, String prefix) {
140: assert entity instanceof TMapComponent;
141: ExNamespaceContext context = ((TMapComponent) entity)
142: .getNamespaceContext();
143: Collection<WSDLModel> models = getWSDLModels(
144: ((TMapComponent) entity).getModel(), context
145: .getNamespaceURI(prefix));
146: return models;
147: }
148:
149: static Collection<WSDLModel> getWSDLModels(TMapModel model,
150: String namespace) {
151: return getInstance().getModels(model, namespace);
152: }
153:
154: private Collection<WSDLModel> getModels(TMapModel model,
155: String namespace) {
156: Collection<WSDLModel> ret = new LinkedList<WSDLModel>();
157:
158: if (myRetrievers.size() == 1) {
159: return myRetrievers.iterator().next().getWSDLModels(model,
160: namespace);
161: }
162: for (ExternalModelRetriever retriever : myRetrievers) {
163: Collection<WSDLModel> collection = retriever.getWSDLModels(
164: model, namespace);
165: ret.addAll(collection);
166: }
167:
168: return ret;
169: }
170:
171: interface WSDLResolver {
172: <T extends ReferenceableWSDLComponent> T resolve(
173: AbstractNamedComponentReference<T> reference);
174: }
175:
176: //////
177: ///////*
178: ////// * Could be consider to do this as service spi and move impls declarations
179: ////// * into service file.
180: ////// */
181: //////
182: interface WSDLReferenceFactory extends
183: WSDLReferenceBuilder.WSDLResolver {
184:
185: <T extends ReferenceableWSDLComponent> boolean isApplicable(
186: Class<T> clazz);
187:
188: <T extends ReferenceableWSDLComponent> WSDLReference<T> create(
189: T target, Class<T> clazz,
190: AbstractDocumentComponent entity);
191:
192: <T extends ReferenceableWSDLComponent> WSDLReference<T> createUnresolvedReference(
193: Class<T> clazz, AbstractDocumentComponent entity,
194: String refString);
195:
196: <T extends ReferenceableWSDLComponent> WSDLReference<T> create(
197: T target, Class<T> clazz,
198: AbstractDocumentComponent entity, String refString);
199:
200: AttributesType.AttrType getAttributeType();
201:
202: }
203:
204: abstract class AbstractGlobalReferenceFactory implements
205: WSDLReferenceFactory {
206:
207: public <T extends ReferenceableWSDLComponent> WSDLReference<T> createUnresolvedReference(
208: Class<T> clazz, AbstractDocumentComponent entity,
209: String refString) {
210: return new GlobalWSDLReferenceImpl<T>(clazz, entity,
211: refString, this );
212: }
213:
214: public <T extends ReferenceableWSDLComponent> WSDLReference<T> create(
215: T target, Class<T> clazz,
216: AbstractDocumentComponent entity, String refString) {
217: return create(target, clazz, entity);
218: }
219:
220: public <T extends ReferenceableWSDLComponent> WSDLReference<T> create(
221: T target, Class<T> clazz,
222: AbstractDocumentComponent entity) {
223: return new GlobalWSDLReferenceImpl<T>(target, clazz,
224: entity, this );
225: }
226:
227: public AttributesType.AttrType getAttributeType() {
228: return AttributesType.AttrType.QNAME;
229: }
230: }
231:
232: /**
233: * This abstract class ONLY for Referenceable elements in WSDL that is Namable.
234: * For others one need to use another implementation.
235: *
236: * Actually curently WSDL don't have not Nameble refrenceable elements.
237: * @author ads
238: *
239: */
240: abstract class AbstractNamedReferenceFactory implements
241: WSDLReferenceFactory {
242:
243: public <T extends ReferenceableWSDLComponent> WSDLReference<T> createUnresolvedReference(
244: Class<T> clazz, AbstractDocumentComponent entity,
245: String refString) {
246: return new WSDLReferenceImpl<T>(null, clazz, entity,
247: refString, this );
248: }
249:
250: public <T extends ReferenceableWSDLComponent> WSDLReference<T> create(
251: T target, Class<T> clazz,
252: AbstractDocumentComponent entity, String refString) {
253: return new WSDLReferenceImpl<T>(target, clazz, entity,
254: refString, this );
255: }
256:
257: public <T extends ReferenceableWSDLComponent> WSDLReference<T> create(
258: T target, Class<T> clazz,
259: AbstractDocumentComponent entity) {
260: assert target instanceof Nameable;
261: return new WSDLReferenceImpl<T>(target, clazz, entity,
262: ((Nameable) target).getName(), this );
263: }
264:
265: public AttributesType.AttrType getAttributeType() {
266: return AttributesType.AttrType.NCNAME;
267: }
268: }
269:
270: class PartnerLinkTypeResolver extends
271: AbstractGlobalReferenceFactory {
272:
273: /* (non-Javadoc)
274: * @see org.netbeans.modules.xslt.tmap.model.impl.WSDLReferenceResolver#isApplicable(java.lang.Class)
275: */
276: public <T extends ReferenceableWSDLComponent> boolean isApplicable(
277: Class<T> clazz) {
278: return PartnerLinkType.class.isAssignableFrom(clazz);
279: }
280:
281: /* (non-Javadoc)
282: * @see org.netbeans.modules.xslt.tmap.model.impl.WSDLReferenceResolver#resolve(java.lang.Class, org.netbeans.modules.bpel.model.impl.AbstractDocumentComponent, java.lang.String)
283: */
284: public <T extends ReferenceableWSDLComponent> T resolve(
285: AbstractNamedComponentReference<T> reference) {
286: String refString = reference.getRefString();
287: Class<T> clazz = reference.getType();
288: AbstractDocumentComponent entity = (AbstractDocumentComponent) reference
289: .getParent();
290:
291: String[] splited = new String[2];
292:
293: splitQName(refString, splited);
294:
295: Collection<WSDLModel> models = WSDLReferenceBuilder
296: .getWSDLModels(entity, splited[0]);
297: for (WSDLModel model : models) {
298: List<PartnerLinkType> list = model
299: .getDefinitions()
300: .getExtensibilityElements(PartnerLinkType.class);
301: for (PartnerLinkType partnerLink : list) {
302: if (splited[1].equals(partnerLink.getName())) {
303: return clazz.cast(partnerLink);
304: }
305: }
306: }
307: return null;
308: }
309:
310: }
311:
312: class RoleResolver extends AbstractNamedReferenceFactory {
313:
314: /* (non-Javadoc)
315: * @see org.netbeans.modules.xslt.tmap.model.impl.WSDLReferenceResolver#isApplicable(java.lang.Class)
316: */
317: public <T extends ReferenceableWSDLComponent> boolean isApplicable(
318: Class<T> clazz) {
319: return Role.class.isAssignableFrom(clazz);
320: }
321:
322: public <T extends ReferenceableWSDLComponent> T resolve(
323: AbstractNamedComponentReference<T> reference) {
324: String refString = reference.getRefString();
325: Class<T> clazz = reference.getType();
326: AbstractDocumentComponent entity = (AbstractDocumentComponent) reference
327: .getParent();
328: assert entity instanceof PartnerLinkTypeReference;
329: WSDLReference<PartnerLinkType> pltRef = ((PartnerLinkTypeReference) entity)
330: .getPartnerLinkType();
331: if (pltRef == null) {
332: return null;
333: }
334: PartnerLinkType partnerLinkType = pltRef.get();
335: if (partnerLinkType == null) {
336: return null;
337: }
338: Role role = partnerLinkType.getRole1();
339: if (role != null && refString.equals(role.getName())) {
340: return clazz.cast(role);
341: }
342: role = partnerLinkType.getRole2();
343: if (role != null && refString.equals(role.getName())) {
344: return clazz.cast(role);
345: }
346: return null;
347: }
348:
349: // TODO m | r
350: ////// /* (non-Javadoc)
351: ////// * @see org.netbeans.modules.xslt.tmap.model.impl.WSDLReferenceResolver#resolve(java.lang.Class, org.netbeans.modules.bpel.model.impl.AbstractDocumentComponent, java.lang.String)
352: ////// */
353: ////// public <T extends ReferenceableWSDLComponent> T resolve(
354: ////// AbstractNamedComponentReference<T> reference )
355: ////// {
356: ////// String refString = reference.getRefString();
357: ////// Class<T> clazz = reference.getType();
358: ////// AbstractDocumentComponent entity = (AbstractDocumentComponent) reference
359: ////// .getParent();
360: ////// assert entity instanceof PartnerLink;
361: ////// WSDLReference<PartnerLinkType> ref =
362: ////// ((PartnerLink) entity).getPartnerLinkType();
363: ////// if (ref == null) {
364: ////// return null;
365: ////// }
366: ////// PartnerLinkType partnerLinkType = ref.get();
367: ////// if (partnerLinkType == null) {
368: ////// return null;
369: ////// }
370: ////// Role role = partnerLinkType.getRole1();
371: ////// if ( role!=null && refString.equals( role.getName()) ){
372: ////// return clazz.cast(role);
373: ////// }
374: ////// role = partnerLinkType.getRole2();
375: ////// if ( role!= null && refString.equals( role.getName()) ){
376: ////// return clazz.cast(role);
377: ////// }
378: ////// return null;
379: ////// }
380:
381: }
382:
383: class OperationResolver extends AbstractNamedReferenceFactory {
384:
385: /* (non-Javadoc)
386: * @see org.netbeans.modules.xslt.tmap.model.impl.WSDLReferenceResolver#isApplicable(java.lang.Class)
387: */
388: public <T extends ReferenceableWSDLComponent> boolean isApplicable(
389: Class<T> clazz) {
390: return Operation.class.isAssignableFrom(clazz);
391: }
392:
393: /* (non-Javadoc)
394: * @see org.netbeans.modules.xslt.tmap.model.impl.WSDLReferenceResolver#resolve(java.lang.Class, org.netbeans.modules.bpel.model.impl.AbstractDocumentComponent, java.lang.String)
395: */
396: public <T extends ReferenceableWSDLComponent> T resolve(
397: AbstractNamedComponentReference<T> reference) {
398: String refString = reference.getRefString();
399: Class<T> clazz = reference.getType();
400:
401: AbstractDocumentComponent entity = (AbstractDocumentComponent) reference
402: .getParent();
403:
404: Collection<Operation> collection = null;
405:
406: if (entity instanceof org.netbeans.modules.xslt.tmap.model.api.Operation) {
407: collection = resolveByTransformOperation(entity);
408: }
409:
410: if (entity instanceof PartnerLinkTypeReference) {
411: collection = resolveByPartnerLink(entity);
412: // ((PartnerLinkTypeReference)entity)
413: }
414:
415: // if (entity instanceof PortTypeReference) {
416: // collection = resolveByPortType(entity);
417: // }
418:
419: //// if ( collection == null || collection.size()==0 ) {
420: //// collection = resolveByPartnerLink(entity);
421: //// }
422: ////
423: if (collection == null) {
424: return null;
425: }
426: for (Operation operation : collection) {
427: if (refString.equals(operation.getName())) {
428: return clazz.cast(operation);
429: }
430: }
431: return null;
432: }
433:
434: private Collection<Operation> resolveByTransformOperation(
435: AbstractDocumentComponent entity) {
436: Component parent = entity == null ? null : entity
437: .getParent();
438: if (parent == null) {
439: return null;
440: }
441:
442: assert parent instanceof AbstractDocumentComponent;
443: return resolveByPartnerLink((AbstractDocumentComponent) parent);
444: }
445:
446: private Collection<Operation> resolveByPartnerLink(
447: AbstractDocumentComponent entity) {
448: if (!(entity instanceof PartnerLinkTypeReference)) {
449: return null;
450: }
451: Collection<Operation> collection;
452: // WSDLReference<PartnerLinkType> ref = (( PartnerLinkTypeReference)entity ).
453: // getPartnerLinkType();
454:
455: WSDLReference<Role> refRole = ((PartnerLinkTypeReference) entity)
456: .getRole();
457:
458: Role role = null;
459: if (refRole != null) {
460: role = refRole.get();
461: }
462:
463: PortType wsdlPortType = null;
464: if (role != null) {
465: NamedComponentReference<PortType> portTypeRef = role
466: .getPortType();
467: if (portTypeRef != null) {
468: wsdlPortType = portTypeRef.get();
469: }
470: }
471:
472: if (wsdlPortType == null) {
473: return null;
474: }
475: collection = wsdlPortType.getOperations();
476: return collection;
477: }
478:
479: //// private Collection<Operation> resolveByPortType(
480: //// AbstractDocumentComponent entity )
481: //// {
482: //// Collection<Operation> collection;
483: //// WSDLReference<PortType> ref = ((PortTypeReference) entity)
484: //// .getPortType();
485: //// if (ref == null) {
486: //// return null;
487: //// }
488: //// PortType portType = ref.get();
489: //// if (portType == null) {
490: //// return null;
491: //// }
492: //// collection = portType.getOperations();
493: //// return collection;
494: //// }
495: }
496:
497: class PartResolver extends AbstractGlobalReferenceFactory {
498:
499: /* (non-Javadoc)
500: * @see org.netbeans.modules.xslt.tmap.model.impl.WSDLReferenceResolver#isApplicable(java.lang.Class)
501: */
502: public <T extends ReferenceableWSDLComponent> boolean isApplicable(
503: Class<T> clazz) {
504: return Part.class.isAssignableFrom(clazz);
505: }
506:
507: /* (non-Javadoc)
508: * @see org.netbeans.modules.xslt.tmap.model.impl.WSDLReferenceResolver#resolve(java.lang.Class, org.netbeans.modules.bpel.model.impl.AbstractDocumentComponent, java.lang.String)
509: */
510: public <T extends ReferenceableWSDLComponent> T resolve(
511: AbstractNamedComponentReference<T> reference) {
512: String refString = reference.getRefString();
513: Class<T> clazz = reference.getType();
514: AbstractDocumentComponent parentComponent = reference
515: .getParent();
516:
517: Part part = null;
518: if (parentComponent instanceof Transform) {
519: part = resolveByTransform(parentComponent, refString);
520: }
521:
522: if (parentComponent instanceof Param) {
523: part = resolveByParam(parentComponent, refString);
524: }
525: return part != null ? clazz.cast(part) : null;
526: }
527:
528: private Part resolveByParam(
529: AbstractDocumentComponent component, String refStr) {
530: if (!(component instanceof Param) || refStr == null) {
531: return null;
532: }
533:
534: return resolveByVarRef(((Param) component)
535: .getVariableReference(), refStr);
536: }
537:
538: private Part resolveByTransform(
539: AbstractDocumentComponent component, String refStr) {
540: if (!(component instanceof Transform) || refStr == null) {
541: return null;
542: }
543:
544: VariableReference varRef = ((Transform) component)
545: .getResult();
546: if (varRef == null || !refStr.equals(varRef.getRefString())) {
547: varRef = ((Transform) component).getSource();
548: }
549: if (!refStr.equals(varRef.getRefString())) {
550: return null;
551: }
552:
553: return resolveByVarRef(varRef, refStr);
554: }
555:
556: private Part resolveByVarRef(VariableReference varRef,
557: String refStr) {
558: if (varRef == null) {
559: return null;
560: }
561:
562: Part part = null;
563:
564: Variable var = varRef == null ? null : varRef
565: .getReferencedVariable();
566: Message message = null;
567: if (var != null) {
568: Reference<Message> messageRef = var.getMessage();
569: message = messageRef == null ? null : messageRef.get();
570: }
571:
572: Collection<Part> parts = null;
573: if (message != null) {
574: parts = message.getParts();
575: }
576:
577: String partRefStr = VariableReferenceImpl
578: .getPartName(refStr);
579: if (parts != null && partRefStr != null) {
580: for (Part partElem : parts) {
581: if (partElem != null
582: && partRefStr.equals(partElem.getName())) {
583: part = partElem;
584: break;
585: }
586: }
587: }
588:
589: return part;
590: }
591: }
592:
593: //////
594: //////class OperationResolver extends AbstractNamedReferenceFactory {
595: //////
596: ////// /* (non-Javadoc)
597: ////// * @see org.netbeans.modules.xslt.tmap.model.impl.WSDLReferenceResolver#isApplicable(java.lang.Class)
598: ////// */
599: ////// public <T extends ReferenceableWSDLComponent> boolean isApplicable(
600: ////// Class<T> clazz )
601: ////// {
602: ////// return Operation.class.isAssignableFrom(clazz);
603: ////// }
604: //////
605: ////// /* (non-Javadoc)
606: ////// * @see org.netbeans.modules.xslt.tmap.model.impl.WSDLReferenceResolver#resolve(java.lang.Class, org.netbeans.modules.bpel.model.impl.AbstractDocumentComponent, java.lang.String)
607: ////// */
608: ////// public <T extends ReferenceableWSDLComponent> T resolve(
609: ////// AbstractNamedComponentReference<T> reference )
610: ////// {
611: ////// String refString = reference.getRefString();
612: ////// Class<T> clazz = reference.getType();
613: ////// AbstractDocumentComponent entity = (AbstractDocumentComponent) reference
614: ////// .getParent();
615: //////
616: ////// Collection<Operation> collection = null;
617: ////// if (entity instanceof PortTypeReference) {
618: ////// collection = resolveByPortType(entity);
619: ////// }
620: //////
621: ////// if ( collection == null || collection.size()==0 ) {
622: ////// collection = resolveByPartnerLink(entity);
623: ////// }
624: //////
625: ////// if ( collection == null ){
626: ////// return null;
627: ////// }
628: ////// for (Operation operation : collection) {
629: ////// if ( refString.equals( operation.getName()) ){
630: ////// return clazz.cast(operation);
631: ////// }
632: ////// }
633: ////// return null;
634: ////// }
635: //////
636: ////// private Collection<Operation> resolveByPartnerLink(
637: ////// AbstractDocumentComponent entity )
638: ////// {
639: ////// if ( ! (entity instanceof PartnerLinkReference) ){
640: ////// return null;
641: ////// }
642: ////// Collection<Operation> collection;
643: ////// BpelReference<PartnerLink> ref = (( PartnerLinkReference )entity ).
644: ////// getPartnerLink();
645: //////
646: ////// NamedComponentReference<PortType> portTypeRef =
647: ////// Utils.getPortTypeRef( ref , entity );
648: ////// if ( portTypeRef == null ){
649: ////// return null;
650: ////// }
651: ////// PortType wsdlPortType = portTypeRef.get();
652: ////// if ( wsdlPortType == null ){
653: ////// return null;
654: ////// }
655: ////// collection = wsdlPortType.getOperations();
656: ////// return collection;
657: ////// }
658: //////
659: ////// private Collection<Operation> resolveByPortType(
660: ////// AbstractDocumentComponent entity )
661: ////// {
662: ////// Collection<Operation> collection;
663: ////// WSDLReference<PortType> ref = ((PortTypeReference) entity)
664: ////// .getPortType();
665: ////// if (ref == null) {
666: ////// return null;
667: ////// }
668: ////// PortType portType = ref.get();
669: ////// if (portType == null) {
670: ////// return null;
671: ////// }
672: ////// collection = portType.getOperations();
673: ////// return collection;
674: ////// }
675:
676: public static void splitQName(String qName, String[] result) {
677: assert qName != null;
678: assert result != null;
679: String[] parts = qName.split(":"); //NOI18N
680: String prefix;
681: String localName;
682: if (parts.length == 2) {
683: prefix = parts[0];
684: localName = parts[1];
685: } else {
686: prefix = null;
687: localName = parts[0];
688: }
689: if (result.length > 0) {
690: result[0] = prefix;
691: }
692: if (result.length > 1) {
693: result[1] = localName;
694: }
695: }
696:
697: }
|