1 15 package org.apache.hivemind.impl; 16 17 import java.util.ArrayList ; 18 import java.util.Collection ; 19 import java.util.HashMap ; 20 import java.util.List ; 21 import java.util.Map ; 22 23 import org.apache.hivemind.SymbolSource; 24 import org.apache.hivemind.impl.BaseLocatable; 25 26 31 public class DefaultsSymbolSource extends BaseLocatable implements SymbolSource 32 { 33 private List _defaults; 34 35 private Map _symbols = new HashMap (); 36 37 public String valueForSymbol(String name) 38 { 39 return (String ) _symbols.get(name); 40 } 41 42 public void initializeService() 43 { 44 int count = _defaults.size(); 45 for (int i = 0; i < count; i++) 46 { 47 FactoryDefault fd = (FactoryDefault) _defaults.get(i); 48 49 String symbol = fd.getSymbol(); 50 String value = fd.getValue(); 51 52 _symbols.put(symbol, value); 53 } 54 } 55 56 public void setDefaults(Collection defaults) 57 { 58 _defaults = new ArrayList (defaults); 59 } 60 } | Popular Tags |