Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does jax-doclets support EclipseLink moxy? #11

Open
wuyg719 opened this issue Sep 26, 2011 · 16 comments
Open

does jax-doclets support EclipseLink moxy? #11

wuyg719 opened this issue Sep 26, 2011 · 16 comments
Labels
Milestone

Comments

@wuyg719
Copy link

wuyg719 commented Sep 26, 2011

My current project is using EclipseLink moxy. Some code is using @XmlPath of EclipseLink moxy to define a fine mapping between Java object and xml schema.
And I also using jax-doclets to generate docs. Now my RestFul API is working as I expected with fine mapping. But the API doc which is generated by jax-doclets didn't follow my fine mapping setting on @XmlPath .

So my question is :

does jax-doclets support EclipseLink moxy?

some of my code like this :

@XmlPath("phones/phone[@type='home']/text()")
public String getHomePhone() {
    return homePhone;
}

@XmlPath("phones/phone[@type='work']/text()")
public String getWorkPhone() {
    return workPhone;
}

.....
@FroMage
Copy link
Owner

FroMage commented Sep 27, 2011

No we don't support it, but if you want to add support for it your contribution will be welcome :)

@wuyg719
Copy link
Author

wuyg719 commented Sep 28, 2011

Hi Stphane,

I took a brief look at the source code of jax-doclets. It did a great job
for creating restful API docs.

For my story, the standard JAXB implementation is not enough powerful and
flexible. So I turned into EclipseLink moxy, another implementation of JAXB.

My though about how to change jax-doclets to support moxy is :

(1) provide an way to pass in customized JAXB implementation
(2) provide an way to pass in Java Object tree which is created by
customized implementation when find a class on restful API interface
(3) use standard JAXB marshal mechanism to generate sample xml from the
step2's Java Object
(4) provide a standard Java Object tree creating process in order to cover
basic function, some mock framework maybe help. Users can extend some class
in order to provide partial customization.

Like to hear what you are thinking.
Sincerely
Justin

2011/9/27 Stphane pardaud <
reply@reply.github.com>

No we don't support it, but if you want to add support for it your
contribution will be welcome :)

Reply to this email directly or view it on GitHub:
#11 (comment)

Justin Wu, Software Developer, Tungle
justin@tungle.com
m. +1.519.498.8138
w. +1.519.746.8779

Scheduling made easy.  Get Tungle at www.tungle.com.
- - - - -
This e-mail is privileged, confidential, and subject to copyright.
Any unauthorized use or disclosure is prohibited.

@FroMage
Copy link
Owner

FroMage commented Sep 28, 2011

Currently all the JAXB mapping is done by hand based on the spec and what we had time to support. You're more than welcome to add support for whatever else you want supported.

@wuyg719
Copy link
Author

wuyg719 commented Sep 30, 2011

I tried my thought and it works, but the objects created on that way
sometimes can't pass schema validation. Seems it has another better way to
generate sample xml:
(1) get JAXB implementation
(2) generate xml schema for target classes
(3) generate xml sample from schema

In this way, it can generate a valid xml sample.

2011/9/28 Stphane pardaud <
reply@reply.github.com>

Currently all the JAXB mapping is done by hand based on the spec and what
we had time to support. You're more than welcome to add support for whatever
else you want supported.

Reply to this email directly or view it on GitHub:
#11 (comment)

Justin Wu, Software Developer, Tungle
justin@tungle.com
m. +1.519.498.8138
w. +1.519.746.8779

Scheduling made easy.  Get Tungle at www.tungle.com.
- - - - -
This e-mail is privileged, confidential, and subject to copyright.
Any unauthorized use or disclosure is prohibited.

@FroMage
Copy link
Owner

FroMage commented Oct 4, 2011

Hey if you manage to get this to work, be my guest. The current solution is a hack but happens to work well enough for most users and was relatively easy to do. Also it supports links to sub-elements and is concise. If you can do better, be my guest and I will include it.

@wuyg719
Copy link
Author

wuyg719 commented Oct 4, 2011

Hi,

I have to pause the implementation of the first thought for weeks because I
was given some high priority tasks. It still needs some coding to finish it.

I can send all my half-way coding if you like or just wait for weeks?
For the second though I thought we need some third-party jars. I found some
discuss on it, But didn't try:
http://stackoverflow.com/questions/17106/how-to-generate-sample-xml-documents-from-their-dtd-or-xsd

