Skip to content

Commit

Permalink
SEAMJCR-22
Browse files Browse the repository at this point in the history
  • Loading branch information
sbryzak committed Dec 10, 2011
1 parent 7af7e09 commit 63e019d
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 24 deletions.
45 changes: 31 additions & 14 deletions docs/src/main/docbook/en-US/jcr-event-mapping.xml
Expand Up @@ -12,29 +12,46 @@
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<chapter id="jcr-eventmapping">
<title>Seam JCR - Event Mapping</title>

<section id="jcr-event-mapping-intro">
<para> Seam JCR provides functionality to fire CDI Events based on events found in JCR. The
rules of how events are fired are based around the underlying implementation. </para>
<tip> You will not have an active JCR Session during the event firing, a new one will need
to be created. </tip>
<tip> Some JCR implementations, like Modeshape fires events on a separate thread, so
probably you will get errors if your observer method is declared on a @RequestScoped
object, for example. </tip>
<title>Introduction to Event Mapping</title>

<para>
Seam JCR provides functionality to fire CDI Events based on events found in JCR. The
rules of how events are fired are based around the underlying implementation.
</para>

<tip>
You will not have an active JCR Session during the event firing, a new one will need
to be created.
</tip>

<tip>
Some JCR implementations, like Modeshape fires events on a separate thread, so
probably you will get errors if your observer method is declared on a @RequestScoped
object, for example.
</tip>
</section>

<section id="jcr-event-mapping-activation">
<para> To observe an event, use the @Observes and the additional qualifiers on seam-jcr-api
module (Check package org.jboss.seam.jcr.annotations.events). If you need to watch any
JCR event, then avoid using any Qualifier at all. </para>
<programlisting role="java"><![CDATA[
import javax.jcr.observation.Event;
<title>Observing JMS events</title>

<para>
To observe an event, use the <code>@Observes</code> and the additional qualifiers from the
<literal>seam-jcr-api</literal> module (Check package <code>org.jboss.seam.jcr.annotations.events</code>).
If you need to watch any JCR event, then avoid using any qualifier at all.
</para>

<programlisting role="java"><![CDATA[import javax.jcr.observation.Event;
public void observeAdded(@Observes @NodeAdded Event evt) {
// Called when a node is added
}
public void observeAll(@Observes javax.jcr.observation.Event evt) {
// Called when any node event occurs
}
]]></programlisting>
}]]></programlisting>

</section>
<!-- vim:et:ts=3:sw=3:tw=120 -->
</chapter>
7 changes: 3 additions & 4 deletions docs/src/main/docbook/en-US/jcr-introduction.xml
Expand Up @@ -48,10 +48,9 @@
<para>
Substitute the expression ${seam.jcr.version} with the most recent or appropriate version of Seam JCR.
Alternatively, you can create a
<ulink
href="http://www.sonatype.com/books/mvnref-book/reference/resource-filtering-sect-properties.html#resource-filtering-sect-user-defined">Maven
user-defined property
</ulink> to satisfy this substitution so you can centrally manage the version.
<ulink
url="http://www.sonatype.com/books/mvnref-book/reference/resource-filtering-sect-properties.html#resource-filtering-sect-user-defined">Maven user-defined property</ulink>
to satisfy this substitution so you can centrally manage the version.
</para>
</tip>
<para>
Expand Down
7 changes: 5 additions & 2 deletions docs/src/main/docbook/en-US/jcr-jackrabbit.xml
Expand Up @@ -33,14 +33,17 @@
</programlisting>
<tip>
<para>
Substitute ${jackrabbit.version} for the JackRabbit version you are running against. Currently, Seam JCR tests against 2.2.4. Please review JackRabbit documentation to determine any additional dependencies.
Substitute ${jackrabbit.version} for the JackRabbit version you are running against. Currently,
Seam JCR tests against 2.2.4. Please review the
<ulink url="http://jackrabbit.apache.org/getting-started-with-apache-jackrabbit.html">JackRabbit documentation</ulink>
to determine any additional dependencies.
</para>
</tip>
</section>
<section id="jcr-jr-usage">
<title>Usage</title>
<para>
In order to use JackRabbit's Repository and Session objects in your application, you must define an injection point using the JcrConfiguration annotation based on JackRabbit's required configuration parameters.
In order to use JackRabbit's Repository and Session objects in your application, you must define an injection point using the <code>JcrConfiguration</code> annotation based on JackRabbit's required configuration parameters.
</para>
<programlisting role="java"><![CDATA[
@Inject @JcrConfiguration(name="org.apache.jackrabbit.repository.home",value="target")
Expand Down
9 changes: 5 additions & 4 deletions docs/src/main/docbook/en-US/jcr-modeshape.xml
Expand Up @@ -37,16 +37,17 @@
<tip>
<para> Substitute ${modeshape.version} for the ModeShape version you are running
against. Currently, Seam JCR tests against 2.5.0.Final. In addition, Lucene is
required to run ModeShape. Please consult the ModeShape getting stated guide for
exact versions. </para>
required to run ModeShape. Please consult the <ulink url="http://docs.jboss.org/modeshape/latest/manuals/gettingstarted/html/">ModeShape Getting Started Guide</ulink>
for exact versions. </para>
</tip>
</section>
<section id="jcr-ms-usage">
<title>Usage</title>
<para> In order to use ModeShape's Repository and Session objects in your application, you
must define an injection point using the JcrConfiguration annotation based on
ModeShape's required configuration parameters. Please review the ModeShape getting
started guide for further details. </para>
ModeShape's required configuration parameters. Please review the
<ulink url="http://docs.jboss.org/modeshape/latest/manuals/gettingstarted/html/">ModeShape Getting Started Guide</ulink>
for further details. </para>
<programlisting role="java"><![CDATA[
@Inject @JcrConfiguration(name="org.modeshape.jcr.URL",value="file:path/to/modeshape.xml?repositoryName=MyRepo")
Repository repository;
Expand Down

0 comments on commit 63e019d

Please sign in to comment.