[dna-commits] DNA SVN: r968 - in trunk: dna-jcr/src/test/java/org/jboss/dna/jcr and 4 other directories.

dna-commits at lists.jboss.org dna-commits at lists.jboss.org
Wed Jun 3 16:09:12 EDT 2009


Author: rhauch
Date: 2009-06-03 16:09:11 -0400 (Wed, 03 Jun 2009)
New Revision: 968

Added:
   trunk/dna-cnd/src/test/resources/cnd/javaSource.cnd
   trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/InMemoryRepositoryStubTest.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/DnaConfiguration.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/DnaEngine.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/JcrConfiguration.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/JcrConfigurationTest.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/JcrEngine.java
   trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/MockStreamSequencerA.java
   trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/MockStreamSequencerB.java
   trunk/docs/examples/gettingstarted/repositories/src/main/resources/aircraft.cnd
   trunk/docs/examples/gettingstarted/repositories/src/main/resources/cars.cnd
Log:
DNA-436 Continued the work on the examples, with fairly substantial changes (simplification) to the configuration frameworks.

Added: trunk/dna-cnd/src/test/resources/cnd/javaSource.cnd
===================================================================
--- trunk/dna-cnd/src/test/resources/cnd/javaSource.cnd	                        (rev 0)
+++ trunk/dna-cnd/src/test/resources/cnd/javaSource.cnd	2009-06-03 20:09:11 UTC (rev 968)
@@ -0,0 +1,257 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of 
+ * individual contributors. 
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+/**
+ * @author Serge Pagop (serge.pagop at innoq.com)
+ */
+
+//------------------------------------------------------------------------------
+// N A M E S P A C E S
+//------------------------------------------------------------------------------
+<java='http://www.jboss.org/dna/java/1.0'>
+<nt='http://www.jcp.org/jcr/nt/1.0'>
+<mix='http://www.jcp.org/jcr/mix/1.0'>
+
+//------------------------------------------------------------------------------
+// B A S E  T Y P E S
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+// V E R S I O N I N G
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+// N O D E T Y P E S
+//------------------------------------------------------------------------------
+
+/**
+ * Element-value
+ */
+[java:elementValue] > nt:unstructured
+ + java:kindOfvalues (java:conditionalExpression, java:annotationDeclaration, java:elementValueArrayInitializer) mandatory
+ 
+/**
+ * Modifiers
+ */
+[java:modifierDeclaration] > nt:unstructured
+ - java:modifierName (string) mandatory
+
+/**
+ * Expression element-value type
+ */
+[java:conditionalExpression] > nt:unstructured
+ - java:expression (string)
+
+/**
+ * Array initializer element-value type
+ */
+[java:elementValueArrayInitializer] > nt:unstructured
+ + java:elementValue (java:elementValue) = java:elementValue multiple
+
+/**
+ * Identifier
+ */
+[java:identifier] > nt:unstructured
+ - java:identifierName (String) mandatory
+ + java:value (java:elementValue) = java:elementValue mandatory
+ 
+/**
+ * Element-value pair
+ */
+[java:elementValuePair] > nt:unstructured
+ + java:identifier (java:identifier) mandatory
+
+/**
+ * Annotation type
+ */
+[java:annotationDeclaration] > nt:unstructured
+ + java:annotationType (java:normalAnnotation, java:markerAnnotation,  java:singleElementAnnotation) mandatory
+  
+/**
+ * Normal annotation e.g. @Entity(name="Customer")
+ */
+[java:normalAnnotation] > nt:unstructured
+ - java:normalAnnotationName (string) mandatory
+ + java:elementValuePair (java:elementValuePair)
+
+/**
+ * Marker annotation e.g. @GET
+ */
+[java:markerAnnotation] > nt:unstructured
+ - java:markerAnnotationName (string) mandatory
+
+/**
+ * Single element annotation  e.g. @Path("/book")
+ */
+[java:singleElementAnnotation] > nt:unstructured
+ - java:singleElementAnnotationName (string) mandatory
+ + java:value (java:elementValue) = java:elementValue mandatory
+
+/** 
+ * Formal parameter
+ */
+[java:formalParameter] > nt:unstructured
+ + java:type (java:primitiveType, java:arrayType, java:simpleType, java:qualifiedType, java:wildcardType, java:parameterizedType)
+
+/**
+ * Primitive type:
+ * - Integral type ('byte', 'short', 'int', 'long', 'char')
+ * - Floating point type ('float', 'double')
+ * - Boolean type ('boolean')
+ * - No return type ('void')
+ */
+[java:primitiveType] > nt:unstructured
+ - java:primitiveTypeDescription (string)
+ + java:modifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:primitiveTypeName (string) mandatory
+ + java:primitiveVariable (java:variable) = java:variable
+ 
+ [java:variable] > nt:unstructured
+ - java:variableName (string) mandatory
+ 
+/** 
+ * java:arrayType 
+ */ 
+[java:arrayType] > nt:unstructured
+ - java:arrayTypeDescription (string)
+ + java:arrayTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:arrayTypeName (string) mandatory
+ + java:arrayTypeVariable (java:variable) = java:variable
+ 
+[java:simpleType] > nt:unstructured
+ - java:simpleTypeDescription (string)
+ + java:simpleTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:simpleTypeName (string) mandatory
+ + java:simpleTypeVariable (java:variable) = java:variable
+
+[java:qualifiedType] > nt:unstructured
+ - java:qualifiedTypeDescription (string)
+ + java:qualifiedTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:qualifiedTypeName (string) mandatory
+ + java:qualifiedTypeVariable (java:variable) = java:variable
+    
+[java:wildcardType] > nt:unstructured
+ - java:wildcardTypeDescription (string)
+ + java:wildcardTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:wildcardTypeName (string) mandatory
+ + java:wildcardTypeVariable (java:variable) = java:variable
+
+[java:parameterizedType] > nt:unstructured
+ - java:parameterizedTypeDescription (string)
+ + java:parameterizedTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:parameterizedTypeName (string) mandatory
+ + java:parameterizedTypeVariable (java:variable) = java:variable
+
+/** 
+ * Field type 
+ */
+[java:fieldType] > nt:unstructured
+ + java:type (java:primitiveType, java:arrayType, java:simpleType, java:qualifiedType, java:wildcardType, java:parameterizedType) mandatory multiple 
+ 
+ /** 
+  * Method declaration 
+  */
+[java:methodDeclaration] > nt:unstructured
+ - java:methodDescription (string)
+ + java:modifier (java:modifierDeclaration) = java:modifierDeclaration
+ + java:resultType (java:primitiveType, java:arrayType, java:simpleType, java:qualifiedType, java:wildcardType, java:parameterizedType) mandatory
+ - java:methodName (string) mandatory
+ + java:parameter (java:formalParameter) multiple
+
+/** 
+ * Constructor declarations 
+ */
+[java:constructorDeclaration] > nt:unstructured
+ - java:constructorDescription (string)
+ + java:modifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:constructorName (string) mandatory
+ + java:parameter (java:formalParameter)
+
+
+/**
+ * Package declarations
+ */
+[java:packageDeclaration] > nt:unstructured
+ + java:annotation (java:annotationDeclaration) = java:annotationDeclaration
+ - java:packageKeyword (string)
+   < 'package' 
+ - java:packageName (string) mandatory 
+
+/**
+ * Import declarations
+ */
+[java:singleTypeImportDeclaration] > nt:unstructured
+ - java:singleTypeImportkeyword (string) mandatory
+  < 'import'
+ - java:singleImportName (string) mandatory
+ 
+[java:typeImportOnDemandDeclaration] > nt:unstructured
+ - java:onDemandImportKeyword (string) mandatory
+  < 'import'
+ - java:onDemandImportName (string) mandatory
+
+ [java:importDeclaration] > nt:unstructured
+ + java:singleImport (java:singleTypeImportDeclaration) = java:singleTypeImportDeclaration
+ + java:importOnDemand (java:typeImportOnDemandDeclaration) = java:typeImportOnDemandDeclaration
+ 
+
+/**
+ * Class declaration
+ *
+ * The body of class declares members (fields and methods and nested classes and interfaces), 
+ * instance and static initializers, and constructors
+ */
+[java:normalClassDeclaration] > nt:unstructured
+ - java:description (string)
+ + java:modifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:normalClassName (string) mandatory
+ + java:field (java:fieldType)  = java:fieldType multiple
+ + java:method (java:methodDeclaration) = java:methodDeclaration multiple
+ + java:constructor (java:constructorDeclaration) = java:constructorDeclaration multiple
+ 
+[java:enumDeclaration] > nt:unstructured // TODO
+ 
+[java:classDeclaration] > nt:unstructured
+ + java:normalClass (java:normalClassDeclaration) = java:normalClassDeclaration
+ + java:enum (java:enumDeclaration) = java:enumDeclaration
+
+/**
+ * Interface declaration 
+ *
+ * The body of class declares members (fields and methods and nested classes and interfaces), 
+ * instance and static initializers, and constructors
+ */
+ //TODO
+[java:interfaceDeclaration] > nt:unstructured
+ 
+ 
+/**
+ * Compilation unit
+ */
+[java:compilationUnit] > nt:unstructured
+ + java:package (java:packageDeclaration) = java:packageDeclaration
+ + java:import (java:importDeclaration) = java:importDeclaration
+ + java:unitType (java:classDeclaration, java:interfaceDeclaration) 
\ No newline at end of file

Added: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/InMemoryRepositoryStubTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/InMemoryRepositoryStubTest.java	                        (rev 0)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/InMemoryRepositoryStubTest.java	2009-06-03 20:09:11 UTC (rev 968)
@@ -0,0 +1,46 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of 
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * JBoss DNA 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.jcr;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNull.notNullValue;
+import static org.junit.Assert.assertThat;
+import java.io.IOException;
+import java.util.Properties;
+import org.junit.Test;
+
+/**
+ * 
+ */
+public class InMemoryRepositoryStubTest {
+
+    @Test
+    public void shouldStartRepositoryStub() throws IOException {
+        Properties env = new Properties();
+        env.load(getClass().getClassLoader().getResourceAsStream("repositoryStubImpl.properties"));
+        InMemoryRepositoryStub stub = new InMemoryRepositoryStub(env);
+        assertThat(stub.getRepository(), is(notNullValue()));
+    }
+
+}


Property changes on: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/InMemoryRepositoryStubTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/DnaConfiguration.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/DnaConfiguration.java	                        (rev 0)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/DnaConfiguration.java	2009-06-03 20:09:11 UTC (rev 968)
@@ -0,0 +1,512 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of 
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * JBoss DNA 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.repository.config;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import net.jcip.annotations.Immutable;
+import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.graph.ExecutionContext;
+import org.jboss.dna.graph.Graph;
+import org.jboss.dna.graph.Node;
+import org.jboss.dna.graph.Workspace;
+import org.jboss.dna.graph.connector.RepositorySource;
+import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
+import org.jboss.dna.graph.property.Path;
+import org.jboss.dna.graph.property.basic.RootPath;
+import org.xml.sax.SAXException;
+
+/**
+ * 
+ */
+public class DnaConfiguration {
+
+    protected static final String DEFAULT_WORKSPACE_NAME = "";
+    protected static final String DEFAULT_PATH = "/";
+
+    private final ExecutionContext context;
+    private ConfigurationContent configurationContent;
+
+    /**
+     * Create a new configuration, using a default-constructed {@link ExecutionContext}.
+     */
+    public DnaConfiguration() {
+        this(new ExecutionContext());
+    }
+
+    /**
+     * Create a new configuration using the supplied {@link ExecutionContext}.
+     * 
+     * @param context the execution context
+     * @throws IllegalArgumentException if the path is null or empty
+     */
+    public DnaConfiguration( ExecutionContext context ) {
+        CheckArg.isNotNull(context, "context");
+        this.context = context;
+    }
+
+    /**
+     * Load the configuration from a file at the given path.
+     * 
+     * @param pathToConfigurationFile the path the file containing the configuration information
+     * @return this configuration object, for convenience and method chaining
+     * @throws IOException if there is an error or problem reading the file at the supplied location
+     * @throws SAXException if the file is not a valid XML format
+     * @throws IllegalArgumentException if the path is null or empty
+     */
+    public DnaConfiguration loadFrom( String pathToConfigurationFile ) throws IOException, SAXException {
+        CheckArg.isNotEmpty(pathToConfigurationFile, "pathToConfigurationFile");
+        return loadFrom(new File(pathToConfigurationFile));
+    }
+
+    /**
+     * Load the configuration from a file.
+     * 
+     * @param configurationFile the file containing the configuration information
+     * @return this configuration object, for convenience and method chaining
+     * @throws IOException if there is an error or problem reading the supplied file
+     * @throws SAXException if the file is not a valid XML format
+     * @throws IllegalArgumentException if the file reference is null
+     */
+    public DnaConfiguration loadFrom( File configurationFile ) throws IOException, SAXException {
+        CheckArg.isNotNull(configurationFile, "configurationFile");
+        InputStream stream = new FileInputStream(configurationFile);
+        try {
+            return loadFrom(stream);
+        } finally {
+            stream.close();
+        }
+    }
+
+    /**
+     * Load the configuration from a file at the supplied URL.
+     * 
+     * @param urlToConfigurationFile the URL of the file containing the configuration information
+     * @return this configuration object, for convenience and method chaining
+     * @throws IOException if there is an error or problem reading the file at the supplied URL
+     * @throws SAXException if the file is not a valid XML format
+     * @throws IllegalArgumentException if the URL is null
+     */
+    public DnaConfiguration loadFrom( URL urlToConfigurationFile ) throws IOException, SAXException {
+        CheckArg.isNotNull(urlToConfigurationFile, "urlToConfigurationFile");
+        InputStream stream = urlToConfigurationFile.openStream();
+        try {
+            return loadFrom(stream);
+        } finally {
+            stream.close();
+        }
+    }
+
+    /**
+     * Load the configuration from a file at the supplied URL.
+     * 
+     * @param configurationFileInputStream the stream with the configuration information
+     * @return this configuration object, for convenience and method chaining
+     * @throws IOException if there is an error or problem reading the file at the supplied URL
+     * @throws SAXException if the file is not a valid XML format
+     * @throws IllegalArgumentException if the stream is null
+     */
+    public DnaConfiguration loadFrom( InputStream configurationFileInputStream ) throws IOException, SAXException {
+        CheckArg.isNotNull(configurationFileInputStream, "configurationFileInputStream");
+
+        // Create the in-memory repository source in which the content will be stored ...
+        InMemoryRepositorySource source = new InMemoryRepositorySource();
+        source.setName("Configuration Repository");
+        source.setDefaultWorkspaceName(DEFAULT_WORKSPACE_NAME);
+
+        // Import the information into the source ...
+        Path path = path(DEFAULT_PATH);
+        Graph graph = Graph.create(source, context);
+        graph.importXmlFrom(configurationFileInputStream).into(path);
+
+        // The file was imported successfully, so now create the content information ...
+        configurationContent = new ConfigurationContent(source, null, path, context);
+        return this;
+    }
+
+    /**
+     * Load the configuration from the repository content using the supplied repository source. This method assumes that the
+     * supplied source has already been configured and is ready to {@link RepositorySource#getConnection() create connections}.
+     * Also, the default workspace of the source will be used, and the configuration content may be found directly under the root
+     * node.
+     * 
+     * @param source the source that defines the repository with the configuration content
+     * @return this configuration object, for convenience and method chaining
+     * @throws IllegalArgumentException if the source is null
+     */
+    public DnaConfiguration loadFrom( RepositorySource source ) {
+        return loadFrom(source, null, null);
+    }
+
+    /**
+     * Load the configuration from the repository content using the workspace in the supplied repository source. This method
+     * assumes that the supplied source has already been configured and is ready to {@link RepositorySource#getConnection() create
+     * connections}. Also, the configuration content may be found directly under the root node.
+     * 
+     * @param source the source that defines the repository with the configuration content
+     * @param workspaceName the name of the workspace with the configuration content, or null if the source's default workspace
+     *        should be used
+     * @return this configuration object, for convenience and method chaining
+     * @throws IllegalArgumentException if the source is null
+     */
+    public DnaConfiguration loadFrom( RepositorySource source,
+                                      String workspaceName ) {
+        CheckArg.isNotNull(source, "source");
+        return loadFrom(source, workspaceName, null);
+    }
+
+    /**
+     * Load the configuration from the repository content at the supplied path in the workspace in the supplied repository source.
+     * This method assumes that the supplied source has already been configured and is ready to
+     * {@link RepositorySource#getConnection() create connections}.
+     * 
+     * @param source the source that defines the repository with the configuration content
+     * @param workspaceName the name of the workspace with the configuration content, or null if the source's default workspace
+     *        should be used
+     * @param pathInWorkspace the path to the parent node under which the configuration content may be found, or null if the
+     *        content may be found under the root node
+     * @return this configuration object, for convenience and method chaining
+     * @throws IllegalArgumentException if the source is null
+     */
+    public DnaConfiguration loadFrom( RepositorySource source,
+                                      String workspaceName,
+                                      String pathInWorkspace ) {
+        CheckArg.isNotNull(source, "source");
+
+        // Verify connectivity ...
+        Graph graph = Graph.create(source, context);
+        if (workspaceName != null) {
+            Workspace workspace = graph.useWorkspace(workspaceName); // should throw exception if not connectable
+            assert workspace.getRoot() != null;
+        }
+
+        // Verify the path ...
+        Path path = pathInWorkspace != null ? path(pathInWorkspace) : path(DEFAULT_PATH);
+        Node parent = graph.getNodeAt(path);
+        assert parent != null;
+
+        // Now create the content information ...
+        configurationContent = new ConfigurationContent(source, workspaceName, path, context);
+        return this;
+    }
+
+    protected ConfigurationContent getConfigurationContent() {
+        return configurationContent;
+    }
+
+    protected Path path( String path ) {
+        return context.getValueFactories().getPathFactory().create(path);
+    }
+
+    public MimeTypeDetectorDetails<? extends DnaConfiguration> mimeTypeDetector( String name ) {
+        return new MimeTypeDetectorBuilder<DnaConfiguration>(this);
+    }
+
+    /**
+     * Construct an engine that reflects the current state of this configuration. This method always creates a new instance.
+     * 
+     * @return the resulting engine; never null
+     */
+    public DnaEngine build() {
+        return new DnaEngine();
+    }
+
+    public interface Returnable<ReturnType> {
+        /**
+         * Return the configuration component.
+         * 
+         * @return the configuration component; never null
+         */
+        ReturnType and();
+    }
+
+    protected static class BaseReturnable<ReturnType> implements Returnable<ReturnType> {
+        protected final ReturnType returnObject;
+
+        protected BaseReturnable( ReturnType returnObject ) {
+            this.returnObject = returnObject;
+        }
+
+        /**
+         * {@inheritDoc}
+         * 
+         * @see org.jboss.dna.repository.config.DnaConfiguration.Returnable#and()
+         */
+        public ReturnType and() {
+            return returnObject;
+        }
+    }
+
+    /**
+     * Interface used to set up and build a RepositorySource instance.
+     * 
+     * @param <ReturnType> the type of the configuration component
+     */
+    public interface MimeTypeDetectorDetails<ReturnType> extends Returnable<ReturnType> {
+    }
+
+    protected static class MimeTypeDetectorBuilder<ReturnType> extends BaseReturnable<ReturnType>
+        implements MimeTypeDetectorDetails<ReturnType> {
+        protected MimeTypeDetectorBuilder( ReturnType returnObject ) {
+            super(returnObject);
+        }
+    }
+
+    /**
+     * Interface used to set up and build a RepositorySource instance.
+     * 
+     * @param <ReturnType> the type of the configuration component
+     */
+    public interface RepositorySourceDetails<ReturnType>
+        extends SetProperties<RepositorySourceDetails<ReturnType>>, Returnable<ReturnType> {
+    }
+
+    /**
+     * Interface for configuring the JavaBean-style properties of an object.
+     * 
+     * @param <ReturnType> the interface returned after the property has been set.
+     * @author Randall Hauch
+     */
+    public interface SetProperties<ReturnType> {
+        /**
+         * Set the property value to an integer.
+         * 
+         * @param beanPropertyName the name of the JavaBean-style property (e.g., "retryLimit")
+         * @param value the new value for the property
+         * @return the next component to continue configuration; never null
+         */
+        ReturnType setProperty( String beanPropertyName,
+                                int value );
+
+        /**
+         * Set the property value to a long number.
+         * 
+         * @param beanPropertyName the name of the JavaBean-style property (e.g., "retryLimit")
+         * @param value the new value for the property
+         * @return the next component to continue configuration; never null
+         */
+        ReturnType setProperty( String beanPropertyName,
+                                long value );
+
+        /**
+         * Set the property value to a short.
+         * 
+         * @param beanPropertyName the name of the JavaBean-style property (e.g., "retryLimit")
+         * @param value the new value for the property
+         * @return the next component to continue configuration; never null
+         */
+        ReturnType setProperty( String beanPropertyName,
+                                short value );
+
+        /**
+         * Set the property value to a boolean.
+         * 
+         * @param beanPropertyName the name of the JavaBean-style property (e.g., "retryLimit")
+         * @param value the new value for the property
+         * @return the next component to continue configuration; never null
+         */
+        ReturnType setProperty( String beanPropertyName,
+                                boolean value );
+
+        /**
+         * Set the property value to a float.
+         * 
+         * @param beanPropertyName the name of the JavaBean-style property (e.g., "retryLimit")
+         * @param value the new value for the property
+         * @return the next component to continue configuration; never null
+         */
+        ReturnType setProperty( String beanPropertyName,
+                                float value );
+
+        /**
+         * Set the property value to a double.
+         * 
+         * @param beanPropertyName the name of the JavaBean-style property (e.g., "retryLimit")
+         * @param value the new value for the property
+         * @return the next component to continue configuration; never null
+         */
+        ReturnType setProperty( String beanPropertyName,
+                                double value );
+
+        /**
+         * Set the property value to a string.
+         * 
+         * @param beanPropertyName the name of the JavaBean-style property (e.g., "retryLimit")
+         * @param value the new value for the property
+         * @return the next component to continue configuration; never null
+         */
+        ReturnType setProperty( String beanPropertyName,
+                                String value );
+
+        /**
+         * Set the property value to an object.
+         * 
+         * @param beanPropertyName the name of the JavaBean-style property (e.g., "retryLimit")
+         * @param value the new value for the property
+         * @return the next component to continue configuration; never null
+         */
+        ReturnType setProperty( String beanPropertyName,
+                                Object value );
+    }
+
+    protected class SourceDetails<ReturnType> extends BaseReturnable<ReturnType> implements RepositorySourceDetails<ReturnType> {
+
+        protected SourceDetails( ReturnType returnObject ) {
+            super(returnObject);
+        }
+
+        public RepositorySourceDetails<ReturnType> setProperty( String beanPropertyName,
+                                                                int value ) {
+            return setProperty(beanPropertyName, (Object)value);
+        }
+
+        public RepositorySourceDetails<ReturnType> setProperty( String beanPropertyName,
+                                                                long value ) {
+            return setProperty(beanPropertyName, (Object)value);
+        }
+
+        public RepositorySourceDetails<ReturnType> setProperty( String beanPropertyName,
+                                                                short value ) {
+            return setProperty(beanPropertyName, (Object)value);
+        }
+
+        public RepositorySourceDetails<ReturnType> setProperty( String beanPropertyName,
+                                                                boolean value ) {
+            return setProperty(beanPropertyName, (Object)value);
+        }
+
+        public RepositorySourceDetails<ReturnType> setProperty( String beanPropertyName,
+                                                                float value ) {
+            return setProperty(beanPropertyName, (Object)value);
+        }
+
+        public RepositorySourceDetails<ReturnType> setProperty( String beanPropertyName,
+                                                                double value ) {
+            return setProperty(beanPropertyName, (Object)value);
+        }
+
+        public RepositorySourceDetails<ReturnType> setProperty( String beanPropertyName,
+                                                                String value ) {
+            return setProperty(beanPropertyName, (Object)value);
+        }
+
+        public RepositorySourceDetails<ReturnType> setProperty( String beanPropertyName,
+                                                                Object value ) {
+            throw new UnsupportedOperationException();
+        }
+    }
+
+    /**
+     * Representation of the current configuration content.
+     */
+    @Immutable
+    protected static class ConfigurationContent {
+        private final RepositorySource source;
+        private final Path path;
+        private final String workspace;
+        private final ExecutionContext context;
+        private Graph graph;
+
+        protected ConfigurationContent( RepositorySource source,
+                                        String workspace,
+                                        Path path,
+                                        ExecutionContext context ) {
+            this.source = source;
+            this.path = path != null ? path : RootPath.INSTANCE;
+            this.workspace = workspace;
+            this.context = context;
+        }
+
+        /**
+         * Get the repository source where the configuration content may be found
+         * 
+         * @return the source for the configuration repository; never null
+         */
+        public RepositorySource getRepositorySource() {
+            return source;
+        }
+
+        /**
+         * Get the path in the configuration repository where the configuration content may be found
+         * 
+         * @return the path to the configuration content; never null
+         */
+        public Path getPath() {
+            return path;
+        }
+
+        /**
+         * Get the name of the workspace used for the configuration repository.
+         * 
+         * @return the name of the workspace, or null if the default workspace should be used
+         */
+        public String getWorkspace() {
+            return workspace;
+        }
+
+        /**
+         * @return context
+         */
+        public ExecutionContext getContext() {
+            return context;
+        }
+
+        /**
+         * Return a copy of this configuration that uses the supplied path instead of this object's {@link #getPath() path}.
+         * 
+         * @param path the desired path for the new configuration; if null, then "/" is used
+         * @return the new configuration
+         */
+        public ConfigurationContent with( Path path ) {
+            return new ConfigurationContent(source, workspace, path, context);
+        }
+
+        /**
+         * Return a copy of this configuration that uses the supplied workspace name instead of this object's
+         * {@link #getWorkspace() workspace}.
+         * 
+         * @param workspace the desired workspace name for the new configuration; if null, then the default workspace will be used
+         * @return the new configuration
+         */
+        public ConfigurationContent withWorkspace( String workspace ) {
+            return new ConfigurationContent(source, workspace, path, context);
+        }
+
+        /**
+         * Obtain a graph to this configuration repository. This method will always return the same graph instance.
+         * 
+         * @return the graph; never null
+         */
+        protected Graph graph() {
+            if (graph == null) {
+                graph = Graph.create(source, context);
+                if (workspace != null) graph.useWorkspace(workspace);
+            }
+            return graph;
+        }
+    }
+}


Property changes on: trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/DnaConfiguration.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/DnaEngine.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/DnaEngine.java	                        (rev 0)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/DnaEngine.java	2009-06-03 20:09:11 UTC (rev 968)
@@ -0,0 +1,31 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of 
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * JBoss DNA 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.repository.config;
+
+/**
+ * 
+ */
+public class DnaEngine {
+
+}


Property changes on: trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/DnaEngine.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/JcrConfiguration.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/JcrConfiguration.java	                        (rev 0)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/JcrConfiguration.java	2009-06-03 20:09:11 UTC (rev 968)
@@ -0,0 +1,145 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of 
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * JBoss DNA 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.repository.config;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import org.jboss.dna.graph.connector.RepositorySource;
+import org.xml.sax.SAXException;
+
+/**
+ * 
+ */
+public class JcrConfiguration extends DnaConfiguration {
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @throws IOException
+     * @throws SAXException
+     * @see org.jboss.dna.repository.config.DnaConfiguration#loadFrom(java.lang.String)
+     */
+    @Override
+    public JcrConfiguration loadFrom( String pathToFile ) throws IOException, SAXException {
+        super.loadFrom(pathToFile);
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.jboss.dna.repository.config.DnaConfiguration#loadFrom(java.io.File)
+     */
+    @Override
+    public JcrConfiguration loadFrom( File configurationFile ) throws IOException, SAXException {
+        super.loadFrom(configurationFile);
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.jboss.dna.repository.config.DnaConfiguration#loadFrom(java.net.URL)
+     */
+    @Override
+    public JcrConfiguration loadFrom( URL urlToConfigurationFile ) throws IOException, SAXException {
+        super.loadFrom(urlToConfigurationFile);
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.jboss.dna.repository.config.DnaConfiguration#loadFrom(java.io.InputStream)
+     */
+    @Override
+    public JcrConfiguration loadFrom( InputStream configurationFileInputStream ) throws IOException, SAXException {
+        super.loadFrom(configurationFileInputStream);
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.jboss.dna.repository.config.DnaConfiguration#loadFrom(org.jboss.dna.graph.connector.RepositorySource)
+     */
+    @Override
+    public JcrConfiguration loadFrom( RepositorySource source ) {
+        super.loadFrom(source);
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.jboss.dna.repository.config.DnaConfiguration#loadFrom(org.jboss.dna.graph.connector.RepositorySource,
+     *      java.lang.String)
+     */
+    @Override
+    public JcrConfiguration loadFrom( RepositorySource source,
+                                      String workspaceName ) {
+        super.loadFrom(source, workspaceName);
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.jboss.dna.repository.config.DnaConfiguration#loadFrom(org.jboss.dna.graph.connector.RepositorySource,
+     *      java.lang.String, java.lang.String)
+     */
+    @Override
+    public JcrConfiguration loadFrom( RepositorySource source,
+                                      String workspaceName,
+                                      String pathInWorkspace ) {
+        super.loadFrom(source, workspaceName, pathInWorkspace);
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.jboss.dna.repository.config.DnaConfiguration#mimeTypeDetector(java.lang.String)
+     */
+    @Override
+    public MimeTypeDetectorDetails<JcrConfiguration> mimeTypeDetector( String name ) {
+        return new MimeTypeDetectorBuilder<JcrConfiguration>(this);
+    }
+
+    public JcrConfiguration addRepository( String repositoryId ) {
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.jboss.dna.repository.config.DnaConfiguration#build()
+     */
+    @Override
+    public JcrEngine build() {
+        return new JcrEngine();
+    }
+}


Property changes on: trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/JcrConfiguration.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/JcrConfigurationTest.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/JcrConfigurationTest.java	                        (rev 0)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/JcrConfigurationTest.java	2009-06-03 20:09:11 UTC (rev 968)
@@ -0,0 +1,98 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of 
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * JBoss DNA 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.repository.config;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNull.notNullValue;
+import static org.hamcrest.core.IsSame.sameInstance;
+import static org.junit.Assert.assertThat;
+import java.io.File;
+import java.net.URL;
+import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
+import org.junit.Test;
+
+/**
+ * 
+ */
+public class JcrConfigurationTest {
+
+    @Test
+    public void shoulConfigureDnaFromFileUsingPath() throws Exception {
+        DnaConfiguration config = new DnaConfiguration();
+        config.loadFrom("some path");
+
+        DnaEngine engine = config.build();
+        assertThat(engine, is(notNullValue()));
+    }
+
+    @Test
+    public void shoulConfigureDnaFromFile() throws Exception {
+        DnaConfiguration config = new DnaConfiguration();
+        config.loadFrom(new File("file:some path"));
+
+        DnaEngine engine = config.build();
+        assertThat(engine, is(notNullValue()));
+    }
+
+    @Test
+    public void shoulConfigureDnaFromFileUsingURL() throws Exception {
+        DnaConfiguration config = new DnaConfiguration();
+        config.loadFrom(new URL("file:some path"));
+
+        DnaEngine engine = config.build();
+        assertThat(engine, is(notNullValue()));
+    }
+
+    @Test
+    public void shoulConfigureDnaFromRepositorySource() throws Exception {
+        InMemoryRepositorySource source = new InMemoryRepositorySource();
+        DnaConfiguration config = new DnaConfiguration();
+        config.loadFrom(source);
+
+        DnaEngine engine = config.build();
+        assertThat(engine, is(notNullValue()));
+    }
+
+    @Test
+    public void shouldBeConfigurableAsDnaConfiguration() throws Exception {
+        DnaConfiguration config = new DnaConfiguration();
+        assertThat(config.loadFrom("some path"), is(sameInstance(config)));
+        assertThat(config.addMimeTypeDetector("something").and(), is(sameInstance(config)));
+
+        DnaEngine engine = config.build();
+        assertThat(engine, is(notNullValue()));
+    }
+
+    @Test
+    public void shouldBeConfigurableAsJcrConfiguration() throws Exception {
+        JcrConfiguration config = new JcrConfiguration();
+        config.loadFrom("some path").addRepository("some repository ID");
+        assertThat(config.loadFrom("some path"), is(sameInstance(config)));
+        assertThat(config.addMimeTypeDetector("something").and(), is(sameInstance(config)));
+
+        JcrEngine engine = config.build();
+        assertThat(engine, is(notNullValue()));
+    }
+
+}


Property changes on: trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/JcrConfigurationTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/JcrEngine.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/JcrEngine.java	                        (rev 0)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/JcrEngine.java	2009-06-03 20:09:11 UTC (rev 968)
@@ -0,0 +1,31 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of 
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * JBoss DNA 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.repository.config;
+
+/**
+ * 
+ */
+public class JcrEngine extends DnaEngine {
+
+}


Property changes on: trunk/dna-repository/src/main/java/org/jboss/dna/repository/config/JcrEngine.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/MockStreamSequencerA.java
===================================================================
--- trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/MockStreamSequencerA.java	                        (rev 0)
+++ trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/MockStreamSequencerA.java	2009-06-03 20:09:11 UTC (rev 968)
@@ -0,0 +1,79 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of 
+ * individual contributors. 
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.dna.repository.sequencer;
+
+import java.io.InputStream;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import net.jcip.annotations.ThreadSafe;
+import org.jboss.dna.graph.sequencer.SequencerOutput;
+import org.jboss.dna.graph.sequencer.StreamSequencer;
+import org.jboss.dna.graph.sequencer.StreamSequencerContext;
+
+/**
+ * A mock stream sequencer that can be used for basic unit testing.
+ */
+ at ThreadSafe
+public class MockStreamSequencerA implements StreamSequencer {
+
+    private AtomicInteger counter = new AtomicInteger();
+    private volatile CountDownLatch latch = new CountDownLatch(0);
+
+    public void setExpectedCount( int numExpected ) {
+        this.latch = new CountDownLatch(numExpected);
+    }
+
+    public boolean awaitExecution( long timeout,
+                                   TimeUnit unit ) throws InterruptedException {
+        return this.latch.await(timeout, unit);
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.jboss.dna.graph.sequencer.StreamSequencer#sequence(java.io.InputStream,
+     *      org.jboss.dna.graph.sequencer.SequencerOutput, org.jboss.dna.graph.sequencer.StreamSequencerContext)
+     */
+    public void sequence( InputStream stream,
+                          SequencerOutput output,
+                          StreamSequencerContext context ) {
+        // increment the counter and record the progress ...
+        this.counter.incrementAndGet();
+        this.latch.countDown();
+    }
+
+    public int getCounter() {
+        return this.counter.get();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return "MockStreamSequencerA [" + this.getCounter() + "]";
+    }
+}


Property changes on: trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/MockStreamSequencerA.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/MockStreamSequencerB.java
===================================================================
--- trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/MockStreamSequencerB.java	                        (rev 0)
+++ trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/MockStreamSequencerB.java	2009-06-03 20:09:11 UTC (rev 968)
@@ -0,0 +1,79 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of 
+ * individual contributors. 
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.dna.repository.sequencer;
+
+import java.io.InputStream;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import net.jcip.annotations.ThreadSafe;
+import org.jboss.dna.graph.sequencer.SequencerOutput;
+import org.jboss.dna.graph.sequencer.StreamSequencer;
+import org.jboss.dna.graph.sequencer.StreamSequencerContext;
+
+/**
+ * A mock stream sequencer that can be used for basic unit testing.
+ */
+ at ThreadSafe
+public class MockStreamSequencerB implements StreamSequencer {
+
+    private AtomicInteger counter = new AtomicInteger();
+    private volatile CountDownLatch latch = new CountDownLatch(0);
+
+    public void setExpectedCount( int numExpected ) {
+        this.latch = new CountDownLatch(numExpected);
+    }
+
+    public boolean awaitExecution( long timeout,
+                                   TimeUnit unit ) throws InterruptedException {
+        return this.latch.await(timeout, unit);
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.jboss.dna.graph.sequencer.StreamSequencer#sequence(java.io.InputStream,
+     *      org.jboss.dna.graph.sequencer.SequencerOutput, org.jboss.dna.graph.sequencer.StreamSequencerContext)
+     */
+    public void sequence( InputStream stream,
+                          SequencerOutput output,
+                          StreamSequencerContext context ) {
+        // increment the counter and record the progress ...
+        this.counter.incrementAndGet();
+        this.latch.countDown();
+    }
+
+    public int getCounter() {
+        return this.counter.get();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return "MockStreamSequencerB [" + this.getCounter() + "]";
+    }
+}


Property changes on: trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/MockStreamSequencerB.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: trunk/docs/examples/gettingstarted/repositories/src/main/resources/aircraft.cnd
===================================================================
--- trunk/docs/examples/gettingstarted/repositories/src/main/resources/aircraft.cnd	                        (rev 0)
+++ trunk/docs/examples/gettingstarted/repositories/src/main/resources/aircraft.cnd	2009-06-03 20:09:11 UTC (rev 968)
@@ -0,0 +1,64 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of 
+ * individual contributors. 
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+ 
+//------------------------------------------------------------------------------
+// N A M E S P A C E S
+//------------------------------------------------------------------------------
+<jcr='http://www.jcp.org/jcr/1.0'>
+<nt='http://www.jcp.org/jcr/nt/1.0'>
+<mix='http://www.jcp.org/jcr/mix/1.0'>
+<air='http://jboss.org/dna/examples/aircraft/1.0'>
+
+//------------------------------------------------------------------------------
+// N O D E T Y P E S
+//------------------------------------------------------------------------------
+
+[air:Aircraft] > nt:unstructured
+  - air:maker (string)
+  - air:model (string)
+  - air:designedBy (string)
+  - air:introduced (string) < '(19|20)\d{2}'                // any 4 digit number starting with '19' or '20'
+  - air:range (string)                                      // any integer (with optional ',' every 1000s place)
+     < '\d{1,3}(,?\d{3})*\s*(nm|m|km|mi|ft)'                // followed by 'nm', 'm', 'km', 'mi', or 'ft'
+  - air:maxSpeed (string)                                   // any integer (with optional ',' every 1000s place)
+    < '\d{1,3}(,?\d{3})*\s*(kt|mph|km/h|kmph)'              // followed by 'kt', 'mph', 'km/h' or 'kmph'
+  - air:takeoffSpeed (string)                               // any integer (with optional ',' every 1000s place)
+    < '\d{1,3}(,?\d{3})*\s*(kt|mph|km/h|kmph)'              // followed by 'kt', 'mph', 'km/h' or 'kmph'
+  - air:cruiseSpeed (string)                                // any integer (with optional ',' every 1000s place)
+    < '\d{1,3}(,?\d{3})*\s*(kt|mph|km/h|kmph)'              // followed by 'kt', 'mph', 'km/h' or 'kmph'
+  - air:emptyWeight (string)                                // any integer (with optional ',' every 1000s place)
+    < '\d{1,3}(,?\d{3})*\s*(lb|kg)'                         // followed by 'lb' or 'kg'
+  - air:maxWeight (string)                                  // any integer (with optional ',' every 1000s place)
+    < '\d{1,3}(,?\d{3})*\s*(lb|kg)'                         // followed by 'lb' or 'kg'
+  - air:rateOfClimb (string)                                // any integer (with optional ',' every 1000s place)
+    < '\d{1,3}(,?\d{3})*\s*(ft|km|m)/(s|min)'               // followed by 'ft/s', 'ft/min', 'km/s', 'km/min', 'm/s', or 'm/min'
+  - air:serviceCeiling (string)                             // any integer (with optional ',' every 1000s place)
+    < '\d{1,3}(,?\d{3})*\s*(nm|m|km|mi|ft)'                 // followed by 'nm', 'm', 'km', 'mi', or 'ft'
+  - air:fuelCapacity (string)                               // any integer (with optional ',' every 1000s place)
+    < '\d{1,3}(,?\d{3})*\s*(lb|kg|gal|L)'                   // followed by 'lb', 'kg', 'gal', or 'L'
+  - air:crew (long) < '[0,)'                                // any non-negative value
+  - air:numberBuilt (string)                                // any integer (with optional ',' every 1000s place)
+    < '\d{1,3}(,?\d{3})*\s*[+]?' ,                          // optionally followed by '+'
+      '([<>]\s*)?\d{1,3}(,?\d{3})*'                         // or prefixed by '<' or '>'
+  - air:url (string)

Added: trunk/docs/examples/gettingstarted/repositories/src/main/resources/cars.cnd
===================================================================
--- trunk/docs/examples/gettingstarted/repositories/src/main/resources/cars.cnd	                        (rev 0)
+++ trunk/docs/examples/gettingstarted/repositories/src/main/resources/cars.cnd	2009-06-03 20:09:11 UTC (rev 968)
@@ -0,0 +1,50 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of 
+ * individual contributors. 
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+ 
+//------------------------------------------------------------------------------
+// N A M E S P A C E S
+//------------------------------------------------------------------------------
+<jcr='http://www.jcp.org/jcr/1.0'>
+<nt='http://www.jcp.org/jcr/nt/1.0'>
+<mix='http://www.jcp.org/jcr/mix/1.0'>
+<car='http://jboss.org/dna/examples/cars/1.0'>
+
+//------------------------------------------------------------------------------
+// N O D E T Y P E S
+//------------------------------------------------------------------------------
+
+[car:Car] > nt:unstructured
+  - car:maker (string)
+  - car:model (string)
+  - car:year (string) < '(19|20)\d{2}'                     // any 4 digit number starting with '19' or '20'
+  - car:msrp (string) < '[$]\d{1,3}[,]?\d{3}([.]\d{2})?'   // of the form "$X,XXX.ZZ", "$XX,XXX.ZZ" or "$XXX,XXX.ZZ" 
+                                                           // where '.ZZ' is optional
+  - car:userRating (long) < '[1,5]'                        // any value from 1 to 5 (inclusive)
+  - car:valueRating (long) < '[1,5]'                       // any value from 1 to 5 (inclusive)
+  - car:mpgCity (long) < '(0,]'                            // any value greater than 0
+  - car:mpgHighway (long) < '(0,]'                         // any value greater than 0
+  - car:lengthInInches (double) < '(0,]'                   // any value greater than 0
+  - car:wheelbaseInInches (double) < '(0,]'                // any value greater than 0
+  - car:engine (string)
+




More information about the dna-commits mailing list