Sincerely
Justin

2011/10/4 Stphane pardaud <
reply@reply.github.com>

Hey if you manage to get this to work, be my guest. The current solution is
a hack but happens to work well enough for most users and was relatively
easy to do. Also it supports links to sub-elements and is concise. If you
can do better, be my guest and I will include it.

Reply to this email directly or view it on GitHub:
#11 (comment)

Justin Wu, Software Developer, Tungle
justin@tungle.com
m. +1.519.498.8138
w. +1.519.746.8779

Scheduling made easy.  Get Tungle at www.tungle.com.
- - - - -
This e-mail is privileged, confidential, and subject to copyright.
Any unauthorized use or disclosure is prohibited.

@FroMage
Copy link
Owner

FroMage commented Oct 4, 2011

I can wait, no rush :) Thanks for your help!

@wuyg719
Copy link
Author

wuyg719 commented Jan 12, 2012

Hi Stphane pardaud,

Now I am back to the javadocs again.

First I summary What I am going to do:

let jax-doclet can handle customized JAXB implementation.

So I assume :

Any customized JAXB implementation can generate xml schema for all

entity Java bean even without container supporting

Of course the one I am working is Eclipse_Moxy, which can meet this
requirement.

Then I Summary what I am going to do:
(1) Define an interface "XmlSchemaFactory", will let user customize
their own implementation and pass the target schema to our doclet,

(2) I will create an XmlGenerator class will generate sample xml data
based on the schema which is passed into in the first step. This step will
use a third party jar: xsom, http://xsom.java.net/userguide.html

(3) customized xmlGenerator: XmlGenerator is not good for every schema
because it do a lot of assumption. So I will create another mechanism to
do customized implementation.

I did a simple implementation of step 1 and 2, For step3 , My first
thought is to pass XPATH into our doclet and our doclet will adjust
generated xml based on those XPATH.

I'd like to hear your idea.

Sincerely
Justin

2011/10/4 Stphane pardaud <
reply@reply.github.com>

I can wait, no rush :) Thanks for your help!

Reply to this email directly or view it on GitHub:
#11 (comment)

Justin Wu, Software Developer, Tungle
justin@tungle.com
m. +1.519.498.8138
w. +1.519.746.8779

Scheduling made easy.  Get Tungle at www.tungle.com.
- - - - -
This e-mail is privileged, confidential, and subject to copyright.
Any unauthorized use or disclosure is prohibited.

@wuyg719
Copy link
Author

wuyg719 commented Jan 12, 2012

Another issue is that some JAXRS method return javax.ws.rs.core.Response,
which warp up real return type . I am thinking how to handle it.

2012/1/12 Justin Wu justin@tungle.com

Hi Stphane pardaud,

Now I am back to the javadocs again.

First I summary What I am going to do:

let jax-doclet can handle customized JAXB implementation.

So I assume :

Any customized JAXB implementation can generate xml schema for all

entity Java bean even without container supporting

Of course the one I am working is Eclipse_Moxy, which can meet this
requirement.

Then I Summary what I am going to do:
(1) Define an interface "XmlSchemaFactory", will let user customize
their own implementation and pass the target schema to our doclet,

(2) I will create an XmlGenerator class will generate sample xml data
based on the schema which is passed into in the first step. This step will
use a third party jar: xsom, http://xsom.java.net/userguide.html

(3) customized xmlGenerator: XmlGenerator is not good for every schema
because it do a lot of assumption. So I will create another mechanism to
do customized implementation.

I did a simple implementation of step 1 and 2, For step3 , My first
thought is to pass XPATH into our doclet and our doclet will adjust
generated xml based on those XPATH.

I'd like to hear your idea.

Sincerely
Justin

2011/10/4 Stphane pardaud <
reply@reply.github.com>

I can wait, no rush :) Thanks for your help!

Reply to this email directly or view it on GitHub:
#11 (comment)

Justin Wu, Software Developer, Tungle
justin@tungle.com
m. +1.519.498.8138
w. +1.519.746.8779

Scheduling made easy.  Get Tungle at www.tungle.com.
- - - - -
This e-mail is privileged, confidential, and subject to copyright.
Any unauthorized use or disclosure is prohibited.

