/*
 * Created on 2005-12-19
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package org.huihoo.jfox.soaf.samples.struts.dao;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import org.huihoo.jfox.soaf.samples.struts.model.Cheese;

/**
 * @author peter
 * 
 * TODO To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Style - Code Templates
 */
public class CheeseDaoImpl implements CheeseDao {

	private final Map cheeses;

	public CheeseDaoImpl() {
		cheeses = new HashMap();
		cheeses.put("cheddar", new Cheese("cheddar", "England"));
	}

	public void save(Cheese cheese) {
		cheeses.put(cheese.getName(), cheese);
	}

	public void remove(Cheese cheese) {
		cheeses.remove(cheese.getName());
	}

	public Cheese get(String name) {
		return (Cheese) cheeses.get(name);
	}

	public Collection all() {
		return cheeses.values();
	}

}