JBoss AOP does not require the user to write a factory, yet, the JBoss AOP user 
can do simple Java Bean attribute injection.

To provide this feature, I need a generic factory that holds the 
properties/attributes that need to be injected into a created aspect.   When 
some aspect needs binding into a class, the generic factory creates an instance 
of the aspect based on the properties passed in.

So, for the new MC, I need to be able to specify a generic factory in the new 
MC:

i.e.


  | <bean name="MyAspect"
  |          class="org.jboss.aop.GenericFactory">
  |     <attribute name-"AspectClass">org.jboss.SomeAspect</attribute>
  |    <attribute name="TransactionManager><depends>tx</depends</attribute>
  | </bean>
  | 
  | ----
  | package org.jboss.kernel;
  | 
  | public interface GenericBean
  | {
  |    void setAttribute(String name, Object value);
  |    Object getAttribute(String name);
  |    ClassInfo getClassInfo();
  | }
  | 
  | ----
  | 
  | public class GenericFactory implements org.jboss.kernel.GenericBean, 
GenericAspectFactory
  | {
  |    Class aspectClass 
  |    public void setAttribute(String name, Object value)
  |     {
  |           if (name.equals("AspectClass"))
  |            {
  |                aspectClass = loadClass(value);
  |            } else 
  |          map.put(name, value);
  |     }
  | 
  |    public Object getAttribute(String name)
  |    {
  |        return map.get(name);
  |    }
  | 
  |    public Object createAspect() {
  | 
  |        Object aspect = aspectClass.newInstance();
  | 
  |        for (String attr : map.keySet())
  |         {
  |               Method m = .getMethod(attr);
  |               m.invoke(aspect, map.get(attr));
  |         }
  |    } 
  | }
  | 
  | 

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3861491#3861491

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3861491


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
JBoss-Development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to