KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > jaxrpc > nodes > WebServiceChildren


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 package org.netbeans.modules.websvc.jaxrpc.nodes;
20
21 // Retouche
22
//import javax.jmi.reflect.JmiException;
23
//import org.netbeans.jmi.javamodel.JavaClass;
24
//import org.netbeans.jmi.javamodel.Method;
25
//import org.netbeans.modules.j2ee.common.JMIUtils;
26
//import org.netbeans.modules.j2ee.common.ui.nodes.ComponentMethodModel;
27
//import org.netbeans.modules.j2ee.common.ui.nodes.ComponentMethodViewStrategy;
28
import java.util.*;
29 import org.openide.filesystems.FileObject;
30 import org.openide.nodes.*;
31 import org.netbeans.modules.j2ee.dd.api.webservices.WebserviceDescription;
32 import org.netbeans.modules.j2ee.dd.api.webservices.PortComponent;
33 import org.netbeans.modules.j2ee.dd.api.webservices.ServiceImplBean;
34 import org.netbeans.modules.websvc.api.webservices.WebServicesSupport;
35 import java.awt.Image JavaDoc;
36 import org.openide.util.Utilities;
37 import java.io.IOException JavaDoc;
38 import org.openide.cookies.OpenCookie;
39 import org.openide.nodes.Children;
40
41 /*
42  * Children of the web service node, namely,
43  * the operations of the webservice
44  */

45
46 public class WebServiceChildren extends Children.Keys<WebserviceDescription>/*ComponentMethodModel */{
47     
48     private WebserviceDescription webServiceDescription;
49     private FileObject srcRoot;
50     
51     public WebServiceChildren(WebserviceDescription webServiceDescription, FileObject srcRoot) {
52         super();
53         this.webServiceDescription = webServiceDescription;
54         this.srcRoot = srcRoot;
55     }
56     
57     protected Node[] createNodes(WebserviceDescription key) {
58         return new Node[]{};
59     }
60     
61 // Retouche
62
// public ComponentMethodViewStrategy createViewStrategy() {
63
// WSComponentMethodViewStrategy strategy = WSComponentMethodViewStrategy.instance();
64
// return strategy;
65
// }
66
//
67
// protected JavaClass getImplBean() {
68
// return getImplBeanClass(webServiceDescription);
69
// }
70
//
71
// protected Collection getInterfaces() {
72
// Set set = new HashSet();
73
// set.add(getServiceEndpointInterface(webServiceDescription));
74
// return set;
75
// }
76
//
77
// private JavaClass getServiceEndpointInterface(WebserviceDescription webServiceDescription){
78
// PortComponent portComponent = webServiceDescription.getPortComponent(0);
79
// String sei = portComponent.getServiceEndpointInterface();
80
// if(sei != null) {
81
// sei = sei.trim(); // IZ 56889: must trim white space, if any, before using this information.
82
// }
83
// return JMIUtils.findClass(sei);
84
// }
85
//
86
// private JavaClass getImplBeanClass(WebserviceDescription webServiceDescription) {
87
// PortComponent portComponent = webServiceDescription.getPortComponent(0); //assume one port per ws
88
// ServiceImplBean serviceImplBean = portComponent.getServiceImplBean();
89
// String link =serviceImplBean.getServletLink();
90
// if(link == null) {
91
// link = serviceImplBean.getEjbLink();
92
// }
93
// if(link != null) {
94
// link = link.trim(); // Related to IZ 56889: must trim white space, if any, before using this information.
95
// }
96
// WebServicesSupport wsSupport = WebServicesSupport.getWebServicesSupport(srcRoot);
97
// String implBean = wsSupport.getImplementationBean(link);
98
// if(implBean != null) {
99
// return JMIUtils.findClass(implBean);
100
// }
101
// return null;
102
// }
103
//
104
// public static class WSComponentMethodViewStrategy implements ComponentMethodViewStrategy {
105
// // private Image NOT_OPERATION_BADGE = Utilities.loadImage("org/openide/src/resources/error.gif");
106
// private static WSComponentMethodViewStrategy wsmvStrategy;
107
// private WSComponentMethodViewStrategy(){
108
// }
109
//
110
// public static WSComponentMethodViewStrategy instance(){
111
// if(wsmvStrategy == null){
112
// wsmvStrategy = new WSComponentMethodViewStrategy();
113
// }
114
// return wsmvStrategy;
115
// }
116
// public Image getBadge(Method method, Collection interfaces){
117
//
118
// /* no need to badge this, it sometimes not a sign for bad operation see 55679 Set paramTypes = new HashSet();
119
// //FIX-ME:Need a better way to find out if method is in SEI
120
// MethodParameter[] parameters = method.getParameters();
121
// for(int i = 0; i < parameters.length; i++){
122
// paramTypes.add(parameters[i].getType());
123
// }
124
// Iterator iter = interfaces.iterator();
125
// while(iter.hasNext()){
126
// ClassElement intf = (ClassElement)iter.next();
127
// if(intf.getMethod(method.getName(), (Type[])paramTypes.toArray(new Type[paramTypes.size()])) == null){
128
// return NOT_OPERATION_BADGE;
129
// }
130
//
131
// }*/
132
//
133
// return null;
134
// }
135
// public void deleteImplMethod(Method m, JavaClass implClass, Collection interfaces) throws IOException{
136
// //delete method in the SEI
137
// Iterator iter = interfaces.iterator();
138
// while (iter.hasNext()){
139
// JavaClass intf = (JavaClass)iter.next();
140
// try {
141
// intf.getContents().remove(m);
142
// } catch (JmiException e) {
143
// throw new IOException(e.getMessage());
144
// }
145
// }
146
// //delete method from Impl class
147
// Method[] methods = JMIUtils.getMethods(implClass);
148
// for(int i = 0; i < methods.length; i++){
149
// Method method = methods[i];
150
// if (JMIUtils.equalMethods(m, method)) {
151
// try {
152
// implClass.getContents().remove(method);
153
// break;
154
// } catch (JmiException e) {
155
// throw new IOException(e.getMessage());
156
// }
157
// }
158
// }
159
// }
160
//
161
// public OpenCookie getOpenCookie(Method m, JavaClass implClass, Collection interfaces) {
162
// Method[] methods = JMIUtils.getMethods(implClass);
163
// for(int i = 0; i < methods.length; i++) {
164
// Method method = methods[i];
165
// if (JMIUtils.equalMethods(m, method)) {
166
// return (OpenCookie)JMIUtils.getCookie(method, OpenCookie.class);
167
// }
168
// }
169
// return null;
170
// }
171
//
172
// public Image getIcon(Method me, Collection interfaces) {
173
// return Utilities.loadImage("org/openide/src/resources/methodPublic.gif");
174
// }
175
//
176
// }
177

178 }
179
Popular Tags