KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > client > CustomWebServicesClientSupportProvider


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.websvc.client;
21
22 import java.io.IOException JavaDoc;
23 import java.net.URL JavaDoc;
24 import java.util.HashMap JavaDoc;
25 import java.util.List JavaDoc;
26 import java.util.Map JavaDoc;
27 import org.netbeans.modules.websvc.api.client.ClientStubDescriptor;
28 import org.netbeans.modules.websvc.api.client.WebServicesClientSupport;
29 import org.netbeans.modules.websvc.api.jaxws.client.JAXWSClientSupport;
30 import org.netbeans.modules.websvc.spi.client.WebServicesClientSupportFactory;
31 import org.netbeans.modules.websvc.spi.client.WebServicesClientSupportImpl;
32 import org.netbeans.modules.websvc.spi.client.WebServicesClientSupportProvider;
33 import org.netbeans.modules.websvc.spi.jaxws.client.JAXWSClientSupportFactory;
34 import org.netbeans.modules.websvc.spi.jaxws.client.JAXWSClientSupportImpl;
35 import org.openide.filesystems.FileObject;
36 import org.openide.nodes.Node;
37
38 /**
39  *
40  * @author Lukas Jungmann
41  */

42 public class CustomWebServicesClientSupportProvider implements WebServicesClientSupportProvider {
43     
44     private Map JavaDoc<FileObject, WebServicesClientSupport> cache = new HashMap JavaDoc<FileObject, WebServicesClientSupport>();
45     private Map JavaDoc<FileObject, JAXWSClientSupport> cache2 = new HashMap JavaDoc<FileObject, JAXWSClientSupport>();
46     
47     /** Creates a new instance of CustomWebServicesSupportProvider */
48     public CustomWebServicesClientSupportProvider() {
49     }
50     
51     public WebServicesClientSupport findWebServicesClientSupport(FileObject file) {
52         if (file.getExt().equals("ws") || file.getExt().equals("both")) {
53             WebServicesClientSupport em = (WebServicesClientSupport) cache.get(file.getParent());
54             if (em == null) {
55                 em = WebServicesClientSupportFactory.createWebServicesClientSupport(new CustomWebServicesClientSupportImpl(file));
56                 cache.put(file.getParent(), em);
57             }
58             return em;
59         }
60         return null;
61     }
62     
63     public JAXWSClientSupport findJAXWSClientSupport(FileObject file) {
64         if (file.getExt().equals("jaxws") || file.getExt().equals("both")) {
65             JAXWSClientSupport em = cache2.get(file.getParent());
66             if (em == null) {
67                 em = JAXWSClientSupportFactory.createJAXWSClientSupport(new CustomJAXWSClientSupportImpl(file));
68                 cache2.put(file.getParent(), em);
69             }
70             return em;
71         }
72         return null;
73     }
74     
75     private static final class CustomWebServicesClientSupportImpl implements WebServicesClientSupportImpl {
76         
77         private FileObject fo;
78         
79         CustomWebServicesClientSupportImpl(FileObject fo) {
80             this.fo = fo;
81         }
82         
83         public void addServiceClient(String JavaDoc serviceName, String JavaDoc packageName,
84                 String JavaDoc sourceUrl, FileObject configFile,
85                 ClientStubDescriptor stubDescriptor) {
86             throw new UnsupportedOperationException JavaDoc("Not supported yet.");
87         }
88         
89         public void addServiceClient(String JavaDoc serviceName, String JavaDoc packageName,
90                 String JavaDoc sourceUrl, FileObject configFile,
91                 ClientStubDescriptor stubDescriptor,
92                 String JavaDoc[] wscompileFeatures) {
93             throw new UnsupportedOperationException JavaDoc("Not supported yet.");
94         }
95         
96         public void addServiceClientReference(String JavaDoc serviceName,
97                 String JavaDoc fqServiceName,
98                 String JavaDoc relativeWsdlPath,
99                 String JavaDoc mappingPath,
100                 String JavaDoc[] portSEIInfo) {
101             throw new UnsupportedOperationException JavaDoc("Not supported yet.");
102         }
103         
104         public void removeServiceClient(String JavaDoc serviceName) {
105             throw new UnsupportedOperationException JavaDoc("Not supported yet.");
106         }
107         
108         public FileObject getWsdlFolder(boolean create) throws IOException JavaDoc {
109             throw new UnsupportedOperationException JavaDoc("Not supported yet.");
110         }
111         
112         public FileObject getDeploymentDescriptor() {
113             throw new UnsupportedOperationException JavaDoc("Not supported yet.");
114         }
115         
116         public List JavaDoc getStubDescriptors() {
117             throw new UnsupportedOperationException JavaDoc("Not supported yet.");
118         }
119         
120         public List JavaDoc getServiceClients() {
121             throw new UnsupportedOperationException JavaDoc("Not supported yet.");
122         }
123         
124         public String JavaDoc getWsdlSource(String JavaDoc serviceName) {
125             throw new UnsupportedOperationException JavaDoc("Not supported yet.");
126         }
127         
128         public void setWsdlSource(String JavaDoc serviceName, String JavaDoc wsdlSource) {
129             throw new UnsupportedOperationException JavaDoc("Not supported yet.");
130         }
131         
132         public void setProxyJVMOptions(String JavaDoc proxyHost, String JavaDoc proxyPort) {
133             throw new UnsupportedOperationException JavaDoc("Not supported yet.");
134         }
135         
136         public String JavaDoc getServiceRefName(String JavaDoc serviceName) {
137             throw new UnsupportedOperationException JavaDoc("Not supported yet.");
138         }
139     }
140     
141     private static final class CustomJAXWSClientSupportImpl implements JAXWSClientSupportImpl {
142         
143         private FileObject fo;
144         
145         CustomJAXWSClientSupportImpl(FileObject fo) {
146             this.fo = fo;
147         }
148         
149         public String JavaDoc addServiceClient(String JavaDoc clientName, String JavaDoc wsdlUrl,
150                 String JavaDoc packageName, boolean isJsr109) {
151             throw new UnsupportedOperationException JavaDoc("Not supported yet.");
152         }
153         
154         public FileObject getWsdlFolder(boolean create) throws IOException JavaDoc {
155             throw new UnsupportedOperationException JavaDoc("Not supported yet.");
156         }
157         
158         public FileObject getLocalWsdlFolderForClient(String JavaDoc clientName,
159                 boolean createFolder) {
160             throw new UnsupportedOperationException JavaDoc("Not supported yet.");
161         }
162         
163         public FileObject getBindingsFolderForClient(String JavaDoc clientName,
164                 boolean createFolder) {
165             throw new UnsupportedOperationException JavaDoc("Not supported yet.");
166         }
167         
168         public void removeServiceClient(String JavaDoc serviceName) {
169             throw new UnsupportedOperationException JavaDoc("Not supported yet.");
170         }
171         
172         public List JavaDoc getServiceClients() {
173             throw new UnsupportedOperationException JavaDoc("Not supported yet.");
174         }
175         
176         public URL JavaDoc getCatalog() {
177             throw new UnsupportedOperationException JavaDoc("Not supported yet.");
178         }
179         
180         public String JavaDoc getServiceRefName(Node clientNode) {
181             throw new UnsupportedOperationException JavaDoc("Not supported yet.");
182         }
183     }
184 }
185
Popular Tags