1 16 17 package org.apache.cocoon.components.web3.impl; 18 19 import java.util.Properties ; 20 import java.util.ArrayList ; 21 import java.util.Iterator ; 22 import java.io.InputStream ; 23 import java.io.IOException ; 24 25 32 public class Web3Properties extends Properties { 33 34 ArrayList orderedKeys = new ArrayList (); 35 36 37 public Web3Properties() { 38 super(); 39 } 40 41 public Web3Properties(Properties defaults) { 42 super(defaults); 43 } 44 45 public synchronized Iterator getKeysIterator() { 46 return orderedKeys.iterator(); 47 } 48 49 public static Web3Properties load(String name) throws Exception { 50 Web3Properties props = null; 51 InputStream is = Web3Properties.class.getResourceAsStream(name); 52 props = new Web3Properties(); 53 if (null != is) { 54 props.load(is); 55 return props; 56 } 57 else { 58 throw new IOException ("Properties could not be loaded."); 59 } 60 } 61 62 public synchronized Object put(Object key, Object value) { 63 Object obj = super.put(key, value); 64 orderedKeys.add(key); 65 return obj; 66 } 67 68 public synchronized Object remove(Object key) { 69 Object obj = super.remove(key); 70 orderedKeys.remove(key); 71 return obj; 72 } 73 } 74 | Popular Tags |