package Juno2Util;

import java.rmi.RemoteException;

import javax.ejb.CreateException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import juno2Beans.acctList.CmdAccountList;
import juno2Beans.acctList.CmdAccountListHome;

public class CmdAccountListHelper {
	
	private static CmdAccountListHelper m_singleton = null;

	private	CmdAccountListHome	m_home;

	private	CmdAccountList	m_helper;
	
	private	DataSource	m_ds;

	public final static String cmdAccountListLookup = "ejb/juno2Beans/CmdAccountListHome";
	
			
	public CmdAccountList getCmdAccountListHelper() throws NamingException, CreateException, RemoteException, Exception
	{
		if (m_helper == null)
		{
			m_helper = getCmdAccountListHome().create();
			
		}
		return m_helper;
	}
	
	public CmdAccountListHome getCmdAccountListHome() throws NamingException, CreateException, RemoteException
	{
		if (m_home == null)
		{
			Context initContext = new InitialContext();
			
			Object obj=initContext.lookup(cmdAccountListLookup);
			m_home=(CmdAccountListHome)javax.rmi.PortableRemoteObject.narrow(obj,CmdAccountListHome.class);
		}
		return m_home;
	}
	
	public static CmdAccountListHelper instance()
	{
		if (m_singleton == null) 
			m_singleton = new CmdAccountListHelper();
			
		return m_singleton;
	}
	
}


