Custom persistence layer

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Custom persistence layer

Binesh Gummadi
Eric/Alex,

I am in the process of writing a custom persistence layer for Alfresco. I followed the documentation and was able to push content to Alfresco on Save in form builder. Publish button should be enabled right after save is successful but it is not in my case. I guess I am not returning something back to orbeon.

This is what I did so far.
1. Exposed REST services in a custom app to accept GET, PUT, POST and DELETE.
2. Hooked PUT request to Alfresco and able to save the xml content. GET, DELETE are blank implementations.
3. Added the following to properties-local.xml
<property as="xs:anyURI"  name="oxf.fr.persistence.app.uri.*.*.*" value="http://localhost:8181/jy/rest-services" />

I checked logs to see if Orbeon issues a GET request to read the data back but it doesn't look like it. At what point is the form ready to be published? Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Custom persistence layer

Erik Bruchez
Administrator
Binesh,

PUT doesn't need to return anything except a successful HTTP status
code (e.g. 201 which means "created").

Not sure if you are using HTTP Scoop or similar, but that's immensely
helpful when you are doing this kind of work:

http://wiki.orbeon.com/forms/doc/developer-guide/admin/monitoring-http-requests

And then yes Form Builder should enable the Publish button.

-Erik

On Tue, Apr 5, 2011 at 8:48 AM, Binesh Gummadi <[hidden email]> wrote:

> Eric/Alex,
>
> I am in the process of writing a custom persistence layer for Alfresco. I
> followed the documentation and was able to push content to Alfresco on Save
> in form builder. Publish button should be enabled right after save is
> successful but it is not in my case. I guess I am not returning something
> back to orbeon.
>
> This is what I did so far.
> 1. Exposed REST services in a custom app to accept GET, PUT, POST and
> DELETE.
> 2. Hooked PUT request to Alfresco and able to save the xml content. GET,
> DELETE are blank implementations.
> 3. Added the following to properties-local.xml
>
>
> I checked logs to see if Orbeon issues a GET request to read the data back
> but it doesn't look like it. At what point is the form ready to be
> published? Thanks.
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Custom-persistence-layer-tp3428424p3428424.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Custom persistence layer

Binesh Gummadi
Eric,

Here are the calls issues by orbeon.

Default Implementation
127.0.0.1 -  -  [13/Apr/2011:02:21:48 +0000] "POST /orbeon/xforms-server HTTP/1.1" 200 1378
127.0.0.1 -  -  [13/Apr/2011:02:21:48 +0000] "PUT /orbeon/fr/service/exist/crud/orbeon/builder/data/42affed7bf47ff9b441e689f00437227/data.xml HTTP/1.1" 200 4517
127.0.0.1 -  -  [13/Apr/2011:02:21:49 +0000] "PUT /orbeon/exist/rest/db/orbeon/fr/orbeon/builder/data/42affed7bf47ff9b441e689f00437227/data.xml HTTP/1.1" 201 0

Custom Persistence
127.0.0.1 -  -  [13/Apr/2011:13:28:59 +0000] "POST /orbeon/xforms-server HTTP/1.1" 200 327
127.0.0.1 -  -  [13/Apr/2011:13:28:59 +0000] "PUT /crafter-studio/rest-services/crud/orbeon/builder/data/41d8184aa628f919ca4ad6e92e515ab2/data.xml HTTP/1.1" 204 0


Here is my REST service which accepts the requests, persists in alfresco and returns nothing (void) and the response code is 204.

<property as="xs:anyURI"  name="oxf.fr.persistence.app.uri.*.*.*" value="http://localhost:8181/crafter-studio/rest-services"/>

        @PUT
        @Path("/builder/data/{uid}/data.xml")
        @Consumes(MediaType.APPLICATION_XML)
        public void save(@PathParam("uid") String id, @Context HttpServletRequest request) {
        }

Hope void is not creating the issue here.

Thanks
Binesh Gummadi
Reply | Threaded
Open this post in threaded view
|

Re: Custom persistence layer

Binesh Gummadi
It works if I change the return type to String.

@PUT
@Path("/builder/data/{uid}/data.xml")
@Consumes(MediaType.APPLICATION_XML)
public String save(@PathParam("uid") String id, @Context HttpServletRequest request) {
  return "Success";
}

So does it work only for specific http status codes?