[Design the new POJO MicroContainer] - Added JndiBinding aspect/annotation
by scott.stark@jboss.org
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(a)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.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984848#3984848
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984848
19 years, 5 months
[Design of JBossCache] - static field replication in PojoCache
by ben.wang@jboss.com
I am trying to scope out the requirement for the static field replication. Here are what I have:
1. Create a @Replicatable field annotation so user can annotate the POJO to designate the static field for replication, e.g.,
| @org.jboss.cache.pojo.annotation.PojoCacheable
| public class POJO
| {
| @org.jboss.cache.pojo.annotation.Replicatble
| public static int someStaticVar;
|
| ...
| }
|
such that POJO.someStatic=10 will trigger the replication.
2. Only support the static variable of either Primitive or Serializable. I.e., can't support another "aspectized" POJO.
3. The fqn name for the static field varialbe is global and is known a priori, e.g., in the above case, someStaticVar will be stored under:
/__JBoss_Static_/POJO/someStaticVar
4. The static variable will be stored under the cache during POJO initialization (even when no POJO has not been put into the cache yet!)
5. And finally, there can be only ONE PojoCache instance per VM! This is needed to follow the normal Java semantics. Furthermore, if we have multiple cache instances, which cache instance are we going to store the static variables under?
Of course, the last requirement is more restrictive and more importantly make the unit testing difficult.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984816#3984816
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984816
19 years, 5 months