0 Replies Latest reply on Apr 20, 2006 4:01 PM by Kabir Khan

    AOP and scoped classloading

    Kabir Khan Master

      I have been playing with aop deployed as part of a scoped deployment on my machine. The three main parts of what I have so far are

      1) Determining if this is a scoped classloader. The only way I could find so far is to check if the DeploymentInfo.ucl/TCL is an instance of RepositoryClassLoader, and its parent has the name "org.jboss.mx.loading.HeirarchicalLoaderRepository3$NoParentClassLoader". If anybody knows a better solution I'd be glad to hear it!

      2) If it is a scoped classloader I have the AspectDeployer set the TCL to the di.ucl, and pass in the classloader to the AspectXMLLoader which in turn passes this in to the AspectFactories, so that they can use the correct classloader when it comes to constructing the aspect instances.

      3) When calling AspectManager.instance() and the tcl is a scoped classloader, I make sure that the returned manager is a subdomain of the aspectmanager (indexed by classloader). All aspectfactories, bindings, advisors etc. coming from this deployment are added to this child domain.

      So far this only works for jboss-aop.xml files deployed in .aop files as part of a scoped archive, since I see no way to obtain the classloader via a name in a standalone jboss-aop.xml file. In any case, unless the classes have been "prepared" the aop.xml will need to be deployed before the actual classes.