KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > webservices > PortComponent


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. 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 JavaDoc;
20 import java.util.HashMap JavaDoc;
21
22 public class PortComponent {
23     private String JavaDoc portComponentName;
24     private String JavaDoc wsdlPort;
25     private String JavaDoc serviceEndpointInterface;
26     private ServiceImplBean serviceImplBean;
27
28     /**
29      * List of Handler objects
30      *
31      * @see org.apache.geronimo.webservices.Handler
32      */

33     private ArrayList JavaDoc handlerList = new ArrayList JavaDoc();
34     /**
35      * Map of Handler objects indexed by handlerName
36      *
37      * @see org.apache.geronimo.webservices.Handler#getHandlerName
38      */

39     private HashMap JavaDoc handlerMap = new HashMap JavaDoc();
40
41     public void addHandler(Handler handler) throws IndexOutOfBoundsException JavaDoc {
42         handlerList.add(handler);
43         handlerMap.put(handler.getHandlerName(), handler);
44     }
45
46     public void addHandler(int index, Handler handler) throws IndexOutOfBoundsException JavaDoc {
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 JavaDoc {
57         if ((index < 0) || (index > handlerList.size())) {
58             throw new IndexOutOfBoundsException JavaDoc();
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 JavaDoc handlerName) {
73         return (Handler) handlerMap.get(handlerName);
74     }
75
76     public void setHandler(int index, Handler handler) throws IndexOutOfBoundsException JavaDoc {
77         if ((index < 0) || (index > handlerList.size())) {
78             throw new IndexOutOfBoundsException JavaDoc();
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 JavaDoc getPortComponentName() {
100         return portComponentName;
101     }
102
103     public void setPortComponentName(String JavaDoc portComponentName) {
104         this.portComponentName = portComponentName;
105     }
106
107     public String JavaDoc getWsdlPort() {
108         return wsdlPort;
109     }
110
111     public void setWsdlPort(String JavaDoc wsdlPort) {
112         this.wsdlPort = wsdlPort;
113     }
114
115     public String JavaDoc getServiceEndpointInterface() {
116         return serviceEndpointInterface;
117     }
118
119     public void setServiceEndpointInterface(String JavaDoc 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 }
131
Popular Tags