Restlet based REST API or WebEngine JAX-RS based API or ...?

View: New views
7 Messages — Rating Filter:   Alert me  

Restlet based REST API or WebEngine JAX-RS based API or ...?

by jiveforums-ecm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

I have to develop some custom API which allows to access Nuxeo ECM functionality like document management, workflows, user management etc. Expected API will have some our application business logic additionally.  I do not plan to use any social networking or web engine specific functions like portal, blogs, wiki, gudgets etc. I am interesting in ECM functionality of the system only.
After some research I have decided to develop API using REST approach with reusing of some CMIS ideas. After discovering Nuxeo existing functionality I have found that there are already exists several implementations of REST API for document management:
1. Restlet based API methods in org.nuxeo.ecm.platform.ui.web.restAPI and org.nuxeo.ecm.platform.syndication.restAPI packages.
2. JAX-RS based API methods in Nuxeo WebEngine (it looks like they are not completed, but some base functionality exists).
3. CMIS implementation in the future (in sandbox now).

I am trying to figure out which one is the best for extending for our application. I think it is logically to reuse some existing in Nuxeo approach instead of building own from the scratch.
Here is my ideas about each of them which are based on my current understanding of Nuxeo functionality:
1. Restlet based API.
__A. Pros (for my needs):
____a. Mature enough.
____b. Documented.
____c. Does not require WebEngine (I am trying to have the system as "lightweight" as possible if this term applicable for Jboss based application :) )
__B. Cons (for my needs):
____a. I need to have Jboss runned and restart it often in order to develop my own API method which extends BaseNuxeoRestlet subclasses. For now I use debug mode code replacing in Eclipse to partly workaround this problem (but it does not work in some cases like method signature changing etc. due to some technical reasons).
____b. It is not such convenient to develop API as it is with JAX-RS.
2. JAX-RS based API.
__A. Pros (for my needs):
____a. I can use Jetty configuration for API rapid development.
____b. We can use Jetty configuration as development lightweight configuration for the team who develop application which use our custom Nuxeo REST API.
____c. I can use Groovy.
____d. JAX-RS is a standard.
____e. I can deploy my API to Nuxeo Jboss recommended for production usage since WebEngine could be deployed on both configurations.
__B. Cons (for my needs):
____a. Does not looks like mature for this moment.
____b. WebEngine has a lot of not required for our needs functionality (I hope I can delete all not required WebEngine bundles without affecting dependencies and left just ).
3. Nuxeo CMIS implementation is too raw for this moment for usage in the nearest time. CMIS is not a standard yet.

Here I am asking for advise in this selection.
Q1. What is the best choice “Restlet based API” or “JAX-RS based API” as the base for our own REST API with some our application specific functionality?
Q2. Is it possible to develop Restlet based API on Jetty configuration? If so, could you provide a link to example configs?
Q3. Which direction is in Nuxeo long-term plan to support and ?
Q4. Which functionality of Nuxeo DM is not available on Jetty and available on JBoss configuration? Give me a link if it is described somewhere please.
Q5. Do my assumptions described above correct?
Q6. Any other pros/cons or ideas about the subject?

Sorry for so long post and thanks in advance!

Best regards,
Alexander Litvin.
--
Posted by "alexander.litvin" at Nuxeo Discussions <http://nuxeo.org/discussions>
View the complete thread: <http://www.nuxeo.org/discussions/thread.jspa?threadID=2941#8616>
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm

Re: Restlet based REST API or WebEngine JAX-RS based API or ...?

by Bogdan Stefanescu-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You should choose between JAX-RS or CMIS.

Btw, CMIS is using JAX-RS for the rest implementation.
CMIS provides a standardized way to interop. with repositories but it is not covering all specific functionality of Nuxeo. In time the Nuxeo Core will align with CMIS specifications so that more and more functionality will be exposed through CMIS. But anyway there are some specific Nuxeo aspects that will never be provided through CMIS (if CMIS will not define them in future). To overcome this we plan to add some nuxeo specific features over CMIS (in nuxeo CMIS impl.) to be able to address all our services. The problem is this can take at least some months of work.

