Source Code Cross Referenced for WebServiceData.java in  » IDE-Netbeans » web.core » org » netbeans » modules » websvc » registry » model » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » web.core » org.netbeans.modules.websvc.registry.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        package org.netbeans.modules.websvc.registry.model;
043:
044:        ///import org.netbeans.modules.websvc.registry.model.WebServiceListModel;
045:        ///import org.netbeans.modules.websvc.registry.jaxrpc.Wsdl2Java;
046:        ////import org.netbeans.modules.websvc.registry.util.Util;
047:
048:        import com.sun.xml.rpc.processor.model.Port;
049:        import com.sun.xml.rpc.processor.model.Operation; /////////import com.sun.xml.rpc.processor.model.java.JavaMethod;
050:
051:        import java.net.MalformedURLException;
052:        import java.net.URL;
053:
054:        import java.io.File;
055:
056:        import java.util.ArrayList;
057:        import java.util.Iterator;
058:        import java.util.Arrays;
059:        import java.util.List;
060:        import java.util.Set;
061:        import java.util.HashSet;
062:        import java.util.HashMap;
063:
064:        /**
065:         * A webservice model. Holds the URL & methods information etc
066:         * When the WSDL is parsed for each port a WebServiceData is created and added to the
067:         * WebService Node Model.
068:         * @author octav, Winston Prakash, David Botterill
069:         */
070:        public class WebServiceData {
071:
072:            /** Unique Web service id*/
073:            private String websvcId;
074:            /** Web service name */
075:            private String name;
076:            /** Web Service port number */
077:            private int webServicePort;
078:            /** Web service URL */
079:            private String wsdlUrl;
080:            /** proxy name */
081:            private String proxy;
082:
083:            private String groupId;
084:
085:            private String displayName;
086:
087:            private String proxyJarFileName;
088:
089:            private String packageName;
090:
091:            private String webServiceAddress;
092:
093:            /**
094:             * Array list of com.sun.xml.rpc.processor.model.Port objects
095:             */
096:            private ArrayList ports = new ArrayList();
097:
098:            public final static String PORT_PROPERTY_NAME = "WSPORTNAME";
099:
100:            /** Default constructor */
101:            public WebServiceData() {
102:                this (WebServiceListModel.getInstance().getUniqueWebServiceId());
103:            }
104:
105:            public WebServiceData(String id) {
106:                setId(id);
107:            }
108:
109:            public void setId(String id) {
110:                websvcId = id;
111:            }
112:
113:            public String getId() {
114:                return websvcId;
115:            }
116:
117:            public String getName() {
118:                return name;
119:            }
120:
121:            public String getDisplayName() {
122:                if (displayName == null)
123:                    displayName = name;
124:                return displayName;
125:            }
126:
127:            public void setDisplayName(String dispName) {
128:                displayName = dispName;
129:            }
130:
131:            public String getGroupId() {
132:                return groupId;
133:            }
134:
135:            public void setGroupId(String id) {
136:                groupId = id;
137:            }
138:
139:            public void setPackageName(String inPackageName) {
140:                packageName = inPackageName;
141:            }
142:
143:            public void setWebServiceAddress(String inAddress) {
144:                webServiceAddress = inAddress;
145:            }
146:
147:            /**
148:             * InSync needs this, however this is a read only property
149:             * @param Web Service name
150:             */
151:            public void setName(String name) {
152:                this .name = name;
153:            }
154:
155:            /** This method will return the methods for the service.
156:             * @return an array list of com.sun.xml.rpc.processor.model.Operation objects.
157:             */
158:            public ArrayList getMethods() {
159:
160:                /**
161:                 * Go through the ports and get the operations, for each
162:                 * operation, return the JavaMethod.
163:                 */
164:                ArrayList returnMethods = new ArrayList();
165:                Iterator portIterator = ports.iterator();
166:                Port currentPort = null;
167:                while (portIterator.hasNext()) {
168:                    currentPort = (Port) portIterator.next();
169:                    if (null == currentPort
170:                            || null == currentPort.getOperations()) {
171:                        continue;
172:                    }
173:                    Iterator operationIterator = currentPort.getOperations();
174:                    Operation currentOperation = null;
175:                    while (operationIterator.hasNext()) {
176:                        currentOperation = (Operation) operationIterator.next();
177:                        if (null == currentOperation) {
178:                            continue;
179:                        }
180:                        returnMethods.add(currentOperation);
181:                    }
182:                }
183:                return returnMethods;
184:            }
185:
186:            public int getWebServicePort() {
187:                return webServicePort;
188:            }
189:
190:            public void setWebServicePort(int portNumber) {
191:                webServicePort = portNumber;
192:            }
193:
194:            public String getURL() {
195:                return wsdlUrl;
196:            }
197:
198:            public void setURL(String url) {
199:                wsdlUrl = url;
200:            }
201:
202:            public String getProxy() {
203:                return proxy;
204:            }
205:
206:            public void setProxy(String proxy) {
207:                this .proxy = proxy;
208:            }
209:
210:            public void setProxyJarFileName(String jarName) {
211:
212:                proxyJarFileName = jarName;
213:            }
214:
215:            public String getProxyJarFileName() {
216:                /**
217:                 * Since this data could have been persisted and moved, we need to
218:                 * make sure the file name of this jar file is still valid.  If it is not found,
219:                 * try getting it from the current user directory.  There are really only two places
220:                 * that are valid for the location to be in, the netbeans user directory or a temp directory
221:                 * when the user is testing the web service before they've added it to server navigator.
222:                 * - David Botterill 4/23/2004
223:                 */
224:                if (null == proxyJarFileName)
225:                    return null;
226:
227:                File proxyFile = new File(proxyJarFileName);
228:                if (!proxyFile.exists()) {
229:                    /**
230:                     * First, strip off any bogus path information for both windows and unix style paths that might exist.
231:                     */
232:                    String fileOnlyName = proxyJarFileName;
233:                    if (proxyJarFileName.indexOf("/") != -1) {
234:                        fileOnlyName = proxyJarFileName
235:                                .substring(proxyJarFileName.lastIndexOf("/") + 1);
236:                    }
237:
238:                    if (proxyJarFileName.indexOf("\\") != -1) {
239:                        fileOnlyName = proxyJarFileName
240:                                .substring(proxyJarFileName.lastIndexOf("\\") + 1);
241:                    }
242:
243:                    String newName = System.getProperty("netbeans.user")
244:                            + File.separator + "websvc" + File.separator
245:                            + fileOnlyName;
246:                    proxyFile = new File(newName);
247:                    if (!proxyFile.exists()) {
248:                        return null;
249:                    } else {
250:                        proxyJarFileName = newName;
251:                        /**
252:                         * make sure to set the new name.
253:                         */
254:                        this .setProxyJarFileName(proxyJarFileName);
255:                    }
256:                }
257:
258:                return proxyJarFileName;
259:            }
260:
261:            public String getWSDescription() {
262:                return "Web Service Information-\n" + "Name: " + name + "\n"
263:                        + "Port number: " + webServicePort + "\n" + "URL: "
264:                        + wsdlUrl + "\n" + "Address: " + webServiceAddress
265:                        + "\n";
266:            }
267:
268:            public String getPackageName() {
269:                if (null == packageName) {
270:                    packageName = "webservice";///Wsdl2Java.DEFAULT_TARGET_PACKAGE;
271:                }
272:                return packageName;
273:            }
274:
275:            public String getWebServiceAddress() {
276:                return webServiceAddress;
277:            }
278:
279:            public Port[] getPorts() {
280:                return (Port[]) ports.toArray(new Port[0]);
281:            }
282:
283:            public void addPort(Port inPort) {
284:                ports.add(inPort);
285:            }
286:
287:            public void setPorts(Port[] inPorts) {
288:                ports = new ArrayList(Arrays.asList(inPorts));
289:            }
290:
291:            /**
292:             * Override equals to specialize checking equality of WebServiceData.  Web services
293:             * for Creator will be equal if the display name is equal regardless of case.
294:             */
295:            public boolean equals(Object inWSData) {
296:                /**
297:                 * If the object passed isn't of the same type, they aren't equal.
298:                 */
299:                if (!(inWSData instanceof  WebServiceData)) {
300:                    return false;
301:                }
302:
303:                WebServiceData comparingWSdata = (WebServiceData) inWSData;
304:                String this DisplayName = this .getDisplayName();
305:                String comparingDisplayName = comparingWSdata.getDisplayName();
306:
307:                /**
308:                 * the Display Name should never be null but we still need to check the condition.
309:                 */
310:                if (null == comparingDisplayName && null != this DisplayName) {
311:                    return false;
312:                }
313:                if (null == this DisplayName && null != comparingDisplayName) {
314:                    return false;
315:                }
316:
317:                /**
318:                 * This should never happen but they logically are equal based on our
319:                 * definition of object equality.
320:                 */
321:                if (null == this DisplayName && null == comparingDisplayName) {
322:                    return true;
323:                }
324:
325:                if (this DisplayName.equalsIgnoreCase(comparingDisplayName)) {
326:                    return true;
327:                } else {
328:                    return false;
329:                }
330:
331:            }
332:
333:            /**
334:             * Not only debug, also used to present the W/S node description in the
335:             * Server Navigator
336:             * @return W/S Info stuff: name, port, URL
337:             */
338:            public String toString() {
339:                // return "Web Service Information - \n\tName: " + name + "\n\t Port number " + webServicePort + "\n\t URL " + wsdlUrl;
340:                return "<html><b>Web Service Information</b>" + ""
341:                        + "<br><b>Name:</b> " + name
342:                        + "<br><b>Port number:</b> " + webServicePort
343:                        + "<br><b>URL:</b> " + wsdlUrl + "<br><b>Address:</b> "
344:                        + webServiceAddress + "</html>";
345:            }
346:
347:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.