franta-hg@1: /* ================================================================ franta-hg@1: * Cewolf : Chart enabling Web Objects Framework franta-hg@1: * ================================================================ franta-hg@1: * franta-hg@1: * Project Info: http://cewolf.sourceforge.net franta-hg@1: * Project Lead: Guido Laures (guido@laures.de); franta-hg@1: * franta-hg@1: * (C) Copyright 2002, by Guido Laures franta-hg@1: * franta-hg@1: * This library is free software; you can redistribute it and/or modify it under the terms franta-hg@1: * of the GNU Lesser General Public License as published by the Free Software Foundation; franta-hg@1: * either version 2.1 of the License, or (at your option) any later version. franta-hg@1: * franta-hg@1: * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; franta-hg@1: * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. franta-hg@1: * See the GNU Lesser General Public License for more details. franta-hg@1: * franta-hg@1: * You should have received a copy of the GNU Lesser General Public License along with this franta-hg@1: * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, franta-hg@1: * Boston, MA 02111-1307, USA. franta-hg@1: */ franta-hg@1: franta-hg@1: package de.laures.cewolf.taglib.util; franta-hg@1: franta-hg@1: import java.util.Date; franta-hg@1: import java.util.Hashtable; franta-hg@1: import java.util.Iterator; franta-hg@1: import java.util.Map; franta-hg@1: franta-hg@1: import org.apache.commons.logging.Log; franta-hg@1: import org.apache.commons.logging.LogFactory; franta-hg@1: franta-hg@1: /** franta-hg@1: * @author glaures franta-hg@1: */ franta-hg@1: public class DatasetProductionTimeStore extends Hashtable { franta-hg@1: franta-hg@1: private static final DatasetProductionTimeStore instance = new DatasetProductionTimeStore(); franta-hg@1: private static final Log log = LogFactory.getLog(DatasetProductionTimeStore.class); franta-hg@1: public static final DatasetProductionTimeStore getInstance() { franta-hg@1: return instance; franta-hg@1: } franta-hg@1: franta-hg@1: private DatasetProductionTimeStore() { franta-hg@1: } franta-hg@1: franta-hg@1: public boolean containsEntry(String producerId, Map params) { franta-hg@1: return containsKey(new DatasetProductionTimesKey(producerId, params)); franta-hg@1: } franta-hg@1: franta-hg@1: public void addEntry(String producerId, Map params, Date produceTime) { franta-hg@1: log.debug("add entry: " + producerId); franta-hg@1: put(new DatasetProductionTimesKey(producerId, params), produceTime); franta-hg@1: } franta-hg@1: franta-hg@1: public void removeEntry(String producerId, Map params) { franta-hg@1: log.debug("remove entry: " + producerId); franta-hg@1: franta-hg@1: remove(new DatasetProductionTimesKey(producerId, params)); franta-hg@1: } franta-hg@1: franta-hg@1: public Date getProductionTime(String producerId, Map params) { franta-hg@1: return (Date) get(new DatasetProductionTimesKey(producerId, params)); franta-hg@1: } franta-hg@1: franta-hg@1: public String paramsToString(Map params){ franta-hg@1: Iterator it = params.keySet().iterator(); franta-hg@1: StringBuffer buf = new StringBuffer("["); franta-hg@1: while(it.hasNext()){ franta-hg@1: String key = (String)it.next(); franta-hg@1: buf.append(key + ":" + params.get(key)); franta-hg@1: } franta-hg@1: buf.append("]"); franta-hg@1: return buf.toString(); franta-hg@1: } franta-hg@1: franta-hg@1: }