0 Replies Latest reply on Nov 10, 2006 5:47 AM by Scott Stark

    Added JndiBinding aspect/annotation

    Scott Stark Master

      I added org.jboss.aop.microcontainer.aspects.jndi.JndiIntroduction and a org.jboss.aop.microcontainer.aspects.jndi.JndiBinding annotation to support binding a bean into jndi on the KernelControllerContextAware callbacks.

      /**
       * An annotation that indicates an object should be bound into JNDI
       *
       * @author Scott.Stark@jboss.org
       * @version $Revision: 46386 $
       */
      @Retention(RetentionPolicy.RUNTIME)
      @Target({ElementType.TYPE,ElementType.FIELD})
      public @interface JndiBinding
      {
       /**
       * the name under which the binding will be located
       * @return
       */
       String name() ;
       /**
       * Optional additional aliases to also bind
       * @return
       */
       String[] aliases() default {};
      }
      


      <deployment xmlns="urn:jboss:bean-deployer:2.0">
      ...
       <!-- Define the jndi binding advice -->
       <beanfactory name="JndiAdvice" class="org.jboss.aop.microcontainer.aspects.jndi.JndiIntroduction">
       <!-- The IntialContext ctor env to use -->
       <property name="env">
       <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
       <entry><key>java.naming.factory.initial</key><value>org.jboss.test.microcontainer.support.jndi.MockInitialContextFactory</value></entry>
       </map>
       </property>
       </beanfactory>
      
      ...
      


      See the org.jboss.test.microcontainer.test.JndiDecoratedTestCase and /aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/JndiDecoratedTestCase.xml for an example.