package com.jxml.quick.ocm; // Open Conversion Model
import com.jxml.quick.*;
import org.xml.sax.*;
import java.util.*;
import java.io.*;

/**
 * Maps data model classes to peer classes.
 */
public class OCMpeerFactoryMap implements OCMpeerFactory
{
	public HashMap entries=new HashMap();

	// implements an OCMbase method
	public OCMbase.SubBase spawn(HashMap prior)
	{
		return null;
	}

	/**
	 * Return a peer object.
	 */
	public OCMpeer createPeer(Object dataModel, OCMcontext context, OCMpeer parent)
		throws SAXException, IOException
	{
		if (dataModel==null)
			return null;
		String key=dataModel.getClass().getName();
		OCMpeerFactoryEntry entry=(OCMpeerFactoryEntry)entries.get(key);
		if (entry==null)
			return null;
		return entry.createPeer(dataModel,context,parent);
	}
}
