1 22 package org.jboss.aop.advice; 23 24 import org.jboss.aop.pointcut.DynamicCFlow; 25 import org.jboss.util.xml.XmlLoadable; 26 import org.w3c.dom.Element ; 27 28 34 public class DynamicCFlowDefinition 35 { 36 private String name; 37 private String className; 38 private Element element; 39 private Class pClass; 40 41 public DynamicCFlowDefinition(Element element, String className, String name) 42 { 43 this.className = className; 44 this.element = element; 45 this.name = name; 46 } 47 48 public String getName() 49 { 50 return name; 51 } 52 53 public String getClassName() 54 { 55 return className; 56 } 57 58 public DynamicCFlow create() 59 { 60 if (pClass == null) 61 { 62 try 63 { 64 pClass = Thread.currentThread().getContextClassLoader().loadClass(className); 65 } 66 catch (ClassNotFoundException e) 67 { 68 throw new RuntimeException ("dynamic cflow class not found: " + className); 69 } 70 } 71 try 72 { 73 DynamicCFlow cflow = (DynamicCFlow) pClass.newInstance(); 74 if (cflow instanceof XmlLoadable) 75 { 76 ((XmlLoadable) cflow).importXml(element); 77 } 78 return cflow; 79 } 80 catch (InstantiationException e) 81 { 82 throw new RuntimeException (e); 83 } 84 catch (IllegalAccessException e) 85 { 86 throw new RuntimeException (e); 87 } 88 89 } 90 91 } 92 | Popular Tags |