1 package org.enhydra.pim.spec; 2 3 import org.enhydra.pim.business.DataManagerI; 4 import org.enhydra.pim.exception.EnhydraPimException; 5 6 12 public class DataManagerFactory { 13 14 private static final String EJB_LOCAL_HOME = "org.enhydra.pim.ejb.session.DataManagerLocalHome"; 15 16 private static final String EJB_UTIL_CLASS_NAME = "org.enhydra.pim.ejb.session.DataManagerUtil"; 17 18 private static DataManagerI dataManager = null; 19 20 23 24 public static DataManagerI getDataManager() throws EnhydraPimException { 25 26 if (dataManager == null) { 27 try { 28 if (SpecUtil.useEjb) { 29 Object manager = SpecUtil.getLocalEjbManagerObject(EJB_UTIL_CLASS_NAME, EJB_LOCAL_HOME); 30 dataManager = (DataManagerI) manager; 31 return dataManager; 32 } 33 Class objectClass = Class.forName("org.enhydra.pim.business.DataManager"); 34 dataManager = (DataManagerI) objectClass.newInstance(); 35 36 } catch (Exception ex) { 37 System.out.println("Error on creating the DataManager object" + ex); 38 } 39 } 40 return dataManager; 41 } 42 43 } | Popular Tags |