You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Davide Giannella <gi...@gmail.com> on 2014/02/13 11:22:44 UTC

Pushing specific nodetype in oak

Good morning,

for testing purposed I'd like to add nodes in oak with properties of a
specific node types. In my specific case it will be a Date but any other
JCR types could be needed.

I'd like to test the end-to-end behaviour therefore I'm running oak with

org.apache.jackrabbit.oak.run.Main server /path/to/repo.

It will fire an http servlet from which I can post JSON payload for
creating nodes but it manages all the nodes as String.

Regards
Davide



Re: Pushing specific nodetype in oak

Posted by Davide Giannella <gi...@gmail.com>.
On 14/02/2014 09:29, Angela Schreiber wrote:

> hi davide

> just out of curiosity: what are you trying to do?

In order to test what happens on a end-to-end case for OAK-1263 I
needed to see it behaving with a JCR Date type of property.

The reason behind it is that the property index store the keys as node
names and they're sorted using a String order. Most probably I will
have to convert the incoming date into an ISO format  before using it
as node name but I'd like to see actually what happens now before
start coding :)

D.

Re: Pushing specific nodetype in oak

Posted by Angela Schreiber <an...@adobe.com>.
hi davide

just out of curiosity: what are you trying to do?

IMO the OakServlet is just a simple proof of concept like we used to
have with in the oak-sling project. i don't think that you can use
this as a functional oak-remoting system.

in fact i was already about to suggest to move it out to the sandbox
until we have the resources to create a proper http-binding for oak.

kind regards
angela

On 14/02/14 09:47, "Davide Giannella" <gi...@gmail.com> wrote:

>On 13/02/2014 18:27, Tobias Bocanegra wrote:
>> ...
>>
>> {
>> "lastModified": "{Date}1.1.1970",
>> }
>>
>I was actually thinking something around this approach but then I saw as
>well JSON-LD[0] that will be awesome but maybe the scope of the servlet
>in oak-http is not provide a full implementation as for that we could
>leverage Sling on top of it..
>
>For now I'm investigating other routes as well but if agreed we could
>start filing an issue where we says it would be nice to have a type hint
>int he format above for the OOTB servlet. It will be the matter of
>adding another IF in [1].
>
>Any comments more than welcome :)
>
>D.
>
>(0) http://json-ld.org/
>(1)
>
>https://github.com/apache/jackrabbit-oak/blob/trunk/oak-http/src/main/java
>/org/apache/jackrabbit/oak/http/OakServlet.java?source=c#L186
>


Re: Pushing specific nodetype in oak

Posted by Davide Giannella <gi...@gmail.com>.
On 13/02/2014 18:27, Tobias Bocanegra wrote:
> ...
>
> {
> "lastModified": "{Date}1.1.1970",
> }
>
I was actually thinking something around this approach but then I saw as
well JSON-LD[0] that will be awesome but maybe the scope of the servlet
in oak-http is not provide a full implementation as for that we could
leverage Sling on top of it..

For now I'm investigating other routes as well but if agreed we could
start filing an issue where we says it would be nice to have a type hint
int he format above for the OOTB servlet. It will be the matter of
adding another IF in [1].

Any comments more than welcome :)

D.

(0) http://json-ld.org/
(1)

https://github.com/apache/jackrabbit-oak/blob/trunk/oak-http/src/main/java/org/apache/jackrabbit/oak/http/OakServlet.java?source=c#L186


Re: Pushing specific nodetype in oak

Posted by Tobias Bocanegra <tr...@apache.org>.
Hi Davide,


On Thu, Feb 13, 2014 at 2:48 AM, Davide Giannella
<gi...@gmail.com> wrote:
> On 13/02/2014 10:22, Davide Giannella wrote:
>> ...
>> It will fire an http servlet from which I can post JSON payload for
>> creating nodes but it manages all the nodes as String.
>>
> Sorry my bad. Wrong information. It won't treat all the items as string
> but it doesn't consider the Date case
>
> https://github.com/apache/jackrabbit-oak/blob/trunk/oak-http/src/main/java/org/apache/jackrabbit/oak/http/OakServlet.java?source=c#L186

The problem is, that JSON does not really specify a date type. there
are several way to solve this.

1) invent a way to transport the desired extended type. e.g. the
@TypeHint mechanics of the sling post servlet, or include the type in
the json value or name eg:
{
"lastModified": "1.1.1970",
"lastModified@TypeHint": "Date",
}

or

{
"lastModified@Date": "1.1.1970",
}

or

{
"lastModified": "{Date}1.1.1970",
}

2) try to parse the string value into a date..and assume it's date if
parsing succeeds

3) use a nodetype with a property that is required to have a date
type, eg add a mix:LastModified to your node and then use
jcr:lastModified.

Regards, Toby

Re: Pushing specific nodetype in oak

Posted by Davide Giannella <gi...@gmail.com>.
On 13/02/2014 10:22, Davide Giannella wrote:
> ...
> It will fire an http servlet from which I can post JSON payload for
> creating nodes but it manages all the nodes as String.
>
Sorry my bad. Wrong information. It won't treat all the items as string
but it doesn't consider the Date case

https://github.com/apache/jackrabbit-oak/blob/trunk/oak-http/src/main/java/org/apache/jackrabbit/oak/http/OakServlet.java?source=c#L186

D.