View Javadoc

1   /**
2    *
3    * Copyright 2003-2004 The Apache Software Foundation
4    *
5    *  Licensed under the Apache License, Version 2.0 (the "License");
6    *  you may not use this file except in compliance with the License.
7    *  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   *  Unless required by applicable law or agreed to in writing, software
12   *  distributed under the License is distributed on an "AS IS" BASIS,
13   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   *  See the License for the specific language governing permissions and
15   *  limitations under the License.
16   */
17  package org.apache.geronimo.webservices;
18  
19  import java.util.ArrayList;
20  import java.util.HashMap;
21  
22  public class WebServiceDescription {
23      private String webServiceDescriptionName;
24      private String wsdlFile;
25      private String jaxrpcMappingFile;
26  
27      /**
28       * List of PortComponent objects
29       *
30       * @see org.apache.geronimo.webservices.PortComponent
31       */
32      private ArrayList portComponentList = new ArrayList();
33      /**
34       * Map of PortComponent objects indexed by portComponentName
35       *
36       * @see org.apache.geronimo.webservices.PortComponent#getPortComponentName
37       */
38      private HashMap portComponentMap = new HashMap();
39  
40      public String getWebServiceDescriptionName() {
41          return webServiceDescriptionName;
42      }
43  
44      public void setWebServiceDescriptionName(String webServiceDescriptionName) {
45          this.webServiceDescriptionName = webServiceDescriptionName;
46      }
47  
48      public String getWsdlFile() {
49          return wsdlFile;
50      }
51  
52      public void setWsdlFile(String wsdlFile) {
53          this.wsdlFile = wsdlFile;
54      }
55  
56      public String getJaxrpcMappingFile() {
57          return jaxrpcMappingFile;
58      }
59  
60      public void setJaxrpcMappingFile(String jaxrpcMappingFile) {
61          this.jaxrpcMappingFile = jaxrpcMappingFile;
62      }
63  
64      public void addPortComponent(PortComponent portComponent) throws IndexOutOfBoundsException {
65          portComponentList.add(portComponent);
66          portComponentMap.put(portComponent.getPortComponentName(), portComponent);
67      }
68  
69      public void addPortComponent(int index, PortComponent portComponent) throws IndexOutOfBoundsException {
70          portComponentList.add(index, portComponent);
71          portComponentMap.put(portComponent.getPortComponentName(), portComponent);
72      }
73  
74      public boolean removePortComponent(PortComponent portComponent) {
75          portComponentMap.remove(portComponent.getPortComponentName());
76          return portComponentList.remove(portComponent);
77      }
78  
79      public PortComponent getPortComponent(int index) throws IndexOutOfBoundsException {
80          if ((index < 0) || (index > portComponentList.size())) {
81              throw new IndexOutOfBoundsException();
82          }
83          return (PortComponent) portComponentList.get(index);
84      }
85  
86      public PortComponent[] getPortComponent() {
87          int size = portComponentList.size();
88          PortComponent[] mArray = new PortComponent[size];
89          for (int index = 0; index < size; index++) {
90              mArray[index] = (PortComponent) portComponentList.get(index);
91          }
92          return mArray;
93      }
94  
95      public PortComponent getPortComponent(String portComponentName) {
96          return (PortComponent) portComponentMap.get(portComponentName);
97      }
98  
99      public void setPortComponent(int index, PortComponent portComponent) throws IndexOutOfBoundsException {
100         if ((index < 0) || (index > portComponentList.size())) {
101             throw new IndexOutOfBoundsException();
102         }
103         PortComponent removed = (PortComponent) portComponentList.set(index, portComponent);
104         portComponentMap.remove(removed.getPortComponentName());
105         portComponentMap.put(portComponent.getPortComponentName(), portComponent);
106     }
107 
108     public void setPortComponent(PortComponent[] portComponentArray) {
109         portComponentList.clear();
110         for (int i = 0; i < portComponentArray.length; i++) {
111             PortComponent portComponent = portComponentArray[i];
112             portComponentList.add(portComponent);
113             portComponentMap.put(portComponent.getPortComponentName(), portComponent);
114         }
115     }
116 
117     public void clearPortComponent() {
118         portComponentList.clear();
119         portComponentMap.clear();
120     }
121 
122 }