KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > wsitmodelext > mex > MexFactories


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

19
20 package org.netbeans.modules.websvc.wsitmodelext.mex;
21
22 import org.netbeans.modules.xml.wsdl.model.WSDLComponent;
23 import org.netbeans.modules.xml.wsdl.model.spi.ElementFactory;
24 import org.w3c.dom.Element JavaDoc;
25
26 import javax.xml.namespace.QName JavaDoc;
27 import java.util.Collections JavaDoc;
28 import java.util.Set JavaDoc;
29 import org.netbeans.modules.websvc.wsitmodelext.mex.impl.DialectImpl;
30 import org.netbeans.modules.websvc.wsitmodelext.mex.impl.IdentifierImpl;
31 import org.netbeans.modules.websvc.wsitmodelext.mex.impl.LocationImpl;
32 import org.netbeans.modules.websvc.wsitmodelext.mex.impl.MetadataImpl;
33 import org.netbeans.modules.websvc.wsitmodelext.mex.impl.MetadataReferenceImpl;
34 import org.netbeans.modules.websvc.wsitmodelext.mex.impl.MetadataSectionImpl;
35
36 public class MexFactories {
37
38     public static class Metadata extends ElementFactory {
39         @Override JavaDoc
40         public Set JavaDoc<QName JavaDoc> getElementQNames() {
41             return Collections.singleton(MexQName.METADATA.getQName());
42         }
43         public <C extends WSDLComponent> C create(WSDLComponent context, Class JavaDoc<C> type) {
44             return type.cast(new MetadataImpl(context.getModel()));
45         }
46         @Override JavaDoc
47         public WSDLComponent create(WSDLComponent context, Element JavaDoc element) {
48             return new MetadataImpl(context.getModel(), element);
49         }
50     }
51
52     public static class MetadataReference extends ElementFactory {
53         @Override JavaDoc
54         public Set JavaDoc<QName JavaDoc> getElementQNames() {
55             return Collections.singleton(MexQName.METADATAREFERENCE.getQName());
56         }
57         public <C extends WSDLComponent> C create(WSDLComponent context, Class JavaDoc<C> type) {
58             return type.cast(new MetadataReferenceImpl(context.getModel()));
59         }
60         @Override JavaDoc
61         public WSDLComponent create(WSDLComponent context, Element JavaDoc element) {
62             return new MetadataReferenceImpl(context.getModel(), element);
63         }
64     }
65
66     public static class MetadataSection extends ElementFactory {
67         @Override JavaDoc
68         public Set JavaDoc<QName JavaDoc> getElementQNames() {
69             return Collections.singleton(MexQName.METADATASECTION.getQName());
70         }
71         public <C extends WSDLComponent> C create(WSDLComponent context, Class JavaDoc<C> type) {
72             return type.cast(new MetadataSectionImpl(context.getModel()));
73         }
74         @Override JavaDoc
75         public WSDLComponent create(WSDLComponent context, Element JavaDoc element) {
76             return new MetadataSectionImpl(context.getModel(), element);
77         }
78     }
79
80     public static class Dialect extends ElementFactory {
81         @Override JavaDoc
82         public Set JavaDoc<QName JavaDoc> getElementQNames() {
83             return Collections.singleton(MexQName.DIALECT.getQName());
84         }
85         public <C extends WSDLComponent> C create(WSDLComponent context, Class JavaDoc<C> type) {
86             return type.cast(new DialectImpl(context.getModel()));
87         }
88         @Override JavaDoc
89         public WSDLComponent create(WSDLComponent context, Element JavaDoc element) {
90             return new DialectImpl(context.getModel(), element);
91         }
92     }
93
94     public static class Identifier extends ElementFactory {
95         @Override JavaDoc
96         public Set JavaDoc<QName JavaDoc> getElementQNames() {
97             return Collections.singleton(MexQName.IDENTIFIER.getQName());
98         }
99         public <C extends WSDLComponent> C create(WSDLComponent context, Class JavaDoc<C> type) {
100             return type.cast(new IdentifierImpl(context.getModel()));
101         }
102         @Override JavaDoc
103         public WSDLComponent create(WSDLComponent context, Element JavaDoc element) {
104             return new IdentifierImpl(context.getModel(), element);
105         }
106     }
107
108     public static class Location extends ElementFactory {
109         @Override JavaDoc
110         public Set JavaDoc<QName JavaDoc> getElementQNames() {
111             return Collections.singleton(MexQName.LOCATION.getQName());
112         }
113         public <C extends WSDLComponent> C create(WSDLComponent context, Class JavaDoc<C> type) {
114             return type.cast(new LocationImpl(context.getModel()));
115         }
116         @Override JavaDoc
117         public WSDLComponent create(WSDLComponent context, Element JavaDoc element) {
118             return new LocationImpl(context.getModel(), element);
119         }
120     }
121 }
122
Popular Tags