KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdl > model > impl > WSDLComponentFactoryImpl


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-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.xml.wsdl.model.impl;
21
22 import javax.xml.namespace.QName JavaDoc;
23 import org.netbeans.modules.xml.wsdl.model.*;
24 import org.netbeans.modules.xml.wsdl.model.extensions.soap.SOAPAddress;
25 import org.netbeans.modules.xml.wsdl.model.extensions.soap.SOAPBinding;
26 import org.netbeans.modules.xml.wsdl.model.extensions.soap.SOAPBody;
27 import org.netbeans.modules.xml.wsdl.model.extensions.soap.SOAPFault;
28 import org.netbeans.modules.xml.wsdl.model.extensions.soap.SOAPHeader;
29 import org.netbeans.modules.xml.wsdl.model.extensions.soap.SOAPHeaderFault;
30 import org.netbeans.modules.xml.wsdl.model.extensions.soap.SOAPOperation;
31 import org.netbeans.modules.xml.wsdl.model.extensions.soap.impl.SOAPAddressImpl;
32 import org.netbeans.modules.xml.wsdl.model.extensions.soap.impl.SOAPBindingImpl;
33 import org.netbeans.modules.xml.wsdl.model.extensions.soap.impl.SOAPBodyImpl;
34 import org.netbeans.modules.xml.wsdl.model.extensions.soap.impl.SOAPFaultImpl;
35 import org.netbeans.modules.xml.wsdl.model.extensions.soap.impl.SOAPHeaderFaultImpl;
36 import org.netbeans.modules.xml.wsdl.model.extensions.soap.impl.SOAPHeaderImpl;
37 import org.netbeans.modules.xml.wsdl.model.extensions.soap.impl.SOAPOperationImpl;
38 import org.netbeans.modules.xml.wsdl.model.extensions.xsd.WSDLSchema;
39 import org.netbeans.modules.xml.wsdl.model.extensions.xsd.impl.WSDLSchemaImpl;
40 import org.netbeans.modules.xml.wsdl.model.spi.ElementFactory;
41 import org.netbeans.modules.xml.wsdl.model.spi.GenericExtensibilityElement;
42 import org.netbeans.modules.xml.wsdl.model.spi.WSDLComponentBase;
43 import org.w3c.dom.Element JavaDoc;
44
45 /**
46  *
47  * @author rico
48  */

49 public class WSDLComponentFactoryImpl implements WSDLComponentFactory {
50     
51     private WSDLModel model;
52     /** Creates a new instance of WSDLComponentFactoryImpl */
53     public WSDLComponentFactoryImpl(WSDLModel model) {
54         this.model = model;
55     }
56     
57     public WSDLComponent create(Element element, WSDLComponent context) {
58         ElementFactory factory = ElementFactoryRegistry.getDefault().get(
59                 Util.getQName(element, (WSDLComponentBase)context));
60         return create(factory, element, context);
61     }
62     
63     private WSDLComponent create(ElementFactory factory, Element element, WSDLComponent context) {
64         if(factory != null ){
65             return factory.create(context, element);
66         } else {
67             return new GenericExtensibilityElement(model, element);
68         }
69     }
70     
71     public WSDLComponent create(WSDLComponent parent, QName JavaDoc qName) {
72        String JavaDoc q = qName.getPrefix();
73        if (q == null || q.length() == 0) {
74            q = qName.getLocalPart();
75        } else {
76            q = q + ":" + qName.getLocalPart();
77        }
78
79        ElementFactory factory = ElementFactoryRegistry.getDefault().get(qName);
80        Element element = model.getDocument().createElementNS(qName.getNamespaceURI(), q);
81        return create(factory, element, parent);
82     }
83     
84     public Port createPort() {
85          return new PortImpl(model);
86      }
87          
88      public Part createPart() {
89          return new PartImpl(model);
90      }
91          
92      public Output createOutput() {
93          return new OutputImpl(model);
94      }
95          
96      public Binding createBinding() {
97          return new BindingImpl(model);
98      }
99          
100      public BindingFault createBindingFault() {
101          return new BindingFaultImpl(model);
102      }
103          
104      public BindingInput createBindingInput() {
105          return new BindingInputImpl(model);
106      }
107          
108      public BindingOperation createBindingOperation() {
109          return new BindingOperationImpl(model);
110      }
111          
112      public BindingOutput createBindingOutput() {
113          return new BindingOutputImpl(model);
114      }
115          
116      public Documentation createDocumentation() {
117          return new DocumentationImpl(model);
118      }
119          
120      public Fault createFault() {
121          return new FaultImpl(model);
122      }
123          
124      public Import createImport() {
125          return new ImportImpl(model);
126      }
127          
128      public Input createInput() {
129          return new InputImpl(model);
130      }
131          
132      public Message createMessage() {
133          return new MessageImpl(model);
134      }
135          
136      public OneWayOperation createOneWayOperation() {
137          return new OneWayOperationImpl(model);
138      }
139
140      public NotificationOperation createNotificationOperation() {
141          return new NotificationOperationImpl(model);
142      }
143      public RequestResponseOperation createRequestResponseOperation() {
144          return new RequestResponseOperationImpl(model);
145      }
146
147      public SolicitResponseOperation createSolicitResponseOperation() {
148          return new SolicitResponseOperationImpl(model);
149      }
150     public Types createTypes() {
151         return new TypesImpl(model);
152     }
153
154     public Service createService() {
155         return new ServiceImpl(model);
156     }
157
158     public PortType createPortType() {
159         return new PortTypeImpl(model);
160     }
161     
162     // SOAP
163

164     public SOAPAddress createSOAPAddress() {
165         return new SOAPAddressImpl(model);
166     }
167
168     public SOAPBinding createSOAPBinding() {
169         return new SOAPBindingImpl(model);
170     }
171
172     public SOAPBody createSOAPBody() {
173         return new SOAPBodyImpl(model);
174     }
175
176     public SOAPFault createSOAPFault() {
177         return new SOAPFaultImpl(model);
178     }
179
180     public SOAPHeader createSOAPHeader() {
181         return new SOAPHeaderImpl(model);
182     }
183
184     public SOAPHeaderFault createSOAPHeaderFault() {
185         return new SOAPHeaderFaultImpl(model);
186     }
187
188     public SOAPOperation createSOAPOperation() {
189         return new SOAPOperationImpl(model);
190     }
191     
192     // XSD
193
public WSDLSchema createWSDLSchema() {
194         return new WSDLSchemaImpl(model);
195     }
196 }
197
198
Popular Tags