1 22 package org.jboss.aop.microcontainer.integration; 23 24 import java.util.List ; 25 26 import org.jboss.classadapter.plugins.dependency.AbstractDependencyBuilder; 27 import org.jboss.classadapter.spi.ClassAdapter; 28 import org.jboss.classadapter.spi.DependencyBuilder; 29 30 39 public class AOPDependencyBuilder extends AbstractDependencyBuilder 40 { 41 DependencyBuilder delegate; 42 43 public List getDependencies(ClassAdapter classAdapter) 44 { 45 DependencyBuilder builder = getDependencyBuilderDelegate(classAdapter); 46 if (builder == null) 47 { 48 return super.getDependencies(classAdapter); 49 } 50 return delegate.getDependencies(classAdapter); 51 } 52 53 private synchronized DependencyBuilder getDependencyBuilderDelegate(ClassAdapter classAdapter) 54 { 55 if (delegate != null) 56 { 57 return delegate; 58 } 59 60 Class clazz = AOPDeployedChecker.getClassIfExists( 61 classAdapter.getClassLoader(), 62 "org.jboss.aop.microcontainer.integration.AOPDependencyBuilderDelegate"); 63 64 if (clazz == null) 65 { 66 return null; 67 } 68 69 try 70 { 71 delegate = (DependencyBuilder)clazz.newInstance(); 72 } 73 catch (Exception e) 74 { 75 throw new RuntimeException ("Error instantiating AOPDependencyBuilderDelegate", e); 76 } 77 78 return delegate; 79 } 80 } 81 | Popular Tags |