1 22 23 package org.jboss.resource.deployment.ds.builder; 24 25 31 public class DsMetaDataBuilderFactory 32 { 33 34 private static DsMetaDataBuilder DEFAULT_BUILDER; 35 36 public static DsMetaDataBuilder getBuilder(String builderName) 37 { 38 DsMetaDataBuilder builder = null; 39 40 if(builderName == null) 41 { 42 return DEFAULT_BUILDER; 43 } 44 45 final ClassLoader loader = Thread.currentThread().getContextClassLoader(); 46 Class clazz; 47 48 try 49 { 50 clazz = loader.loadClass(builderName); 51 builder = (DsMetaDataBuilder)clazz.newInstance(); 52 53 } 54 catch (ClassNotFoundException e) 55 { 56 builder = DEFAULT_BUILDER; 57 58 } 59 catch (InstantiationException e) 60 { 61 builder = DEFAULT_BUILDER; 62 63 } 64 catch (IllegalAccessException e) 65 { 66 builder = DEFAULT_BUILDER; 67 } 68 69 return builder; 70 71 } 72 73 74 } 75 | Popular Tags |