KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > jaxrpc > actions > WebServiceClassesCookieImpl


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.actions;
20
21 import com.sun.source.tree.MethodTree;
22 import java.io.IOException JavaDoc;
23 import java.util.Iterator JavaDoc;
24 // Retouche
25
//import org.netbeans.jmi.javamodel.Array;
26
//import org.netbeans.jmi.javamodel.JavaClass;
27
//import org.netbeans.jmi.javamodel.Method;
28
//import org.netbeans.jmi.javamodel.MultipartId;
29
//import org.netbeans.jmi.javamodel.PrimitiveType;
30
//import org.netbeans.jmi.javamodel.PrimitiveTypeKindEnum;
31
//import org.netbeans.jmi.javamodel.Type;
32
//import org.netbeans.modules.j2ee.common.JMIUtils;
33
//import org.netbeans.modules.javacore.internalapi.JavaModelUtil;
34
import org.netbeans.modules.websvc.api.webservices.WebServicesSupport;
35 import org.netbeans.modules.j2ee.dd.api.webservices.PortComponent;
36 import org.netbeans.modules.j2ee.dd.api.webservices.ServiceImplBean;
37 import org.netbeans.modules.j2ee.dd.api.webservices.WebserviceDescription;
38 import org.openide.ErrorManager;
39 import org.openide.cookies.SaveCookie;
40 import org.openide.filesystems.FileObject;
41 import org.openide.util.NbBundle;
42
43 public class WebServiceClassesCookieImpl implements WebServiceClassesCookie {
44     WebserviceDescription webServiceDescription;
45     FileObject implClassFO;
46     
47     public WebServiceClassesCookieImpl(WebserviceDescription webServiceDescription, FileObject implClassFO) {
48         this.webServiceDescription = webServiceDescription;
49         this.implClassFO = implClassFO;
50     }
51     public void addOperation(MethodTree m) {
52         
53     }
54 // Retouche
55
// private JavaClass getSEIClass() {
56
// PortComponent portComponent = webServiceDescription.getPortComponent(0); //assume one port per ws
57
// String sei = portComponent.getServiceEndpointInterface();
58
// //System.out.println("Service endpoint interface: " + sei);
59
// JavaClass cl = JMIUtils.findClass(sei, implClassFO);
60
// return cl;
61
// }
62
//
63
//
64
// private JavaClass getImplBeanClass() {
65
// PortComponent portComponent = webServiceDescription.getPortComponent(0); //assume one port per ws
66
// ServiceImplBean serviceImplBean = portComponent.getServiceImplBean();
67
// String link =serviceImplBean.getServletLink();
68
// if(link == null) {
69
// link = serviceImplBean.getEjbLink();
70
// }
71
// WebServicesSupport wsSupport = WebServicesSupport.getWebServicesSupport(implClassFO);
72
// String implBean = wsSupport.getImplementationBean(link);
73
// if(implBean != null) {
74
// return JMIUtils.findClass(implBean, implClassFO);
75
// }
76
// return null;
77
// }
78
//
79
// private String getImplicitValue(Type t) {
80
// // TODO - should enhance to enum types, annotation types
81
// String ret = "return ";
82
//
83
// if (t instanceof PrimitiveType) {
84
//
85
// if (((PrimitiveType)t).getKind().equals(PrimitiveTypeKindEnum.BOOLEAN)) {
86
// return "false"; //NOI18N
87
// }
88
// if (((PrimitiveType)t).getKind().equals(PrimitiveTypeKindEnum.CHAR)) {
89
// return "''"; //NOI18N
90
// }
91
// return "0"; //NOI18N
92
//
93
// } else if (t instanceof JavaClass) {
94
// return "null"; //NOI18N
95
//
96
// } else if (t instanceof Array) {
97
// return "new " + t.getName() + " { }"; //NOI18N
98
// }
99
//
100
// return null;
101
// }
102
//
103
//
104
// public void addOperation(Method m) {
105
// JavaClass implClass = null;
106
// JavaClass seiClass = null;
107
// boolean rollback = true;
108
// JMIUtils.beginJmiTransaction(true);
109
// try {
110
// m.setJavadocText("Web service operation");
111
// implClass = getImplBeanClass();
112
//
113
// String body = NbBundle.getMessage(WebServiceClassesCookieImpl.class, "TXT_VoidOperation"); //NOI18N
114
//
115
// Type returnType = m.getType();
116
// if (!((returnType instanceof PrimitiveType) && ((PrimitiveType) returnType).getKind().equals(PrimitiveTypeKindEnum.VOID))) {
117
// String retString = getImplicitValue(m.getType());
118
// if (retString != null) {
119
// body += "return " + retString + ";"; //NOI18N
120
// }
121
// }
122
//
123
// seiClass = getSEIClass();
124
// final String remoteExceptionName = "java.rmi.RemoteException"; // NOI18N
125
// boolean excFound = false;
126
// for (Iterator iter = m.getExceptionNames().iterator(); iter.hasNext(); ) {
127
// MultipartId id = (MultipartId) iter.next();
128
// if (remoteExceptionName.equals(id.getName())) {
129
// excFound = true;
130
// break;
131
// }
132
// }
133
// if (!excFound) {
134
// JMIUtils.addException(m, remoteExceptionName);
135
// }
136
// if (seiClass != null) {
137
// Method newMet = (Method) JavaModelUtil.duplicateInScope(seiClass, m);
138
// seiClass.getContents().add(newMet);
139
// }
140
//
141
// if (implClass != null) {
142
// implClass.getContents().add(m);
143
// }
144
// // #61178
145
// JMIUtils.fixImports(implClass);
146
// JMIUtils.fixImports(seiClass);
147
//
148
// m.setBodyText(body);
149
//
150
// rollback = false;
151
// } catch (Exception e) {
152
// ErrorManager.getDefault().notify(e);
153
// } finally {
154
// JMIUtils.endJmiTransaction(rollback);
155
// }
156
//
157
// //save the SEI class
158
// save(seiClass);
159
//
160
// JMIUtils.openInEditor(m);
161
// }
162
//
163
// private void save(JavaClass jc){
164
// if(jc == null) return;
165
// SaveCookie saveCookie =(SaveCookie) JMIUtils.getCookie(jc, SaveCookie.class);
166
// if (saveCookie != null) {
167
// try {
168
// saveCookie.save();
169
// } catch (IOException ioe) {
170
// ErrorManager.getDefault().notify(ErrorManager.EXCEPTION, ioe);
171
// }
172
// }
173
// }
174

175 }
176
177
Popular Tags