1 7 package org.enhydra.pim.spec; 8 9 import java.lang.reflect.InvocationTargetException ; 10 import java.lang.reflect.Method ; 11 12 17 public class SpecUtil { 18 19 public static boolean useEjb = false; 20 21 28 public static Object getLocalEjbManagerObject(String ejb_util_class_name, String ejb_local_home) 29 throws ClassNotFoundException , NoSuchMethodException , IllegalAccessException , 30 InvocationTargetException { 31 32 Class utilClass = Class.forName(ejb_util_class_name); 33 Method getLocalHomeMethod = utilClass.getMethod("getLocalHome", new Class [0]); 34 Object homeObject = getLocalHomeMethod.invoke(utilClass, new Class [0]); 35 36 Class localHomeClass = Class.forName(ejb_local_home); 37 Method createMethod = localHomeClass.getMethod("create", new Class [0]); 38 39 Object manager = createMethod.invoke(homeObject, new Class [0]); 40 41 return manager; 42 } 43 44 47 public static void useEjb(boolean value) { 48 49 SpecUtil.useEjb = value; 50 } 51 } | Popular Tags |