KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > pim > spec > ContactTypeManagerFactory


1 /*
2  * Created on May 5, 2005
3  *
4  * TODO To change the template for this generated file go to Window -
5  * Preferences - Java - Code Style - Code Templates
6  */

7 package org.enhydra.pim.spec;
8
9 import org.enhydra.pim.business.ContactTypeManagerI;
10 import org.enhydra.pim.exception.EnhydraPimException;
11
12 /**
13  * @author P.Djojic May 5, 2005 9:43:08 PM
14  *
15  * TODO ContactTypeManagerFactory
16  */

17 public class ContactTypeManagerFactory {
18
19     private static final String JavaDoc EJB_LOCAL_HOME = "org.enhydra.pim.ejb.session.ContactTypeManagerLocalHome";
20
21     private static final String JavaDoc EJB_UTIL_CLASS_NAME = "org.enhydra.pim.ejb.session.ContactTypeManagerUtil";
22
23     private static ContactTypeManagerI contactTypeManager = null;
24
25     /**
26      * Create a ContactTypeManager
27      */

28     public static ContactTypeManagerI getContactTypeManager() throws EnhydraPimException {
29
30         if (contactTypeManager == null) {
31             try {
32                 if (SpecUtil.useEjb) {
33                     Object JavaDoc manager = SpecUtil.getLocalEjbManagerObject(EJB_UTIL_CLASS_NAME, EJB_LOCAL_HOME);
34                     contactTypeManager = (ContactTypeManagerI) manager;
35                     return contactTypeManager;
36                 }
37                 Class JavaDoc objectClass = Class.forName("org.enhydra.pim.business.ContactTypeManager");
38                 contactTypeManager = (ContactTypeManagerI) objectClass.newInstance();
39             } catch (Exception JavaDoc ex) {
40                 System.out.println("Error on creating the ContactTypeManager object" + ex);
41             }
42         }
43         return contactTypeManager;
44     }
45
46 }
Popular Tags