KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > wsitmodelext > addressing > AddressingFactories


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.addressing;
21
22 import org.netbeans.modules.websvc.wsitmodelext.addressing.impl.*;
23 import org.netbeans.modules.xml.wsdl.model.WSDLComponent;
24 import org.netbeans.modules.xml.wsdl.model.spi.ElementFactory;
25 import org.w3c.dom.Element JavaDoc;
26
27 import javax.xml.namespace.QName JavaDoc;
28 import java.util.Collections JavaDoc;
29 import java.util.Set JavaDoc;
30
31
32 public class AddressingFactories {
33
34     public static class EndpointReferenceFactory extends ElementFactory {
35         @Override JavaDoc
36         public Set JavaDoc<QName JavaDoc> getElementQNames() {
37             return Collections.singleton(AddressingQName.ENDPOINTREFERENCE.getQName());
38         }
39         public <C extends WSDLComponent> C create(WSDLComponent context, Class JavaDoc<C> type) {
40             return type.cast(new EndpointReferenceImpl(context.getModel()));
41         }
42
43         @Override JavaDoc
44         public WSDLComponent create(WSDLComponent context, Element JavaDoc element) {
45             return new EndpointReferenceImpl(context.getModel(), element);
46         }
47     }
48
49     public static class AddressFactory extends ElementFactory {
50         @Override JavaDoc
51         public Set JavaDoc<QName JavaDoc> getElementQNames() {
52             return Collections.singleton(AddressingQName.ADDRESS.getQName());
53         }
54         public <C extends WSDLComponent> C create(WSDLComponent context, Class JavaDoc<C> type) {
55             return type.cast(new AddressImpl(context.getModel()));
56         }
57
58         @Override JavaDoc
59         public WSDLComponent create(WSDLComponent context, Element JavaDoc element) {
60             return new AddressImpl(context.getModel(), element);
61         }
62     }
63
64     public static class AddressingServiceNameFactory extends ElementFactory {
65         @Override JavaDoc
66         public Set JavaDoc<QName JavaDoc> getElementQNames() {
67             return Collections.singleton(AddressingQName.SERVICENAME.getQName());
68         }
69         public <C extends WSDLComponent> C create(WSDLComponent context, Class JavaDoc<C> type) {
70             return type.cast(new AddressingServiceNameImpl(context.getModel()));
71         }
72
73         @Override JavaDoc
74         public WSDLComponent create(WSDLComponent context, Element JavaDoc element) {
75             return new AddressingServiceNameImpl(context.getModel(), element);
76         }
77     }
78
79     public static class AddressingPortTypeFactory extends ElementFactory {
80         @Override JavaDoc
81         public Set JavaDoc<QName JavaDoc> getElementQNames() {
82             return Collections.singleton(AddressingQName.PORTTYPE.getQName());
83         }
84         public <C extends WSDLComponent> C create(WSDLComponent context, Class JavaDoc<C> type) {
85             return type.cast(new AddressingPortTypeImpl(context.getModel()));
86         }
87
88         @Override JavaDoc
89         public WSDLComponent create(WSDLComponent context, Element JavaDoc element) {
90             return new AddressingPortTypeImpl(context.getModel(), element);
91         }
92     }
93
94     public static class ReferenceParametersFactory extends ElementFactory {
95         @Override JavaDoc
96         public Set JavaDoc<QName JavaDoc> getElementQNames() {
97             return Collections.singleton(AddressingQName.REFERENCEPARAMETERS.getQName());
98         }
99         public <C extends WSDLComponent> C create(WSDLComponent context, Class JavaDoc<C> type) {
100             return type.cast(new ReferenceParametersImpl(context.getModel()));
101         }
102
103         @Override JavaDoc
104         public WSDLComponent create(WSDLComponent context, Element JavaDoc element) {
105             return new ReferenceParametersImpl(context.getModel(), element);
106         }
107     }
108
109     public static class ReferencePropertiesFactory extends ElementFactory {
110         @Override JavaDoc
111         public Set JavaDoc<QName JavaDoc> getElementQNames() {
112             return Collections.singleton(AddressingQName.REFERENCEPROPERTIES.getQName());
113         }
114         public <C extends WSDLComponent> C create(WSDLComponent context, Class JavaDoc<C> type) {
115             return type.cast(new ReferencePropertiesImpl(context.getModel()));
116         }
117
118         @Override JavaDoc
119         public WSDLComponent create(WSDLComponent context, Element JavaDoc element) {
120             return new ReferencePropertiesImpl(context.getModel(), element);
121         }
122     }
123     
124 }
125
Popular Tags