Justin Wu, Software Developer, Tungle
justin@tungle.com
m. +1.519.498.8138
w. +1.519.746.8779

Scheduling made easy.  Get Tungle at www.tungle.com.
- - - - -
This e-mail is privileged, confidential, and subject to copyright.
Any unauthorized use or disclosure is prohibited.

@FroMage
Copy link
Owner

FroMage commented Jan 27, 2012

Well, I just suspect most users of JAXB will be like me and not even have or care about schemas or extensions. It'd be great to add support for extensions such as @XmlPath, but we can do that on an ad-hoc basis, I certainly don't want to require schemas. I'm fine with making schemas optional, but the simple/default case should still work like now (though I agree the example XML can be improved, but it cannot require more info from the user).

@wuyg719
Copy link
Author

wuyg719 commented Jan 27, 2012

Even I don't care the xml schema. The only purpose of those schema is to
generate sample xml.

My change is small. the main is part leaving to the customized
implementation.

Of course I can keep it only for myself if you don't like the idea.

2012/1/27 Stphane pardaud <
reply@reply.github.com

Well, I just suspect most users of JAXB will be like me and not even have
or care about schemas or extensions. It'd be great to add support for
extensions such as @XmlPath, but we can do that on an ad-hoc basis, I
certainly don't want to require schemas. I'm fine with making schemas
optional, but the simple/default case should still work like now (though I
agree the example XML can be improved, but it cannot require more info from
the user).


Reply to this email directly or view it on GitHub:
#11 (comment)

Justin Wu, Software Developer, Tungle
justin@tungle.com
m. +1.519.498.8138
w. +1.519.746.8779

Scheduling made easy.  Get Tungle at www.tungle.com.
- - - - -
This e-mail is privileged, confidential, and subject to copyright.
Any unauthorized use or disclosure is prohibited.

@FroMage
Copy link
Owner

FroMage commented Jan 27, 2012

No I'm certainly interested :)

@wuyg719
Copy link
Author

wuyg719 commented Jan 27, 2012

how can I check in the code?

2012/1/27 Stphane pardaud <
reply@reply.github.com

No I'm certainly interested :)


Reply to this email directly or view it on GitHub:
#11 (comment)

Justin Wu, Software Developer, Tungle
justin@tungle.com
m. +1.519.498.8138
w. +1.519.746.8779

Scheduling made easy.  Get Tungle at www.tungle.com.
- - - - -
This e-mail is privileged, confidential, and subject to copyright.
Any unauthorized use or disclosure is prohibited.

@wuyg719
Copy link
Author

wuyg719 commented Jan 27, 2012

do you need a review on it?

2012/1/27 Justin Wu justin@tungle.com

how can I check in the code?

2012/1/27 Stphane pardaud <
reply@reply.github.com

No I'm certainly interested :)


Reply to this email directly or view it on GitHub:
#11 (comment)

Justin Wu, Software Developer, Tungle
justin@tungle.com
m. +1.519.498.8138
w. +1.519.746.8779

Scheduling made easy.  Get Tungle at www.tungle.com.
- - - - -
This e-mail is privileged, confidential, and subject to copyright.
Any unauthorized use or disclosure is prohibited.

Justin Wu, Software Developer, Tungle
justin@tungle.com
m. +1.519.498.8138
w. +1.519.746.8779

Scheduling made easy.  Get Tungle at www.tungle.com.
- - - - -
This e-mail is privileged, confidential, and subject to copyright.
Any unauthorized use or disclosure is prohibited.

@FroMage
Copy link
Owner

FroMage commented Jan 27, 2012

Yes please, make a pull request.

@wuyg719
Copy link
Author

wuyg719 commented Jan 27, 2012

Please see the attachment and review my changes.

the file build_sample.xml is an ant script sample.

2012/1/27 Stphane pardaud <
reply@reply.github.com

Yes please, make a pull request.


Reply to this email directly or view it on GitHub:
#11 (comment)

Justin Wu, Software Developer, Tungle
justin@tungle.com
m. +1.519.498.8138
w. +1.519.746.8779

Scheduling made easy.  Get Tungle at www.tungle.com.
- - - - -
This e-mail is privileged, confidential, and subject to copyright.
Any unauthorized use or disclosure is prohibited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants