001 /** 002 * 003 * Copyright 2003-2004 The Apache Software Foundation 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * 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 */ 017 package org.apache.geronimo.webservices; 018 019 import java.util.ArrayList; 020 021 public class Handler { 022 private String handlerName; 023 private String handlerClass; 024 private ArrayList soapHeaderList = new ArrayList(); 025 private ArrayList soapRoleList = new ArrayList(); 026 027 public String getHandlerName() { 028 return handlerName; 029 } 030 031 public void setHandlerName(String handlerName) { 032 this.handlerName = handlerName; 033 } 034 035 public String getHandlerClass() { 036 return handlerClass; 037 } 038 039 public void setHandlerClass(String handlerClass) { 040 this.handlerClass = handlerClass; 041 } 042 043 044 public void addSoapHeader(String soapHeader) throws IndexOutOfBoundsException { 045 soapHeaderList.add(soapHeader); 046 } 047 048 public void addSoapHeader(int index, String soapHeader) throws IndexOutOfBoundsException { 049 soapHeaderList.add(index, soapHeader); 050 } 051 052 public boolean removeSoapHeader(String soapHeader) { 053 return soapHeaderList.remove(soapHeader); 054 } 055 056 public String getSoapHeader(int index) throws IndexOutOfBoundsException { 057 if ((index < 0) || (index > soapHeaderList.size())) { 058 throw new IndexOutOfBoundsException(); 059 } 060 return (String) soapHeaderList.get(index); 061 } 062 063 public String[] getSoapHeader() { 064 int size = soapHeaderList.size(); 065 String[] mArray = new String[size]; 066 for (int index = 0; index < size; index++) { 067 mArray[index] = (String) soapHeaderList.get(index); 068 } 069 return mArray; 070 } 071 072 public void setSoapHeader(int index, String soapHeader) throws IndexOutOfBoundsException { 073 if ((index < 0) || (index > soapHeaderList.size())) { 074 throw new IndexOutOfBoundsException(); 075 } 076 soapHeaderList.set(index, soapHeader); 077 } 078 079 public void setSoapHeader(String[] soapHeaderArray) { 080 soapHeaderList.clear(); 081 for (int i = 0; i < soapHeaderArray.length; i++) { 082 String soapHeader = soapHeaderArray[i]; 083 soapHeaderList.add(soapHeader); 084 } 085 } 086 087 public void clearSoapHeader() { 088 soapHeaderList.clear(); 089 } 090 091 092 public void addSoapRole(String soapRole) throws IndexOutOfBoundsException { 093 soapRoleList.add(soapRole); 094 } 095 096 public void addSoapRole(int index, String soapRole) throws IndexOutOfBoundsException { 097 soapRoleList.add(index, soapRole); 098 } 099 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 }