geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <>
Subject Re: [Discuss] Model for deployment plans in GEP - Move from EMF to XMLBeans or JAXB?
Date Fri, 14 Mar 2008 19:47:57 GMT

On Mar 14, 2008, at 3:54 AM, yunfeng ma wrote:

> Cool, great news ... :)
> I'm trying to replace EMF using JAXB and got some issues need your  
> help.
> 1. Some elements in the deployment plan can not be unmarshalled,  
> such as gbeans in geronimo-web.xml. I'm not sure if it's because  
> geronimo-web-2.0.1.xsd only includes an abstract element "service"  
> which is the parent of "gbean".
Is the gbean in the correct namespace for the schemas involved?  In  
the geronimo plan processing we do quite a bit of work to correct  
namespaces so that the plan author doesn't need to keep changing  
namespaces; in particular we set the correct namespace for gbeans no  
matter what the original namespace is.

> 2. Now the schema files are compiled to generate the model classes  
> during every GEP building. I think the better way is generating the  
> java source codes offline and importing the source codes to svn  
> directly, this provides us a chance to customize the generated  
> source codes (like the way in OpenEJB).
I agree.

> 3. The deployment plan saved by JAXB after modification is  
> unformatted, only contents are in one line. We need save the  
> deployment plan with well format.
This code seems to work well in AttributesXmlUtil:

     public static void writeAttributes(AttributesType metadata,  
Writer out) throws XMLStreamException, JAXBException {
         Marshaller marshaller = ATTRIBUTES_CONTEXT.createMarshaller();
         marshaller.setProperty("jaxb.formatted.output", true);
         JAXBElement<AttributesType> element = new ObjectFactory 
         marshaller.marshal(element, out);

> 4. More elegant way to operate the POJOs generate by JAXB. JAXB  
> uses POJO to represent the element in XML, so how to create a new  
> instance of an element (JAX
> B way is too fussy), how to set/get the properties of an element  
> via property name (JAXB doesn't provide any way for this), how to  
> get the parent instance of an element (JAXB doesn't provide any way  
> for this) etc.

I don't understand the problem here.  I thought the main point of  
using something like jaxb was so you can write typed java code for a  
typed java model corresponding to the xml.  Do you want to write  
generic java code to deal with the typed java model?

david jencks

> Any advice for the above issues?
> Thanks a lot.
> -- YunFeng Ma 

View raw message