1 17 package org.apache.geronimo.webservices; 18 19 import java.util.ArrayList ; 20 import java.util.HashMap ; 21 22 23 32 public class WebServices { 33 38 private ArrayList webServiceDescriptionList = new ArrayList (); 39 44 private HashMap webServiceDescriptionMap = new HashMap (); 45 46 public void addWebServiceDescription(WebServiceDescription webServiceDescription) throws IndexOutOfBoundsException { 47 webServiceDescriptionList.add(webServiceDescription); 48 webServiceDescriptionMap.put(webServiceDescription.getWebServiceDescriptionName(), webServiceDescription); 49 } 50 51 public void addWebServiceDescription(int index, WebServiceDescription webServiceDescription) throws IndexOutOfBoundsException { 52 webServiceDescriptionList.add(index, webServiceDescription); 53 webServiceDescriptionMap.put(webServiceDescription.getWebServiceDescriptionName(), webServiceDescription); 54 } 55 56 public boolean removeWebServiceDescription(WebServiceDescription webServiceDescription) { 57 webServiceDescriptionMap.remove(webServiceDescription.getWebServiceDescriptionName()); 58 return webServiceDescriptionList.remove(webServiceDescription); 59 } 60 61 public WebServiceDescription getWebServiceDescription(int index) throws IndexOutOfBoundsException { 62 if ((index < 0) || (index > webServiceDescriptionList.size())) { 63 throw new IndexOutOfBoundsException (); 64 } 65 return (WebServiceDescription) webServiceDescriptionList.get(index); 66 } 67 68 public WebServiceDescription[] getWebServiceDescription() { 69 int size = webServiceDescriptionList.size(); 70 WebServiceDescription[] mArray = new WebServiceDescription[size]; 71 for (int index = 0; index < size; index++) { 72 mArray[index] = (WebServiceDescription) webServiceDescriptionList.get(index); 73 } 74 return mArray; 75 } 76 77 public WebServiceDescription getWebServiceDescription(String webServiceDescriptionName) { 78 return (WebServiceDescription) webServiceDescriptionMap.get(webServiceDescriptionName); 79 } 80 81 public void setWebServiceDescription(int index, WebServiceDescription webServiceDescription) throws IndexOutOfBoundsException { 82 if ((index < 0) || (index > webServiceDescriptionList.size())) { 83 throw new IndexOutOfBoundsException (); 84 } 85 WebServiceDescription removed = (WebServiceDescription) webServiceDescriptionList.set(index, webServiceDescription); 86 webServiceDescriptionMap.remove(removed.getWebServiceDescriptionName()); 87 webServiceDescriptionMap.put(webServiceDescription.getWebServiceDescriptionName(), webServiceDescription); 88 } 89 90 public void setWebServiceDescription(WebServiceDescription[] webServiceDescriptionArray) { 91 clearWebServiceDescription(); 92 for (int i = 0; i < webServiceDescriptionArray.length; i++) { 93 WebServiceDescription webServiceDescription = webServiceDescriptionArray[i]; 94 webServiceDescriptionList.add(webServiceDescription); 95 webServiceDescriptionMap.put(webServiceDescription.getWebServiceDescriptionName(), webServiceDescription); 96 } 97 } 98 99 public void clearWebServiceDescription() { 100 webServiceDescriptionList.clear(); 101 webServiceDescriptionMap.clear(); 102 } 103 } 104 | Popular Tags |