[
https://issues.apache.org/jira/browse/PLUTO-308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474702
]
Christian Raschka commented on PLUTO-308:
-----------------------------------------
For those who want to add things to the *DD classes, here's a small instruction
how to write JAXB annotations:
* before the class add: @XmlAccessorType(XmlAccessType.FIELD)
and: @XmlType(name = "NAME", propOrder = {
"PROP1",
"PROP2",
"PROP3"
})
where NAME is the name of the attribute in the xml file and PROP* are the
fields in the class.
* before each field in the class add @XmlElement(name = "PROP"), if the
attribute in the xml file is PROP
* if you use fields, which are not in the xml file, mark it with @XmlTransient
* there are many other annotations, for more information see JSR222
* add methods in the "ObjectFactory" (see this class for examples)
* add an entry to jaxb.index if you wrote a new class
* if you have problems, use the code generator xjc (maven plugin) and copy the
information to the *DD classes
(maybe this info should go to the wiki or something else?)
> This patch is for new deployment with JAXB instead of castor and the changes
> for the new API Revision from 8 to 11.
> -------------------------------------------------------------------------------------------------------------------
>
> Key: PLUTO-308
> URL: https://issues.apache.org/jira/browse/PLUTO-308
> Project: Pluto
> Issue Type: New Feature
> Components: general
> Affects Versions: 1.1-286-COMPATIBILITY
> Reporter: Torsten Dettborn
> Fix For: 1.1-286-COMPATIBILITY
>
> Attachments: jaxb_n_api-r11.080207.patch
>
>
> Christian has made a patch for the new JAXB binding for the deployment from
> the portlets, because there are too many problems with the patch (Issue 287)
> we decided to reject this issue and patch it all in one. Here is the
> description from Christian:
> "Unfortunately this patch is a big one. In the new spec there are
> qnames, which are used to identify names, e.g. event names. The
> previous implementation of the Portlet Object Model use castor
> for xml binding. Unfortunately castor does not support qnames in
> a way we need it. Thats why i implement the xml data binding with
> jaxb. In the new Spec there are other points JAXB will be used,
> therefor i think using JAXB is not a bad idea.
> My first idea was to change the *DD classes to interfaces and then
> let castor and jaxb implement this classes. In this case we should
> be able to use both xml data bindings together and the user has the
> choice.
> But i ran into several problems with this approach. On the one hand,
> the castor *DD classes doesn't provide all necessary methods
> and therefor much work with the castor implementation has to be
> done. On the other hand i want to use the classes automatically
> generated by jaxb.
> In my mind the best thing would be, to use the castor classes and
> annotate them with jaxb annotations. Then there aren't as much
> changes as with this patch.
> I have gone the other way, a matter of time. I've delete the castor
> things and use jaxb as the only xml data binding.
> What this patch does:
> I have generated (xjc maven plugin) the jaxb classes and add it to the
> repository. Then all occurences of *DD are replaced by the jaxb *Type
> classes. Some methods had to be renamed, and some jaxb classes had to
> be implemented because of XMLSchema conflicts.
> I use the JAXB RI, that is why i had to change the poms and installation
> dependencies. I add a new JaxbDescriptorService interface and the
> corresponding implementation.
> Note:
> With the current portlet-app_2_0.xsd (provided at:
> http://ipc658.inf-swt.uni-jena.de/spec/JSR%202.0%20API/portlet-app_2_0.xsd)
> it is not possible to use old portlet.xml files from JSR168. This has
> to be changed in the final release of the specification. Therefor i had
> to change the portlet.xml files in the repo.
> What has to be done:
> Writing of portlet.xml and web.xml is not supported yet.
> I would appreciate if someone could implement the (IMHO) better approach
> of adding the jaxb annotations to the castor classes."
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.