1 package com.jcorporate.expresso.kernel.digester; 2 3 66 67 import java.util.ArrayList ; 68 import java.util.Collections ; 69 import java.util.HashMap ; 70 import java.util.Iterator ; 71 import java.util.Map ; 72 73 82 public class ComponentConfig implements java.io.Serializable { 83 84 private String name; 85 private String className; 86 private Map properties; 87 private Map indexedProperties; 88 private Map mappedProperties; 89 90 private ArrayList childComponents; 91 92 95 public ComponentConfig() { 96 name = null; 97 className = null; 98 properties = new HashMap (); 99 childComponents = new ArrayList (); 100 indexedProperties = new HashMap (); 101 mappedProperties = new HashMap (); 102 } 103 104 109 public String getName() { 110 return name; 111 } 112 113 118 public void setName(String name) { 119 this.name = name; 120 } 121 122 127 public void setClassName(String className) { 128 this.className = className; 129 } 130 131 136 public String getClassName() { 137 return className; 138 } 139 140 146 public void addProperty(String name, String value) { 147 properties.put(name, value); 148 } 149 150 157 public void addMappedProperty(String name, String key, String value) { 158 if (mappedProperties == null) { 159 mappedProperties = new HashMap (); 160 } 161 162 if (!mappedProperties.containsKey(name)) { 163 mappedProperties.put(name, new HashMap ()); 164 } 165 166 Map keyedProperties = (Map ) mappedProperties.get(name); 167 keyedProperties.put(key, value); 168 169 } 170 171 178 public void addIndexedProperty(String name, int index, String value) { 179 if (indexedProperties == null) { 180 indexedProperties = new HashMap (); 181 } 182 183 if (!indexedProperties.containsKey(name)) { 184 HashMap internalArray = new HashMap (index); 185 indexedProperties.put(name, internalArray); 186 } 187 188 Map indexKeyMap = (Map ) indexedProperties.get(name); 189 indexKeyMap.put(new Integer (index), value); 190 191 } 192 193 199 public String getProperty(String name) { 200 return (String ) properties.get(name); 201 } 202 203 209 public void setProperty(String name, String value) { 210 if (properties == null) { 211 properties = new HashMap (); 212 } 213 properties.put(name, value); 214 } 215 216 223 public String getMappedProperty(String name, String key) { 224 if (mappedProperties == null) { 225 return null; 226 } 227 228 Map oneMapped = (Map ) mappedProperties.get(name); 229 if (oneMapped == null) { 230 return null; 231 } else { 232 return (String ) oneMapped.get(key); 233 } 234 } 235 236 243 public void setMappedProperty(String key, String name, String value) { 244 if (mappedProperties == null) { 245 mappedProperties = new HashMap (); 246 } 247 248 Map oneProperty = (Map ) mappedProperties.get(key); 249 if (oneProperty == null) { 250 oneProperty = new HashMap (); 251 mappedProperties.put(key, oneProperty); 252 } 253 254 oneProperty.put(name, value); 255 } 256 257 258 265 public Map getMappedProperties(String name) { 266 if (mappedProperties == null) { 267 return null; 268 } 269 270 return (Map ) mappedProperties.get(name); 271 } 272 273 282 public Map getAllMappedProperties() { 283 return mappedProperties; 284 } 285 286 293 public Map getIndexedProperties(String name) { 294 if (indexedProperties == null) { 295 return null; 296 } else { 297 return (Map ) indexedProperties.get(name); 298 } 299 } 300 301 308 public Map getAllIndexedProperties() { 309 return indexedProperties; 310 } 311 312 319 public String getIndexedProperty(String key, int index) { 320 Map
|