-
1. Re: JAXB annotations for OSGi Blueprint
aloubyansky Jun 20, 2009 4:50 AM (in response to thomas.diesler)You are on the right track, actually :)
You've specified the namespace using JBossXmlSchema annotation. Which is correct. You should still add namespace element to the XmlRootElement annotation, which is a bit confusing having JBossXmlSchema. You don't have to do that XmlElement annotations.
Unfortunately, we don't have JAXB tutorial for JBossXB. But you can find one for JAXB on Sun's web-site and use javadoc. For examples you can see tests in XB http://anonsvn.jboss.org/repos/common/jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/
And post issues here. -
2. Re: JAXB annotations for OSGi Blueprint
ropalka Jun 22, 2009 3:48 AM (in response to thomas.diesler)Hi Thomas,
when you'll start to be frustrated with JBossXB, try X2JB instead ;) You'll be surprised how easy is to do XML -> Java mapping.
Richard -
3. Re: JAXB annotations for OSGi Blueprint
thomas.diesler Jun 30, 2009 4:15 AM (in response to thomas.diesler)Hi Richard,
yes, I seem to spent a lot of time to get even trivial stuff working. Looking at X2JB it seems rather simplistic.
Does it support collections of abstract types?List<Animal> getAnimals(); <animals> <cat> <dog> <horse> </animals>
Perhaps you like to explain a little better why I would want to use X2JB and why it is more suitable than JBossXB or JAXB.
https://sourceforge.net/forum/forum.php?thread_id=3318335&forum_id=638125 -
4. Re: JAXB annotations for OSGi Blueprint
thomas.diesler Jun 30, 2009 4:21 AM (in response to thomas.diesler)@Alex
I did as you suggested, but still get the same error
https://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TBlueprint.java -
5. Re: JAXB annotations for OSGi Blueprint
adrian.brock Jun 30, 2009 5:15 AM (in response to thomas.diesler)"thomas.diesler@jboss.com" wrote:
@Alex
I did as you suggested, but still get the same error
https://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TBlueprint.java
JBossXB was never updated to look at fields so you need to move the @XmlElement(s) to the getter.
It should be easy though to make JBossXB look at fields.
http://anonsvn.jboss.org/repos/common/jbossxb/trunk/src/main/java/org/jboss/xb/builder/JBossXBNoSchemaBuilder.java// Create the handler -BeanInfo beanInfo = JBossXBBuilder.configuration.getBeanInfo(typeInfo); + BeanInfo beanInfo = JBossXBBuilder.configuration.getBeanInfo(typeInfo, BeanAccessMode.ALL);
P.S. All metadata should be Serializable
P.S.2. You should be setting the property order on the type otherwise the parsing
won't match the schema - you get a random order of elements based on what
java.lang.reflect returns.
P.S.3. We already have the metadata for the bean stuff. Look at the spring-mc-int project
which maps the spring xml to mc metadata (or speak to Ales) - no point reinventing it -
6. Re: JAXB annotations for OSGi Blueprint
adrian.brock Jun 30, 2009 5:27 AM (in response to thomas.diesler)"thomas.diesler@jboss.com" wrote:
Perhaps you like to explain a little better why I would want to use X2JB and why it is more suitable than JBossXB or JAXB.
https://sourceforge.net/forum/forum.php?thread_id=3318335&forum_id=638125
One major disadvantage (without even looking at the code)
is that it is another thirdparty dependency which would mean more bloat.
We already have an xml binding framework which is JBossXB and its based on a standard.
If it doesn't do what you want then fix/change it, don't write another, that's just
NIH syndrome. -
7. Re: JAXB annotations for OSGi Blueprint
aloubyansky Jun 30, 2009 8:26 AM (in response to thomas.diesler)As Adrian said, the annotations should be moved to methods. You can see what is bound and how if you enable TRACE for org.jboss.xb.builder.
-
8. Re: JAXB annotations for OSGi Blueprint
ropalka Jul 1, 2009 1:16 AM (in response to thomas.diesler)"adrian@jboss.org" wrote:
don't write another, that's just
NIH syndrome.
This is relative (like everything in this world). My point of view on NIH is nice expressed here.
I don't consider MC as NIH comparing to Spring, because it's critical project for JBoss/RH.
For the same reason I don't consider X2JB NIH because its critical for my projects because I need to:
* have the full control over the XML->Java binding process
* have the full control over the code to do architectural changes
* have the full control of X2JB project lifecycle (to fix/release immediately)
I don't have that kind of control over the JAXB or XMLBeans thus I'm not going to use
JBossXB, JAXB, XMLBeans and other binding frameworks neither now nor in the future
in my not JBoss related projects. -
9. Re: JAXB annotations for OSGi Blueprint
ropalka Jul 1, 2009 2:02 AM (in response to thomas.diesler)"thomas.diesler@jboss.com" wrote:
Looking at X2JB it seems rather simplistic.
Yes, this was one of the requirements: extreme simplicity."thomas.diesler@jboss.com" wrote:
Does it support collections of abstract types?List<Animal> getAnimals(); <animals> <cat> <dog> <horse> </animals>
Perhaps you like to explain a little better why I would want to use X2JB and why it is more suitable than JBossXB or JAXB.
It doesn't support collections but it supports arrays, see my posts on X2JB forum. -
10. Re: JAXB annotations for OSGi Blueprint
aloubyansky Jul 1, 2009 4:20 AM (in response to thomas.diesler)Richard, all these are non-problems.
"richard.opalka@jboss.com" wrote:
* have the full control over the XML->Java binding process
* have the full control over the code to do architectural changes
* have the full control of X2JB project lifecycle (to fix/release immediately)
I don't have that kind of control over the JAXB or XMLBeans thus I'm not going to use
JBossXB, JAXB, XMLBeans and other binding frameworks neither now nor in the future
in my not JBoss related projects.
You can have all of that. I don't think anybody would mind.
There are lots of custom binding features in XB. You are welcome to add more.
There have never been a complaint about project lifecycle for the reason that there is no roadmap. It's demand-driven. If someone needs a release we can do it often the same day or whenever it's needed.
You want to do architectural changes - really no problem. Given that the existing users are not affected of course. I guess that's the real thing you don't want to deal with. -
11. Re: JAXB annotations for OSGi Blueprint
thomas.diesler Jul 1, 2009 4:42 AM (in response to thomas.diesler)@Richard
At the end of the day you might find that it saves you a lot of time using jbossxb instead of writing your own unmarshalling layer. This is time you can spend on your main project instead ;-)
Alexey, is indeed very responsive when it comes to resolving technical issues. jbossas uses jbossxb for all its configuration tasks (which are non-trivial in places). Please also remember that we used jbossxb for the jax-rpc part in jbossws. We could never have delivered on time if we had to do our own XML marshalling layer.
I agree that the entry to jbossxb is high because of it sucks in documentation. Which is probably the root of your jbossxb adoption problem.
You can monitor
https://jira.jboss.org/jira/browse/JBXB-208
for this issue.
Anyway, good luck with your (main) project. -
12. Re: JAXB annotations for OSGi Blueprint
ropalka Jul 1, 2009 5:32 AM (in response to thomas.diesler)"alex.loubyansky@jboss.com" wrote:
You can have all of that. I don't think anybody would mind.
There are lots of custom binding features in XB. You are welcome to add more.
There have never been a complaint about project lifecycle for the reason that there is no roadmap. It's demand-driven. If someone needs a release we can do it often the same day or whenever it's needed.
You want to do architectural changes - really no problem. Given that the existing users are not affected of course. I guess that's the real thing you don't want to deal with.
Thanks Alex, I highly appreciate it ;)
I'm not saying JBossXB is bad.
I started X2JB project before I joined JBoss
and before I learned JBossXB.
The above arguments were mainly about
explaining what is/isn't NIH ;)
RIchard -
13. Re: JAXB annotations for OSGi Blueprint
ropalka Jul 1, 2009 5:39 AM (in response to thomas.diesler)"thomas.diesler@jboss.com" wrote:
At the end of the day you might find that it saves you a lot of time using jbossxb instead of writing your own unmarshalling layer. This is time you can spend on your main project instead ;-)
Yes, I know what you mean. X2JB is one of my little free time projects.
If I'd count man days spent on it in last two and half years, it wouldn't reach
20 MD at all ;) Thus X2JB isn't my main project."thomas.diesler@jboss.com" wrote:
Alexey, is indeed very responsive when it comes to resolving technical issues. jbossas uses jbossxb for all its configuration tasks (which are non-trivial in places). Please also remember that we used jbossxb for the jax-rpc part in jbossws. We could never have delivered on time if we had to do our own XML marshalling layer.
Agreed."thomas.diesler@jboss.com" wrote:
Anyway, good luck with your (main) project.
Thanks ;) -
14. Re: JAXB annotations for OSGi Blueprint
anil.saldhana Jul 1, 2009 6:15 PM (in response to thomas.diesler)"adrian@jboss.org" wrote:
We already have an xml binding framework which is JBossXB and its based on a standard.
What standard does JBossXB support?