You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Torsten Schlabach <ts...@apache.org> on 2005/07/28 16:28:10 UTC

JCR question

Hi guys,

I have successfully achieved this:

1. I have built Jackrabbit and created a sample repository using the
examples (First Steps) code samples. This is a repository which is
entirely independent of Cocoon.

2. I have imported some XML stuff into the repository, also following that
XHTML/MathML example from the Jackrabbit First Steps page.

3. I managed to make this repository known to Cocoon's JCR block by
editing cocoon.xconf approprietely.

4. I can generate the collections through the TraversableGenerator in
webapp/samples/blocks/jcr of Cocoon (though on the blocks overview page it
says the jcr block did not have any samples). I can see the collection of
nodes that were created by the Jackrabbit example, such as /xmlimport for
example.

But this is where I am stuck.

In order not to get the collections but an actual property (read: piece of
content) from the repository, I tried something like:

<map:generate src="jcr://importxml/xhtml:html/xhtml:body/xhtml:p[2]" />

But no matter what node I try, I keep getting

org.apache.cocoon.ProcessingException: Exception during source resolving.:
org.apache.excalibur.source.SourceException: Path
'jcr://importxml/xhtml:html/xhtml:body/xhtml:p[2]' is a collection

What do I have to put into the jcr:// URI in order to access content, not
meta-information.

Regards,
Torsten


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: JCR question

Posted by Torsten Schlabach <ts...@apache.org>.
Josias,

thank you very much for your explaination! It really helped me over the
hurdle. For the first time, I was able to get something out of my
repository.

I also start to understand the difference between a repository and a plain
filesystem and that the JCR source basically proposes a very specific view
on the repository to make it act like a filesystem again.

Gotta put some thoughts to this ... But thank you in the meanwhile. You
probably made my weekend!

Regards,
Torsten

> On Fri, 2005-07-29 at 16:20 +0200, Torsten Schlabach wrote:
>> Josias,
>>
>> >> <content-node type="nt:resource"
>> >>   content-prop="jcr:data"
>> >>   mimetype-prop="jcr:mimeType"
>> >>   lastmodified-prop="jcr:lastModified"
>> >>   validity-prop="jcr:lastModified"/>
>>
>> That piece was definitely missing. But I am not yet sure that I have
>> fully
>> understood this stuff. I have imported the sample as you can see it from
>>
>> http://incubator.apache.org/jackrabbit/firststeps.html
>>
>> and changed my repository config in Cocoon to find that repository which
>> Jackrabbit has created. So far that worked fine. Now I am trying to get
>> back any piece of that XML document that got imported in the first steps
>> example.
>>
>> >From reading the JCR (JSR-170) spec on page 16 I got the impression,
>> that
>> actual content is always a property, not a node. My understanding of
>> page
>> 16 of the spec was that nodes are just some kind of directory, but that
>> might be wrong.
>
> Yes, in JCR the content is always stored in a property.
> But with the jcr:// protocol, you are referring to nodes. The trick is
> that nodes have a type, and depending on the type, the jcr:// protocol
> will either regard the node as a "folder" or as a "file". Only files can
> have actual content.
> If you specifiy the path to a file-node with the jcr:// protocol, the
> corresponding content-property will be fetched and the content returned.
> Which nodetypes are folders and which are files is defined in the
> configuration of the JCRSourceFactory. You also have to define which
> property holds the content. BTW, the javadoc of this class has a good
> explanation.
>
> As far as I understood it, the JCR-block is quite filesystem-oriented.
> That means that a folder cannot have content of its own.
> In JCR, this is certainly possible, any node can have subnodes and
> properties at the same time.
> In the firststeps example of jackrabbit, all nodes in the "import"
> branch seem to have type "nt:unstructured". So I see no way to define
> which nodes are folders and which are files.
> To me it seems that you cannot really use an arbitrary repository with
> the JCR block.
>
> But I'm no JCR expert at all, and I might be wrong.
>
> Josias
>
>
>
>
>>
>> > Does your configuration match your repository?
>>
>> No, I have no idea how
>>
>> >> <content-node type="nt:resource"
>> >>   content-prop="jcr:data"
>> >>   mimetype-prop="jcr:mimeType"
>> >>   lastmodified-prop="jcr:lastModified"
>> >>   validity-prop="jcr:lastModified"/>
>>
>> might match my repository or not.
>>
>> Regards,
>> Torsten
>>
>>
>> > On Thu, 2005-07-28 at 17:17 +0200, Josias Thoeny wrote:
>> >> On Thu, 2005-07-28 at 16:28 +0200, Torsten Schlabach wrote:
>> >> > Hi guys,
>> >> >
>> >> > I have successfully achieved this:
>> >> >
>> >> > 1. I have built Jackrabbit and created a sample repository using
>> the
>> >> > examples (First Steps) code samples. This is a repository which is
>> >> > entirely independent of Cocoon.
>> >> >
>> >> > 2. I have imported some XML stuff into the repository, also
>> following
>> >> that
>> >> > XHTML/MathML example from the Jackrabbit First Steps page.
>> >> >
>> >> > 3. I managed to make this repository known to Cocoon's JCR block by
>> >> > editing cocoon.xconf approprietely.
>> >> >
>> >> > 4. I can generate the collections through the TraversableGenerator
>> in
>> >> > webapp/samples/blocks/jcr of Cocoon (though on the blocks overview
>> >> page it
>> >> > says the jcr block did not have any samples). I can see the
>> collection
>> >> of
>> >> > nodes that were created by the Jackrabbit example, such as
>> /xmlimport
>> >> for
>> >> > example.
>> >> >
>> >> > But this is where I am stuck.
>> >> >
>> >> > In order not to get the collections but an actual property (read:
>> >> piece of
>> >> > content) from the repository, I tried something like:
>> >> >
>> >> > <map:generate
>> src="jcr://importxml/xhtml:html/xhtml:body/xhtml:p[2]"
>> >> />
>> >> >
>> >> > But no matter what node I try, I keep getting
>> >> >
>> >> > org.apache.cocoon.ProcessingException: Exception during source
>> >> resolving.:
>> >> > org.apache.excalibur.source.SourceException: Path
>> >> > 'jcr://importxml/xhtml:html/xhtml:body/xhtml:p[2]' is a collection
>> >> >
>> >> > What do I have to put into the jcr:// URI in order to access
>> content,
>> >> not
>> >> > meta-information.
>> >>
>> >> What is the configuration of your JCRSourceFactory?
>> >> I think to define which nodes actually contain the data, you have to
>> >> define a file-node with a content-node having a content-prop, like
>> e.g.:
>> >
>> > oops, accidentally sent...
>> >
>> > Here is a part of the sample configuration of the JCRSourceFactory:
>> >
>> > <file-node content-ref="jcr:content" type="nt:linkedFile"/>
>> >                <content-node type="nt:resource"
>> >                              content-prop="jcr:data"
>> >                              mimetype-prop="jcr:mimeType"
>> >                              lastmodified-prop="jcr:lastModified"
>> >                              validity-prop="jcr:lastModified"/>
>> >
>> > It means there will be a "jcr:content" node with a property "jcr:data"
>> > which will contain the actual data.
>> > Does your configuration match your repository?
>> >
>> > hth,
>> > Josias
>> >
>> >
>> >>
>> >>
>> >> >
>> >> > Regards,
>> >> > Torsten
>> >> >
>> >> >
>> >> > ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> >> > For additional commands, e-mail: users-help@cocoon.apache.org
>> >> >
>> >> >
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> >> For additional commands, e-mail: users-help@cocoon.apache.org
>> >>
>> >>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> > For additional commands, e-mail: users-help@cocoon.apache.org
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: JCR question

Posted by Josias Thoeny <jo...@wyona.com>.
On Fri, 2005-07-29 at 16:20 +0200, Torsten Schlabach wrote:
> Josias,
> 
> >> <content-node type="nt:resource"
> >>   content-prop="jcr:data"
> >>   mimetype-prop="jcr:mimeType"
> >>   lastmodified-prop="jcr:lastModified"
> >>   validity-prop="jcr:lastModified"/>
> 
> That piece was definitely missing. But I am not yet sure that I have fully
> understood this stuff. I have imported the sample as you can see it from
> 
> http://incubator.apache.org/jackrabbit/firststeps.html
> 
> and changed my repository config in Cocoon to find that repository which
> Jackrabbit has created. So far that worked fine. Now I am trying to get
> back any piece of that XML document that got imported in the first steps
> example.
> 
> >From reading the JCR (JSR-170) spec on page 16 I got the impression, that
> actual content is always a property, not a node. My understanding of page
> 16 of the spec was that nodes are just some kind of directory, but that
> might be wrong.

Yes, in JCR the content is always stored in a property.
But with the jcr:// protocol, you are referring to nodes. The trick is
that nodes have a type, and depending on the type, the jcr:// protocol
will either regard the node as a "folder" or as a "file". Only files can
have actual content.
If you specifiy the path to a file-node with the jcr:// protocol, the
corresponding content-property will be fetched and the content returned.
Which nodetypes are folders and which are files is defined in the
configuration of the JCRSourceFactory. You also have to define which
property holds the content. BTW, the javadoc of this class has a good
explanation.

As far as I understood it, the JCR-block is quite filesystem-oriented.
That means that a folder cannot have content of its own. 
In JCR, this is certainly possible, any node can have subnodes and
properties at the same time.
In the firststeps example of jackrabbit, all nodes in the "import"
branch seem to have type "nt:unstructured". So I see no way to define
which nodes are folders and which are files.
To me it seems that you cannot really use an arbitrary repository with
the JCR block.

But I'm no JCR expert at all, and I might be wrong.

Josias




> 
> > Does your configuration match your repository?
> 
> No, I have no idea how
> 
> >> <content-node type="nt:resource"
> >>   content-prop="jcr:data"
> >>   mimetype-prop="jcr:mimeType"
> >>   lastmodified-prop="jcr:lastModified"
> >>   validity-prop="jcr:lastModified"/>
> 
> might match my repository or not.
> 
> Regards,
> Torsten
> 
> 
> > On Thu, 2005-07-28 at 17:17 +0200, Josias Thoeny wrote:
> >> On Thu, 2005-07-28 at 16:28 +0200, Torsten Schlabach wrote:
> >> > Hi guys,
> >> >
> >> > I have successfully achieved this:
> >> >
> >> > 1. I have built Jackrabbit and created a sample repository using the
> >> > examples (First Steps) code samples. This is a repository which is
> >> > entirely independent of Cocoon.
> >> >
> >> > 2. I have imported some XML stuff into the repository, also following
> >> that
> >> > XHTML/MathML example from the Jackrabbit First Steps page.
> >> >
> >> > 3. I managed to make this repository known to Cocoon's JCR block by
> >> > editing cocoon.xconf approprietely.
> >> >
> >> > 4. I can generate the collections through the TraversableGenerator in
> >> > webapp/samples/blocks/jcr of Cocoon (though on the blocks overview
> >> page it
> >> > says the jcr block did not have any samples). I can see the collection
> >> of
> >> > nodes that were created by the Jackrabbit example, such as /xmlimport
> >> for
> >> > example.
> >> >
> >> > But this is where I am stuck.
> >> >
> >> > In order not to get the collections but an actual property (read:
> >> piece of
> >> > content) from the repository, I tried something like:
> >> >
> >> > <map:generate src="jcr://importxml/xhtml:html/xhtml:body/xhtml:p[2]"
> >> />
> >> >
> >> > But no matter what node I try, I keep getting
> >> >
> >> > org.apache.cocoon.ProcessingException: Exception during source
> >> resolving.:
> >> > org.apache.excalibur.source.SourceException: Path
> >> > 'jcr://importxml/xhtml:html/xhtml:body/xhtml:p[2]' is a collection
> >> >
> >> > What do I have to put into the jcr:// URI in order to access content,
> >> not
> >> > meta-information.
> >>
> >> What is the configuration of your JCRSourceFactory?
> >> I think to define which nodes actually contain the data, you have to
> >> define a file-node with a content-node having a content-prop, like e.g.:
> >
> > oops, accidentally sent...
> >
> > Here is a part of the sample configuration of the JCRSourceFactory:
> >
> > <file-node content-ref="jcr:content" type="nt:linkedFile"/>
> >                <content-node type="nt:resource"
> >                              content-prop="jcr:data"
> >                              mimetype-prop="jcr:mimeType"
> >                              lastmodified-prop="jcr:lastModified"
> >                              validity-prop="jcr:lastModified"/>
> >
> > It means there will be a "jcr:content" node with a property "jcr:data"
> > which will contain the actual data.
> > Does your configuration match your repository?
> >
> > hth,
> > Josias
> >
> >
> >>
> >>
> >> >
> >> > Regards,
> >> > Torsten
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >> > For additional commands, e-mail: users-help@cocoon.apache.org
> >> >
> >> >
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >> For additional commands, e-mail: users-help@cocoon.apache.org
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: JCR question

Posted by Torsten Schlabach <ts...@apache.org>.
Josias,

>> <content-node type="nt:resource"
>>   content-prop="jcr:data"
>>   mimetype-prop="jcr:mimeType"
>>   lastmodified-prop="jcr:lastModified"
>>   validity-prop="jcr:lastModified"/>

That piece was definitely missing. But I am not yet sure that I have fully
understood this stuff. I have imported the sample as you can see it from

http://incubator.apache.org/jackrabbit/firststeps.html

and changed my repository config in Cocoon to find that repository which
Jackrabbit has created. So far that worked fine. Now I am trying to get
back any piece of that XML document that got imported in the first steps
example.

>From reading the JCR (JSR-170) spec on page 16 I got the impression, that
actual content is always a property, not a node. My understanding of page
16 of the spec was that nodes are just some kind of directory, but that
might be wrong.

> Does your configuration match your repository?

No, I have no idea how

>> <content-node type="nt:resource"
>>   content-prop="jcr:data"
>>   mimetype-prop="jcr:mimeType"
>>   lastmodified-prop="jcr:lastModified"
>>   validity-prop="jcr:lastModified"/>

might match my repository or not.

Regards,
Torsten


> On Thu, 2005-07-28 at 17:17 +0200, Josias Thoeny wrote:
>> On Thu, 2005-07-28 at 16:28 +0200, Torsten Schlabach wrote:
>> > Hi guys,
>> >
>> > I have successfully achieved this:
>> >
>> > 1. I have built Jackrabbit and created a sample repository using the
>> > examples (First Steps) code samples. This is a repository which is
>> > entirely independent of Cocoon.
>> >
>> > 2. I have imported some XML stuff into the repository, also following
>> that
>> > XHTML/MathML example from the Jackrabbit First Steps page.
>> >
>> > 3. I managed to make this repository known to Cocoon's JCR block by
>> > editing cocoon.xconf approprietely.
>> >
>> > 4. I can generate the collections through the TraversableGenerator in
>> > webapp/samples/blocks/jcr of Cocoon (though on the blocks overview
>> page it
>> > says the jcr block did not have any samples). I can see the collection
>> of
>> > nodes that were created by the Jackrabbit example, such as /xmlimport
>> for
>> > example.
>> >
>> > But this is where I am stuck.
>> >
>> > In order not to get the collections but an actual property (read:
>> piece of
>> > content) from the repository, I tried something like:
>> >
>> > <map:generate src="jcr://importxml/xhtml:html/xhtml:body/xhtml:p[2]"
>> />
>> >
>> > But no matter what node I try, I keep getting
>> >
>> > org.apache.cocoon.ProcessingException: Exception during source
>> resolving.:
>> > org.apache.excalibur.source.SourceException: Path
>> > 'jcr://importxml/xhtml:html/xhtml:body/xhtml:p[2]' is a collection
>> >
>> > What do I have to put into the jcr:// URI in order to access content,
>> not
>> > meta-information.
>>
>> What is the configuration of your JCRSourceFactory?
>> I think to define which nodes actually contain the data, you have to
>> define a file-node with a content-node having a content-prop, like e.g.:
>
> oops, accidentally sent...
>
> Here is a part of the sample configuration of the JCRSourceFactory:
>
> <file-node content-ref="jcr:content" type="nt:linkedFile"/>
>                <content-node type="nt:resource"
>                              content-prop="jcr:data"
>                              mimetype-prop="jcr:mimeType"
>                              lastmodified-prop="jcr:lastModified"
>                              validity-prop="jcr:lastModified"/>
>
> It means there will be a "jcr:content" node with a property "jcr:data"
> which will contain the actual data.
> Does your configuration match your repository?
>
> hth,
> Josias
>
>
>>
>>
>> >
>> > Regards,
>> > Torsten
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> > For additional commands, e-mail: users-help@cocoon.apache.org
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: JCR question

