DNA SVN: r134 - in trunk/docs: examples/gettingstarted/sequencers/src/test/java/org/jboss/example/dna/sequencers and 1 other directories.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2008-05-08 18:00:44 -0400 (Thu, 08 May 2008)
New Revision: 134
Modified:
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencers/SequencingClient.java
trunk/docs/examples/gettingstarted/sequencers/src/test/java/org/jboss/example/dna/sequencers/MockUserInterface.java
trunk/docs/examples/gettingstarted/sequencers/src/test/java/org/jboss/example/dna/sequencers/SequencingClientTest.java
trunk/docs/gettingstarted/en/master.xml
Log:
Changed the example and documentation to note that the PICT file is not sequencable.
Modified: trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencers/SequencingClient.java
===================================================================
--- trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencers/SequencingClient.java 2008-05-08 20:51:55 UTC (rev 133)
+++ trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencers/SequencingClient.java 2008-05-08 22:00:44 UTC (rev 134)
@@ -226,7 +226,7 @@
String desc = "Sequences image files to extract the characteristics of the image";
String classname = "org.jboss.dna.sequencer.images.ImageMetadataSequencer";
String[] classpath = null; // Use the current classpath
- String[] pathExpressions = {"//(*.(jpg|jpeg|pict|gif|bmp|pcx|png|iff|ras|pbm|pgm|ppm|psd))[*]/jcr:content[@jcr:data] => /images/$1"};
+ String[] pathExpressions = {"//(*.(jpg|jpeg|gif|bmp|pcx|png|iff|ras|pbm|pgm|ppm|psd))[*]/jcr:content[@jcr:data] => /images/$1"};
SequencerConfig imageSequencerConfig = new SequencerConfig(name, desc, classname, classpath, pathExpressions);
this.sequencingService.addSequencer(imageSequencerConfig);
Modified: trunk/docs/examples/gettingstarted/sequencers/src/test/java/org/jboss/example/dna/sequencers/MockUserInterface.java
===================================================================
--- trunk/docs/examples/gettingstarted/sequencers/src/test/java/org/jboss/example/dna/sequencers/MockUserInterface.java 2008-05-08 20:51:55 UTC (rev 133)
+++ trunk/docs/examples/gettingstarted/sequencers/src/test/java/org/jboss/example/dna/sequencers/MockUserInterface.java 2008-05-08 22:00:44 UTC (rev 134)
@@ -33,17 +33,19 @@
private final String repositoryPath;
private final URL fileToUpload;
+ private final int numberOfSearchResults;
- public MockUserInterface( URL fileToUpload, String repositoryPath ) {
+ public MockUserInterface( URL fileToUpload, String repositoryPath, int numSearchResults ) {
this.repositoryPath = repositoryPath;
this.fileToUpload = fileToUpload;
+ this.numberOfSearchResults = numSearchResults;
}
/**
* {@inheritDoc}
*/
public void displaySearchResults( List<ImageInfo> images ) {
- assertThat(images.size(), is(1));
+ assertThat(images.size(), is(this.numberOfSearchResults));
for (ImageInfo image : images) {
System.out.println("Image: " + image);
}
Modified: trunk/docs/examples/gettingstarted/sequencers/src/test/java/org/jboss/example/dna/sequencers/SequencingClientTest.java
===================================================================
--- trunk/docs/examples/gettingstarted/sequencers/src/test/java/org/jboss/example/dna/sequencers/SequencingClientTest.java 2008-05-08 20:51:55 UTC (rev 133)
+++ trunk/docs/examples/gettingstarted/sequencers/src/test/java/org/jboss/example/dna/sequencers/SequencingClientTest.java 2008-05-08 22:00:44 UTC (rev 134)
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
+ * as indicated by the @author tags. See the copyright.txt pngImageUrl in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
package org.jboss.example.dna.sequencers;
import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNull.notNullValue;
import static org.junit.Assert.assertThat;
import java.net.URL;
import org.jboss.dna.common.util.FileUtil;
@@ -34,12 +35,16 @@
*/
public class SequencingClientTest {
- private URL file;
+ private URL pngImageUrl;
+ private URL pictImageUrl;
+ private URL jpegImageUrl;
private SequencingClient client;
@Before
public void beforeEach() throws Exception {
- this.file = Thread.currentThread().getContextClassLoader().getResource("caution.png");
+ this.pngImageUrl = Thread.currentThread().getContextClassLoader().getResource("caution.png");
+ this.pictImageUrl = Thread.currentThread().getContextClassLoader().getResource("caution.pict");
+ this.jpegImageUrl = Thread.currentThread().getContextClassLoader().getResource("caution.jpg");
client = new SequencingClient();
client.setWorkingDirectory("target/repositoryData");
client.setJackrabbitConfigPath("src/main/resources/jackrabbitConfig.xml");
@@ -54,6 +59,13 @@
}
@Test
+ public void shouldFindImages() {
+ assertThat(this.pictImageUrl, is(notNullValue()));
+ assertThat(this.pngImageUrl, is(notNullValue()));
+ assertThat(this.jpegImageUrl, is(notNullValue()));
+ }
+
+ @Test
public void shouldStartupAndShutdownRepository() throws Exception {
client.startRepository();
client.shutdownRepository();
@@ -69,8 +81,8 @@
}
@Test
- public void shouldUploadFile() throws Exception {
- client.setUserInterface(new MockUserInterface(this.file, "/a/b/caution.png"));
+ public void shouldUploadAndSequencePngFile() throws Exception {
+ client.setUserInterface(new MockUserInterface(this.pngImageUrl, "/a/b/caution.png", 1));
client.startRepository();
client.startDnaServices();
client.uploadFile();
@@ -87,4 +99,42 @@
assertThat(client.getStatistics().getNumberOfNodesSequenced(), is(1l));
}
+ @Test
+ public void shouldUploadAndSequenceJpegFile() throws Exception {
+ client.setUserInterface(new MockUserInterface(this.jpegImageUrl, "/a/b/caution.jpeg", 1));
+ client.startRepository();
+ client.startDnaServices();
+ client.uploadFile();
+
+ // Use a trick to wait until the sequencing has been done by sleeping (to give the sequencing time to start)
+ // and to then shut down the DNA services (which will block until all sequencing has been completed) ...
+ Thread.sleep(1000);
+ client.shutdownDnaServices();
+
+ // The sequencers should have run, so perform the search.
+ // The mock user interface checks the results.
+ client.search();
+
+ assertThat(client.getStatistics().getNumberOfNodesSequenced(), is(1l));
+ }
+
+ @Test
+ public void shouldUploadAndNotSequencePictFile() throws Exception {
+ client.setUserInterface(new MockUserInterface(this.pictImageUrl, "/a/b/caution.pict", 0));
+ client.startRepository();
+ client.startDnaServices();
+ client.uploadFile();
+
+ // Use a trick to wait until the sequencing has been done by sleeping (to give the sequencing time to start)
+ // and to then shut down the DNA services (which will block until all sequencing has been completed) ...
+ Thread.sleep(1000);
+ client.shutdownDnaServices();
+
+ // The sequencers should have run, so perform the search.
+ // The mock user interface checks the results.
+ client.search();
+
+ assertThat(client.getStatistics().getNumberOfNodesSequenced(), is(0l));
+ }
+
}
Modified: trunk/docs/gettingstarted/en/master.xml
===================================================================
--- trunk/docs/gettingstarted/en/master.xml 2008-05-08 20:51:55 UTC (rev 133)
+++ trunk/docs/gettingstarted/en/master.xml 2008-05-08 22:00:44 UTC (rev 134)
@@ -872,11 +872,14 @@
<title>Uploading an image using the Example Client</title>
<graphic align="center" scale="100" fileref="images/example-sequencer-upload.png" />
</figure>
- However, you can specify any fully-qualified or relative path. The application will notify you if it cannot
- find the file you specified. The example client configures JBoss DNA to sequence image files with one of the following
- file extensions: <code>jpg</code>, <code>jpeg</code>, <code>pict</code>, <code>gif</code>, <code>bmp</code>,
+ You can specify any fully-qualified or relative path. The application will notify you if it cannot
+ find the file you specified. The example client configures JBoss DNA to sequence image files (technically nodes that have names)
+ with one of the following
+ extensions: <code>jpg</code>, <code>jpeg</code>, <code>gif</code>, <code>bmp</code>,
<code>pcx</code>, <code>png</code>, <code>iff</code>, <code>ras</code>, <code>pbm</code>, <code>pgm</code>, <code>ppm</code>, and <code>psd</code>.
- Files with any other extension will be ignored.
+ Files with other extensions in the repository path will be ignored. For your convenience, the example provides
+ several files that will be sequenced (<code>caution.png</code>, <code>caution.jpg</code> and <code>caution.gif</code>)
+ and one image that will not be sequenced (<code>caution.pict</code>). Feel free to try other files.
</para>
<para>
After you specified the file you want to upload, the example application asks you where in the repository you'd
@@ -934,11 +937,12 @@
</para>
<para>
Most of the Java classes in the example really have nothing in particular to do with JBoss DNA. The <code>UserInterface</code>,
- <code>ConsoleInput</code>, and <code>ImageInfo</code> classes
-
- but this was a pretty
- simple example. Let's look at the Java source codeUnderstanding how you can use JBoss DNA in your application
+ <code>ConsoleInput</code>, and <code>ImageInfo</code> classes are there to just make the example easy to run.
+ The interesting code is in <code>SequencingClient</code>.
</para>
+
+ <para>
+ </para>
</sect1>
16 years
DNA SVN: r133 - in trunk/docs: gettingstarted/en and 1 other directories.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2008-05-08 16:51:55 -0400 (Thu, 08 May 2008)
New Revision: 133
Modified:
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencers/ConsoleInput.java
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencers/SequencingClient.java
trunk/docs/gettingstarted/en/images/example-sequencer-cli-client.png
trunk/docs/gettingstarted/en/images/example-sequencer-search.png
trunk/docs/gettingstarted/en/images/example-sequencer-search2.png
trunk/docs/gettingstarted/en/images/example-sequencer-statistics.png
trunk/docs/gettingstarted/en/images/example-sequencer-statistics2.png
trunk/docs/gettingstarted/en/images/example-sequencer-upload.png
trunk/docs/gettingstarted/en/images/example-sequencer-upload2.png
trunk/docs/gettingstarted/en/master.xml
Log:
More corrections and changes to the examples and Getting Started document
Modified: trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencers/ConsoleInput.java
===================================================================
--- trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencers/ConsoleInput.java 2008-05-08 20:51:18 UTC (rev 132)
+++ trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencers/ConsoleInput.java 2008-05-08 20:51:55 UTC (rev 133)
@@ -72,9 +72,11 @@
client.search();
break;
case 'm':
+ case '?':
+ case 'h':
System.out.println(getMenu());
break;
- case 'p':
+ case 'd':
System.out.println(getStatistics(client.getStatistics()));
break;
case 'q':
@@ -128,9 +130,9 @@
buffer.append("u) Upload a file to the repository\n");
buffer.append("s) Search the repository using extracted metadata\n");
buffer.append("\n");
- buffer.append("p) Print statistics\n");
+ buffer.append("d) Display statistics\n");
buffer.append("\n");
- buffer.append("m) Display menu\n");
+ buffer.append("?) Show this menu\n");
buffer.append("q) Quit");
return buffer.toString();
}
Modified: trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencers/SequencingClient.java
===================================================================
--- trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencers/SequencingClient.java 2008-05-08 20:51:18 UTC (rev 132)
+++ trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencers/SequencingClient.java 2008-05-08 20:51:55 UTC (rev 133)
@@ -226,7 +226,7 @@
String desc = "Sequences image files to extract the characteristics of the image";
String classname = "org.jboss.dna.sequencer.images.ImageMetadataSequencer";
String[] classpath = null; // Use the current classpath
- String[] pathExpressions = {"//(*.(jpg|jpeg|gif|bmp|pcx|png|iff|ras|pbm|pgm|ppm|psd))[*]/jcr:content[@jcr:data] => /images/$1"};
+ String[] pathExpressions = {"//(*.(jpg|jpeg|pict|gif|bmp|pcx|png|iff|ras|pbm|pgm|ppm|psd))[*]/jcr:content[@jcr:data] => /images/$1"};
SequencerConfig imageSequencerConfig = new SequencerConfig(name, desc, classname, classpath, pathExpressions);
this.sequencingService.addSequencer(imageSequencerConfig);
Modified: trunk/docs/gettingstarted/en/images/example-sequencer-cli-client.png
===================================================================
(Binary files differ)
Modified: trunk/docs/gettingstarted/en/images/example-sequencer-search.png
===================================================================
(Binary files differ)
Modified: trunk/docs/gettingstarted/en/images/example-sequencer-search2.png
===================================================================
(Binary files differ)
Modified: trunk/docs/gettingstarted/en/images/example-sequencer-statistics.png
===================================================================
(Binary files differ)
Modified: trunk/docs/gettingstarted/en/images/example-sequencer-statistics2.png
===================================================================
(Binary files differ)
Modified: trunk/docs/gettingstarted/en/images/example-sequencer-upload.png
===================================================================
(Binary files differ)
Modified: trunk/docs/gettingstarted/en/images/example-sequencer-upload2.png
===================================================================
(Binary files differ)
Modified: trunk/docs/gettingstarted/en/master.xml
===================================================================
--- trunk/docs/gettingstarted/en/master.xml 2008-05-08 20:51:18 UTC (rev 132)
+++ trunk/docs/gettingstarted/en/master.xml 2008-05-08 20:51:55 UTC (rev 133)
@@ -30,25 +30,27 @@
<bookinfo>
<title>JBoss DNA</title>
<subtitle>Getting Started Guide</subtitle>
- <releaseinfo>&versionNumber;</releaseinfo>
- <productnumber>&versionNumber;</productnumber>
+ <releaseinfo>&versionNumber;
+ </releaseinfo>
+ <productnumber>&versionNumber;
+ </productnumber>
<issuenum>1</issuenum>
<mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/dna-logo.png" align="center" />
- </imageobject>
- <imageobject role="pdf">
- <imagedata fileref="images/dna-logo.png" scale="75" align="center" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/dna-logo.png" depth="3cm" />
- </imageobject>
- <imageobject role="xhtml">
- <imagedata fileref="images/dna-logo.png" depth="3cm" />
- </imageobject>
- <imageobject role="xhtml_single">
- <imagedata fileref="images/dna-logo.png" depth="3cm" />
- </imageobject>
+ <imageobject role="fo">
+ <imagedata fileref="images/dna-logo.png" align="center" />
+ </imageobject>
+ <imageobject role="pdf">
+ <imagedata fileref="images/dna-logo.png" scale="75" align="center" />
+ </imageobject>
+ <imageobject role="html">
+ <imagedata fileref="images/dna-logo.png" depth="3cm" />
+ </imageobject>
+ <imageobject role="xhtml">
+ <imagedata fileref="images/dna-logo.png" depth="3cm" />
+ </imageobject>
+ <imageobject role="xhtml_single">
+ <imagedata fileref="images/dna-logo.png" depth="3cm" />
+ </imageobject>
</mediaobject>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Author_Group.xml" />
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Legal_Notice.xml" />
@@ -57,9 +59,9 @@
<title>What this book covers</title>
<para>The goal of this book is to help you learn about JBoss DNA and how you can use it in your own applications to get the
most out of your JCR repositories.</para>
- <para>The first part of the book starts out with an introduction to content repositories and an overview of the JCR API, both of
- which are an important aspect of JBoss DNA. This is followed by an overview of the JBoss DNA project, it's architecture,
- and a basic roadmap for what's coming next.</para>
+ <para>The first part of the book starts out with an introduction to content repositories and an overview of the JCR API,
+ both of which are an important aspect of JBoss DNA. This is followed by an overview of the JBoss DNA project, it's
+ architecture, and a basic roadmap for what's coming next.</para>
<para>The next part of the book covers how to download and build the examples, how to use JBoss DNA with existing
repositories, and how to build and use custom sequencers.</para>
<para>
@@ -80,8 +82,8 @@
<chapter id="introduction">
<title>Introduction</title>
<para>There are a lot of choices for how applications can store information persistently so that it can be accessed at a
- later time and by other processes. The challenge developers face is to use an approach that most closely matches the needs of
- their application. This choice is more important as developers choose to focus their efforts on the application-specific
+ later time and by other processes. The challenge developers face is to use an approach that most closely matches the needs
+ of their application. This choice is more important as developers choose to focus their efforts on the application-specific
logic, delegating much of the responsibilities for persistence to libraries and frameworks.</para>
<para>
Perhaps one of the easiest techniques is to simply store information in
@@ -399,8 +401,7 @@
<listitem>
<para>
<emphasis role="strong">Java Source File Sequencer</emphasis>
- - Process Java source files to extract the class structure (including annotations) into the repository.
- (See
+ - Process Java source files to extract the class structure (including annotations) into the repository. (See
<ulink url="http://jira.jboss.org/jira/browse/DNA-51">DNA-51</ulink>
)
</para>
@@ -784,135 +785,161 @@
/MockUserInterface.java
</programlisting>
</para>
- <para>
- As mentioned in the <ulink url="downloading">previous chapter</ulink>, simply type <code>mvn package</code> from the <code>example/sequencer</code>
- directory to compile the source code, run the unit tests, build a client JAR and assemble a distribution containing all of the necessary files.
- </para>
- <para>If you successfully built the examples, there will be a <code>examples/sequencers/target/dna-example-sequencers-basic.dir/</code>
- directory that contains the following:
- <itemizedlist>
- <listitem>
- <para><emphasis role="strong"><code>run.sh</code></emphasis> is the *nix shell script that will run the example.</para>
+ <sect1 id="running_examples">
+ <title>Running the example</title>
+ <para>
+ As mentioned in the <ulink url="downloading">previous chapter</ulink>, simply type <code>mvn package</code> from the <code>example/sequencer</code>
+ directory to compile the source code, run the unit tests, build a client JAR and assemble a distribution containing all of the necessary files.
+ </para>
+ <para>If you successfully built the examples, there will be a <code>examples/sequencers/target/dna-example-sequencers-basic.dir/</code>
+ directory that contains the following:
+ <itemizedlist>
+ <listitem>
+ <para><emphasis role="strong"><code>run.sh</code></emphasis> is the *nix shell script that will run the example.</para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis role="strong">
+ <code>log4j.properties</code>
+ </emphasis>
+ is the Log4J configuration file.
+ </para>
</listitem>
- <listitem>
+ <listitem>
+ <para>
+ <emphasis role="strong">
+ <code>jackrabbitConfig.xml</code>
+ </emphasis>
+ is the Jackrabbit configuration file, which is set up to use a transient in-memory repository.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis role="strong">
+ <code>jackrabbitNodeTypes.cnd</code>
+ </emphasis>
+ defines the additional JCR node types used by this example.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis role="strong">
+ <code>caution.gif</code>
+ </emphasis>, <emphasis role="strong">
+ <code>caution.png</code>
+ </emphasis>, and <emphasis role="strong">
+ <code>caution.jpg</code>
+ </emphasis>
+ are images that you'll use later and upload into the repository.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis role="strong">
+ <code>lib</code>
+ </emphasis>
+ subdirectory contains the JARs for all of the JBoss DNA artifacts as well as those for other libraries required
+ by JBoss DNA and the example.
+ </para>
+ </listitem>
+ </itemizedlist>
+ <note>
+ <para>JBoss DNA 0.1 and the examples are currently tested with <ulink url="http://jackrabbit.apache.org/">Apache Jackrabbit</ulink> version 1.3.3.
+ This version is stable and used by a number of other projects and applications. However, you should be able to use a newer
+ version of Jackrabbit, as long as that version uses the same JCR API. For example, version 1.4.2 was released on March 26, 2008 and
+ should be compatible.
+ </para>
+ <para>Just remember, if the version of Jackrabbit you want to use for these examples is not in the Maven repository,
+ you'll have to either add it or add it locally. For more information, see the <ulink url="http://maven.apache.org/">Maven documentation</ulink>.
+ </para>
+ </note>
+ </para>
<para>
- <emphasis role="strong">
- <code>log4j.properties</code>
- </emphasis>
- is the Log4J configuration file.
+ To run the client application, go to the <code>examples/sequencers/target/dna-example-sequencers-basic.dir/</code>
+ directory and type <code>./run.sh</code>. You should see the command line client and its menus in your terminal:
+ <figure id="xample-sequencer-cli-client">
+ <title>Example Client</title>
+ <graphic align="center" scale="100" fileref="images/example-sequencer-cli-client.png" />
+ </figure>
+ From this menu, you can upload a file into the repository, search for images in the repository, print sequencing statistics, or quit the application.
</para>
- </listitem>
- <listitem>
<para>
- <emphasis role="strong">
- <code>jackrabbitConfig.xml</code>
- </emphasis>
- is the Jackrabbit configuration file, which is set up to use a transient in-memory repository.
+ The first step is to upload one of the example images. If you type 'u' and press return, you'll be prompted
+ to supply the path to the file you want to upload. Since the application is running from within the
+ <code>examples/sequencers/target/dna-example-sequencers-basic.dir/</code> directory, you can specify any
+ of the files in that directory without specifying the path:
+ <figure id="example-sequencer-upload">
+ <title>Uploading an image using the Example Client</title>
+ <graphic align="center" scale="100" fileref="images/example-sequencer-upload.png" />
+ </figure>
+ However, you can specify any fully-qualified or relative path. The application will notify you if it cannot
+ find the file you specified. The example client configures JBoss DNA to sequence image files with one of the following
+ file extensions: <code>jpg</code>, <code>jpeg</code>, <code>pict</code>, <code>gif</code>, <code>bmp</code>,
+ <code>pcx</code>, <code>png</code>, <code>iff</code>, <code>ras</code>, <code>pbm</code>, <code>pgm</code>, <code>ppm</code>, and <code>psd</code>.
+ Files with any other extension will be ignored.
</para>
- </listitem>
- <listitem>
<para>
- <emphasis role="strong">
- <code>jackrabbitNodeTypes.cnd</code>
- </emphasis>
- defines the additional JCR node types used by this example.
+ After you specified the file you want to upload, the example application asks you where in the repository you'd
+ like to place the file. (If you want to use the suggested location, just press <code>return</code>.)
+ The client application uses the JCR API to upload the file to that location in the repository, creating any nodes (of type <code>nt:folder</code>)
+ for any directories that don't exist, and creating a node (of type <code>nt:file</code>) for the file. And,
+ per the JCR specification, the application creates a <code>jcr:content</code> node (of type <code>nt:resource</code>)
+ under the file node. The file contents are placed on this <code>jcr:content</code> node in the <code>jcr:data</code> property.
+ For example, if you specify <code>/a/b/caution.png</code>, the following structure will be created in the repository:
+ <programlisting>
+ /a (nt:folder)
+ /b (nt:folder)
+ /caution.png (nt:file)
+ /jcr:content (nt:resource)
+ @jcr:data = {contents of the file}
+ @jcr:mimeType = {mime type of the file}
+ @jcr:lastModified = {now}
+ </programlisting>
</para>
- </listitem>
- <listitem>
<para>
- <emphasis role="strong">
- <code>caution.gif</code>
- </emphasis>, <emphasis role="strong">
- <code>caution.png</code>
- </emphasis>, and <emphasis role="strong">
- <code>caution.jpg</code>
- </emphasis>
- are images that you'll use later and upload into the repository.
+ When the client uploads the file using the JCR API, DNA gets notified of the changes, consults the sequencers
+ to see whether any of them are interested in the new or updated content, and if so runs the sequencers. The image
+ sequencer processes image files for metadata, and any metadata found is stored under the <code>/images</code>
+ branch of the repository. All of this happens asynchronously, so any DNA activity doesn't impede or slow
+ down the client activities.
</para>
- </listitem>
- <listitem>
<para>
- <emphasis role="strong">
- <code>lib</code>
- </emphasis>
- subdirectory contains the JARs for all of the JBoss DNA artifacts as well as those for other libraries required
- by JBoss DNA and the example.
+ So, after the file is uploaded, you can search the repository for the image metadata using the "s" menu option:
+ <figure id="example-sequencer-search">
+ <title>Uploading an image using the Example Client</title>
+ <graphic align="center" scale="100" fileref="images/example-sequencer-search.png" />
+ </figure>
+ You can also display the sequencing statistics using the "d" menu option:
+ <figure id="example-sequencer-statistics">
+ <title>Uploading an image using the Example Client</title>
+ <graphic align="center" scale="100" fileref="images/example-sequencer-statistics.png" />
+ </figure>
+ These stats show how many nodes were sequenced, and how many nodes were skipped because they didn't apply to the
+ sequencer's criteria.</para>
+ <note>
+ <para>There will probably be more nodes skipped than sequenced, since there are more <code>nt:folder</code>
+ and <code>nt:resource</code> nodes than there are <code>nt:file</code> nodes with acceptible names.
</para>
- </listitem>
- </itemizedlist>
- <note>
- <para>JBoss DNA 0.1 and the examples are currently tested with <ulink url="http://jackrabbit.apache.org/">Apache Jackrabbit</ulink> version 1.3.3.
- This version is stable and used by a number of other projects and applications. However, you should be able to use a newer
- version of Jackrabbit, as long as that version uses the same JCR API. For example, version 1.4.2 was released on March 26, 2008 and
- should be compatible.
+ </note>
+ <para>
+ You can repeat this process with other files. Any file that isn't an image (as recognized by the sequencing configuration
+ described later) will not be sequenced.
</para>
- <para>Just remember, if the version of Jackrabbit you want to use for these examples is not in the Maven repository,
- you'll have to either add it or add it locally. For more information, see the <ulink url="http://maven.apache.org/">Maven documentation</ulink>.
+ </sect1>
+ <sect1 id="example_java_code">
+ <title>Reviewing the Java code</title>
+ <para>The example you just ran demonstrated that JBoss DNA does sequence image files. It does everything
+ necessary to set up and configure JBoss DNA to use a JCR repository, so reviewing that code can help understand
+ what's involved.
</para>
- </note>
- </para>
- <para>
- To run the client application, go to the <code>examples/sequencers/target/dna-example-sequencers-basic.dir/</code>
- directory and type <code>./run.sh</code>. You should see the command line client and its menus in your terminal:
- <figure id="xample-sequencer-cli-client">
- <title>Example Client</title>
- <graphic align="center" scale="100" fileref="images/example-sequencer-cli-client.png" />
- </figure>
- From this menu, you can upload a file into the repository, search for images in the repository, print sequencing statistics, or quit the application.
- </para>
- <para>
- The first step is to upload one of the example images. If you type 'u' and press return, you'll be prompted
- to supply the path to the file you want to upload. Since the application is running from within the
- <code>examples/sequencers/target/dna-example-sequencers-basic.dir/</code> directory, you can specify any
- of the files in that directory without specifying the path:
- <figure id="example-sequencer-upload">
- <title>Uploading an image using the Example Client</title>
- <graphic align="center" scale="100" fileref="images/example-sequencer-upload.png" />
- </figure>
- However, you can specify any fully-qualified or relative path. The application will notify you if it cannot
- find the file you specified.
- </para>
- <para>
- After you specified the file you want to upload, the example application asks you where in the repository you'd
- like to place the file. (If you want to use the suggested location, just press <code>return</code>.)
- The client application uses the JCR API to upload the file to that location in the repository, creating any nodes (of type <code>nt:folder</code>)
- for any directories that don't exist, and creating a node (of type <code>nt:file</code>) for the file. And,
- per the JCR specification, the application creates a <code>jcr:content</code> node (of type <code>nt:resource</code>)
- under the file node. The file contents are placed on this <code>jcr:content</code> node in the <code>jcr:data</code> property.
- For example, if you specify <code>/a/b/caution.png</code>, the following structure will be created in the repository:
- <programlisting>
- /a (nt:folder)
- /b (nt:folder)
- /caution.png (nt:file)
- /jcr:content (nt:resource)
- @jcr:data = {contents of the file}
- @jcr:mimeType = {mime type of the file}
- @jcr:lastModified = {now}
- </programlisting>
- </para>
- <para>
- When the client uploads the file using the JCR API, DNA gets notified of the changes, consults the sequencers
- to see whether any of them are interested in the new or updated content, and if so runs the sequencers. The image
- sequencer processes image files for metadata, and any metadata found is stored under the <code>/images</code>
- branch of the repository.
- </para>
- <para>
- So, very soon after the file is uploaded, DNA will sequence the image file and store the metadata.
- You can search the repository for this metadata using the "s" menu option:
- <figure id="example-sequencer-search">
- <title>Uploading an image using the Example Client</title>
- <graphic align="center" scale="100" fileref="images/example-sequencer-search.png" />
- </figure>
- You can also print the statistics for the sequencer using the "p" menu option:
- <figure id="example-sequencer-statistics">
- <title>Uploading an image using the Example Client</title>
- <graphic align="center" scale="100" fileref="images/example-sequencer-statistics.png" />
- </figure>
- </para>
- <para>
- You can repeat this process with other files. Any file that isn't an image (as recognized by the sequencing configuration
- described later) will not be sequenced.
- </para>
+ <para>
+ Most of the Java classes in the example really have nothing in particular to do with JBoss DNA. The <code>UserInterface</code>,
+ <code>ConsoleInput</code>, and <code>ImageInfo</code> classes
+
+ but this was a pretty
+ simple example. Let's look at the Java source codeUnderstanding how you can use JBoss DNA in your application
+ </para>
+ </sect1>
16 years
DNA SVN: r132 - trunk/build/assembly.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2008-05-08 16:51:18 -0400 (Thu, 08 May 2008)
New Revision: 132
Modified:
trunk/build/assembly/examples.xml
Log:
Added the example's parent pom.xml to the example ZIP file
Modified: trunk/build/assembly/examples.xml
===================================================================
--- trunk/build/assembly/examples.xml 2008-05-08 19:49:44 UTC (rev 131)
+++ trunk/build/assembly/examples.xml 2008-05-08 20:51:18 UTC (rev 132)
@@ -30,5 +30,15 @@
<exclude>target/**</exclude>
</excludes>
</fileSet>
+ <fileSet>
+ <!--
+ Gather into the distribution the examples
+ -->
+ <directory>docs/examples/gettingstarted</directory>
+ <outputDirectory>examples</outputDirectory>
+ <includes>
+ <include>pom.xml</include>
+ </includes>
+ </fileSet>
</fileSets>
</assembly>
16 years
DNA SVN: r131 - in trunk/docs/gettingstarted/en: images and 1 other directory.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2008-05-08 15:49:44 -0400 (Thu, 08 May 2008)
New Revision: 131
Added:
trunk/docs/gettingstarted/en/images/dna-logo.png
Modified:
trunk/docs/gettingstarted/en/Author_Group.xml
trunk/docs/gettingstarted/en/Legal_Notice.xml
trunk/docs/gettingstarted/en/master.xml
Log:
Corrected typos, added copyrights, and made a few other small changes.
Modified: trunk/docs/gettingstarted/en/Author_Group.xml
===================================================================
--- trunk/docs/gettingstarted/en/Author_Group.xml 2008-05-08 19:49:02 UTC (rev 130)
+++ trunk/docs/gettingstarted/en/Author_Group.xml 2008-05-08 19:49:44 UTC (rev 131)
@@ -1,6 +1,28 @@
<?xml version='1.0' encoding='UTF-8'?>
-<!DOCTYPE authorgroup PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-]>
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~
+ ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Middleware LLC.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<!DOCTYPE authorgroup PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<authorgroup>
<corpauthor>Randall Hauch</corpauthor>
</authorgroup>
\ No newline at end of file
Modified: trunk/docs/gettingstarted/en/Legal_Notice.xml
===================================================================
--- trunk/docs/gettingstarted/en/Legal_Notice.xml 2008-05-08 19:49:02 UTC (rev 130)
+++ trunk/docs/gettingstarted/en/Legal_Notice.xml 2008-05-08 19:49:44 UTC (rev 131)
@@ -1,16 +1,56 @@
<?xml version='1.0' encoding='UTF-8'?>
-<!DOCTYPE authorgroup PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-]>
-<legalnotice id="Book-Legal_Notice">
- <title>Legal Notice</title>
- <para>
- <address>
- <street>1801 Varsity Drive</street>
- <city>Raleigh</city>, <state>NC</state> <postcode>27606-2072</postcode> <country>USA</country>
- <phone>Phone: +1 919 754 3700</phone>
- <phone>Phone: 888 733 4281</phone>
- <fax>Fax: +1 919 754 3701</fax>
- <pob>PO Box 13588</pob>, <city>Research Triangle Park</city>, <state>NC</state> <postcode>27709</postcode> <country>USA</country>
- </address>
- </para>
-</legalnotice>
\ No newline at end of file
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~
+ ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Middleware LLC.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<!DOCTYPE legalnotice PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<legalnotice id="Legal_Notice">
+ <title>Legal Notice</title>
+ <para>
+ <address>
+ <street>1801 Varsity Drive</street>
+ <city>Raleigh</city>, <state>NC</state><postcode>27606-2072</postcode><country>USA</country>
+ <phone>Phone: +1 919 754 3700</phone>
+ <phone>Phone: 888 733 4281</phone>
+ <fax>Fax: +1 919 754 3701</fax>
+ <pob>PO Box 13588</pob><city>Research Triangle Park</city>, <state>NC</state><postcode>27709</postcode><country>USA</country>
+ </address>
+ </para>
+ <para>
+ Copyright <trademark class="copyright"/> 2007 by Red Hat, Inc. This copyrighted material is made available to
+ anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions of the
+ GNU <ulink url="http://www.gnu.org/licenses/lgpl-2.1.html">Lesser General Public License</ulink>, as published
+ by the Free Software Foundation.
+ </para>
+ <para>
+ Red Hat and the Red Hat "Shadow Man" logo are registered trademarks of Red Hat, Inc. in the United States and other countries.
+ </para>
+ <para>
+ All other trademarks referenced herein are the property of their respective owners.
+ </para>
+ <para>
+ The GPG fingerprint of the security(a)redhat.com key is:
+ </para>
+ <para>
+ CA 20 86 86 2B D6 9D FC 65 F6 EC C4 21 91 80 CD DB 42 A6 0E
+ </para>
+</legalnotice>
Added: trunk/docs/gettingstarted/en/images/dna-logo.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/gettingstarted/en/images/dna-logo.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/docs/gettingstarted/en/master.xml
===================================================================
--- trunk/docs/gettingstarted/en/master.xml 2008-05-08 19:49:02 UTC (rev 130)
+++ trunk/docs/gettingstarted/en/master.xml 2008-05-08 19:49:44 UTC (rev 131)
@@ -1,13 +1,55 @@
-<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~
+ ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Middleware LLC.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
<!ENTITY % RH-ENTITIES SYSTEM "Common_Config/rh-entities.ent">
-]>
+<!ENTITY versionNumber "0.1">
+<!ENTITY copyrightYear "2008">
+<!ENTITY copyrightHolder "Red Hat Middleware, LLC.">]>
<book>
<bookinfo>
<title>JBoss DNA</title>
<subtitle>Getting Started Guide</subtitle>
- <issuenum>0.1</issuenum>
- <productnumber>1</productnumber>
+ <releaseinfo>&versionNumber;</releaseinfo>
+ <productnumber>&versionNumber;</productnumber>
+ <issuenum>1</issuenum>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata fileref="images/dna-logo.png" align="center" />
+ </imageobject>
+ <imageobject role="pdf">
+ <imagedata fileref="images/dna-logo.png" scale="75" align="center" />
+ </imageobject>
+ <imageobject role="html">
+ <imagedata fileref="images/dna-logo.png" depth="3cm" />
+ </imageobject>
+ <imageobject role="xhtml">
+ <imagedata fileref="images/dna-logo.png" depth="3cm" />
+ </imageobject>
+ <imageobject role="xhtml_single">
+ <imagedata fileref="images/dna-logo.png" depth="3cm" />
+ </imageobject>
+ </mediaobject>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Author_Group.xml" />
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Legal_Notice.xml" />
</bookinfo>
@@ -15,8 +57,8 @@
<title>What this book covers</title>
<para>The goal of this book is to help you learn about JBoss DNA and how you can use it in your own applications to get the
most out of your JCR repositories.</para>
- <para>The part of the book starts out with an introduction to content repositories and an overview of the JCR API, both of
- which are an important aspect of JBoss DNA. This is followed by an overview of the the JBoss DNA project, it's architecture,
+ <para>The first part of the book starts out with an introduction to content repositories and an overview of the JCR API, both of
+ which are an important aspect of JBoss DNA. This is followed by an overview of the JBoss DNA project, it's architecture,
and a basic roadmap for what's coming next.</para>
<para>The next part of the book covers how to download and build the examples, how to use JBoss DNA with existing
repositories, and how to build and use custom sequencers.</para>
@@ -38,7 +80,7 @@
<chapter id="introduction">
<title>Introduction</title>
<para>There are a lot of choices for how applications can store information persistently so that it can be accessed at a
- later time and by other processes. The challenge developers face is to use an approach that most closes matches the needs of
+ later time and by other processes. The challenge developers face is to use an approach that most closely matches the needs of
their application. This choice is more important as developers choose to focus their efforts on the application-specific
logic, delegating much of the responsibilities for persistence to libraries and frameworks.</para>
<para>
@@ -357,7 +399,7 @@
<listitem>
<para>
<emphasis role="strong">Java Source File Sequencer</emphasis>
- - Process Java source files (bytecode) to extract the class structure (including annotations) into the repository.
+ - Process Java source files to extract the class structure (including annotations) into the repository.
(See
<ulink url="http://jira.jboss.org/jira/browse/DNA-51">DNA-51</ulink>
)
@@ -699,7 +741,7 @@
<chapter id="using_dna">
<title>Using JBoss DNA</title>
<para>With this release, JBoss DNA is able to monitor existing JCR repositories and automatically sequence newly upload files and updated content.
- The information produced by the sequencers are saved to the repository, making it available to any repository client.
+ The information produced by the sequencers is saved to the repository, making it available to any repository client.
Using JBoss DNA, therefore, consists of setting up the DNA Java components and connecting them to the JCR repositories.
This chapter walks you through this process, using the examples downloaded in the <link linkend="downloading">previous chapter</link>.
</para>
16 years
DNA SVN: r130 - in trunk/docs/examples/gettingstarted/sequencers: src/test and 1 other directories.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2008-05-08 15:49:02 -0400 (Thu, 08 May 2008)
New Revision: 130
Added:
trunk/docs/examples/gettingstarted/sequencers/src/test/resources/
trunk/docs/examples/gettingstarted/sequencers/src/test/resources/log4j.properties
Modified:
trunk/docs/examples/gettingstarted/sequencers/.classpath
Log:
Added test resources (including Log4J properties).
Modified: trunk/docs/examples/gettingstarted/sequencers/.classpath
===================================================================
--- trunk/docs/examples/gettingstarted/sequencers/.classpath 2008-05-08 19:26:39 UTC (rev 129)
+++ trunk/docs/examples/gettingstarted/sequencers/.classpath 2008-05-08 19:49:02 UTC (rev 130)
@@ -3,6 +3,7 @@
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="src" path="src/test/java"/>
+ <classpathentry kind="src" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
Added: trunk/docs/examples/gettingstarted/sequencers/src/test/resources/log4j.properties
===================================================================
--- trunk/docs/examples/gettingstarted/sequencers/src/test/resources/log4j.properties (rev 0)
+++ trunk/docs/examples/gettingstarted/sequencers/src/test/resources/log4j.properties 2008-05-08 19:49:02 UTC (rev 130)
@@ -0,0 +1,16 @@
+# Direct log messages to stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %m%n
+
+# Root logger option
+log4j.rootLogger=INFO, stdout
+
+# Set up the default logging to be INFO level, then override specific units
+log4j.logger.org.jboss.dna=INFO
+
+# Jackrabbit logging
+log4j.logger.org.apache.jackrabbit=WARN, stdout
+log4j.logger.org.apache.derby=INFO, stdout
+
16 years
DNA SVN: r129 - trunk.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2008-05-08 15:26:39 -0400 (Thu, 08 May 2008)
New Revision: 129
Modified:
trunk/pom.xml
Log:
Added integration tests back into list of modules, and removed 'integration-tests' profile. With the separate profile, continuous integration did not compile the integration tests. Now, the CI runs to compile, but only run the integration tests if the 'integration' goal is run (during the nightly builds).
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2008-05-08 19:06:57 UTC (rev 128)
+++ trunk/pom.xml 2008-05-08 19:26:39 UTC (rev 129)
@@ -17,6 +17,7 @@
<module>dna-repository</module>
<module>sequencers/dna-sequencer-images</module>
<module>dna-maven-classloader</module>
+ <module>dna-integration-tests</module>
</modules>
<properties>
<dna-version>${project.version}</dna-version>
@@ -24,21 +25,6 @@
<profiles>
<profile>
<!--
- This profile is activated when the "integration.tests" property is set,
- as in "mvn ... -Dintegration.tests=true ..."
- -->
- <id>integration-tests</id>
- <activation>
- <property>
- <name>integration.tests</name>
- </property>
- </activation>
- <modules>
- <module>dna-integration-tests</module>
- </modules>
- </profile>
- <profile>
- <!--
This profile is activated when the "generate.docs" property is set,
as in "mvn ... -Dgenerate.docs=true ..."
-->
@@ -97,7 +83,6 @@
</plugins>
</build>
<modules>
- <module>dna-integration-tests</module>
<module>docs</module>
<module>docs/examples/gettingstarted</module>
</modules>
16 years
DNA SVN: r128 - in trunk/dna-repository/src: test/java/org/jboss/dna/repository/sequencers and 1 other directory.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2008-05-08 15:06:57 -0400 (Thu, 08 May 2008)
New Revision: 128
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencingService.java
trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencers/MockSequencerA.java
trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencers/SequencingServiceTest.java
Log:
Corrected a concurrency problem in SequencingService.awaitTermination(...) that sometimes caused a deadlock.
Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencingService.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencingService.java 2008-05-08 19:05:58 UTC (rev 127)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencingService.java 2008-05-08 19:06:57 UTC (rev 128)
@@ -387,7 +387,7 @@
}
protected boolean doAwaitTermination( long timeout, TimeUnit unit ) throws InterruptedException {
- if (this.executorService.isShutdown()) return true;
+ if (this.executorService == null || this.executorService.isTerminated()) return true;
return this.executorService.awaitTermination(timeout, unit);
}
Modified: trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencers/MockSequencerA.java
===================================================================
--- trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencers/MockSequencerA.java 2008-05-08 19:05:58 UTC (rev 127)
+++ trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencers/MockSequencerA.java 2008-05-08 19:06:57 UTC (rev 128)
@@ -43,7 +43,7 @@
private SequencerConfig config;
private AtomicInteger counter = new AtomicInteger();
- private CountDownLatch latch = new CountDownLatch(0);
+ private volatile CountDownLatch latch = new CountDownLatch(0);
public void setExpectedCount( int numExpected ) {
this.latch = new CountDownLatch(numExpected);
Modified: trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencers/SequencingServiceTest.java
===================================================================
--- trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencers/SequencingServiceTest.java 2008-05-08 19:05:58 UTC (rev 127)
+++ trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencers/SequencingServiceTest.java 2008-05-08 19:06:57 UTC (rev 128)
@@ -22,21 +22,18 @@
package org.jboss.dna.repository.sequencers;
-import java.util.concurrent.TimeUnit;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNull.notNullValue;
import static org.hamcrest.core.IsNull.nullValue;
import static org.hamcrest.core.IsSame.sameInstance;
import static org.junit.Assert.assertThat;
import static org.junit.matchers.JUnitMatchers.hasItem;
+import java.util.concurrent.TimeUnit;
import javax.jcr.Node;
import javax.jcr.Session;
import javax.jcr.observation.Event;
import org.jboss.dna.common.jcr.AbstractJcrRepositoryTest;
import org.jboss.dna.repository.observation.ObservationService;
-import org.jboss.dna.repository.sequencers.Sequencer;
-import org.jboss.dna.repository.sequencers.SequencerConfig;
-import org.jboss.dna.repository.sequencers.SequencingService;
import org.jboss.dna.repository.services.ServiceAdministrator;
import org.jboss.dna.repository.util.ExecutionContext;
import org.jboss.dna.repository.util.MockExecutionContext;
@@ -67,9 +64,11 @@
@After
public void afterEach() throws Exception {
- super.shutdownRepository();
- this.sequencingService.getAdministrator().shutdown();
this.observationService.getAdministrator().shutdown();
+ this.observationService.getAdministrator().awaitTermination(5, TimeUnit.SECONDS);
+ this.sequencingService.getAdministrator().shutdown();
+ this.sequencingService.getAdministrator().awaitTermination(5, TimeUnit.SECONDS);
+ super.shutdownRepository();
}
@Test
@@ -303,6 +302,7 @@
MockSequencerA sequencerA = (MockSequencerA)sequencingService.getSequencerLibrary().getInstances().get(0);
assertThat(sequencerA, is(notNullValue()));
assertThat(sequencerA.getCounter(), is(0));
+ sequencerA.setExpectedCount(1);
assertThat(sequencingService.getSequencerLibrary().getInstances(), hasItem((Sequencer)sequencerA));
// Cause an event, but not one that the sequencer cares about ...
@@ -320,7 +320,6 @@
assertThat(sequencingService.getSequencerLibrary().getInstances(), hasItem((Sequencer)sequencerA));
// Now set the property that the sequencer DOES care about ...
- sequencerA.setExpectedCount(1);
nodeD.setProperty("description", "This is the value");
session.save();
16 years
DNA SVN: r127 - in trunk: dna-integration-tests and 1 other directories.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2008-05-08 15:05:58 -0400 (Thu, 08 May 2008)
New Revision: 127
Modified:
trunk/dna-integration-tests/pom.xml
trunk/dna-repository/pom.xml
trunk/pom.xml
Log:
Changed to the latest version of Drools, and changed the dependency on Jackrabbit to be only test scope
Modified: trunk/dna-integration-tests/pom.xml
===================================================================
--- trunk/dna-integration-tests/pom.xml 2008-05-08 15:50:57 UTC (rev 126)
+++ trunk/dna-integration-tests/pom.xml 2008-05-08 19:05:58 UTC (rev 127)
@@ -77,8 +77,6 @@
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>
- <version>1.0.1</version>
- <scope>compile</scope>
</dependency>
<!--
Apache Jackrabbit (JCR Implementation)
Modified: trunk/dna-repository/pom.xml
===================================================================
--- trunk/dna-repository/pom.xml 2008-05-08 15:50:57 UTC (rev 126)
+++ trunk/dna-repository/pom.xml 2008-05-08 19:05:58 UTC (rev 127)
@@ -105,12 +105,10 @@
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-api</artifactId>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-core</artifactId>
- <scope>test</scope>
</dependency>
</dependencies>
</project>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2008-05-08 15:50:57 UTC (rev 126)
+++ trunk/pom.xml 2008-05-08 19:05:58 UTC (rev 127)
@@ -230,13 +230,13 @@
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-jsr94</artifactId>
- <version>4.0.5</version>
+ <version>4.0.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
- <version>4.0.5</version>
+ <version>4.0.7</version>
<scope>test</scope>
</dependency>
<!-- Testing (note the scope) -->
@@ -302,7 +302,7 @@
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-api</artifactId>
<version>1.3.3</version>
- <scope>compile</scope>
+ <scope>test</scope>
<!-- Exclude these since they are included in JDK 1.5 -->
<exclusions>
<exclusion>
@@ -319,7 +319,7 @@
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-core</artifactId>
<version>1.3.3</version>
- <scope>compile</scope>
+ <scope>test</scope>
<!-- Exclude these since they are included in JDK 1.5 -->
<exclusions>
<exclusion>
16 years
DNA SVN: r126 - trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencers.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2008-05-08 11:50:57 -0400 (Thu, 08 May 2008)
New Revision: 126
Modified:
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencers/SequencingClient.java
Log:
Removed the use of JCIP annotations, which are unnecessary for the example.
Modified: trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencers/SequencingClient.java
===================================================================
--- trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencers/SequencingClient.java 2008-05-08 02:58:27 UTC (rev 125)
+++ trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencers/SequencingClient.java 2008-05-08 15:50:57 UTC (rev 126)
@@ -39,7 +39,6 @@
import javax.jcr.SimpleCredentials;
import javax.jcr.Value;
import javax.jcr.observation.Event;
-import net.jcip.annotations.NotThreadSafe;
import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
import org.apache.jackrabbit.core.TransientRepository;
import org.jboss.dna.common.SystemFailureException;
@@ -54,7 +53,6 @@
/**
* @author Randall Hauch
*/
-@NotThreadSafe
public class SequencingClient {
public static final String DEFAULT_JACKRABBIT_CONFIG_PATH = "jackrabbitConfig.xml";
16 years
DNA SVN: r125 - trunk.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2008-05-07 22:58:27 -0400 (Wed, 07 May 2008)
New Revision: 125
Modified:
trunk/pom.xml
Log:
Added the production of source JARs for the test sources
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2008-05-07 22:02:54 UTC (rev 124)
+++ trunk/pom.xml 2008-05-08 02:58:27 UTC (rev 125)
@@ -146,6 +146,7 @@
<phase>verify</phase>
<goals>
<goal>jar</goal>
+ <goal>test-jar</goal>
</goals>
</execution>
</executions>
16 years