[jboss-dev-forums] [Design of POJO Server] - Re: Unifying metadata

wolfc do-not-reply at jboss.com
Mon Sep 24 09:01:54 EDT 2007


The problem for EJB 3 is meta data translation and meta data repository.

For example defining a stateful bean with a remove method:

   <enterprise-beans>
  |       <session>
  |          <description>A stateful bean</description>
  |          <ejb-name>StatefulBean</ejb-name>
  |          <local>org.jboss.ejb3.test.stateful.Stateful</local>
  |          <ejb-class>org.jboss.ejb3.test.stateful.StatefulBean</ejb-class>
  |          <remove-method>
  |             <bean-method>
  |                <method-name>removeBean</method-name>
  |             </bean-method>
  |          </remove-method>
  |       </session>
  |    </enterprise-beans>

is the same as:

package org.jboss.ejb3.test.stateful;
  | 
  | @Stateful(description="A stateful bean")
  | @Local(Stateful.class)
  | public class StatefulBean implements Stateful
  | {
  | ...
  |    @Remove
  |    public void remove() { }
  | }

or:

package org.jboss.ejb3.test.stateful;
  | 
  | @Stateful(description="A stateful bean")
  | public class StatefulBean implements Stateful
  | {
  | ...
  |    public void remove() { }
  | }
  | 
  | @Local
  | public interface Stateful
  | {
  |    @Remove
  |    void remove();
  | }

You can see that a Description annotation never even enters the picture.

Secondly we use the class container as meta data repository, so we can do this:
      <bind pointcut="execution(public * *->@javax.ejb.Remove(..))">
  |          <interceptor-ref name="org.jboss.ejb3.stateful.StatefulRemoveFactory"/>
  |       </bind>

Again the public API annotations are leading.

Another problem: we can't use the API annotations to express all meta data, because they're not conclusive. Not everything can be expressed in annotations. So I would rather have the unified meta data as the base, which is conclusive and un-ambiguous and some translator on top. So if you ask for getAnnotation(@Remove) it will look it up in the right meta data repository in the right meta data.

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

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



More information about the jboss-dev-forums mailing list