// Path: src/java/se/agura/memorial/search/api/ObituarySearch.java
// public interface ObituarySearch {
//               
// 	public Collection findGraves (
// 			           String firstName,
// 			           String lastName,
// 					   String personIdentifier,
// 					   CustomMemorialDate dateOfBirthFrom,
// 					   CustomMemorialDate dateOfBirthTo,			           
// 					   CustomMemorialDate dateOfDeathFrom,
// 					   CustomMemorialDate dateOfDeathTo,			           
// 			           String hometown,
// 			           String graveyard);
// 	
// 	public Collection getGraveyards();	
// 	
// 	public Grave findGrave(String graveId);	
// 	
// }
// 
// Path: src/java/se/agura/memorial/search/data/GraveDatabaseConn.java
// public interface GraveDatabaseConn extends IDOEntity {
// 	/**
// 	 * @see se.agura.memorial.search.data.GraveDatabaseConnBMPBean#setDatabaseName
// 	 */
// 	public void setDatabaseName(String name);
// 
// 	/**
// 	 * @see se.agura.memorial.search.data.GraveDatabaseConnBMPBean#getDatabaseName
// 	 */
// 	public String getDatabaseName();
// 
// 	/**
// 	 * @see se.agura.memorial.search.data.GraveDatabaseConnBMPBean#setAPIDBConnection
// 	 */
// 	public void setAPIDBConnection(String name);
// 
// 	/**
// 	 * @see se.agura.memorial.search.data.GraveDatabaseConnBMPBean#getAPIDBConnection
// 	 */
// 	public String getAPIDBConnection();
// 
// 	/**
// 	 * @see se.agura.memorial.search.data.GraveDatabaseConnBMPBean#setDescription
// 	 */
// 	public void setDescription(String description);
// 
// 	/**
// 	 * @see se.agura.memorial.search.data.GraveDatabaseConnBMPBean#getDescription
// 	 */
// 	public String getDescription();
// 
// }
// 
// Path: src/java/se/agura/memorial/search/data/GraveDatabaseConnHome.java
// public interface GraveDatabaseConnHome extends IDOHome {
// 	public GraveDatabaseConn create() throws javax.ejb.CreateException;
// 
// 	public GraveDatabaseConn findByPrimaryKey(Object pk)
// 			throws javax.ejb.FinderException;
// 
// 	/**
// 	 * @see se.agura.memorial.search.data.GraveDatabaseConnBMPBean#ejbFindAll
// 	 */
// 	public Collection findAll() throws FinderException;
// 
// 	/**
// 	 * @see se.agura.memorial.search.data.GraveDatabaseConnBMPBean#ejbFindAllNameContaining
// 	 */
// 	public Collection findAllNameContaining(String s) throws FinderException;
// 
// }


import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.ejb.FinderException;
import se.agura.memorial.search.api.ObituarySearch;
import se.agura.memorial.search.data.GraveDatabaseConn;
import se.agura.memorial.search.data.GraveDatabaseConnHome;
import com.idega.business.IBOServiceBean;
import com.idega.data.IDOLookup;
import com.idega.data.IDOLookupException;
package se.agura.memorial.search.business;





public class SearchImplBrokerBean extends IBOServiceBean  implements SearchImplBroker{
	
	private Map map = new HashMap();
	
	public SearchImplBrokerBean() {
	
		try {
			Collection c = getAllDatabaseConnections();
			
			for (Iterator iter = c.iterator(); iter.hasNext();) {
				GraveDatabaseConn gdc = (GraveDatabaseConn) iter.next();
				
				try {
					Class implClass = Class.forName(gdc.getAPIDBConnection());
					ObituarySearch os = (ObituarySearch) implClass.newInstance();
					map.put(gdc.getPrimaryKey(), os);					
				} catch (Exception e) {
					// TODO: handle exception
					e.printStackTrace();
				}	
				
			}			
			
		} catch (IDOLookupException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (FinderException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}	
	    
		
	}	
	
	
	public ObituarySearch getSearch(int databaseConnId) {	

		return (ObituarySearch) map.get(new Integer(databaseConnId));
		
	}
	
	private Collection getAllDatabaseConnections()throws FinderException,IDOLookupException {
// Path: src/java/se/agura/memorial/search/api/ObituarySearch.java
// public interface ObituarySearch {
//               
// 	public Collection findGraves (
// 			           String firstName,
// 			           String lastName,
// 					   String personIdentifier,
// 					   CustomMemorialDate dateOfBirthFrom,
// 					   CustomMemorialDate dateOfBirthTo,			           
// 					   CustomMemorialDate dateOfDeathFrom,
// 					   CustomMemorialDate dateOfDeathTo,			           
// 			           String hometown,
// 			           String graveyard);
// 	
// 	public Collection getGraveyards();	
// 	
// 	public Grave findGrave(String graveId);	
// 	
// }
// 
// Path: src/java/se/agura/memorial/search/data/GraveDatabaseConn.java
// public interface GraveDatabaseConn extends IDOEntity {
// 	/**
// 	 * @see se.agura.memorial.search.data.GraveDatabaseConnBMPBean#setDatabaseName
// 	 */
// 	public void setDatabaseName(String name);
// 
// 	/**
// 	 * @see se.agura.memorial.search.data.GraveDatabaseConnBMPBean#getDatabaseName
// 	 */
// 	public String getDatabaseName();
// 
// 	/**
// 	 * @see se.agura.memorial.search.data.GraveDatabaseConnBMPBean#setAPIDBConnection
// 	 */
// 	public void setAPIDBConnection(String name);
// 
// 	/**
// 	 * @see se.agura.memorial.search.data.GraveDatabaseConnBMPBean#getAPIDBConnection
// 	 */
// 	public String getAPIDBConnection();
// 
// 	/**
// 	 * @see se.agura.memorial.search.data.GraveDatabaseConnBMPBean#setDescription
// 	 */
// 	public void setDescription(String description);
// 
// 	/**
// 	 * @see se.agura.memorial.search.data.GraveDatabaseConnBMPBean#getDescription
// 	 */
// 	public String getDescription();
// 
// }
// 
// Path: src/java/se/agura/memorial/search/data/GraveDatabaseConnHome.java
// public interface GraveDatabaseConnHome extends IDOHome {
// 	public GraveDatabaseConn create() throws javax.ejb.CreateException;
// 
// 	public GraveDatabaseConn findByPrimaryKey(Object pk)
// 			throws javax.ejb.FinderException;
// 
// 	/**
// 	 * @see se.agura.memorial.search.data.GraveDatabaseConnBMPBean#ejbFindAll
// 	 */
// 	public Collection findAll() throws FinderException;
// 
// 	/**
// 	 * @see se.agura.memorial.search.data.GraveDatabaseConnBMPBean#ejbFindAllNameContaining
// 	 */
// 	public Collection findAllNameContaining(String s) throws FinderException;
// 
// }


// Path: src/java/se/agura/memorial/search/business/SearchImplBrokerBean.java
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.ejb.FinderException;
import se.agura.memorial.search.api.ObituarySearch;
import se.agura.memorial.search.data.GraveDatabaseConn;
import se.agura.memorial.search.data.GraveDatabaseConnHome;
import com.idega.business.IBOServiceBean;
import com.idega.data.IDOLookup;
import com.idega.data.IDOLookupException;

package se.agura.memorial.search.business;





public class SearchImplBrokerBean extends IBOServiceBean  implements SearchImplBroker{
	
	private Map map = new HashMap();
	
	public SearchImplBrokerBean() {
	
		try {
			Collection c = getAllDatabaseConnections();
			
			for (Iterator iter = c.iterator(); iter.hasNext();) {
				GraveDatabaseConn gdc = (GraveDatabaseConn) iter.next();
				
				try {
					Class implClass = Class.forName(gdc.getAPIDBConnection());
					ObituarySearch os = (ObituarySearch) implClass.newInstance();
					map.put(gdc.getPrimaryKey(), os);					
				} catch (Exception e) {
					// TODO: handle exception
					e.printStackTrace();
				}	
				
			}			
			
		} catch (IDOLookupException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (FinderException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}	
	    
		
	}	
	
	
	public ObituarySearch getSearch(int databaseConnId) {	

		return (ObituarySearch) map.get(new Integer(databaseConnId));
		
	}
	
	private Collection getAllDatabaseConnections()throws FinderException,IDOLookupException {
		GraveDatabaseConnHome gdch = (GraveDatabaseConnHome) IDOLookup.getHome(GraveDatabaseConn.class);