001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.geronimo.webservices;
017:
018: import java.util.ArrayList;
019: import java.util.HashMap;
020:
021: public class PortComponent {
022: private String portComponentName;
023: private String wsdlPort;
024: private String serviceEndpointInterface;
025: private ServiceImplBean serviceImplBean;
026:
027: /**
028: * List of Handler objects
029: *
030: * @see org.apache.geronimo.webservices.Handler
031: */
032: private ArrayList handlerList = new ArrayList();
033: /**
034: * Map of Handler objects indexed by handlerName
035: *
036: * @see org.apache.geronimo.webservices.Handler#getHandlerName
037: */
038: private HashMap handlerMap = new HashMap();
039:
040: public void addHandler(Handler handler)
041: throws IndexOutOfBoundsException {
042: handlerList.add(handler);
043: handlerMap.put(handler.getHandlerName(), handler);
044: }
045:
046: public void addHandler(int index, Handler handler)
047: throws IndexOutOfBoundsException {
048: handlerList.add(index, handler);
049: handlerMap.put(handler.getHandlerName(), handler);
050: }
051:
052: public boolean removeHandler(Handler handler) {
053: handlerMap.remove(handler.getHandlerName());
054: return handlerList.remove(handler);
055: }
056:
057: public Handler getHandler(int index)
058: throws IndexOutOfBoundsException {
059: if ((index < 0) || (index > handlerList.size())) {
060: throw new IndexOutOfBoundsException();
061: }
062: return (Handler) handlerList.get(index);
063: }
064:
065: public Handler[] getHandler() {
066: int size = handlerList.size();
067: Handler[] mArray = new Handler[size];
068: for (int index = 0; index < size; index++) {
069: mArray[index] = (Handler) handlerList.get(index);
070: }
071: return mArray;
072: }
073:
074: public Handler getHandler(String handlerName) {
075: return (Handler) handlerMap.get(handlerName);
076: }
077:
078: public void setHandler(int index, Handler handler)
079: throws IndexOutOfBoundsException {
080: if ((index < 0) || (index > handlerList.size())) {
081: throw new IndexOutOfBoundsException();
082: }
083: Handler removed = (Handler) handlerList.set(index, handler);
084: handlerMap.remove(removed.getHandlerName());
085: handlerMap.put(handler.getHandlerName(), handler);
086: }
087:
088: public void setHandler(Handler[] handlerArray) {
089: handlerList.clear();
090: for (int i = 0; i < handlerArray.length; i++) {
091: Handler handler = handlerArray[i];
092: handlerList.add(handler);
093: handlerMap.put(handler.getHandlerName(), handler);
094: }
095: }
096:
097: public void clearHandler() {
098: handlerList.clear();
099: handlerMap.clear();
100: }
101:
102: public String getPortComponentName() {
103: return portComponentName;
104: }
105:
106: public void setPortComponentName(String portComponentName) {
107: this .portComponentName = portComponentName;
108: }
109:
110: public String getWsdlPort() {
111: return wsdlPort;
112: }
113:
114: public void setWsdlPort(String wsdlPort) {
115: this .wsdlPort = wsdlPort;
116: }
117:
118: public String getServiceEndpointInterface() {
119: return serviceEndpointInterface;
120: }
121:
122: public void setServiceEndpointInterface(
123: String serviceEndpointInterface) {
124: this .serviceEndpointInterface = serviceEndpointInterface;
125: }
126:
127: public ServiceImplBean getServiceImplBean() {
128: return serviceImplBean;
129: }
130:
131: public void setServiceImplBean(ServiceImplBean serviceImplBean) {
132: this.serviceImplBean = serviceImplBean;
133: }
134: }
|