001 package com.khubla.pragmatach.framework.configuration; 002 003 import java.util.HashMap; 004 import java.util.Map; 005 006 import com.khubla.pragmatach.framework.api.PragmatachException; 007 008 /** 009 * a configuration class mainly useful for testing 010 * 011 * @author tome 012 */ 013 public class HashmapConfigurationImpl extends BaseConfiguration { 014 /** 015 * the parameters 016 */ 017 private final Map<String, String> map = new HashMap<String, String>(); 018 019 /** 020 * ctor 021 */ 022 public HashmapConfigurationImpl() { 023 } 024 025 public HashmapConfigurationImpl(String[][] parameters) { 026 for (final String[] set : parameters) { 027 map.put(set[0], set[1]); 028 } 029 } 030 031 @Override 032 public Map<String, String> getAll() throws PragmatachException { 033 return map; 034 } 035 036 @Override 037 public Object getObject(String name) throws PragmatachException { 038 return resolveObject(map.get(name)); 039 } 040 041 @Override 042 public String getParameter(String name) throws PragmatachException { 043 return resolveString(map.get(name)); 044 } 045 046 public void setParameter(String name, String value) { 047 map.put(name, value); 048 } 049 }