If you plan in short term  to have better control and to use specific nuxeo APIs that are not covered by CMIS you should envisage JAX-RS.
Otherwise you can wait for all Nuxeo services to be exposed through an extension of CMIS. (or help us with this).

If you want something that you can control better (in terms of functionality) and you don't want to be dependent on milestones in having a fully CMIS working with Nuxeo + all Nuxeo additional features , then you should take the JAX-RS approach.

Now about JAX-RS.
I think there is an misunderstanding about WebEngine.
- The first goal of WebEngine is to provide JAX-RS abilities in Nuxeo. This inclues complete JAX-RS support (as it is provided by the JBoss reasteasy implementation used by webengine), Nuxeo Login and Session management on the JAX-RS objects, and also transaction management (using EJB annotations or default transaction mechanism - i.e. a transaction per request)
-  The second goal of webengine is to provide a suitable framework to build Web Sites using JAX-RS objcets. For this WebEngine extends the JAX-RS model by adding new concepts like WebObjects, WebAdapters etc.

The second point is optional, you can always use WebEngine to build good REST interfaces to Nuxeo without having to deal with WebEngine support for web sites. You can create pure JAX-RS application if that is what you want. In that case WebEngine will do the integration of your JAX-RS objects in a running Nuxeo server.
We already have examples in Nuxeo that are using WebEngine only to provide REST APis.

More, even if you don't use WebObjects (the extended webengine model) you can still use some cool features like freemarker templates, groovy, path bindings in configuration files for your root JAX-RS objects etc.

So I would not say Nuxeo JAX-RS support is not mature enough. It is as mature as JBoss Resteasy implementation is mature... You have nothing that is missing - you have only optional functionality (provided by webengine) that you can choose to use or not.

I can provide you examples on how to build JAX-RS applications with Nuxeo if you need.
 
Bogdan


2009/10/22 <jiveforums-ecm@...>
Hi!

I have to develop some custom API which allows to access Nuxeo ECM functionality like document management, workflows, user management etc. Expected API will have some our application business logic additionally.  I do not plan to use any social networking or web engine specific functions like portal, blogs, wiki, gudgets etc. I am interesting in ECM functionality of the system only.
After some research I have decided to develop API using REST approach with reusing of some CMIS ideas. After discovering Nuxeo existing functionality I have found that there are already exists several implementations of REST API for document management:
1. Restlet based API methods in org.nuxeo.ecm.platform.ui.web.restAPI and org.nuxeo.ecm.platform.syndication.restAPI packages.
2. JAX-RS based API methods in Nuxeo WebEngine (it looks like they are not completed, but some base functionality exists).
3. CMIS implementation in the future (in sandbox now).

I am trying to figure out which one is the best for extending for our application. I think it is logically to reuse some existing in Nuxeo approach instead of building own from the scratch.
Here is my ideas about each of them which are based on my current understanding of Nuxeo functionality:
1. Restlet based API.
__A. Pros (for my needs):
____a. Mature enough.
____b. Documented.
____c. Does not require WebEngine (I am trying to have the system as "lightweight" as possible if this term applicable for Jboss based application :) )
__B. Cons (for my needs):
____a. I need to have Jboss runned and restart it often in order to develop my own API method which extends BaseNuxeoRestlet subclasses. For now I use debug mode code replacing in Eclipse to partly workaround this problem (but it does not work in some cases like method signature changing etc. due to some technical reasons).
____b. It is not such convenient to develop API as it is with JAX-RS.
2. JAX-RS based API.
__A. Pros (for my needs):
____a. I can use Jetty configuration for API rapid development.
____b. We can use Jetty configuration as development lightweight configuration for the team who develop application which use our custom Nuxeo REST API.
____c. I can use Groovy.
____d. JAX-RS is a standard.
____e. I can deploy my API to Nuxeo Jboss recommended for production usage since WebEngine could be deployed on both configurations.
__B. Cons (for my needs):
____a. Does not looks like mature for this moment.
____b. WebEngine has a lot of not required for our needs functionality (I hope I can delete all not required WebEngine bundles without affecting dependencies and left just ).
3. Nuxeo CMIS implementation is too raw for this moment for usage in the nearest time. CMIS is not a standard yet.