Posted by Josias Thoeny <jo...@wyona.com>.
On Thu, 2005-07-28 at 17:17 +0200, Josias Thoeny wrote:
> On Thu, 2005-07-28 at 16:28 +0200, Torsten Schlabach wrote:
> > Hi guys,
> > 
> > I have successfully achieved this:
> > 
> > 1. I have built Jackrabbit and created a sample repository using the
> > examples (First Steps) code samples. This is a repository which is
> > entirely independent of Cocoon.
> > 
> > 2. I have imported some XML stuff into the repository, also following that
> > XHTML/MathML example from the Jackrabbit First Steps page.
> > 
> > 3. I managed to make this repository known to Cocoon's JCR block by
> > editing cocoon.xconf approprietely.
> > 
> > 4. I can generate the collections through the TraversableGenerator in
> > webapp/samples/blocks/jcr of Cocoon (though on the blocks overview page it
> > says the jcr block did not have any samples). I can see the collection of
> > nodes that were created by the Jackrabbit example, such as /xmlimport for
> > example.
> > 
> > But this is where I am stuck.
> > 
> > In order not to get the collections but an actual property (read: piece of
> > content) from the repository, I tried something like:
> > 
> > <map:generate src="jcr://importxml/xhtml:html/xhtml:body/xhtml:p[2]" />
> > 
> > But no matter what node I try, I keep getting
> > 
> > org.apache.cocoon.ProcessingException: Exception during source resolving.:
> > org.apache.excalibur.source.SourceException: Path
> > 'jcr://importxml/xhtml:html/xhtml:body/xhtml:p[2]' is a collection
> > 
> > What do I have to put into the jcr:// URI in order to access content, not
> > meta-information.
> 
> What is the configuration of your JCRSourceFactory?
> I think to define which nodes actually contain the data, you have to
> define a file-node with a content-node having a content-prop, like e.g.:

oops, accidentally sent...

Here is a part of the sample configuration of the JCRSourceFactory:

<file-node content-ref="jcr:content" type="nt:linkedFile"/>
               <content-node type="nt:resource"
                             content-prop="jcr:data"
                             mimetype-prop="jcr:mimeType"
                             lastmodified-prop="jcr:lastModified"
                             validity-prop="jcr:lastModified"/>

It means there will be a "jcr:content" node with a property "jcr:data"
which will contain the actual data.
Does your configuration match your repository?

hth,
Josias


> 
> 
> > 
> > Regards,
> > Torsten
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: JCR question

Posted by Josias Thoeny <jo...@wyona.com>.
On Thu, 2005-07-28 at 16:28 +0200, Torsten Schlabach wrote:
> Hi guys,
> 
> I have successfully achieved this:
> 
> 1. I have built Jackrabbit and created a sample repository using the
> examples (First Steps) code samples. This is a repository which is
> entirely independent of Cocoon.
> 
> 2. I have imported some XML stuff into the repository, also following that
> XHTML/MathML example from the Jackrabbit First Steps page.
> 
> 3. I managed to make this repository known to Cocoon's JCR block by
> editing cocoon.xconf approprietely.
> 
> 4. I can generate the collections through the TraversableGenerator in
> webapp/samples/blocks/jcr of Cocoon (though on the blocks overview page it
> says the jcr block did not have any samples). I can see the collection of
> nodes that were created by the Jackrabbit example, such as /xmlimport for
> example.
> 
> But this is where I am stuck.
> 
> In order not to get the collections but an actual property (read: piece of
> content) from the repository, I tried something like:
> 
> <map:generate src="jcr://importxml/xhtml:html/xhtml:body/xhtml:p[2]" />
> 
> But no matter what node I try, I keep getting
> 
> org.apache.cocoon.ProcessingException: Exception during source resolving.:
> org.apache.excalibur.source.SourceException: Path
> 'jcr://importxml/xhtml:html/xhtml:body/xhtml:p[2]' is a collection
> 
> What do I have to put into the jcr:// URI in order to access content, not
> meta-information.

What is the configuration of your JCRSourceFactory?
I think to define which nodes actually contain the data, you have to
define a file-node with a content-node having a content-prop, like e.g.:


> 
> Regards,
> Torsten
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org