1 16 17 package org.apache.jetspeed.om.profile.psml; 18 19 import java.util.Vector ; 20 import java.util.Iterator ; 21 22 import org.apache.jetspeed.om.profile.*; 23 24 32 public class PsmlConfigElement implements ConfigElement, java.io.Serializable 33 { 34 35 private String name = null; 36 37 private Vector parameters = new Vector (); 38 39 40 public PsmlConfigElement() 41 {} 42 43 44 public String getName() 45 { 46 return this.name; 47 } 48 49 50 public void setName( String name ) 51 { 52 this.name = name; 53 } 54 55 56 public Vector getParameters() 57 { 58 return this.parameters; 59 } 60 61 64 public void setParameters(Vector parameters) 65 { 66 this.parameters = parameters; 67 } 68 69 public String getParameterValue(String name) 70 { 71 if (parameters == null) 72 return null; 73 74 for (int ix=0; ix < parameters.size(); ix++) 75 { 76 Parameter param = (Parameter)parameters.elementAt(ix); 77 if (param.getName().equals(name)) 78 return param.getValue(); 79 } 80 return null; 81 } 82 83 public Parameter getParameter(String name) 84 { 85 if (parameters == null) 86 return null; 87 88 for (int ix=0; ix < parameters.size(); ix++) 89 { 90 Parameter param = (Parameter)parameters.elementAt(ix); 91 if (param.getName().equals(name)) 92 return param; 93 } 94 return null; 95 } 96 97 public Iterator getParameterIterator() 98 { 99 return parameters.iterator(); 100 } 101 102 public Parameter getParameter(int index) 103 throws java.lang.IndexOutOfBoundsException 104 { 105 if ((index < 0) || (index > parameters.size())) { 107 throw new IndexOutOfBoundsException (); 108 } 109 110 return (Parameter) parameters.elementAt(index); 111 } 113 public int getParameterCount() 114 { 115 return parameters.size(); 116 } 118 public void removeAllParameter() 119 { 120 parameters.removeAllElements(); 121 } 123 public Parameter removeParameter(int index) 124 { 125 Object obj = parameters.elementAt(index); 126 parameters.removeElementAt(index); 127 return (Parameter) obj; 128 } 130 public void setParameter(int index, Parameter vParameter) 131 throws java.lang.IndexOutOfBoundsException 132 { 133 if ((index < 0) || (index > parameters.size())) { 135 throw new IndexOutOfBoundsException (); 136 } 137 parameters.setElementAt(vParameter, index); 138 } 140 public Parameter[] getParameter() 141 { 142 int size = parameters.size(); 143 Parameter[] mArray = new Parameter[size]; 144 for (int index = 0; index < size; index++) { 145 mArray[index] = (Parameter) parameters.elementAt(index); 146 } 147 return mArray; 148 } 150 public void addParameter(Parameter vParameter) 151 throws java.lang.IndexOutOfBoundsException 152 { 153 parameters.addElement(vParameter); 154 } 156 159 public Object clone() 160 throws java.lang.CloneNotSupportedException 161 { 162 Object cloned = super.clone(); 163 164 if (this.parameters != null) 166 { 167 ((PsmlConfigElement)cloned).parameters = new Vector (this.parameters.size()); 168 Iterator it = this.parameters.iterator(); 169 while (it.hasNext()) 170 { 171 ((PsmlConfigElement)cloned).parameters.add((Parameter) ((Parameter)it.next()).clone()); 172 } 173 } 174 175 return cloned; 176 177 } 179 } 180 | Popular Tags |