KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > api > jaxws > wsdlmodel > WsdlService


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.api.jaxws.wsdlmodel;
21
22 import com.sun.tools.ws.processor.model.Port;
23 import com.sun.tools.ws.processor.model.Service;
24 import java.util.*;
25
26 /**
27  *
28  * @author mkuchtiak
29  */

30 public class WsdlService {
31     
32     private Service service;
33     /** Creates a new instance of WsdlService */
34     WsdlService(Service service) {
35         this.service=service;
36     }
37     
38     public Object JavaDoc /*com.sun.tools.ws.processor.model.Service*/ getInternalJAXWSService() {
39         return service;
40     }
41     
42     public List<WsdlPort> getPorts() {
43         List<WsdlPort> wsdlPorts = new ArrayList<WsdlPort>();
44         if (service==null) return wsdlPorts;
45         List<Port> ports = service.getPorts();
46         for (Port p:ports)
47             wsdlPorts.add(new WsdlPort(p));
48         return wsdlPorts;
49     }
50     
51     public String JavaDoc getName() {
52         if (service==null) return null;
53         return service.getName().getLocalPart();
54     }
55     
56     public String JavaDoc getNamespaceURI() {
57         return service.getName().getNamespaceURI();
58     }
59     
60     public String JavaDoc getJavaName() {
61         if (service==null) return null;
62         return service.getJavaInterface().getName();
63     }
64     
65     public WsdlPort getPortByName(String JavaDoc portName) {
66         List<Port> ports = service.getPorts();
67         for (Port p:ports)
68             if (portName.equals(p.getName().getLocalPart())) return new WsdlPort(p);
69         return null;
70     }
71 }
72
Popular Tags