[dna-commits] DNA SVN: r276 - in trunk: dna-common/src/main/java/org/jboss/dna/common/component and 11 other directories.

dna-commits at lists.jboss.org dna-commits at lists.jboss.org
Thu Jun 12 16:10:35 EDT 2008


Author: jverhaeg at redhat.com
Date: 2008-06-12 16:10:35 -0400 (Thu, 12 Jun 2008)
New Revision: 276

Modified:
   trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnection.java
   trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentLibrary.java
   trunk/dna-common/src/main/java/org/jboss/dna/common/monitor/ProgressStatus.java
   trunk/dna-common/src/main/java/org/jboss/dna/common/util/ArgCheck.java
   trunk/dna-common/src/test/java/org/jboss/dna/common/util/ArgCheckTest.java
   trunk/dna-common/src/test/java/org/jboss/dna/common/util/LoggerTest.java
   trunk/dna-maven-classloader/src/main/java/org/jboss/dna/maven/MavenClassLoaders.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/federation/FederatedRepository.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/federation/FederatedRepositorySource.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleSetRepositoryMonitor.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencingService.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/StreamSequencerAdapter.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicPath.java
   trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/TimeDelayingRepositorySource.java
   trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencers/SequencingClient.java
   trunk/sequencers/dna-sequencer-images/src/main/java/org/jboss/dna/sequencer/images/ImageMetadata.java
Log:
Updated code to eliminate compiler warnings related to invalid JavaDocs, etc., and corrected a few vague uses of generics

Modified: trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnection.java
===================================================================
--- trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnection.java	2008-06-12 19:57:43 UTC (rev 275)
+++ trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnection.java	2008-06-12 20:10:35 UTC (rev 276)
@@ -72,11 +72,8 @@
     private final Cache<Name, Object> cache;
     private RepositorySourceListener listener = NO_OP_LISTENER;
 
-    /**
-     * 
-     */
-    /* package */JBossCacheConnection( JBossCacheSource source,
-                                        Cache<Name, Object> cache ) {
+    JBossCacheConnection( JBossCacheSource source,
+                          Cache<Name, Object> cache ) {
         assert source != null;
         assert cache != null;
         this.source = source;

Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentLibrary.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentLibrary.java	2008-06-12 19:57:43 UTC (rev 275)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentLibrary.java	2008-06-12 20:10:35 UTC (rev 276)
@@ -43,6 +43,7 @@
  * Therefore, this library does guarantee that the {@link #getInstances() instances} at the time they are
  * {@link #getInstances() obtained} are always reflected by the configurations.
  * </p>
+ * 
  * @author Randall Hauch
  * @param <ComponentType> the type of component being managed, which may be a subclass of {@link Component}
  * @param <ConfigType> the configuration type describing the components
@@ -64,7 +65,7 @@
 
     /**
      * The list of component instances. The index of each component instance matches the corresponding configuration instance in
-     * {@link #configurations}
+     * {@link #configs}
      */
     @GuardedBy( value = "lock" )
     private final List<ComponentType> instances = new CopyOnWriteArrayList<ComponentType>();
@@ -83,6 +84,7 @@
      * {@link #DEFAULT default} class loader factory, which uses the
      * {@link Thread#getContextClassLoader() current thread's context class loader} if not null or the class loader that loaded
      * the library class.
+     * 
      * @return the class loader factory; never null
      * @see #setClassLoaderFactory(ClassLoaderFactory)
      */
@@ -95,8 +97,9 @@
      * {@link #DEFAULT default} class loader factory, which uses the
      * {@link Thread#getContextClassLoader() current thread's context class loader} if not null or the class loader that loaded
      * the library class.
+     * 
      * @param classLoaderFactory the class loader factory reference, or null if the {@link #DEFAULT default class loader factory}
-     * should be used
+     *        should be used
      * @see #getClassLoaderFactory()
      */
     public void setClassLoaderFactory( ClassLoaderFactory classLoaderFactory ) {
@@ -106,9 +109,10 @@
     /**
      * Add the configuration for a sequencer, or update any existing one that represents the
      * {@link ConfigType#equals(Object) same configuration}
+     * 
      * @param config the new configuration
      * @return true if the component was added, or false if there already was an existing and
-     * {@link ComponentConfig#hasChanged(ComponentConfig) unchanged} component configuration
+     *         {@link ComponentConfig#hasChanged(ComponentConfig) unchanged} component configuration
      * @throws IllegalArgumentException if <code>config</code> is null
      * @see #update(ComponentConfig)
      * @see #remove(ComponentConfig)
@@ -140,9 +144,10 @@
 
     /**
      * Update the configuration for a sequencer, or add it if there is no {@link ConfigType#equals(Object) matching configuration}.
+     * 
      * @param config the updated (or new) configuration
      * @return true if the component was updated, or false if there already was an existing and
-     * {@link ComponentConfig#hasChanged(ComponentConfig) unchanged} component configuration
+     *         {@link ComponentConfig#hasChanged(ComponentConfig) unchanged} component configuration
      * @throws IllegalArgumentException if <code>config</code> is null
      * @see #add(ComponentConfig)
      * @see #remove(ComponentConfig)
@@ -153,6 +158,7 @@
 
     /**
      * Remove the configuration for a sequencer.
+     * 
      * @param config the configuration to be removed
      * @return true if the component was remove, or false if there was no existing configuration
      * @throws IllegalArgumentException if <code>config</code> is null
@@ -179,6 +185,7 @@
 
     /**
      * Return the list of sequencers.
+     * 
      * @return the unmodifiable list of sequencers; never null
      */
     public List<ComponentType> getInstances() {
@@ -188,6 +195,7 @@
     /**
      * Instantiate, configure and return a new sequencer described by the supplied configuration. This method does not manage the
      * returned instance.
+     * 
      * @param config the configuration describing the sequencer
      * @return the new sequencer, or null if the sequencer could not be successfully configured
      * @throws IllegalArgumentException if the sequencer could not be configured properly
@@ -218,8 +226,9 @@
     /**
      * Method that instantiates the supplied class. This method can be overridden by subclasses that may need to wrap or adapt the
      * instance to be a ComponentType.
+     * 
      * @param componentClass
-     * @return
+     * @return the new ComponentType instance
      * @throws InstantiationException
      * @throws IllegalAccessException
      */
@@ -229,7 +238,8 @@
     }
 
     /**
-     * Find the index for the matching {@link #configurations configuration} and {@link #sequencerInstances sequencer}.
+     * Find the index for the matching {@link #configs configuration} and {@link #instances sequencer}.
+     * 
      * @param config the configuration; may not be null
      * @return the index, or -1 if not found
      */

Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/monitor/ProgressStatus.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/monitor/ProgressStatus.java	2008-06-12 19:57:43 UTC (rev 275)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/monitor/ProgressStatus.java	2008-06-12 20:10:35 UTC (rev 276)
@@ -24,11 +24,12 @@
 
 import java.io.Serializable;
 import java.text.DecimalFormat;
+import net.jcip.annotations.Immutable;
 import org.jboss.dna.common.util.StringUtil;
-import net.jcip.annotations.Immutable;
 
 /**
  * A snapshot of the progress on an activity.
+ * 
  * @author Randall Hauch
  */
 @Immutable
@@ -42,11 +43,13 @@
 
     /**
      * Compute the percentage worked, accounting for imprecision in
+     * 
      * @param workedSoFar the amount of work so far percentage worked
      * @param totalWork the total amount of work for this activity
-     * @return
+     * @return the percentage worked
      */
-    protected static double computePercentage( double workedSoFar, double totalWork ) {
+    protected static double computePercentage( double workedSoFar,
+                                               double totalWork ) {
         if (isSamePercentage(workedSoFar, 0.0d)) return 0.0d;
         assert totalWork > 0.0d;
         double percentage = workedSoFar / totalWork * 100.0d;
@@ -54,7 +57,8 @@
         return percentage;
     }
 
-    protected static boolean isSamePercentage( double percentage1, double percentage2 ) {
+    protected static boolean isSamePercentage( double percentage1,
+                                               double percentage2 ) {
         return Math.abs(percentage1 - percentage2) <= PERCENT_PRECISION;
     }
 
@@ -66,13 +70,17 @@
 
     /**
      * Create the progress status.
+     * 
      * @param activityName the name of the activity, which may not be null
      * @param message the message for the progress, which may not be null
      * @param percentWorked the percentage worked, ranging from 0.0 for not started to 100.0 for complete; a negative value are
-     * treated as 0.0, while a value greater than 100.0 is treated as 100.0
+     *        treated as 0.0, while a value greater than 100.0 is treated as 100.0
      * @param cancelled true if the activity has been requested to be cancelled, or false otherwise
      */
-    public ProgressStatus( String activityName, String message, double percentWorked, boolean cancelled ) {
+    public ProgressStatus( String activityName,
+                           String message,
+                           double percentWorked,
+                           boolean cancelled ) {
         assert activityName != null;
         assert message != null;
         this.activityName = activityName;
@@ -84,18 +92,24 @@
 
     /**
      * Create the progress status and compute the percentage worked.
+     * 
      * @param activityName the name of the activity, which may not be null
      * @param message the message for the progress, which may not be null
      * @param workedSoFar the amount of work so far percentage worked
      * @param totalWork the total amount of work for this activity
      * @param cancelled true if the activity has been requested to be cancelled, or false otherwise
      */
-    public ProgressStatus( String activityName, String message, double workedSoFar, double totalWork, boolean cancelled ) {
+    public ProgressStatus( String activityName,
+                           String message,
+                           double workedSoFar,
+                           double totalWork,
+                           boolean cancelled ) {
         this(activityName, message, computePercentage(workedSoFar, totalWork), cancelled);
     }
 
     /**
      * Get the name of the activity.
+     * 
      * @return the activity's name
      */
     public String getActivityName() {
@@ -104,6 +118,7 @@
 
     /**
      * Get the progress as a percentage of the total work that's been completed.
+     * 
      * @return the percentage worked, ranging from 0.0 to 100.0
      */
     public double getPercentWorked() {
@@ -112,6 +127,7 @@
 
     /**
      * Get the progress monitor's text message.
+     * 
      * @return the text message
      */
     public String getMessage() {
@@ -120,6 +136,7 @@
 
     /**
      * Return whether work on this activity has completed.
+     * 
      * @return true if work has completed, or false if work on the activity is still progressing
      * @see #isCancelled()
      */
@@ -129,6 +146,7 @@
 
     /**
      * Return whether the activity was requested to be cancelled.
+     * 
      * @return cancelled
      * @see #isDone()
      */

Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/util/ArgCheck.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/ArgCheck.java	2008-06-12 19:57:43 UTC (rev 275)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/ArgCheck.java	2008-06-12 20:10:35 UTC (rev 276)
@@ -332,15 +332,14 @@
     /**
      * Check that the object is an instance of the specified Class
      * 
-     * @param <T> the class type
      * @param argument Value
      * @param expectedClass Class
      * @param name The name of the argument
      * @throws IllegalArgumentException If value is null
      */
-    public static <T> void isInstanceOf( Object argument,
-                                         Class<T> expectedClass,
-                                         String name ) {
+    public static void isInstanceOf( Object argument,
+                                     Class<?> expectedClass,
+                                     String name ) {
         isNotNull(argument, name);
         if (!expectedClass.isInstance(argument)) {
             throw new IllegalArgumentException(CommonI18n.argumentMustBeInstanceOf.text(name,
@@ -359,13 +358,12 @@
      * @return value cast to the specified Class
      * @throws IllegalArgumentException If value is not an instance of theClass.
      */
-    @SuppressWarnings( "unchecked" )
     // due to cast in return
     public static <C> C getInstanceOf( Object argument,
                                        Class<C> expectedClass,
                                        String name ) {
         isInstanceOf(argument, expectedClass, name);
-        return (C)argument;
+        return expectedClass.cast(argument);
     }
 
     /**

Modified: trunk/dna-common/src/test/java/org/jboss/dna/common/util/ArgCheckTest.java
===================================================================
--- trunk/dna-common/src/test/java/org/jboss/dna/common/util/ArgCheckTest.java	2008-06-12 19:57:43 UTC (rev 275)
+++ trunk/dna-common/src/test/java/org/jboss/dna/common/util/ArgCheckTest.java	2008-06-12 20:10:35 UTC (rev 276)
@@ -22,8 +22,8 @@
 
 package org.jboss.dna.common.util;
 
-import static org.junit.Assert.*;
-import static org.hamcrest.core.Is.*;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;

Modified: trunk/dna-common/src/test/java/org/jboss/dna/common/util/LoggerTest.java
===================================================================
--- trunk/dna-common/src/test/java/org/jboss/dna/common/util/LoggerTest.java	2008-06-12 19:57:43 UTC (rev 275)
+++ trunk/dna-common/src/test/java/org/jboss/dna/common/util/LoggerTest.java	2008-06-12 20:10:35 UTC (rev 276)
@@ -436,7 +436,7 @@
          */
         public void removeFirst( Logger.Level expectedLevel,
                                  String expectedMessageExpression,
-                                 Class<?> expectedExceptionClass ) {
+                                 Class<? extends Throwable> expectedExceptionClass ) {
             if (!hasEvents()) {
                 fail("Expected log message but found none: " + expectedLevel + " - " + expectedMessageExpression);
             }

Modified: trunk/dna-maven-classloader/src/main/java/org/jboss/dna/maven/MavenClassLoaders.java
===================================================================
--- trunk/dna-maven-classloader/src/main/java/org/jboss/dna/maven/MavenClassLoaders.java	2008-06-12 19:57:43 UTC (rev 275)
+++ trunk/dna-maven-classloader/src/main/java/org/jboss/dna/maven/MavenClassLoaders.java	2008-06-12 20:10:35 UTC (rev 276)
@@ -45,6 +45,7 @@
  * dependency rules</a>. Each {@link MavenRepository} instance owns an instance of this class, which provides a cached set of
  * class loaders and a facility for {@link MavenRepository#getClassLoader(ClassLoader, MavenId...) getting class loaders} based
  * upon a set of one or more versioned libraries.
+ * 
  * @author Randall Hauch
  */
 /* package */class MavenClassLoaders {
@@ -66,8 +67,8 @@
     /**
      * Create with a specified repository and optionally the parent class loader that should be consulted first and a default
      * class loader that should be consulted after all others.
+     * 
      * @param repository the Maven repository; may not be null
-     * @param parentClassLoader the parent class loader that should be accessed before any class loaders for any Maven project.
      */
     /* package */MavenClassLoaders( MavenRepository repository ) {
         this.repository = repository;
@@ -97,7 +98,8 @@
         return result;
     }
 
-    public ProjectClassLoader getClassLoader( ClassLoader parent, MavenId... mavenIds ) {
+    public ProjectClassLoader getClassLoader( ClassLoader parent,
+                                              MavenId... mavenIds ) {
         if (parent == null) parent = Thread.currentThread().getContextClassLoader();
         if (parent == null) parent = this.getClass().getClassLoader();
         ProjectClassLoader result = new ProjectClassLoader(parent);
@@ -129,6 +131,7 @@
     /**
      * A project class loader is responsible for loading all classes and resources for the project, including delegating to
      * dependent projects if required and adhearing to all stated exclusions.
+     * 
      * @author Randall Hauch
      */
     protected class ProjectClassLoader extends ClassLoader {
@@ -141,13 +144,13 @@
 
         /**
          * Create a class loader for the given project.
+         * 
          * @param mavenId
          * @param jarFileClassLoader
-         * @param dependencies
-         * @param parent
          * @see MavenClassLoaders#getClassLoader(ClassLoader, MavenId...)
          */
-        protected ProjectClassLoader( MavenId mavenId, URLClassLoader jarFileClassLoader ) {
+        protected ProjectClassLoader( MavenId mavenId,
+                                      URLClassLoader jarFileClassLoader ) {
             super(null);
             this.mavenId = mavenId;
             this.jarFileClassLoader = jarFileClassLoader;
@@ -155,7 +158,7 @@
 
         /**
          * Create a class loader that doesn't reference a top level project, but instead references multiple projects.
-         * @param dependencies
+         * 
          * @param parent
          * @see MavenClassLoaders#getClassLoader(ClassLoader, MavenId...)
          */
@@ -188,9 +191,10 @@
         /**
          * Finds the resource with the given name. This implementation first consults the class loader for this project's JAR
          * file, and failing that, consults all of the class loaders for the dependent projects.
+         * 
          * @param name The resource name
          * @return A <tt>URL</tt> object for reading the resource, or <tt>null</tt> if the resource could not be found or the
-         * invoker doesn't have adequate privileges to get the resource.
+         *         invoker doesn't have adequate privileges to get the resource.
          */
         @Override
         protected URL findResource( String name ) {
@@ -203,17 +207,19 @@
          * this method should only be directly called by test methods; subclasses should call {@link #findResource(String)}.</i>
          * <p>
          * This method first looks in this project's JAR. If the resource is not found, then this method
-         * {@link #findResource(String, Set, List) searches the dependencies}. This method's signature allows for a list to be
-         * supplied for reporting the list of projects that make up the searched classpath (excluding those that were never
+         * {@link #findResource(String, Set, Set, List) searches the dependencies}. This method's signature allows for a list to
+         * be supplied for reporting the list of projects that make up the searched classpath (excluding those that were never
          * searched because the resource was found).
          * </p>
+         * 
          * @param name The resource name
          * @param debugSearchPath the list into which the IDs of the searched projects will be placed; may be null if this
-         * information is not needed
+         *        information is not needed
          * @return A <tt>URL</tt> object for reading the resource, or <tt>null</tt> if the resource could not be found or the
-         * invoker doesn't have adequate privileges to get the resource.
+         *         invoker doesn't have adequate privileges to get the resource.
          */
-        protected URL findResource( String name, List<MavenId> debugSearchPath ) {
+        protected URL findResource( String name,
+                                    List<MavenId> debugSearchPath ) {
             Set<MavenId> processed = new HashSet<MavenId>();
             // This method is called only by the top-level class loader handling a request.
             // Therefore, first look in this project's JAR file ...
@@ -231,7 +237,10 @@
             return result;
         }
 
-        protected URL findResource( String name, Set<MavenId> processed, Set<MavenId> exclusions, List<MavenId> debugSearchPath ) {
+        protected URL findResource( String name,
+                                    Set<MavenId> processed,
+                                    Set<MavenId> exclusions,
+                                    List<MavenId> debugSearchPath ) {
             // If this project is to be excluded, then simply return ...
             if (exclusions != null && exclusions.contains(this.mavenId)) return null;
 

Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/federation/FederatedRepository.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/federation/FederatedRepository.java	2008-06-12 19:57:43 UTC (rev 275)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/federation/FederatedRepository.java	2008-06-12 20:10:35 UTC (rev 276)
@@ -79,7 +79,8 @@
         /**
          * {@inheritDoc}
          */
-        public boolean awaitTermination( long timeout, TimeUnit unit ) throws InterruptedException {
+        public boolean awaitTermination( long timeout,
+                                         TimeUnit unit ) throws InterruptedException {
             return FederatedRepository.this.awaitTermination(timeout, unit);
         }
 
@@ -108,7 +109,8 @@
      * @param name the name of the repository
      * @throws IllegalArgumentException if the service is null or the name is null or blank
      */
-    public FederatedRepository( FederationService service, String name ) {
+    public FederatedRepository( FederationService service,
+                                String name ) {
         ArgCheck.isNotNull(service, "service");
         ArgCheck.isNotEmpty(name, "name");
         this.name = name;
@@ -165,8 +167,15 @@
 
     /**
      * Utility method called by the administrator.
+     * 
+     * @param timeout
+     * @param unit
+     * @return true if all pools were terminated in the supplied time (or were already terminated), or false if the timeout
+     *         occurred before all the connections were closed
+     * @throws InterruptedException
      */
-    protected boolean awaitTermination( long timeout, TimeUnit unit ) throws InterruptedException {
+    protected boolean awaitTermination( long timeout,
+                                        TimeUnit unit ) throws InterruptedException {
         // Check whether all source pools are shut down. This is done inside the sources write lock.
         try {
             this.sourcesWriteLock.lock();
@@ -245,7 +254,7 @@
      * 
      * @param source the source to add
      * @return true if the source is added, or false if the reference is null or if there is already an existing source with the
-     * supplied name.
+     *         supplied name.
      */
     public boolean addSource( FederatedSource source ) {
         if (source == null) return false;
@@ -270,10 +279,11 @@
      * @param source the source to add
      * @param index the index at which the source should be added
      * @return true if the source is added, or false if the reference is null or if there is already an existing source with the
-     * supplied name.
+     *         supplied name.
      * @throws IndexOutOfBoundsException if the index is out of bounds
      */
-    public boolean addSource( FederatedSource source, int index ) {
+    public boolean addSource( FederatedSource source,
+                              int index ) {
         if (source == null) return false;
         try {
             this.sourcesWriteLock.lock();
@@ -297,12 +307,14 @@
      * 
      * @param source the source to be removed
      * @param timeToAwait the amount of time to wait while all of the source's connections are closed, or non-positive if the call
-     * should not wait at all
+     *        should not wait at all
      * @param unit the time unit to be used for <code>timeToAwait</code>
      * @return true if the source was removed, or false if the source was not a source for this repository.
      * @throws InterruptedException if the thread is interrupted while awaiting closing of the connections
      */
-    public boolean removeSource( FederatedSource source, long timeToAwait, TimeUnit unit ) throws InterruptedException {
+    public boolean removeSource( FederatedSource source,
+                                 long timeToAwait,
+                                 TimeUnit unit ) throws InterruptedException {
         // Use the name; don't use the object equality ...
         return removeSource(source.getName(), timeToAwait, unit) != null;
     }
@@ -317,13 +329,15 @@
      * 
      * @param name the name of the source to be removed
      * @param timeToAwait the amount of time to wait while all of the source's connections are closed, or non-positive if the call
-     * should not wait at all
+     *        should not wait at all
      * @param unit the time unit to be used for <code>timeToAwait</code>
      * @return the source with the supplied name that was removed, or null if no existing source matching the supplied name could
-     * be found
+     *         be found
      * @throws InterruptedException if the thread is interrupted while awaiting closing of the connections
      */
-    public FederatedSource removeSource( String name, long timeToAwait, TimeUnit unit ) throws InterruptedException {
+    public FederatedSource removeSource( String name,
+                                         long timeToAwait,
+                                         TimeUnit unit ) throws InterruptedException {
         try {
             this.sourcesWriteLock.lock();
             for (FederatedSource existingSource : this.sources) {
@@ -349,7 +363,7 @@
      * 
      * @param listener the new listener
      * @return true if the listener was added, or false if the listener was not added (if reference is null, or if non-null
-     * listener is already an existing listener)
+     *         listener is already an existing listener)
      */
     public boolean addListener( RepositorySourceListener listener ) {
         if (listener == null) return false;
@@ -386,7 +400,8 @@
      * @param credentials the credentials
      * @return true if authentication succeeded, or false otherwise
      */
-    public boolean authenticate( String username, Object credentials ) {
+    public boolean authenticate( String username,
+                                 Object credentials ) {
         return true;
     }
 

Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/federation/FederatedRepositorySource.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/federation/FederatedRepositorySource.java	2008-06-12 19:57:43 UTC (rev 275)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/federation/FederatedRepositorySource.java	2008-06-12 20:10:35 UTC (rev 276)
@@ -63,10 +63,8 @@
     private String username;
     private String credentials;
 
-    /**
-     * 
-     */
-    protected FederatedRepositorySource( FederationService federationService, String repositoryName ) {
+    protected FederatedRepositorySource( FederationService federationService,
+                                         String repositoryName ) {
         ArgCheck.isNotNull(federationService, "federationService");
         ArgCheck.isNotNull(repositoryName, "repositoryName");
         this.federationService = federationService;
@@ -102,13 +100,16 @@
         // Find the repository ...
         FederatedRepository repository = federationService.getRepository(this.repositoryName);
         if (repository == null) {
-            throw new RepositorySourceException(RepositoryI18n.unableToCreateConnectionToFederatedRepository.text(this.repositoryName));
+            throw new RepositorySourceException(
+                                                RepositoryI18n.unableToCreateConnectionToFederatedRepository.text(this.repositoryName));
         }
         // Authenticate the user ...
         String username = this.username;
         Object credentials = this.credentials;
         if (!repository.authenticate(username, credentials)) {
-            throw new RepositorySourceException(RepositoryI18n.unableToAuthenticateConnectionToFederatedRepository.text(this.repositoryName, username));
+            throw new RepositorySourceException(
+                                                RepositoryI18n.unableToAuthenticateConnectionToFederatedRepository.text(this.repositoryName,
+                                                                                                                        username));
         }
         // Return the new connection ...
         return new FederatedRepositoryConnection(repository, this);
@@ -188,7 +189,10 @@
         /**
          * {@inheritDoc}
          */
-        public Object getObjectInstance( Object obj, javax.naming.Name name, Context nameCtx, Hashtable<?, ?> environment ) throws Exception {
+        public Object getObjectInstance( Object obj,
+                                         javax.naming.Name name,
+                                         Context nameCtx,
+                                         Hashtable<?, ?> environment ) throws Exception {
             if (obj instanceof Reference) {
                 Map<String, String> values = new HashMap<String, String>();
                 Reference ref = (Reference)obj;

Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleSetRepositoryMonitor.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleSetRepositoryMonitor.java	2008-06-12 19:57:43 UTC (rev 275)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleSetRepositoryMonitor.java	2008-06-12 20:10:35 UTC (rev 276)
@@ -54,6 +54,7 @@
  * branch are discovered, they are processed asynchronously. This ensure that the processing of the repository contents does not
  * block the other listeners of the {@link ObservationService}.
  * </p>
+ * 
  * @author Randall Hauch
  */
 @ThreadSafe
@@ -73,14 +74,17 @@
     /**
      * Create an instance that can listen to the {@link RuleSet} definitions stored in a JCR repository and ensure that the
      * {@link RuleSet} instances of a {@link RuleService} reflect the definitions in the repository.
+     * 
      * @param ruleService the rule service that should be kept in sync with the JCR repository.
      * @param jcrAbsolutePath the absolute path to the branch where the rule sets are defined; if null or empty, the
-     * {@link #DEFAULT_JCR_ABSOLUTE_PATH default path} is used
+     *        {@link #DEFAULT_JCR_ABSOLUTE_PATH default path} is used
      * @param executionContext the context in which this monitor is to execute
      * @throws IllegalArgumentException if the rule service or execution context is null, or if the supplied
-     * <code>jcrAbsolutePath</code> is invalid
+     *         <code>jcrAbsolutePath</code> is invalid
      */
-    public RuleSetRepositoryMonitor( RuleService ruleService, String jcrAbsolutePath, ExecutionContext executionContext ) {
+    public RuleSetRepositoryMonitor( RuleService ruleService,
+                                     String jcrAbsolutePath,
+                                     ExecutionContext executionContext ) {
         ArgCheck.isNotNull(ruleService, "rule service");
         ArgCheck.isNotNull(executionContext, "execution context");
         this.ruleService = ruleService;
@@ -95,7 +99,10 @@
             if (!leadingPath.endsWith(JCR_PATH_DELIM)) leadingPath = leadingPath + JCR_PATH_DELIM;
             this.ruleSetNamePattern = Pattern.compile(leadingPath + "([^/]+)/?.*");
         } catch (PatternSyntaxException e) {
-            throw new IllegalArgumentException(RepositoryI18n.unableToBuildRuleSetRegularExpressionPattern.text(e.getPattern(), jcrAbsolutePath, e.getDescription()));
+            throw new IllegalArgumentException(
+                                               RepositoryI18n.unableToBuildRuleSetRegularExpressionPattern.text(e.getPattern(),
+                                                                                                                jcrAbsolutePath,
+                                                                                                                e.getDescription()));
         }
     }
 
@@ -161,6 +168,7 @@
 
     /**
      * Process the rule sets given by the supplied names, keyed by the repository workspace name.
+     * 
      * @param ruleSetNamesByWorkspaceName the set of rule set names keyed by the repository workspace name
      */
     protected void processRuleSets( Map<String, Set<String>> ruleSetNamesByWorkspaceName ) {
@@ -221,11 +229,15 @@
      * property. Rule set properties are optional.</li>
      * </ul>
      * </p>
+     * 
      * @param name the name of the rule set; never null
      * @param ruleSetNode the node representing the rule set; null if the rule set doesn't exist
+     * @param tools
      * @return the rule set for the information stored in the repository, or null if the rule set does not exist or has errors
      */
-    protected RuleSet buildRuleSet( String name, Node ruleSetNode, JcrTools tools ) {
+    protected RuleSet buildRuleSet( String name,
+                                    Node ruleSetNode,
+                                    JcrTools tools ) {
         if (ruleSetNode == null) return null;
 
         SimpleProblems simpleProblems = new SimpleProblems();

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-06-12 19:57:43 UTC (rev 275)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencingService.java	2008-06-12 20:10:35 UTC (rev 276)
@@ -86,7 +86,9 @@
          * @param nodeChange the set of node changes; never null
          * @return the list of sequencers that should be used; may not be null
          */
-        List<Sequencer> selectSequencers( List<Sequencer> sequencers, Node node, NodeChange nodeChange );
+        List<Sequencer> selectSequencers( List<Sequencer> sequencers,
+                                          Node node,
+                                          NodeChange nodeChange );
     }
 
     /**
@@ -97,7 +99,9 @@
      */
     protected static class DefaultSelector implements Selector {
 
-        public List<Sequencer> selectSequencers( List<Sequencer> sequencers, Node node, NodeChange nodeChange ) {
+        public List<Sequencer> selectSequencers( List<Sequencer> sequencers,
+                                                 Node node,
+                                                 NodeChange nodeChange ) {
             return sequencers;
         }
     }
@@ -149,7 +153,8 @@
      * {@link Thread#getContextClassLoader() current thread's context class loader} (if not null) or component library's class
      * loader.
      */
-    protected static final ClassLoaderFactory DEFAULT_CLASSLOADER_FACTORY = new StandardClassLoaderFactory(SequencingService.class.getClassLoader());
+    protected static final ClassLoaderFactory DEFAULT_CLASSLOADER_FACTORY = new StandardClassLoaderFactory(
+                                                                                                           SequencingService.class.getClassLoader());
 
     /**
      * The administrative component for this service.
@@ -191,7 +196,8 @@
         /**
          * {@inheritDoc}
          */
-        public boolean awaitTermination( long timeout, TimeUnit unit ) throws InterruptedException {
+        public boolean awaitTermination( long timeout,
+                                         TimeUnit unit ) throws InterruptedException {
             return doAwaitTermination(timeout, unit);
         }
 
@@ -270,7 +276,7 @@
      * 
      * @param config the new configuration
      * @return true if the sequencer was added, or false if there already was an existing and
-     * {@link SequencerConfig#hasChanged(SequencerConfig) unchanged} sequencer configuration
+     *         {@link SequencerConfig#hasChanged(SequencerConfig) unchanged} sequencer configuration
      * @throws IllegalArgumentException if <code>config</code> is null
      * @see #updateSequencer(SequencerConfig)
      * @see #removeSequencer(SequencerConfig)
@@ -285,7 +291,7 @@
      * 
      * @param config the updated (or new) configuration
      * @return true if the sequencer was updated, or false if there already was an existing and
-     * {@link SequencerConfig#hasChanged(SequencerConfig) unchanged} sequencer configuration
+     *         {@link SequencerConfig#hasChanged(SequencerConfig) unchanged} sequencer configuration
      * @throws IllegalArgumentException if <code>config</code> is null
      * @see #addSequencer(SequencerConfig)
      * @see #removeSequencer(SequencerConfig)
@@ -380,12 +386,12 @@
 
     /**
      * Override this method to creates a different kind of default executor service. This method is called when the system is
-     * {@link #start() started} without an executor service being {@link #setExecutorService(ExecutorService) set}.
+     * {@link #startService() started} without an executor service being {@link #setExecutorService(ExecutorService) set}.
      * <p>
      * This method creates a {@link Executors#newSingleThreadExecutor() single-threaded executor}.
      * </p>
      * 
-     * @return
+     * @return the executor service
      */
     protected ExecutorService createDefaultExecutorService() {
         return Executors.newSingleThreadExecutor();
@@ -417,7 +423,8 @@
         return true;
     }
 
-    protected boolean doAwaitTermination( long timeout, TimeUnit unit ) throws InterruptedException {
+    protected boolean doAwaitTermination( long timeout,
+                                          TimeUnit unit ) throws InterruptedException {
         if (this.executorService == null || this.executorService.isTerminated()) return true;
         return this.executorService.awaitTermination(timeout, unit);
     }
@@ -483,9 +490,9 @@
 
     /**
      * Do the work of processing by sequencing the node. This method is called by the {@link #executorService executor service}
-     * when it performs it's work on the enqueued {@link ChangedNode ChangedNode runnable objects}.
+     * when it performs it's work on the enqueued {@link NodeChange NodeChange runnable objects}.
      * 
-     * @param node the node to be processed.
+     * @param changedNode the node to be processed.
      */
     protected void processChangedNode( NodeChange changedNode ) {
         try {
@@ -506,7 +513,8 @@
                             SequencerPathExpression.Matcher matcher = pathExpression.matcher(path);
                             if (matcher.matches()) {
                                 // String selectedPath = matcher.getSelectedPath();
-                                RepositoryNodePath outputPath = RepositoryNodePath.parse(matcher.getOutputPath(), repositoryWorkspaceName);
+                                RepositoryNodePath outputPath = RepositoryNodePath.parse(matcher.getOutputPath(),
+                                                                                         repositoryWorkspaceName);
                                 SequencerCall call = new SequencerCall(sequencer, propertyName);
                                 // Record the output path ...
                                 Set<RepositoryNodePath> outputPaths = sequencerCalls.get(call);
@@ -562,9 +570,17 @@
                             final ProgressMonitor sequenceMonitor = progressMonitor.createSubtask(1);
                             try {
                                 sequenceMonitor.beginTask(100, RepositoryI18n.sequencerSubtask, sequencerName);
-                                sequencer.execute(node, propertyName, changedNode, outputPaths, executionContext, sequenceMonitor.createSubtask(80)); // 80%
+                                sequencer.execute(node,
+                                                  propertyName,
+                                                  changedNode,
+                                                  outputPaths,
+                                                  executionContext,
+                                                  sequenceMonitor.createSubtask(80)); // 80%
                             } catch (RepositoryException e) {
-                                this.logger.error(e, RepositoryI18n.errorInRepositoryWhileSequencingNode, sequencerName, changedNode);
+                                this.logger.error(e,
+                                                  RepositoryI18n.errorInRepositoryWhileSequencingNode,
+                                                  sequencerName,
+                                                  changedNode);
                             } catch (SequencerException e) {
                                 this.logger.error(e, RepositoryI18n.errorWhileSequencingNode, sequencerName, changedNode);
                             } finally {
@@ -721,7 +737,8 @@
         private final String sequencedPropertyName;
         private final int hc;
 
-        protected SequencerCall( Sequencer sequencer, String sequencedPropertyName ) {
+        protected SequencerCall( Sequencer sequencer,
+                                 String sequencedPropertyName ) {
             this.sequencer = sequencer;
             this.sequencerName = sequencer.getConfiguration().getName();
             this.sequencedPropertyName = sequencedPropertyName;

Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/StreamSequencerAdapter.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/StreamSequencerAdapter.java	2008-06-12 19:57:43 UTC (rev 275)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/StreamSequencerAdapter.java	2008-06-12 20:10:35 UTC (rev 276)
@@ -47,6 +47,7 @@
 
 /**
  * An adapter class that wraps a {@link StreamSequencer} instance to be a {@link Sequencer}.
+ * 
  * @author Randall Hauch
  */
 public class StreamSequencerAdapter implements Sequencer {
@@ -75,8 +76,12 @@
     /**
      * {@inheritDoc}
      */
-    public void execute( Node input, String sequencedPropertyName, NodeChange changes, Set<RepositoryNodePath> outputPaths, ExecutionContext context, ProgressMonitor progressMonitor )
-        throws RepositoryException, SequencerException {
+    public void execute( Node input,
+                         String sequencedPropertyName,
+                         NodeChange changes,
+                         Set<RepositoryNodePath> outputPaths,
+                         ExecutionContext context,
+                         ProgressMonitor progressMonitor ) throws RepositoryException, SequencerException {
         // 'sequencedPropertyName' contains the name of the modified property on 'input' that resuled the call to this sequencer
         // 'changes' contains all of the changes to this node that occurred in the transaction.
         // 'outputPaths' contains the paths of the node(s) where this sequencer is to save it's data
@@ -125,7 +130,11 @@
 
             // Find each output node and save the image metadata there ...
             ProgressMonitor writingProgress = progressMonitor.createSubtask(40);
-            writingProgress.beginTask(outputPaths.size(), RepositoryI18n.writingOutputSequencedFromPropertyOnNodes, sequencedPropertyName, input.getPath(), outputPaths.size());
+            writingProgress.beginTask(outputPaths.size(),
+                                      RepositoryI18n.writingOutputSequencedFromPropertyOnNodes,
+                                      sequencedPropertyName,
+                                      input.getPath(),
+                                      outputPaths.size());
             for (RepositoryNodePath outputPath : outputPaths) {
                 Session session = null;
                 try {
@@ -158,13 +167,16 @@
     /**
      * Save the sequencing output to the supplied node. This method does not need to save the output, as that is done by the
      * caller of this method.
+     * 
      * @param outputNode the existing node onto (or below) which the output is to be written; never null
-     * @param outputProperties the (immutable) sequencing output; never null
+     * @param output the (immutable) sequencing output; never null
      * @param context the execution context for this sequencing operation; never null
      * @return true if the output was written to the node, or false if no information was written
      * @throws RepositoryException
      */
-    protected boolean saveOutput( Node outputNode, SequencerOutputMap output, ExecutionContext context ) throws RepositoryException {
+    protected boolean saveOutput( Node outputNode,
+                                  SequencerOutputMap output,
+                                  ExecutionContext context ) throws RepositoryException {
         if (output.isEmpty()) return false;
         final PathFactory pathFactory = context.getValueFactories().getPathFactory();
         final NamespaceRegistry namespaceRegistry = context.getNamespaceRegistry();
@@ -195,7 +207,8 @@
                     }
                     // We only have the primary type for the final one ...
                     if (i == (max - 1) && primaryType != null) {
-                        targetNode = targetNode.addNode(qualifiedName, primaryType.getString(namespaceRegistry, Path.NO_OP_ENCODER));
+                        targetNode = targetNode.addNode(qualifiedName, primaryType.getString(namespaceRegistry,
+                                                                                             Path.NO_OP_ENCODER));
                     } else {
                         targetNode = targetNode.addNode(qualifiedName);
                     }

Modified: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicPath.java
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicPath.java	2008-06-12 19:57:43 UTC (rev 275)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicPath.java	2008-06-12 20:10:35 UTC (rev 276)
@@ -39,7 +39,7 @@
 
 /**
  * A basic implementation of {@link Path}.
- *
+ * 
  * @author Randall Hauch
  * @author John Verhaeg
  */
@@ -52,461 +52,461 @@
 
     private static final List<Segment> EMPTY_SEGMENTS = Collections.emptyList();
 
-	public static final Path ROOT = new BasicPath(EMPTY_SEGMENTS, true);
+    public static final Path ROOT = new BasicPath(EMPTY_SEGMENTS, true);
 
-	protected static final Path SELF_PATH = new BasicPath(Collections.singletonList(Path.SELF_SEGMENT), false);
+    protected static final Path SELF_PATH = new BasicPath(Collections.singletonList(Path.SELF_SEGMENT), false);
 
-	private final List<Segment> segments;
-	private final boolean absolute;
-	private final boolean normalized;
-	private transient String path;
+    private final List<Segment> segments;
+    private final boolean absolute;
+    private final boolean normalized;
+    private transient String path;
 
-	/**
-	 * @param segments the segments
-	 * @param absolute true if this path is absolute, or false otherwise
-	 */
-	public BasicPath( List<Segment> segments,
-	                  boolean absolute ) {
-		ArgCheck.isNotNull(segments, "segments");
-		this.segments = segments.isEmpty() ? EMPTY_SEGMENTS : Collections.unmodifiableList(segments);
-		this.absolute = absolute;
-		this.normalized = isNormalized(this.segments);
-	}
+    /**
+     * @param segments the segments
+     * @param absolute true if this path is absolute, or false otherwise
+     */
+    public BasicPath( List<Segment> segments,
+                      boolean absolute ) {
+        ArgCheck.isNotNull(segments, "segments");
+        this.segments = segments.isEmpty() ? EMPTY_SEGMENTS : Collections.unmodifiableList(segments);
+        this.absolute = absolute;
+        this.normalized = isNormalized(this.segments);
+    }
 
-	protected boolean isNormalized( List<Segment> segments ) {
-		for (Segment segment : segments) {
-			if (segment.isSelfReference() || segment.isParentReference()) return false;
-		}
-		return true;
-	}
+    protected boolean isNormalized( List<Segment> segments ) {
+        for (Segment segment : segments) {
+            if (segment.isSelfReference() || segment.isParentReference()) return false;
+        }
+        return true;
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public Path getAncestor() {
-		if (this.isRoot()) return this;
-		if (this.segments.size() == 1) return ROOT;
-		return subpath(0, this.segments.size() - 1);
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public Path getAncestor() {
+        if (this.isRoot()) return this;
+        if (this.segments.size() == 1) return ROOT;
+        return subpath(0, this.segments.size() - 1);
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public Path getAncestor( int degree ) {
-		ArgCheck.isNonNegative(degree, "degree");
-		if (this.isRoot()) return this;
-		if (degree == 0) return this;
-		int endIndex = this.segments.size() - degree;
-		if (endIndex < 0) {
-			String msg = SpiI18n.pathAncestorDegreeIsInvalid.text(this.getString(), Inflector.getInstance().ordinalize(degree));
-			throw new PathNotFoundException(msg);
-		}
-		return subpath(0, endIndex);
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public Path getAncestor( int degree ) {
+        ArgCheck.isNonNegative(degree, "degree");
+        if (this.isRoot()) return this;
+        if (degree == 0) return this;
+        int endIndex = this.segments.size() - degree;
+        if (endIndex < 0) {
+            String msg = SpiI18n.pathAncestorDegreeIsInvalid.text(this.getString(), Inflector.getInstance().ordinalize(degree));
+            throw new PathNotFoundException(msg);
+        }
+        return subpath(0, endIndex);
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public Path getCanonicalPath() {
-		if (!this.isAbsolute()) {
-			String msg = SpiI18n.pathIsNotAbsolute.text(this);
-			throw new InvalidPathException(msg);
-		}
-		if (this.isNormalized()) return this;
-		return this.getNormalizedPath();
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public Path getCanonicalPath() {
+        if (!this.isAbsolute()) {
+            String msg = SpiI18n.pathIsNotAbsolute.text(this);
+            throw new InvalidPathException(msg);
+        }
+        if (this.isNormalized()) return this;
+        return this.getNormalizedPath();
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public Path getCommonAncestor( Path that ) {
-		if (that == null) return null;
-		if (this.isRoot() || that.isRoot()) return ROOT;
-		Path normalizedPath = this.getNormalizedPath();
-		int lastIndex = 0;
-		Iterator<Segment> thisIter = normalizedPath.iterator();
-		Iterator<Segment> thatIter = that.getNormalizedPath().iterator();
-		while (thisIter.hasNext() && thatIter.hasNext()) {
-			Segment thisSeg = thisIter.next();
-			Segment thatSeg = thatIter.next();
-			if (thisSeg.equals(thatSeg)) {
-				++lastIndex;
-			} else {
-				break;
-			}
-		}
-		if (lastIndex == 0) return ROOT;
-		return normalizedPath.subpath(0, lastIndex);
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public Path getCommonAncestor( Path that ) {
+        if (that == null) return null;
+        if (this.isRoot() || that.isRoot()) return ROOT;
+        Path normalizedPath = this.getNormalizedPath();
+        int lastIndex = 0;
+        Iterator<Segment> thisIter = normalizedPath.iterator();
+        Iterator<Segment> thatIter = that.getNormalizedPath().iterator();
+        while (thisIter.hasNext() && thatIter.hasNext()) {
+            Segment thisSeg = thisIter.next();
+            Segment thatSeg = thatIter.next();
+            if (thisSeg.equals(thatSeg)) {
+                ++lastIndex;
+            } else {
+                break;
+            }
+        }
+        if (lastIndex == 0) return ROOT;
+        return normalizedPath.subpath(0, lastIndex);
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public Path.Segment getLastSegment() {
-		if (this.isRoot()) return null;
-		return this.segments.get(size() - 1);
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public Path.Segment getLastSegment() {
+        if (this.isRoot()) return null;
+        return this.segments.get(size() - 1);
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public Path getNormalizedPath() {
-		if (this.isNormalized()) return this; // ROOT is normalized already
-		LinkedList<Segment> newSegments = new LinkedList<Segment>();
-		for (Segment segment : segments) {
-			if (segment.isSelfReference()) continue;
-			if (segment.isParentReference()) {
-				if (newSegments.isEmpty()) {
-					if (this.isAbsolute()) {
-						throw new InvalidPathException(CommonI18n.pathCannotBeNormalized.text(this));
-					}
-				} else if (!newSegments.getLast().isParentReference()) {
-					newSegments.removeLast();
-					continue;
-				}
-			}
-			newSegments.add(segment);
-		}
-		if (newSegments.isEmpty()) {
-			if (this.isAbsolute()) return ROOT;
-			// Otherwise relative and it had contained nothing but self references ...
-			return SELF_PATH;
-		}
-		return new BasicPath(newSegments, this.isAbsolute());
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public Path getNormalizedPath() {
+        if (this.isNormalized()) return this; // ROOT is normalized already
+        LinkedList<Segment> newSegments = new LinkedList<Segment>();
+        for (Segment segment : segments) {
+            if (segment.isSelfReference()) continue;
+            if (segment.isParentReference()) {
+                if (newSegments.isEmpty()) {
+                    if (this.isAbsolute()) {
+                        throw new InvalidPathException(CommonI18n.pathCannotBeNormalized.text(this));
+                    }
+                } else if (!newSegments.getLast().isParentReference()) {
+                    newSegments.removeLast();
+                    continue;
+                }
+            }
+            newSegments.add(segment);
+        }
+        if (newSegments.isEmpty()) {
+            if (this.isAbsolute()) return ROOT;
+            // Otherwise relative and it had contained nothing but self references ...
+            return SELF_PATH;
+        }
+        return new BasicPath(newSegments, this.isAbsolute());
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public Segment getSegment( int index ) {
-		return this.segments.get(index);
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public Segment getSegment( int index ) {
+        return this.segments.get(index);
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public Segment[] getSegmentsArray() {
-		return this.segments.toArray(new Path.Segment[this.segments.size()]);
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public Segment[] getSegmentsArray() {
+        return this.segments.toArray(new Path.Segment[this.segments.size()]);
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public List<Segment> getSegmentsList() {
-		return this.segments;
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public List<Segment> getSegmentsList() {
+        return this.segments;
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public String getString() {
-		return doGetString(null, DEFAULT_ENCODER);
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public String getString() {
+        return doGetString(null, DEFAULT_ENCODER);
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public String getString( TextEncoder encoder ) {
-		return doGetString(null, encoder);
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public String getString( TextEncoder encoder ) {
+        return doGetString(null, encoder);
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public String getString( NamespaceRegistry namespaceRegistry ) {
-		ArgCheck.isNotNull(namespaceRegistry, "namespaceRegistry");
-		return doGetString(namespaceRegistry, null);
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public String getString( NamespaceRegistry namespaceRegistry ) {
+        ArgCheck.isNotNull(namespaceRegistry, "namespaceRegistry");
+        return doGetString(namespaceRegistry, null);
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public String getString( NamespaceRegistry namespaceRegistry,
-	                         TextEncoder encoder ) {
-		ArgCheck.isNotNull(namespaceRegistry, "namespaceRegistry");
-		return doGetString(namespaceRegistry, encoder);
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public String getString( NamespaceRegistry namespaceRegistry,
+                             TextEncoder encoder ) {
+        ArgCheck.isNotNull(namespaceRegistry, "namespaceRegistry");
+        return doGetString(namespaceRegistry, encoder);
+    }
 
-	/**
-	 * Method that creates the string representation. This method works two different ways depending upon whether the namespace
-	 * registry is provided.
-	 *
-	 * @param namespaceRegistry
-	 * @param encoder
-	 * @return
-	 */
-	protected String doGetString( NamespaceRegistry namespaceRegistry,
-	                              TextEncoder encoder ) {
-		if (encoder == null) encoder = DEFAULT_ENCODER;
-		if (encoder == DEFAULT_ENCODER && this.path != null) return this.path;
+    /**
+     * Method that creates the string representation. This method works two different ways depending upon whether the namespace
+     * registry is provided.
+     * 
+     * @param namespaceRegistry
+     * @param encoder
+     * @return this path as a string
+     */
+    protected String doGetString( NamespaceRegistry namespaceRegistry,
+                                  TextEncoder encoder ) {
+        if (encoder == null) encoder = DEFAULT_ENCODER;
+        if (encoder == DEFAULT_ENCODER && this.path != null) return this.path;
 
-		// Since the segments are immutable, this code need not be synchronized because concurrent threads
-		// may just compute the same value (with no harm done)
-		StringBuilder sb = new StringBuilder();
-		if (this.isAbsolute()) sb.append(DELIMITER);
-		boolean first = true;
-		for (Segment segment : this.segments) {
-			if (first) {
-				first = false;
-			} else {
-				sb.append(DELIMITER);
-			}
-			assert segment != null;
-			if (namespaceRegistry != null) {
-				sb.append(segment.getString(namespaceRegistry, encoder));
-			} else {
-				sb.append(segment.getString(encoder));
-			}
-		}
-		String result = sb.toString();
-		// Save the result to the internal string if this the default encoder is used.
-		// This is not synchronized, but it's okay
-		if (encoder == DEFAULT_ENCODER && this.path == null) this.path = result;
-		return result;
-	}
+        // Since the segments are immutable, this code need not be synchronized because concurrent threads
+        // may just compute the same value (with no harm done)
+        StringBuilder sb = new StringBuilder();
+        if (this.isAbsolute()) sb.append(DELIMITER);
+        boolean first = true;
+        for (Segment segment : this.segments) {
+            if (first) {
+                first = false;
+            } else {
+                sb.append(DELIMITER);
+            }
+            assert segment != null;
+            if (namespaceRegistry != null) {
+                sb.append(segment.getString(namespaceRegistry, encoder));
+            } else {
+                sb.append(segment.getString(encoder));
+            }
+        }
+        String result = sb.toString();
+        // Save the result to the internal string if this the default encoder is used.
+        // This is not synchronized, but it's okay
+        if (encoder == DEFAULT_ENCODER && this.path == null) this.path = result;
+        return result;
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public boolean hasSameAncestor( Path that ) {
-		if (that == null) return false;
-		if (that.size() != this.size()) return false;
-		if (this.size() == 1) return false;
-		for (int i = this.size() - 2; i < 0; --i) {
-			Path.Segment thisSegment = this.getSegment(i);
-			Path.Segment thatSegment = that.getSegment(i);
-			if (!thisSegment.equals(thatSegment)) return false;
-		}
-		return true;
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasSameAncestor( Path that ) {
+        if (that == null) return false;
+        if (that.size() != this.size()) return false;
+        if (this.size() == 1) return false;
+        for (int i = this.size() - 2; i < 0; --i) {
+            Path.Segment thisSegment = this.getSegment(i);
+            Path.Segment thatSegment = that.getSegment(i);
+            if (!thisSegment.equals(thatSegment)) return false;
+        }
+        return true;
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public boolean isAbsolute() {
-		return this.absolute;
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isAbsolute() {
+        return this.absolute;
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public boolean isAncestorOf( Path decendant ) {
-		if (decendant == null) return false;
-		if (this == decendant) return false;
-		if (this.size() >= decendant.size()) return false;
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isAncestorOf( Path decendant ) {
+        if (decendant == null) return false;
+        if (this == decendant) return false;
+        if (this.size() >= decendant.size()) return false;
 
-		Iterator<Path.Segment> thisIter = this.iterator();
-		Iterator<Path.Segment> thatIter = decendant.iterator();
-		while (thisIter.hasNext()) {
-			Path.Segment thisSeg = thisIter.next();
-			Path.Segment thatSeg = thatIter.next();
-			if (!thisSeg.equals(thatSeg)) return false;
-		}
-		return true;
-	}
+        Iterator<Path.Segment> thisIter = this.iterator();
+        Iterator<Path.Segment> thatIter = decendant.iterator();
+        while (thisIter.hasNext()) {
+            Path.Segment thisSeg = thisIter.next();
+            Path.Segment thatSeg = thatIter.next();
+            if (!thisSeg.equals(thatSeg)) return false;
+        }
+        return true;
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public boolean isDecendantOf( Path ancestor ) {
-		if (ancestor == null) return false;
-		return ancestor.isAncestorOf(this);
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isDecendantOf( Path ancestor ) {
+        if (ancestor == null) return false;
+        return ancestor.isAncestorOf(this);
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public boolean isNormalized() {
-		return this.normalized;
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isNormalized() {
+        return this.normalized;
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public boolean isRoot() {
-		return this == ROOT || this.segments.isEmpty();
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isRoot() {
+        return this == ROOT || this.segments.isEmpty();
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public boolean isSame( Path other ) {
-		return this.compareTo(other) == 0;
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isSame( Path other ) {
+        return this.compareTo(other) == 0;
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public Iterator<Segment> iterator() {
-		return this.segments.iterator();
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<Segment> iterator() {
+        return this.segments.iterator();
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public Path relativeTo( Path startingPath ) {
-		ArgCheck.isNotNull(startingPath, "to");
-		if (!this.isAbsolute()) {
-			String msg = SpiI18n.pathIsNotAbsolute.text(this);
-			throw new InvalidPathException(msg);
-		}
-		if (!startingPath.isAbsolute()) {
-			String msg = SpiI18n.pathIsNotAbsolute.text(startingPath);
-			throw new InvalidPathException(msg);
-		}
+    /**
+     * {@inheritDoc}
+     */
+    public Path relativeTo( Path startingPath ) {
+        ArgCheck.isNotNull(startingPath, "to");
+        if (!this.isAbsolute()) {
+            String msg = SpiI18n.pathIsNotAbsolute.text(this);
+            throw new InvalidPathException(msg);
+        }
+        if (!startingPath.isAbsolute()) {
+            String msg = SpiI18n.pathIsNotAbsolute.text(startingPath);
+            throw new InvalidPathException(msg);
+        }
 
-		// Count the number of segments up to the common ancestor (relative path is what remains) ...
-		int lengthOfCommonAncestor = 0;
-		Iterator<Segment> thisIter = this.getNormalizedPath().iterator();
-		Iterator<Segment> toIter = startingPath.getNormalizedPath().iterator();
-		while (thisIter.hasNext() && toIter.hasNext()) {
-			Segment thisSeg = thisIter.next();
-			Segment toSeg = toIter.next();
-			if (thisSeg.equals(toSeg)) {
-				++lengthOfCommonAncestor;
-			} else {
-				break;
-			}
-		}
-		// Create the relative path, starting with parent references to the common ancestor ...
-		int numberOfParentReferences = startingPath.size() - lengthOfCommonAncestor;
-		List<Segment> relativeSegments = new ArrayList<Segment>();
-		for (int i = 0; i != numberOfParentReferences; ++i) {
-			relativeSegments.add(Path.PARENT_SEGMENT);
-		}
-		// Add the segments of this path from the common ancestor ...
-		for (int i = lengthOfCommonAncestor; i < this.size(); ++i) {
-			relativeSegments.add(this.segments.get(i));
-		}
-		if (relativeSegments.isEmpty()) {
-			relativeSegments.add(Path.SELF_SEGMENT);
-		}
-		return new BasicPath(relativeSegments, false);
-	}
+        // Count the number of segments up to the common ancestor (relative path is what remains) ...
+        int lengthOfCommonAncestor = 0;
+        Iterator<Segment> thisIter = this.getNormalizedPath().iterator();
+        Iterator<Segment> toIter = startingPath.getNormalizedPath().iterator();
+        while (thisIter.hasNext() && toIter.hasNext()) {
+            Segment thisSeg = thisIter.next();
+            Segment toSeg = toIter.next();
+            if (thisSeg.equals(toSeg)) {
+                ++lengthOfCommonAncestor;
+            } else {
+                break;
+            }
+        }
+        // Create the relative path, starting with parent references to the common ancestor ...
+        int numberOfParentReferences = startingPath.size() - lengthOfCommonAncestor;
+        List<Segment> relativeSegments = new ArrayList<Segment>();
+        for (int i = 0; i != numberOfParentReferences; ++i) {
+            relativeSegments.add(Path.PARENT_SEGMENT);
+        }
+        // Add the segments of this path from the common ancestor ...
+        for (int i = lengthOfCommonAncestor; i < this.size(); ++i) {
+            relativeSegments.add(this.segments.get(i));
+        }
+        if (relativeSegments.isEmpty()) {
+            relativeSegments.add(Path.SELF_SEGMENT);
+        }
+        return new BasicPath(relativeSegments, false);
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public Path resolve( Path relativePath ) {
-		ArgCheck.isNotNull(relativePath, "relative path");
-		if (!this.isAbsolute()) {
-			String msg = SpiI18n.pathIsAlreadyAbsolute.text(this.path);
-			throw new InvalidPathException(msg);
-		}
-		if (relativePath.isAbsolute()) {
-			String msg = SpiI18n.pathIsNotRelative.text(relativePath);
-			throw new InvalidPathException(msg);
-		}
-		// If the relative path is the self or parent reference ...
-		relativePath = relativePath.getNormalizedPath();
-		if (relativePath.size() == 1) {
-			Segment onlySegment = relativePath.getSegment(0);
-			if (onlySegment.isSelfReference()) return this;
-			if (onlySegment.isParentReference()) return this.getAncestor();
-		}
-		List<Segment> segments = new ArrayList<Segment>(this.size() + relativePath.size());
-		segments.addAll(this.segments);
-		segments.addAll(relativePath.getSegmentsList());
-		return new BasicPath(segments, true).getNormalizedPath();
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public Path resolve( Path relativePath ) {
+        ArgCheck.isNotNull(relativePath, "relative path");
+        if (!this.isAbsolute()) {
+            String msg = SpiI18n.pathIsAlreadyAbsolute.text(this.path);
+            throw new InvalidPathException(msg);
+        }
+        if (relativePath.isAbsolute()) {
+            String msg = SpiI18n.pathIsNotRelative.text(relativePath);
+            throw new InvalidPathException(msg);
+        }
+        // If the relative path is the self or parent reference ...
+        relativePath = relativePath.getNormalizedPath();
+        if (relativePath.size() == 1) {
+            Segment onlySegment = relativePath.getSegment(0);
+            if (onlySegment.isSelfReference()) return this;
+            if (onlySegment.isParentReference()) return this.getAncestor();
+        }
+        List<Segment> segments = new ArrayList<Segment>(this.size() + relativePath.size());
+        segments.addAll(this.segments);
+        segments.addAll(relativePath.getSegmentsList());
+        return new BasicPath(segments, true).getNormalizedPath();
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public Path resolveAgainst( Path absolutePath ) {
-		ArgCheck.isNotNull(absolutePath, "absolute path");
-		return absolutePath.resolve(this);
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public Path resolveAgainst( Path absolutePath ) {
+        ArgCheck.isNotNull(absolutePath, "absolute path");
+        return absolutePath.resolve(this);
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public int size() {
-		return this.segments.size();
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public int size() {
+        return this.segments.size();
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public Path subpath( int beginIndex ) {
-		if (beginIndex == 0) return this;
-		int size = size();
-		if (beginIndex >= size) {
-			throw new IndexOutOfBoundsException(SpiI18n.unableToCreateSubpathBeginIndexGreaterThanOrEqualToSize.text(beginIndex,
-			                                                                                                         size));
-		}
-		if (size == 0) return ROOT;
-		return new BasicPath(this.segments.subList(beginIndex, size), this.isAbsolute());
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public Path subpath( int beginIndex ) {
+        if (beginIndex == 0) return this;
+        int size = size();
+        if (beginIndex >= size) {
+            throw new IndexOutOfBoundsException(SpiI18n.unableToCreateSubpathBeginIndexGreaterThanOrEqualToSize.text(beginIndex,
+                                                                                                                     size));
+        }
+        if (size == 0) return ROOT;
+        return new BasicPath(this.segments.subList(beginIndex, size), this.isAbsolute());
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public Path subpath( int beginIndex,
-	                     int endIndex ) {
-		int size = size();
-		if (beginIndex == 0) {
-			if (endIndex == 0) return ROOT;
-			if (endIndex == size) return this;
-		}
-		if (beginIndex >= size) {
-			throw new IndexOutOfBoundsException(SpiI18n.unableToCreateSubpathBeginIndexGreaterThanOrEqualToSize.text(beginIndex,
-			                                                                                                         size));
-		}
-		if (beginIndex > endIndex) {
-			throw new IndexOutOfBoundsException(
-			                                    SpiI18n.unableToCreateSubpathBeginIndexGreaterThanOrEqualToEndingIndex.text(beginIndex,
-			                                                                                                                endIndex));
-		}
-		// This reuses the same list, so it's pretty efficient ...
-		return new BasicPath(this.segments.subList(beginIndex, endIndex), this.isAbsolute());
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public Path subpath( int beginIndex,
+                         int endIndex ) {
+        int size = size();
+        if (beginIndex == 0) {
+            if (endIndex == 0) return ROOT;
+            if (endIndex == size) return this;
+        }
+        if (beginIndex >= size) {
+            throw new IndexOutOfBoundsException(SpiI18n.unableToCreateSubpathBeginIndexGreaterThanOrEqualToSize.text(beginIndex,
+                                                                                                                     size));
+        }
+        if (beginIndex > endIndex) {
+            throw new IndexOutOfBoundsException(
+                                                SpiI18n.unableToCreateSubpathBeginIndexGreaterThanOrEqualToEndingIndex.text(beginIndex,
+                                                                                                                            endIndex));
+        }
+        // This reuses the same list, so it's pretty efficient ...
+        return new BasicPath(this.segments.subList(beginIndex, endIndex), this.isAbsolute());
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public int hashCode() {
-		return this.segments.hashCode();
-	}
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode() {
+        return this.segments.hashCode();
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public boolean equals( Object obj ) {
-		if (obj == this) return true;
-		if (obj instanceof Path) {
-			Path that = (Path)obj;
-			return this.segments.equals(that.getSegmentsList());
-		}
-		return false;
-	}
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals( Object obj ) {
+        if (obj == this) return true;
+        if (obj instanceof Path) {
+            Path that = (Path)obj;
+            return this.segments.equals(that.getSegmentsList());
+        }
+        return false;
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public int compareTo( Path that ) {
-		if (this == that) return 0;
-		Iterator<Segment> thisIter = this.segments.iterator();
-		Iterator<Segment> thatIter = that.iterator();
-		while (thisIter.hasNext() && thatIter.hasNext()) {
-			Segment thisSegment = thisIter.next();
-			Segment thatSegment = thatIter.next();
-			int diff = thisSegment.compareTo(thatSegment);
-			if (diff != 0) return diff;
-		}
-		if (thisIter.hasNext()) return 1;
-		if (thatIter.hasNext()) return -1;
-		return 0;
-	}
+    /**
+     * {@inheritDoc}
+     */
+    public int compareTo( Path that ) {
+        if (this == that) return 0;
+        Iterator<Segment> thisIter = this.segments.iterator();
+        Iterator<Segment> thatIter = that.iterator();
+        while (thisIter.hasNext() && thatIter.hasNext()) {
+            Segment thisSegment = thisIter.next();
+            Segment thatSegment = thatIter.next();
+            int diff = thisSegment.compareTo(thatSegment);
+            if (diff != 0) return diff;
+        }
+        if (thisIter.hasNext()) return 1;
+        if (thatIter.hasNext()) return -1;
+        return 0;
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public String toString() {
-		return getString(Path.URL_ENCODER);
-	}
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return getString(Path.URL_ENCODER);
+    }
 
 }

Modified: trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/TimeDelayingRepositorySource.java
===================================================================
--- trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/TimeDelayingRepositorySource.java	2008-06-12 19:57:43 UTC (rev 275)
+++ trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/TimeDelayingRepositorySource.java	2008-06-12 20:10:35 UTC (rev 276)
@@ -154,7 +154,7 @@
      * 
      * @param connectionName
      * @param xaResource
-     * @return
+     * @return a new Connection
      * @throws RepositorySourceException
      */
     protected Connection newConnection( String connectionName,

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-06-12 19:57:43 UTC (rev 275)
+++ trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencers/SequencingClient.java	2008-06-12 20:10:35 UTC (rev 276)
@@ -368,14 +368,6 @@
         this.userInterface.displaySearchResults(medias);
     }
 
-    /**
-     * @param metadataNodeName
-     * @param mediaType
-     * @param mediaNode media node
-     * @throws RepositoryException
-     * @throws PathNotFoundException
-     * @throws ValueFormatException
-     */
     private MediaInfo extractMediaInfo( String metadataNodeName,
                                         String mediaType,
                                         Node mediaNode ) throws RepositoryException, PathNotFoundException, ValueFormatException {

Modified: trunk/sequencers/dna-sequencer-images/src/main/java/org/jboss/dna/sequencer/images/ImageMetadata.java
===================================================================
--- trunk/sequencers/dna-sequencer-images/src/main/java/org/jboss/dna/sequencer/images/ImageMetadata.java	2008-06-12 19:57:43 UTC (rev 275)
+++ trunk/sequencers/dna-sequencer-images/src/main/java/org/jboss/dna/sequencer/images/ImageMetadata.java	2008-06-12 20:10:35 UTC (rev 276)
@@ -15,8 +15,8 @@
 
 import java.io.DataInput;
 import java.io.FileInputStream;
+import java.io.IOException;
 import java.io.InputStream;
-import java.io.IOException;
 import java.net.URL;
 import java.util.Vector;
 
@@ -35,8 +35,9 @@
  *     System.err.println(&quot;Not a supported image file format.&quot;);
  *     return;
  * }
- * System.out.println(ii.getFormatName() + &quot;, &quot; + ii.getMimeType() + &quot;, &quot; + ii.getWidth() + &quot; x &quot; + ii.getHeight() + &quot; pixels, &quot; + ii.getBitsPerPixel() + &quot; bits per pixel, &quot; + ii.getNumberOfImages()
- *                    + &quot; image(s), &quot; + ii.getNumberOfComments() + &quot; comment(s).&quot;);
+ * System.out.println(ii.getFormatName() + &quot;, &quot; + ii.getMimeType() + &quot;, &quot; + ii.getWidth() + &quot; x &quot; + ii.getHeight() + &quot; pixels, &quot;
+ *                    + ii.getBitsPerPixel() + &quot; bits per pixel, &quot; + ii.getNumberOfImages() + &quot; image(s), &quot;
+ *                    + ii.getNumberOfComments() + &quot; comment(s).&quot;);
  * // there are other properties, check out the API documentation
  * </pre>
  * 
@@ -125,6 +126,7 @@
  * unnecessary casting. Also removed the unnecessary else statements where the previous block ended in a return. Also renamed to
  * <code>ImageMetadata</code>.
  * </ul>
+ * 
  * @author Marco Schmidt
  */
 public class ImageMetadata {
@@ -200,8 +202,8 @@
      * The names of the MIME types for all supported file formats. The FORMAT_xyz int constants can be used as index values for
      * this array.
      */
-    private static final String[] MIME_TYPE_STRINGS =
-        {"image/jpeg", "image/gif", "image/png", "image/bmp", "image/pcx", "image/iff", "image/ras", "image/x-portable-bitmap", "image/x-portable-graymap", "image/x-portable-pixmap", "image/psd"};
+    private static final String[] MIME_TYPE_STRINGS = {"image/jpeg", "image/gif", "image/png", "image/bmp", "image/pcx",
+        "image/iff", "image/ras", "image/x-portable-bitmap", "image/x-portable-graymap", "image/x-portable-pixmap", "image/psd"};
 
     private int width;
     private int height;
@@ -229,6 +231,7 @@
      * Call this method after you have provided an input stream or file using {@link #setInput(InputStream)} or
      * {@link #setInput(DataInput)}. If true is returned, the file format was known and information on the file's content can be
      * retrieved using the various getXyz methods.
+     * 
      * @return if information could be retrieved from input
      */
     public boolean check() {
@@ -280,7 +283,8 @@
             return false;
         }
         bitsPerPixel = getShortLittleEndian(a, 26);
-        if (bitsPerPixel != 1 && bitsPerPixel != 4 && bitsPerPixel != 8 && bitsPerPixel != 16 && bitsPerPixel != 24 && bitsPerPixel != 32) {
+        if (bitsPerPixel != 1 && bitsPerPixel != 4 && bitsPerPixel != 8 && bitsPerPixel != 16 && bitsPerPixel != 24
+            && bitsPerPixel != 32) {
             return false;
         }
         int x = (int)(getIntLittleEndian(a, 36) * 0.0254);
@@ -663,8 +667,10 @@
     }
 
     /**
-     * Run over String list, return false iff at least one of the arguments equals <code>-c</code>.
+     * Run over String list, return false if and only if at least one of the arguments equals <code>-c</code>.
+     * 
      * @param args string list to check
+     * @return <code>true</code> none of the supplied parameters is <code>-c</code>
      */
     private static boolean determineVerbosity( String[] args ) {
         if (args != null && args.length > 0) {
@@ -677,7 +683,11 @@
         return true;
     }
 
-    private static boolean equals( byte[] a1, int offs1, byte[] a2, int offs2, int num ) {
+    private static boolean equals( byte[] a1,
+                                   int offs1,
+                                   byte[] a2,
+                                   int offs2,
+                                   int num ) {
         while (num-- > 0) {
             if (a1[offs1++] != a2[offs2++]) {
                 return false;
@@ -689,6 +699,7 @@
     /**
      * If {@link #check()} was successful, returns the image's number of bits per pixel. Does not include transparency information
      * like the alpha channel.
+     * 
      * @return number of bits per image pixel
      */
     public int getBitsPerPixel() {
@@ -697,6 +708,7 @@
 
     /**
      * Returns the index'th comment retrieved from the file.
+     * 
      * @param index int index of comment to return
      * @return the comment at the supplied index
      * @throws IllegalArgumentException if index is smaller than 0 or larger than or equal to the number of comments retrieved
@@ -712,6 +724,7 @@
     /**
      * If {@link #check()} was successful, returns the image format as one of the FORMAT_xyz constants from this class. Use
      * {@link #getFormatName()} to get a textual description of the file format.
+     * 
      * @return file format as a FORMAT_xyz constant
      */
     public int getFormat() {
@@ -720,6 +733,7 @@
 
     /**
      * If {@link #check()} was successful, returns the image format's name. Use {@link #getFormat()} to get a unique number.
+     * 
      * @return file format name
      */
     public String getFormatName() {
@@ -731,22 +745,26 @@
 
     /**
      * If {@link #check()} was successful, returns one the image's vertical resolution in pixels.
+     * 
      * @return image height in pixels
      */
     public int getHeight() {
         return height;
     }
 
-    private static int getIntBigEndian( byte[] a, int offs ) {
+    private static int getIntBigEndian( byte[] a,
+                                        int offs ) {
         return (a[offs] & 0xff) << 24 | (a[offs + 1] & 0xff) << 16 | (a[offs + 2] & 0xff) << 8 | a[offs + 3] & 0xff;
     }
 
-    private static int getIntLittleEndian( byte[] a, int offs ) {
+    private static int getIntLittleEndian( byte[] a,
+                                           int offs ) {
         return (a[offs + 3] & 0xff) << 24 | (a[offs + 2] & 0xff) << 16 | (a[offs + 1] & 0xff) << 8 | a[offs] & 0xff;
     }
 
     /**
      * If {@link #check()} was successful, returns a String with the MIME type of the format.
+     * 
      * @return MIME type, e.g. <code>image/jpeg</code>
      */
     public String getMimeType() {
@@ -763,6 +781,7 @@
      * If {@link #check()} was successful and {@link #setCollectComments(boolean)} was called with <code>true</code> as
      * argument, returns the number of comments retrieved from the input image stream / file. Any number &gt;= 0 and smaller than
      * this number of comments is then a valid argument for the {@link #getComment(int)} method.
+     * 
      * @return number of comments retrieved from input image
      */
     public int getNumberOfComments() {
@@ -776,6 +795,7 @@
      * Returns the number of images in the examined file. Assumes that <code>setDetermineImageNumber(true);</code> was called
      * before a successful call to {@link #check()}. This value can currently be only different from <code>1</code> for GIF
      * images.
+     * 
      * @return number of images in file
      */
     public int getNumberOfImages() {
@@ -785,6 +805,7 @@
     /**
      * Returns the physical height of this image in dots per inch (dpi). Assumes that {@link #check()} was successful. Returns
      * <code>-1</code> on failure.
+     * 
      * @return physical height (in dpi)
      * @see #getPhysicalWidthDpi()
      * @see #getPhysicalHeightInch()
@@ -796,6 +817,7 @@
     /**
      * If {@link #check()} was successful, returns the physical width of this image in dpi (dots per inch) or -1 if no value could
      * be found.
+     * 
      * @return physical height (in dpi)
      * @see #getPhysicalHeightDpi()
      * @see #getPhysicalWidthDpi()
@@ -813,6 +835,7 @@
     /**
      * If {@link #check()} was successful, returns the physical width of this image in dpi (dots per inch) or -1 if no value could
      * be found.
+     * 
      * @return physical width (in dpi)
      * @see #getPhysicalHeightDpi()
      * @see #getPhysicalWidthInch()
@@ -825,6 +848,7 @@
     /**
      * Returns the physical width of an image in inches, or <code>-1.0f</code> if width information is not available. Assumes
      * that {@link #check} has been called successfully.
+     * 
      * @return physical width in inches or <code>-1.0f</code> on failure
      * @see #getPhysicalWidthDpi
      * @see #getPhysicalHeightInch
@@ -838,16 +862,19 @@
         return -1.0f;
     }
 
-    private static int getShortBigEndian( byte[] a, int offs ) {
+    private static int getShortBigEndian( byte[] a,
+                                          int offs ) {
         return (a[offs] & 0xff) << 8 | (a[offs + 1] & 0xff);
     }
 
-    private static int getShortLittleEndian( byte[] a, int offs ) {
+    private static int getShortLittleEndian( byte[] a,
+                                             int offs ) {
         return (a[offs] & 0xff) | (a[offs + 1] & 0xff) << 8;
     }
 
     /**
      * If {@link #check()} was successful, returns one the image's horizontal resolution in pixels.
+     * 
      * @return image width in pixels
      */
     public int getWidth() {
@@ -856,6 +883,7 @@
 
     /**
      * Returns whether the image is stored in a progressive (also called: interlaced) way.
+     * 
      * @return true for progressive/interlaced, false otherwise
      */
     public boolean isProgressive() {
@@ -866,6 +894,7 @@
      * To use this class as a command line application, give it either some file names as parameters (information on them will be
      * printed to standard output, one line per file) or call it with no parameters. It will then check data given to it via
      * standard input.
+     * 
      * @param args the program arguments which must be file names
      */
     public static void main( String[] args ) {
@@ -901,7 +930,9 @@
         }
     }
 
-    private static void print( String sourceName, ImageMetadata ii, boolean verbose ) {
+    private static void print( String sourceName,
+                               ImageMetadata ii,
+                               boolean verbose ) {
         if (verbose) {
             printVerbose(sourceName, ii);
         } else {
@@ -909,27 +940,38 @@
         }
     }
 
-    private static void printCompact( String sourceName, ImageMetadata imageMetadata ) {
+    private static void printCompact( String sourceName,
+                                      ImageMetadata imageMetadata ) {
         final String SEP = "\t";
-        System.out.println(sourceName + SEP + imageMetadata.getFormatName() + SEP + imageMetadata.getMimeType() + SEP + imageMetadata.getWidth() + SEP + imageMetadata.getHeight() + SEP
-                           + imageMetadata.getBitsPerPixel() + SEP + imageMetadata.getNumberOfImages() + SEP + imageMetadata.getPhysicalWidthDpi() + SEP + imageMetadata.getPhysicalHeightDpi() + SEP
-                           + imageMetadata.getPhysicalWidthInch() + SEP + imageMetadata.getPhysicalHeightInch() + SEP + imageMetadata.isProgressive());
+        System.out.println(sourceName + SEP + imageMetadata.getFormatName() + SEP + imageMetadata.getMimeType() + SEP
+                           + imageMetadata.getWidth() + SEP + imageMetadata.getHeight() + SEP + imageMetadata.getBitsPerPixel()
+                           + SEP + imageMetadata.getNumberOfImages() + SEP + imageMetadata.getPhysicalWidthDpi() + SEP
+                           + imageMetadata.getPhysicalHeightDpi() + SEP + imageMetadata.getPhysicalWidthInch() + SEP
+                           + imageMetadata.getPhysicalHeightInch() + SEP + imageMetadata.isProgressive());
     }
 
-    private static void printLine( int indentLevels, String text, float value, float minValidValue ) {
+    private static void printLine( int indentLevels,
+                                   String text,
+                                   float value,
+                                   float minValidValue ) {
         if (value < minValidValue) {
             return;
         }
         printLine(indentLevels, text, Float.toString(value));
     }
 
-    private static void printLine( int indentLevels, String text, int value, int minValidValue ) {
+    private static void printLine( int indentLevels,
+                                   String text,
+                                   int value,
+                                   int minValidValue ) {
         if (value >= minValidValue) {
             printLine(indentLevels, text, Integer.toString(value));
         }
     }
 
-    private static void printLine( int indentLevels, String text, String value ) {
+    private static void printLine( int indentLevels,
+                                   String text,
+                                   String value ) {
         if (value == null || value.length() == 0) {
             return;
         }
@@ -943,7 +985,8 @@
         System.out.println(value);
     }
 
-    private static void printVerbose( String sourceName, ImageMetadata ii ) {
+    private static void printVerbose( String sourceName,
+                                      ImageMetadata ii ) {
         printLine(0, null, sourceName);
         printLine(1, "File format: ", ii.getFormatName());
         printLine(1, "MIME type: ", ii.getMimeType());
@@ -980,7 +1023,9 @@
         return a.length;
     }
 
-    private int read( byte[] a, int offset, int num ) throws IOException {
+    private int read( byte[] a,
+                      int offset,
+                      int num ) throws IOException {
         if (in != null) {
             return in.read(a, offset, num);
         }
@@ -1004,7 +1049,10 @@
         return sb.toString();
     }
 
-    private static void run( String sourceName, InputStream in, ImageMetadata imageMetadata, boolean verbose ) {
+    private static void run( String sourceName,
+                             InputStream in,
+                             ImageMetadata imageMetadata,
+                             boolean verbose ) {
         imageMetadata.setInput(in);
         imageMetadata.setDetermineImageNumber(true);
         imageMetadata.setCollectComments(verbose);
@@ -1016,6 +1064,7 @@
     /**
      * Specify whether textual comments are supposed to be extracted from input. Default is <code>false</code>. If enabled,
      * comments will be added to an internal list.
+     * 
      * @param newValue if <code>true</code>, this class will read comments
      * @see #getNumberOfComments
      * @see #getComment
@@ -1030,6 +1079,7 @@
      * time-consuming task. Not all file formats support more than one image. If this method is called with <code>true</code> as
      * argument, the actual number of images can be queried via {@link #getNumberOfImages()} after a successful call to
      * {@link #check()}.
+     * 
      * @param newValue will the number of images be determined?
      * @see #getNumberOfImages
      */
@@ -1040,6 +1090,7 @@
     /**
      * Set the input stream to the argument stream (or file). Note that {@link java.io.RandomAccessFile} implements
      * {@link java.io.DataInput}.
+     * 
      * @param dataInput the input stream to read from
      */
     public void setInput( DataInput dataInput ) {
@@ -1049,6 +1100,7 @@
 
     /**
      * Set the input stream to the argument stream (or file).
+     * 
      * @param inputStream the input stream to read from
      */
     public void setInput( InputStream inputStream ) {




More information about the dna-commits mailing list