Here I am asking for advise in this selection.
Q1. What is the best choice “Restlet based API” or “JAX-RS based API” as the base for our own REST API with some our application specific functionality?
Q2. Is it possible to develop Restlet based API on Jetty configuration? If so, could you provide a link to example configs?
Q3. Which direction is in Nuxeo long-term plan to support and ?
Q4. Which functionality of Nuxeo DM is not available on Jetty and available on JBoss configuration? Give me a link if it is described somewhere please.
Q5. Do my assumptions described above correct?
Q6. Any other pros/cons or ideas about the subject?

Sorry for so long post and thanks in advance!

Best regards,
Alexander Litvin.
--
Posted by "alexander.litvin" at Nuxeo Discussions <http://nuxeo.org/discussions>
View the complete thread: <http://www.nuxeo.org/discussions/thread.jspa?threadID=2941#8616>
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm


_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm

Re: Restlet based REST API or WebEngine JAX-RS based API or ...?

by jiveforums-ecm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You should choose between JAX-RS or CMIS.

Btw, CMIS is using JAX-RS for the rest implementation.
CMIS provides a standardized way to interop. with repositories but it is not covering all specific functionality of Nuxeo. In time the Nuxeo Core will align with CMIS specifications so that more and more functionality will be exposed through CMIS. But anyway there are some specific Nuxeo aspects that will never be provided through CMIS (if CMIS will not define them in future). To overcome this we plan to add some nuxeo specific features over CMIS (in nuxeo CMIS impl.) to be able to address all our services. The problem is this can take at least some months of work.

If you plan in short term  to have better control and to use specific nuxeo APIs that are not covered by CMIS you should envisage JAX-RS.
Otherwise you can wait for all Nuxeo services to be exposed through an extension of CMIS. (or help us with this).

If you want something that you can control better (in terms of functionality) and you don't want to be dependent on milestones in having a fully CMIS working with Nuxeo + all Nuxeo additional features , then you should take the JAX-RS approach.

Now about JAX-RS.
I think there is an misunderstanding about WebEngine.
- The first goal of WebEngine is to provide JAX-RS abilities in Nuxeo. This inclues complete JAX-RS support (as it is provided by the JBoss reasteasy implementation used by webengine), Nuxeo Login and Session management on the JAX-RS objects, and also transaction management (using EJB annotations or default transaction mechanism - i.e. a transaction per request)
-  The second goal of webengine is to provide a suitable framework to build Web Sites using JAX-RS objcets. For this WebEngine extends the JAX-RS model by adding new concepts like WebObjects, WebAdapters etc.

The second point is optional, you can always use WebEngine to build good REST interfaces to Nuxeo without having to deal with WebEngine support for web sites. You can create pure JAX-RS application if that is what you want. In that case WebEngine will do the integration of your JAX-RS objects in a running Nuxeo server.
We already have examples in Nuxeo that are using WebEngine only to provide REST APis.

More, even if you don't use WebObjects (the extended webengine model) you can still use some cool features like freemarker templates, groovy, path bindings in configuration files for your root JAX-RS objects etc.

So I would not say Nuxeo JAX-RS support is not mature enough. It is as mature as JBoss Resteasy implementation is mature... You have nothing that is missing - you have only optional functionality (provided by webengine) that you can choose to use or not.

I can provide you examples on how to build JAX-RS applications with Nuxeo if you need.
 
Bogdan
--
Posted by "bstefanescu" at Nuxeo Discussions <http://nuxeo.org/discussions>
View the complete thread: <http://www.nuxeo.org/discussions/thread.jspa?threadID=2941#8623>
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm

Re: Restlet based REST API or WebEngine JAX-RS based API or ...?

by jiveforums-ecm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bogdan, thanks a lot for quick reply and clear explanation!
I need to consider this information and make final decision taking into account your explanation.

>> I think there is an misunderstanding about WebEngine.
You are right, before now I had opinion that the main accent of WebEngine is to provide components (like cms, wiki, blogs etc.) to build web applications. Now situation is more clear for me :)
--
Posted by "alexander.litvin" at Nuxeo Discussions <http://nuxeo.org/discussions>
View the complete thread: <http://www.nuxeo.org/discussions/thread.jspa?threadID=2941#8626>
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm

