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 21 public class Handler { 22 private String handlerName; 23 private String handlerClass; 24 private ArrayList soapHeaderList = new ArrayList(); 25 private ArrayList soapRoleList = new ArrayList(); 26 27 public String getHandlerName() { 28 return handlerName; 29 } 30 31 public void setHandlerName(String handlerName) { 32 this.handlerName = handlerName; 33 } 34 35 public String getHandlerClass() { 36 return handlerClass; 37 } 38 39 public void setHandlerClass(String handlerClass) { 40 this.handlerClass = handlerClass; 41 } 42 43 44 public void addSoapHeader(String soapHeader) throws IndexOutOfBoundsException { 45 soapHeaderList.add(soapHeader); 46 } 47 48 public void addSoapHeader(int index, String soapHeader) throws IndexOutOfBoundsException { 49 soapHeaderList.add(index, soapHeader); 50 } 51 52 public boolean removeSoapHeader(String soapHeader) { 53 return soapHeaderList.remove(soapHeader); 54 } 55 56 public String getSoapHeader(int index) throws IndexOutOfBoundsException { 57 if ((index < 0) || (index > soapHeaderList.size())) { 58 throw new IndexOutOfBoundsException(); 59 } 60 return (String) soapHeaderList.get(index); 61 } 62 63 public String[] getSoapHeader() { 64 int size = soapHeaderList.size(); 65 String[] mArray = new String[size]; 66 for (int index = 0; index < size; index++) { 67 mArray[index] = (String) soapHeaderList.get(index); 68 } 69 return mArray; 70 } 71 72 public void setSoapHeader(int index, String soapHeader) throws IndexOutOfBoundsException { 73 if ((index < 0) || (index > soapHeaderList.size())) { 74 throw new IndexOutOfBoundsException(); 75 } 76 soapHeaderList.set(index, soapHeader); 77 } 78 79 public void setSoapHeader(String[] soapHeaderArray) { 80 soapHeaderList.clear(); 81 for (int i = 0; i < soapHeaderArray.length; i++) { 82 String soapHeader = soapHeaderArray[i]; 83 soapHeaderList.add(soapHeader); 84 } 85 } 86 87 public void clearSoapHeader() { 88 soapHeaderList.clear(); 89 } 90 91 92 public void addSoapRole(String soapRole) throws IndexOutOfBoundsException { 93 soapRoleList.add(soapRole); 94 } 95 96 public void addSoapRole(int index, String soapRole) throws IndexOutOfBoundsException { 97 soapRoleList.add(index, soapRole); 98 } 99 100 public boolean removeSoapRole(String soapRole) { 101 return soapRoleList.remove(soapRole); 102 } 103 104 public String getSoapRole(int index) throws IndexOutOfBoundsException { 105 if ((index < 0) || (index > soapRoleList.size())) { 106 throw new IndexOutOfBoundsException(); 107 } 108 return (String) soapRoleList.get(index); 109 } 110 111 public String[] getSoapRole() { 112 int size = soapRoleList.size(); 113 String[] mArray = new String[size]; 114 for (int index = 0; index < size; index++) { 115 mArray[index] = (String) soapRoleList.get(index); 116 } 117 return mArray; 118 } 119 120 public void setSoapRole(int index, String soapRole) throws IndexOutOfBoundsException { 121 if ((index < 0) || (index > soapRoleList.size())) { 122 throw new IndexOutOfBoundsException(); 123 } 124 soapRoleList.set(index, soapRole); 125 } 126 127 public void setSoapRole(String[] soapRoleArray) { 128 soapRoleList.clear(); 129 for (int i = 0; i < soapRoleArray.length; i++) { 130 String soapRole = soapRoleArray[i]; 131 soapRoleList.add(soapRole); 132 } 133 } 134 135 public void clearSoapRole() { 136 soapRoleList.clear(); 137 } 138 139 140 }