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

adrian@jboss.org do-not-reply at jboss.com
Fri Jan 26 08:23:37 EST 2007


"jason.greene at jboss.com" wrote : Or different schemas need to be associated with the same object model. 
  | -Jason

Yes, this is also broken as well. :-)

The namspace is associated with the
package level annotation rather the root element.
This is a basic reusability issue.

e.g. It should be:


  | public class AbstractEJBModel
  | {
  |     @XMLElement(name="enterpriseBeans")
  |     public void setEJBs(List<EJB> ejbs);
  | }
  | 
  | @XmlRootElement(namespace="EJB21Namespace")
  | public class Ejb21Model extends AbstractEJBModel
  | {
  | }
  | 
  | @XmlRootElement(namespace="EJB30Namespace")
  | public class Ejb30Model extends AbstractEJBModel
  | {
  | }
  | 

The ejbs property should be mapped to EJB21Namespace/EJB21Model or EJB30Namespace/EJB30Model
depending on the model chosen (the namespace in the xml).

I have this in my prototype of bindings for JBossXB annotations -
the USE_PARENT_NAMESPACE.


  | /**
  |  * SchemaProperty.
  |  * 
  |  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  |  * @version $Revision: 1.1 $
  |  */
  | @Documented
  | @Target(ElementType.METHOD)
  | @Retention(RetentionPolicy.RUNTIME)
  | public @interface SchemaProperty
  | {
  |    /** Whether it is mandatory */
  |    boolean mandatory() default true;
  |    
  |    /** The namespace, default empty */
  |    String namespace() default SchemaConstants.USE_PARENT_NAMESPACE;
  | 
  |    /** The local name, default use the property name */
  |    String name() default SchemaConstants.USE_PROPERTY_NAME;
  |    
  |    /** The implementation class */
  |    Class<?> impl() default Object.class;
  |    
  |    /** TODO remove this when groups work properly */
  |    boolean noInterceptor() default false;
  |    
  |    /** TODO combine with mandatory */
  |    boolean ignore() default false;
  | }
  | 

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

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



More information about the jboss-dev-forums mailing list