1 7 package org.enhydra.pim.spec; 8 9 import org.enhydra.pim.business.ContactManagerI; 10 import org.enhydra.pim.exception.EnhydraPimException; 11 12 17 public class ContactManagerFactory { 18 19 private static final String EJB_LOCAL_HOME = "org.enhydra.pim.ejb.session.ContactManagerLocalHome"; 20 21 private static final String EJB_UTIL_CLASS_NAME = "org.enhydra.pim.ejb.session.ContactManagerUtil"; 22 23 private static ContactManagerI contactManager = null; 24 25 28 public static ContactManagerI getContactManager() throws EnhydraPimException { 29 30 if (contactManager == null) { 31 try { 32 if (SpecUtil.useEjb) { 33 Object manager = SpecUtil.getLocalEjbManagerObject(EJB_UTIL_CLASS_NAME, EJB_LOCAL_HOME); 34 contactManager = (ContactManagerI) manager; 35 return contactManager; 36 } 37 Class objectClass = Class.forName("org.enhydra.pim.business.ContactManager"); 38 contactManager = (ContactManagerI) objectClass.newInstance(); 39 } catch (Exception ex) { 40 System.out.println("Error on creating the ContactManagerFactory object" + ex); 41 } 42 } 43 return contactManager; 44 } 45 46 } | Popular Tags |