1 26 27 package org.objectweb.openccm.pss.generator.common.lib; 28 29 31 32 40 41 public class MappingObjectFactory 42 { 43 public static Object 44 getClass(String name) 45 { 46 String pf = null; 47 String class_name = null; 48 ClassLoader loader = null; 49 50 pf = System.getProperty("openccm.pss.pf"); 51 loader = Thread.currentThread().getContextClassLoader(); 52 53 if (pf != null) 54 { 55 class_name = "org.objectweb.openccm.pss.generator." 56 + pf + ".lib." + name; 57 try 58 { 59 Class clazz = Class.forName(class_name); 60 try 61 { 62 return clazz.newInstance(); 63 } catch (Exception e1) { 64 e1.printStackTrace(); 65 } 66 } catch (ClassNotFoundException e) { 67 class_name = "org.objectweb.openccm.pss.generator.common.lib." 69 + name; 70 try 71 { 72 Class clazz = Class.forName(class_name); 73 try 74 { 75 return clazz.newInstance(); 76 } catch (Exception e1) { 77 e1.printStackTrace(); 78 } 79 } catch (ClassNotFoundException e2) { 80 e2.printStackTrace(); 82 } 83 } 84 } 85 86 return null; 87 } 88 } 89 | Popular Tags |