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 PortComponent {
23      private String portComponentName;
24      private String wsdlPort;
25      private String serviceEndpointInterface;
26      private ServiceImplBean serviceImplBean;
27  
28      /**
29       * List of Handler objects
30       *
31       * @see org.apache.geronimo.webservices.Handler
32       */
33      private ArrayList handlerList = new ArrayList();
34      /**
35       * Map of Handler objects indexed by handlerName
36       *
37       * @see org.apache.geronimo.webservices.Handler#getHandlerName
38       */
39      private HashMap handlerMap = new HashMap();
40  
41      public void addHandler(Handler handler) throws IndexOutOfBoundsException {
42          handlerList.add(handler);
43          handlerMap.put(handler.getHandlerName(), handler);
44      }
45  
46      public void addHandler(int index, Handler handler) throws IndexOutOfBoundsException {
47          handlerList.add(index, handler);
48          handlerMap.put(handler.getHandlerName(), handler);
49      }
50  
51      public boolean removeHandler(Handler handler) {
52          handlerMap.remove(handler.getHandlerName());
53          return handlerList.remove(handler);
54      }
55  
56      public Handler getHandler(int index) throws IndexOutOfBoundsException {
57          if ((index < 0) || (index > handlerList.size())) {
58              throw new IndexOutOfBoundsException();
59          }
60          return (Handler) handlerList.get(index);
61      }
62  
63      public Handler[] getHandler() {
64          int size = handlerList.size();
65          Handler[] mArray = new Handler[size];
66          for (int index = 0; index < size; index++) {
67              mArray[index] = (Handler) handlerList.get(index);
68          }
69          return mArray;
70      }
71  
72      public Handler getHandler(String handlerName) {
73          return (Handler) handlerMap.get(handlerName);
74      }
75  
76      public void setHandler(int index, Handler handler) throws IndexOutOfBoundsException {
77          if ((index < 0) || (index > handlerList.size())) {
78              throw new IndexOutOfBoundsException();
79          }
80          Handler removed = (Handler) handlerList.set(index, handler);
81          handlerMap.remove(removed.getHandlerName());
82          handlerMap.put(handler.getHandlerName(), handler);
83      }
84  
85      public void setHandler(Handler[] handlerArray) {
86          handlerList.clear();
87          for (int i = 0; i < handlerArray.length; i++) {
88              Handler handler = handlerArray[i];
89              handlerList.add(handler);
90              handlerMap.put(handler.getHandlerName(), handler);
91          }
92      }
93  
94      public void clearHandler() {
95          handlerList.clear();
96          handlerMap.clear();
97      }
98  
99      public String getPortComponentName() {
100         return portComponentName;
101     }
102 
103     public void setPortComponentName(String portComponentName) {
104         this.portComponentName = portComponentName;
105     }
106 
107     public String getWsdlPort() {
108         return wsdlPort;
109     }
110 
111     public void setWsdlPort(String wsdlPort) {
112         this.wsdlPort = wsdlPort;
113     }
114 
115     public String getServiceEndpointInterface() {
116         return serviceEndpointInterface;
117     }
118 
119     public void setServiceEndpointInterface(String serviceEndpointInterface) {
120         this.serviceEndpointInterface = serviceEndpointInterface;
121     }
122 
123     public ServiceImplBean getServiceImplBean() {
124         return serviceImplBean;
125     }
126 
127     public void setServiceImplBean(ServiceImplBean serviceImplBean) {
128         this.serviceImplBean = serviceImplBean;
129     }
130 }