Re: Restlet based REST API or WebEngine JAX-RS based API or ...?

by jiveforums-ecm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

I have studied WebEngine functionality regarding REST API a little bit more and I have several questions related to REST API based on WebEngine.

How to access existing WebEngine document management API (I am talking in this thread about programming interface, not web user interface)?

1) In “nuxeo-webengine-core/JAX-RS-README.txt” file I have found the following words:
> For example. Let say you want an ATOM API for DocumentModel.
> How you can implement it using WebEngine?
> The response is - you do nothing! :) Just use an atom client that will send
> the correct mime-type through "Accept" headers and WebEngine will use proper Writer and Readers to encode/decode requests.
> All other functionality like accessing documents, locking, unlocking, deleting etc. will be already implemented by the DocumentObejct
Unfortunately, it does not work for me. I have played with different “Accept” HTTP values: application/atom+xml, application/atomcat+xml, application/xml. No one of them returns  ATOM response. After that, I have reviewed “nuxeo-webengine-base” project sources and found that DocumentObject has only “text/htm” value in @Produces annatation. Does it mean that it does not support "application/atom+xml" now?

2) I have tried to register new media-type in module.xml of my application:
<media-types><media-type id="atom">application/atom+xml</media-type></media-types>
then I have created in my project the view file: /src/main/resources/skin/views/Document/index-atom.ftl. But, it did not help in my attempts to get ATOM response from WebEngine document.

3) May be it could be solved using JAX-RS @Provider (implementation of MessageBodyWriter). But, unfortunately, I do not see how to register new provider in web module without modifying “nuxeo-webengine-core” project files (I found only one place in code where providers were registered: org.nuxeo.ecm.webengine.WebEngine constructor).

I will be very thankful for any advises.

Best regards,
Alexander Litvin.
--
Posted by "alexander.litvin" at Nuxeo Discussions <http://nuxeo.org/discussions>
View the complete thread: <http://www.nuxeo.org/discussions/thread.jspa?threadID=2941#8694>
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm

Re: Restlet based REST API or WebEngine JAX-RS based API or ...?

by jiveforums-ecm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have subsequent questions.
--
Posted by "alexander.litvin" at Nuxeo Discussions <http://nuxeo.org/discussions>
View the complete thread: <http://www.nuxeo.org/discussions/thread.jspa?threadID=2941#8695>
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm

Re: Restlet based REST API or WebEngine JAX-RS based API or ...?

by jiveforums-ecm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

I'll try to answer for my previous questions in this topic by myself in order to save time for guys who will have the same questions.

It is information I have found during my more deep research:

1) Regarding my question about ATOM response out of box. It does not present in current WebEngine implementation (or, I did not found it). If you want to have it you need to
1.1 Register MessageBodyWriter for Resource objects, see below.
1.2 Register atom media-type in your module:
> <media-types>
> <media-type id="atom">application/atom+xml</media-type>
> </media-types>
1.3 Create atom templete for each document entity in skin.views folder of your project. Example: skin.view.Document.index-atom.ftl, skin.view.SectionRoot.index-atom.ftl etc.
1.4 Call REST API method with "Content-Type"=”application/atom+xml” request header instead of Accept header due to this issue: jira.nuxeo.org/browse/WEB-277

2) My attempts to get atom response described in previous post was not successful dure to already mentioned issue: jira.nuxeo.org/browse/WEB-277
3) Regarding registering new provider. I did it in initialize method of my WebObject:
> @Override
> public void initialize(Object... args) {
> // register JAX-RS MessageBodyWriter for Resource objects
> ctx.getEngine().getRegistry().addMessageBodyWriter(new ResourceWriter());
> }

I think REST API with WebEngine could be implemented using other architecture approaches (integrate Abdera, for instance), but described solution is the most simple from my current understanding of WebEngine functionality.

Best regards,
Alexander Litvin.
--
Posted by "alexander.litvin" at Nuxeo Discussions <http://nuxeo.org/discussions>
View the complete thread: <http://www.nuxeo.org/discussions/thread.jspa?threadID=2941#8801>
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm