KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > wsitmodelext > transport > TransportFactories


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.transport;
21
22 import org.netbeans.modules.websvc.wsitmodelext.transport.impl.OptimizedTCPTransportImpl;
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 import org.netbeans.modules.websvc.wsitmodelext.transport.impl.AutomaticallySelectFastInfosetImpl;
31 import org.netbeans.modules.websvc.wsitmodelext.transport.impl.AutomaticallySelectOptimalTransportImpl;
32 import org.netbeans.modules.websvc.wsitmodelext.transport.impl.OptimizedFastInfosetSerializationImpl;
33
34 public class TransportFactories {
35
36     public static class OptimizedFastInfosetSerialization extends ElementFactory {
37         @Override JavaDoc
38         public Set JavaDoc<QName JavaDoc> getElementQNames() {
39             return Collections.singleton(FIQName.OPTIMIZEDFASTINFOSETSERIALIZATION.getQName());
40         }
41         public <C extends WSDLComponent> C create(WSDLComponent context, Class JavaDoc<C> type) {
42             return type.cast(new OptimizedFastInfosetSerializationImpl(context.getModel()));
43         }
44         @Override JavaDoc
45         public WSDLComponent create(WSDLComponent context, Element JavaDoc element) {
46             return new OptimizedFastInfosetSerializationImpl(context.getModel(), element);
47         }
48     }
49
50     public static class AutomaticallySelectFastInfoset extends ElementFactory {
51         @Override JavaDoc
52         public Set JavaDoc<QName JavaDoc> getElementQNames() {
53             return Collections.singleton(FIQName.AUTOMATICALLYSELECTFASTINFOSET.getQName());
54         }
55         public <C extends WSDLComponent> C create(WSDLComponent context, Class JavaDoc<C> type) {
56             return type.cast(new AutomaticallySelectFastInfosetImpl(context.getModel()));
57         }
58         @Override JavaDoc
59         public WSDLComponent create(WSDLComponent context, Element JavaDoc element) {
60             return new AutomaticallySelectFastInfosetImpl(context.getModel(), element);
61         }
62     }
63
64     public static class OptimizedTCPTransport extends ElementFactory {
65         @Override JavaDoc
66         public Set JavaDoc<QName JavaDoc> getElementQNames() {
67             return Collections.singleton(TCPQName.OPTIMIZEDTCPTRANSPORT.getQName());
68         }
69         public <C extends WSDLComponent> C create(WSDLComponent context, Class JavaDoc<C> type) {
70             return type.cast(new OptimizedTCPTransportImpl(context.getModel()));
71         }
72         @Override JavaDoc
73         public WSDLComponent create(WSDLComponent context, Element JavaDoc element) {
74             return new OptimizedTCPTransportImpl(context.getModel(), element);
75         }
76     }
77
78     public static class AutomaticallySelectOptimalTransport extends ElementFactory {
79         @Override JavaDoc
80         public Set JavaDoc<QName JavaDoc> getElementQNames() {
81             return Collections.singleton(TCPQName.AUTOMATICALLYSELECTOPTIMALTRANSPORT.getQName());
82         }
83         public <C extends WSDLComponent> C create(WSDLComponent context, Class JavaDoc<C> type) {
84             return type.cast(new AutomaticallySelectOptimalTransportImpl(context.getModel()));
85         }
86         @Override JavaDoc
87         public WSDLComponent create(WSDLComponent context, Element JavaDoc element) {
88             return new AutomaticallySelectOptimalTransportImpl(context.getModel(), element);
89         }
90     }
91     
92 }
93
Popular Tags