archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joak...@apache.org
Subject svn commit: r525176 [10/12] - in /maven/archiva/branches/archiva-jpox-database-refactor: ./ archiva-api/src/main/java/org/apache/maven/archiva/configuration/ archiva-api/src/main/java/org/apache/maven/archiva/consumers/ archiva-api/src/main/java/org/ap...
Date Tue, 03 Apr 2007 15:22:01 GMT
Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractArtifactExtensionMapping.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractArtifactExtensionMapping.java?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractArtifactExtensionMapping.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractArtifactExtensionMapping.java Tue Apr  3 08:21:33 2007
@@ -19,7 +19,7 @@
  * under the License.
  */
 
-import org.apache.maven.archiva.repository.ArchivaArtifact;
+import org.apache.maven.archiva.model.ArchivaArtifact;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -44,6 +44,8 @@
         typeToExtensionMap.put( "java-source", "jar" );
         typeToExtensionMap.put( "aspect", "jar" );
         typeToExtensionMap.put( "uberjar", "jar" );
+        typeToExtensionMap.put( "maven-plugin", "jar" );
+        typeToExtensionMap.put( "maven-archetype", "jar" );
     }
 
     public String getExtension( ArchivaArtifact artifact )

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java Tue Apr  3 08:21:33 2007
@@ -19,7 +19,7 @@
  * under the License.
  */
 
-import org.apache.maven.archiva.repository.ArchivaArtifact;
+import org.apache.maven.archiva.model.ArchivaArtifact;
 
 /**
  * ArtifactExtensionMapping - Utility to provide the mapping between an Artifact's extension and it's type and 

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/BidirectionalRepositoryLayout.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/BidirectionalRepositoryLayout.java?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/BidirectionalRepositoryLayout.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/BidirectionalRepositoryLayout.java Tue Apr  3 08:21:33 2007
@@ -19,7 +19,7 @@
  * under the License.
  */
 
-import org.apache.maven.archiva.repository.ArchivaArtifact;
+import org.apache.maven.archiva.model.ArchivaArtifact;
 
 /**
  * BidirectionalRepositoryLayout - Similar in scope to ArtifactRepositoryLayout, but does

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayout.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayout.java?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayout.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayout.java Tue Apr  3 08:21:33 2007
@@ -20,7 +20,8 @@
  */
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.repository.ArchivaArtifact;
+import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.repository.content.ArtifactExtensionMapping;
 import org.apache.maven.archiva.repository.content.DefaultArtifactExtensionMapping;
 
@@ -32,8 +33,7 @@
  * 
  * @plexus.component role-hint="default"
  */
-public class DefaultBidirectionalRepositoryLayout
-    implements BidirectionalRepositoryLayout
+public class DefaultBidirectionalRepositoryLayout implements BidirectionalRepositoryLayout
 {
     private static final char PATH_SEPARATOR = '/';
 
@@ -101,7 +101,7 @@
         String filename = pathParts[partCount - 1];
 
         // Second to last is the baseVersion (the directory version)
-        // (Don't need it) String baseVersion = pathParts[partCount - 2];
+        String baseVersion = pathParts[partCount - 2];
 
         // Third to last is the artifact Id.
         String artifactId = pathParts[partCount - 3];
@@ -116,14 +116,26 @@
             }
             groupId += pathParts[i];
         }
-        
+
         // Now we need to parse the filename to get the artifact version Id. 
-        String fileParts[] = RepositoryLayoutUtils.splitFilename( filename, artifactId );
-        String version = fileParts[1];
-        String classifier = fileParts[2];
+        FilenameParts fileParts = RepositoryLayoutUtils.splitFilename( filename, artifactId );
 
         String type = extensionMapper.getType( filename );
 
-        return new ArchivaArtifact( groupId, artifactId, version, classifier, type );
+        ArchivaArtifact artifact = new ArchivaArtifact( groupId, artifactId, fileParts.version, fileParts.classifier, type );
+
+        // Sanity Checks.
+        String artifactBaseVersion = VersionUtil.getBaseVersion( fileParts.version );
+        if ( !artifactBaseVersion.equals( baseVersion ) )
+        {
+            throw new LayoutException( "Invalid artifact location, version directory and filename mismatch." );
+        }
+        
+        if ( !artifactId.equals( fileParts.artifactId ) )
+        {
+            throw new LayoutException( "Invalid artifact Id" );
+        }
+
+        return artifact;
     }
 }

Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/FilenameParts.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/FilenameParts.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/FilenameParts.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/FilenameParts.java Tue Apr  3 08:21:33 2007
@@ -0,0 +1,73 @@
+package org.apache.maven.archiva.repository.layout;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * FilenameParts - data object for {@link RepositoryLayoutUtils#splitFilename(String, String)} method. 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+class FilenameParts
+{
+    public String artifactId;
+
+    public String version;
+
+    public String classifier;
+
+    public String extension;
+
+    public void appendArtifactId( String piece )
+    {
+        if ( artifactId == null )
+        {
+            artifactId = piece;
+        }
+        else
+        {
+            artifactId += "-" + piece;
+        }
+    }
+
+    public void appendVersion( String piece )
+    {
+        if ( version == null )
+        {
+            version = piece;
+        }
+        else
+        {
+            version += "-" + piece;
+        }
+    }
+
+    public void appendClassifier( String piece )
+    {
+        if ( classifier == null )
+        {
+            classifier = piece;
+        }
+        else
+        {
+            classifier += "-" + piece;
+        }
+    }
+}
\ No newline at end of file

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/FilenameParts.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/FilenameParts.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/FilenameParts.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayout.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayout.java?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayout.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayout.java Tue Apr  3 08:21:33 2007
@@ -20,7 +20,7 @@
  */
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.repository.ArchivaArtifact;
+import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.repository.content.ArtifactExtensionMapping;
 import org.apache.maven.archiva.repository.content.LegacyArtifactExtensionMapping;
 
@@ -118,18 +118,31 @@
         // The Group ID.
         String groupId = pathParts[0];
 
+        // The Expected Type.
+        String expectedType = pathParts[1];
+
         // The Filename.
         String filename = pathParts[2];
 
-        String fileParts[] = RepositoryLayoutUtils.splitFilename( filename, null );
-
-        String artifactId = fileParts[0];
-        String version = fileParts[1];
-        String classifier = fileParts[2];
+        FilenameParts fileParts = RepositoryLayoutUtils.splitFilename( filename, null );
 
         String type = extensionMapper.getType( filename );
 
-        return new ArchivaArtifact( groupId, artifactId, version, classifier, type );
+        ArchivaArtifact artifact =
+            new ArchivaArtifact( groupId, fileParts.artifactId, fileParts.version, fileParts.classifier, type );
+
+        // Sanity Checks.
+        if ( StringUtils.isEmpty( fileParts.extension ) )
+        {
+            throw new LayoutException( "Invalid artifact, no extension." );
+        }
+
+        if ( !expectedType.equals( fileParts.extension + "s" ) )
+        {
+            throw new LayoutException( "Invalid artifact, extension and layout specified type mismatch." );
+        }
+
+        return artifact;
     }
 
 }

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/RepositoryLayoutUtils.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/RepositoryLayoutUtils.java?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/RepositoryLayoutUtils.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/RepositoryLayoutUtils.java Tue Apr  3 08:21:33 2007
@@ -82,7 +82,7 @@
      * @return the parts of the filename.
      * @throws LayoutException 
      */
-    public static String[] splitFilename( String filename, String possibleArtifactId ) throws LayoutException
+    public static FilenameParts splitFilename( String filename, String possibleArtifactId ) throws LayoutException
     {
         if ( StringUtils.isBlank( filename ) )
         {
@@ -91,11 +91,7 @@
 
         String filestring = filename.trim();
 
-        String artifactId = "";
-        String version = "";
-        String classifier = "";
-        String extension = "";
-
+        FilenameParts parts = new FilenameParts();
         // I like working backwards.
 
         // Find the extension.
@@ -108,7 +104,7 @@
         {
             if ( lowercaseFilename.endsWith( "." + ComplexExtensions[i] ) )
             {
-                extension = ComplexExtensions[i];
+                parts.extension = ComplexExtensions[i];
                 filestring = filestring.substring( 0, filestring.length() - ComplexExtensions[i].length() - 1 );
                 found = true;
             }
@@ -124,7 +120,7 @@
                 // Bad Filename - No Extension
                 throw new LayoutException( "Unable to determine extension from filename " + filename );
             }
-            extension = filestring.substring( index + 1 );
+            parts.extension = filestring.substring( index + 1 );
             filestring = filestring.substring( 0, index );
         }
 
@@ -132,7 +128,7 @@
 
         if ( ( possibleArtifactId != null ) && filename.startsWith( possibleArtifactId ) )
         {
-            artifactId = possibleArtifactId;
+            parts.artifactId = possibleArtifactId;
             filestring = filestring.substring( possibleArtifactId.length() + 1 );
         }
 
@@ -175,7 +171,7 @@
 
             if ( ( mode == ARTIFACTID ) && ( i >= versionStart ) )
             {
-                if ( StringUtils.isBlank( artifactId ) )
+                if ( StringUtils.isBlank( parts.artifactId ) )
                 {
                     throw new LayoutException( "No Artifact Id detected." );
                 }
@@ -185,25 +181,13 @@
             switch ( mode )
             {
                 case ARTIFACTID:
-                    if ( artifactId.length() > 0 )
-                    {
-                        artifactId += "-";
-                    }
-                    artifactId += part;
+                    parts.appendArtifactId( part );
                     break;
                 case VERSION:
-                    if ( version.length() > 0 )
-                    {
-                        version += "-";
-                    }
-                    version += part;
+                    parts.appendVersion( part );
                     break;
                 case CLASSIFIER:
-                    if ( classifier.length() > 0 )
-                    {
-                        classifier += "-";
-                    }
-                    classifier += part;
+                    parts.appendClassifier( part );
                     break;
             }
 
@@ -213,7 +197,7 @@
             }
         }
 
-        return new String[] { artifactId, version, classifier, extension };
+        return parts;
     }
 
 }

Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataException.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataException.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataException.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataException.java Tue Apr  3 08:21:33 2007
@@ -0,0 +1,52 @@
+package org.apache.maven.archiva.repository.metadata;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.repository.RepositoryException;
+
+/**
+ * RepositoryMetadataException 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class RepositoryMetadataException extends RepositoryException
+{
+
+    public RepositoryMetadataException()
+    {
+        super();
+    }
+
+    public RepositoryMetadataException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+    public RepositoryMetadataException( String message )
+    {
+        super( message );
+    }
+
+    public RepositoryMetadataException( Throwable cause )
+    {
+        super( cause );
+    }
+}

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java Tue Apr  3 08:21:33 2007
@@ -0,0 +1,73 @@
+package org.apache.maven.archiva.repository.metadata;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
+import org.apache.maven.archiva.model.RepositoryContent;
+import org.apache.maven.archiva.xml.XMLException;
+import org.apache.maven.archiva.xml.XMLReader;
+
+import java.io.File;
+import java.util.Date;
+
+/**
+ * RepositoryMetadataReader - read maven-metadata.xml files.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class RepositoryMetadataReader
+{
+    /**
+     * Read and return the {@link ArchivaRepositoryMetadata} object from the provided xml file.
+     * 
+     * @param metadataFile the maven-metadata.xml file to read.
+     * @return the archiva repository metadata object that represents the provided file contents.
+     * @throws RepositoryMetadataException
+     */
+    public ArchivaRepositoryMetadata read( File metadataFile ) throws RepositoryMetadataException
+    {
+        try
+        {
+            XMLReader xml = new XMLReader( "metadata", metadataFile );
+
+            ArchivaRepositoryMetadata metadata = new ArchivaRepositoryMetadata();
+
+            RepositoryContent contentKey = new RepositoryContent();
+            contentKey.setGroupId( xml.getElementText( "//metadata/groupId" ) );
+            contentKey.setArtifactId( xml.getElementText( "//metadata/artifactId" ) );
+            
+            metadata.setContentKey( contentKey );
+
+            metadata.setLastModified( new Date( metadataFile.lastModified() ) );
+            metadata.setSize( metadataFile.length() );
+            metadata.setWhenIndexed( new Date() );
+
+            metadata.setReleasedVersion( xml.getElementText( "//metadata/versioning/release" ) );
+            metadata.setAvailableVersions( xml.getElementListText( "//metadata/versioning/versions/version" ) );
+
+            return metadata;
+        }
+        catch ( XMLException e )
+        {
+            throw new RepositoryMetadataException( e.getMessage(), e );
+        }
+    }
+}

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModel300Reader.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModel300Reader.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModel300Reader.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModel300Reader.java Tue Apr  3 08:21:33 2007
@@ -0,0 +1,42 @@
+package org.apache.maven.archiva.repository.project;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.model.ArchivaProjectModel;
+
+import java.io.File;
+
+/**
+ * ProjectModel300Reader 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class ProjectModel300Reader implements ProjectModelReader
+{
+
+    public ArchivaProjectModel read( File pomFile )
+    throws ProjectModelException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModel300Reader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModel300Reader.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModel300Reader.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModel400Reader.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModel400Reader.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModel400Reader.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModel400Reader.java Tue Apr  3 08:21:33 2007
@@ -0,0 +1,405 @@
+package org.apache.maven.archiva.repository.project;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.model.ArchivaProjectModel;
+import org.apache.maven.archiva.model.CiManagement;
+import org.apache.maven.archiva.model.Dependency;
+import org.apache.maven.archiva.model.DependencyScope;
+import org.apache.maven.archiva.model.Exclusion;
+import org.apache.maven.archiva.model.Individual;
+import org.apache.maven.archiva.model.IssueManagement;
+import org.apache.maven.archiva.model.License;
+import org.apache.maven.archiva.model.Organization;
+import org.apache.maven.archiva.model.ProjectRepository;
+import org.apache.maven.archiva.model.RepositoryContent;
+import org.apache.maven.archiva.model.Scm;
+import org.apache.maven.archiva.xml.XMLException;
+import org.apache.maven.archiva.xml.XMLReader;
+import org.dom4j.Element;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * ProjectModel400Reader 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class ProjectModel400Reader implements ProjectModelReader
+{
+
+    public ArchivaProjectModel read( File pomFile ) throws ProjectModelException
+    {
+        try
+        {
+            XMLReader xml = new XMLReader( "project", pomFile );
+
+            ArchivaProjectModel model = new ArchivaProjectModel();
+
+            RepositoryContent contentKey = new RepositoryContent();
+            contentKey.setGroupId( xml.getElementText( "//project/groupId" ) );
+            contentKey.setArtifactId( xml.getElementText( "//project/artifactId" ) );
+            contentKey.setVersion( xml.getElementText( "//project/version" ) );
+            model.setContentKey( contentKey );
+
+            model.setName( xml.getElementText( "//project/name" ) );
+            model.setDescription( xml.getElementText( "//project/description" ) );
+            model.setUrl( xml.getElementText( "//project/url" ) );
+            model.setPackaging( StringUtils.defaultIfEmpty( xml.getElementText( "//project/packaging" ), "jar" ) );
+
+            model.setParentContentKey( getParentContentKey( xml ) );
+
+            model.setCiManagement( getCiManagement( xml ) );
+            model.setIndividuals( getIndividuals( xml ) );
+            model.setIssueManagement( getIssueManagement( xml ) );
+            model.setLicenses( getLicenses( xml ) );
+            model.setOrganization( getOrganization( xml ) );
+            model.setScm( getSCM( xml ) );
+            model.setRepositories( getRepositories( xml ) );
+
+            model.setDependencies( getDependencies( xml ) );
+            model.setPlugins( getPlugins( xml ) );
+            model.setReports( getReports( xml ) );
+
+            return model;
+        }
+        catch ( XMLException e )
+        {
+            throw new ProjectModelException( e.getMessage(), e );
+        }
+    }
+
+    private CiManagement getCiManagement( XMLReader xml ) throws XMLException
+    {
+        Element elemCiMgmt = xml.getElement( "//project/ciManagement" );
+        if ( elemCiMgmt != null )
+        {
+            CiManagement ciManagement = new CiManagement();
+            ciManagement.setSystem( elemCiMgmt.elementTextTrim( "system" ) );
+            ciManagement.setUrl( elemCiMgmt.elementTextTrim( "url" ) );
+            return ciManagement;
+        }
+
+        return null;
+    }
+
+    private List getDependencies( XMLReader xml ) throws XMLException
+    {
+        List dependencies = new ArrayList();
+
+        Iterator it = xml.getElementList( "//project/dependencies/dependency" ).iterator();
+        while ( it.hasNext() )
+        {
+            Element elemDependency = (Element) it.next();
+            Dependency dependency = new Dependency();
+
+            dependency.setContentKey( getContentKey( elemDependency ) );
+
+            dependency.setClassifier( elemDependency.elementTextTrim( "classifier" ) );
+            dependency.setType( StringUtils.defaultIfEmpty( elemDependency.elementTextTrim( "type" ), "jar" ) );
+            dependency.setScope( StringUtils.defaultIfEmpty( elemDependency.elementTextTrim( "scope" ), "compile" ) );
+            // Not for v4.0.0 -> dependency.setUrl( elemDependency.elementTextTrim( "url" ) );
+            dependency.setOptional( toBoolean( elemDependency.elementTextTrim( "optional" ), false ) );
+            if ( DependencyScope.isSystemScoped( dependency ) )
+            {
+                dependency.setSystemPath( elemDependency.elementTextTrim( "systemPath" ) );
+            }
+
+            dependency.setExclusions( getExclusions( elemDependency ) );
+
+            dependencies.add( dependency );
+        }
+
+        return dependencies;
+    }
+
+    private List getExclusions( Element elemDependency )
+    {
+        List exclusions = new ArrayList();
+
+        Element elemExclusions = elemDependency.element( "exclusions" );
+
+        if ( elemExclusions != null )
+        {
+            Iterator it = elemExclusions.elementIterator( "exclusion" );
+            while ( it.hasNext() )
+            {
+                Element elemExclusion = (Element) it.next();
+                Exclusion exclusion = new Exclusion();
+
+                exclusion.setGroupId( elemExclusion.elementTextTrim( "groupId" ) );
+                exclusion.setArtifactId( elemExclusion.elementTextTrim( "artifactId" ) );
+
+                exclusions.add( exclusion );
+            }
+        }
+
+        return exclusions;
+    }
+
+    private List getIndividuals( XMLReader xml ) throws XMLException
+    {
+        List individuals = new ArrayList();
+
+        individuals.addAll( getIndividuals( xml, true, "//project/developers/developer" ) );
+        individuals.addAll( getIndividuals( xml, false, "//project/contributors/contributor" ) );
+
+        return individuals;
+    }
+
+    private List getIndividuals( XMLReader xml, boolean isCommitor, String xpathExpr ) throws XMLException
+    {
+        List ret = new ArrayList();
+
+        List modelPersonList = xml.getElementList( xpathExpr );
+
+        Iterator iter = modelPersonList.iterator();
+        while ( iter.hasNext() )
+        {
+            Element elemPerson = (Element) iter.next();
+            Individual individual = new Individual();
+
+            individual.setCommitor( isCommitor );
+            individual.setEmail( elemPerson.elementTextTrim( "email" ) );
+            individual.setName( elemPerson.elementTextTrim( "name" ) );
+            individual.setOrganization( elemPerson.elementTextTrim( "organization" ) );
+            individual.setOrganizationUrl( elemPerson.elementTextTrim( "organizationUrl" ) );
+            individual.setUrl( elemPerson.elementTextTrim( "url" ) );
+            individual.setTimezone( elemPerson.elementTextTrim( "timezone" ) );
+
+            // Roles
+            Element elemRoles = elemPerson.element( "roles" );
+            if ( elemRoles != null )
+            {
+                List roleNames = elemRoles.elements( "role" );
+                Iterator itRole = roleNames.iterator();
+                while ( itRole.hasNext() )
+                {
+                    Element role = (Element) itRole.next();
+                    individual.addRole( role.getTextTrim() );
+                }
+            }
+
+            // Properties
+            Element elemProperties = elemPerson.element( "properties" );
+            if ( elemProperties != null )
+            {
+                Iterator itProps = elemProperties.elements().iterator();
+                while ( itProps.hasNext() )
+                {
+                    Element elemProp = (Element) itProps.next();
+                    individual.addProperty( elemProp.getName(), elemProp.getText() );
+                }
+            }
+
+            ret.add( individual );
+        }
+
+        return ret;
+    }
+
+    private IssueManagement getIssueManagement( XMLReader xml ) throws XMLException
+    {
+        Element elemIssueMgmt = xml.getElement( "//project/issueManagement" );
+        if ( elemIssueMgmt != null )
+        {
+            IssueManagement issueMgmt = new IssueManagement();
+
+            issueMgmt.setSystem( elemIssueMgmt.elementTextTrim( "system" ) );
+            issueMgmt.setUrl( elemIssueMgmt.elementTextTrim( "url" ) );
+
+            return issueMgmt;
+        }
+
+        return null;
+    }
+
+    private List getLicenses( XMLReader xml ) throws XMLException
+    {
+        List licenses = new ArrayList();
+
+        Element elemLicenses = xml.getElement( "//project/licenses" );
+
+        if ( elemLicenses != null )
+        {
+            Iterator itLicense = elemLicenses.elements( "license" ).iterator();
+            while ( itLicense.hasNext() )
+            {
+                Element elemLicense = (Element) itLicense.next();
+                License license = new License();
+
+                // TODO: Create LicenseIdentity class to managed license ids.
+                // license.setId( elemLicense.elementTextTrim( "id" ) );
+                license.setName( elemLicense.elementTextTrim( "name" ) );
+                license.setUrl( elemLicense.elementTextTrim( "url" ) );
+                license.setComments( elemLicense.elementTextTrim( "comments" ) );
+
+                licenses.add( license );
+            }
+        }
+
+        return licenses;
+    }
+
+    private Organization getOrganization( XMLReader xml ) throws XMLException
+    {
+        Element elemOrg = xml.getElement( "//project/organization" );
+        if ( elemOrg != null )
+        {
+            Organization org = new Organization();
+
+            org.setName( elemOrg.elementTextTrim( "name" ) );
+            org.setUrl( elemOrg.elementTextTrim( "url" ) );
+
+            return org;
+        }
+
+        return null;
+    }
+
+    private RepositoryContent getParentContentKey( XMLReader xml ) throws XMLException
+    {
+        Element elemParent = xml.getElement( "//project/parent" );
+
+        if ( elemParent != null )
+        {
+            return getContentKey( elemParent );
+        }
+
+        return null;
+    }
+
+    private RepositoryContent getContentKey( Element elem )
+    {
+        RepositoryContent contentKey = new RepositoryContent();
+
+        contentKey.setGroupId( elem.elementTextTrim( "groupId" ) );
+        contentKey.setArtifactId( elem.elementTextTrim( "artifactId" ) );
+        contentKey.setVersion( elem.elementTextTrim( "version" ) );
+
+        return contentKey;
+    }
+
+    private List getPlugins( XMLReader xml ) throws XMLException
+    {
+        return getPlugins( xml, "//project/build/plugins/plugin" );
+    }
+
+    private List getReports( XMLReader xml ) throws XMLException
+    {
+        return getPlugins( xml, "//project/reporting/plugins/plugin" );
+    }
+
+    /**
+     * Get List of {@link RepositoryContent} objects from plugin definitions.
+     */
+    private List getPlugins( XMLReader xml, String xpathExpr ) throws XMLException
+    {
+        List plugins = new ArrayList();
+
+        Iterator it = xml.getElementList( xpathExpr ).iterator();
+        while ( it.hasNext() )
+        {
+            Element elemPlugin = (Element) it.next();
+
+            plugins.add( getContentKey( elemPlugin ) );
+        }
+
+        return plugins;
+    }
+
+    private List getRepositories( XMLReader xml ) throws XMLException
+    {
+        List repos = new ArrayList();
+
+        repos.addAll( getRepositories( xml, false, "//project/repositories/repository" ) );
+        repos.addAll( getRepositories( xml, true, "//project/pluginRepositories/pluginRepository" ) );
+
+        return repos;
+    }
+
+    private List getRepositories( XMLReader xml, boolean isPluginRepo, String xpathExpr ) throws XMLException
+    {
+        List ret = new ArrayList();
+
+        List repositoriesList = xml.getElementList( xpathExpr );
+
+        Iterator itRepos = repositoriesList.iterator();
+        while ( itRepos.hasNext() )
+        {
+            Element elemRepo = (Element) itRepos.next();
+            ProjectRepository repo = new ProjectRepository();
+
+            repo.setId( elemRepo.elementTextTrim( "id" ) );
+            repo.setName( elemRepo.elementTextTrim( "name" ) );
+            repo.setUrl( elemRepo.elementTextTrim( "url" ) );
+            repo.setLayout( StringUtils.defaultIfEmpty( elemRepo.elementTextTrim( "layout" ), "default" ) );
+            repo.setPlugins( isPluginRepo );
+
+            repo.setReleases( toBoolean( xml.getElementText( elemRepo, "releases/enabled" ), true ) );
+            repo.setReleases( toBoolean( xml.getElementText( elemRepo, "snapshots/enabled" ), false ) );
+
+            ret.add( repo );
+        }
+
+        return ret;
+    }
+
+    private Scm getSCM( XMLReader xml ) throws XMLException
+    {
+        Element elemScm = xml.getElement( "//project/scm" );
+
+        if ( elemScm != null )
+        {
+            Scm scm = new Scm();
+
+            scm.setConnection( elemScm.elementTextTrim( "connection" ) );
+            scm.setDeveloperConnection( elemScm.elementTextTrim( "developerConnection" ) );
+            scm.setUrl( elemScm.elementTextTrim( "url" ) );
+
+            return scm;
+        }
+
+        return null;
+    }
+
+    private boolean toBoolean( String value, boolean defaultValue )
+    {
+        if ( StringUtils.equalsIgnoreCase( value, "true" ) )
+        {
+            return true;
+        }
+        else if ( StringUtils.equalsIgnoreCase( value, "false" ) )
+        {
+            return false;
+        }
+        else
+        {
+            // If unset, or not "true" or "false".
+            return defaultValue;
+        }
+    }
+
+}

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModel400Reader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModel400Reader.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModel400Reader.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelException.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelException.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelException.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelException.java Tue Apr  3 08:21:33 2007
@@ -0,0 +1,41 @@
+package org.apache.maven.archiva.repository.project;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.common.ArchivaException;
+
+/**
+ * ProjectModelException 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class ProjectModelException extends ArchivaException
+{
+    public ProjectModelException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+    public ProjectModelException( String message )
+    {
+        super( message );
+    }
+}

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelReader.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelReader.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelReader.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelReader.java Tue Apr  3 08:21:33 2007
@@ -0,0 +1,35 @@
+package org.apache.maven.archiva.repository.project;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.model.ArchivaProjectModel;
+
+import java.io.File;
+
+/**
+ * ProjectModelReader 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public interface ProjectModelReader
+{
+    public ArchivaProjectModel read( File pomFile ) throws ProjectModelException;
+}

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelReader.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelReader.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanner.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanner.java?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanner.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanner.java Tue Apr  3 08:21:33 2007
@@ -19,10 +19,10 @@
  * under the License.
  */
 
+import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
+import org.apache.maven.archiva.model.ArchivaRepository;
 import org.apache.maven.archiva.model.RepositoryContentStatistics;
-import org.apache.maven.archiva.repository.ArchivaRepository;
 import org.apache.maven.archiva.repository.RepositoryException;
-import org.apache.maven.archiva.repository.consumer.Consumer;
 import org.codehaus.plexus.util.DirectoryWalker;
 import org.codehaus.plexus.util.FileUtils;
 
@@ -146,14 +146,14 @@
         Iterator it = consumers.iterator();
         while ( it.hasNext() )
         {
-            Consumer consumer = (Consumer) it.next();
+            RepositoryContentConsumer consumer = (RepositoryContentConsumer) it.next();
 
             /* NOTE: Do not insert the consumer exclusion patterns here.
              * Exclusion patterns are handled by RepositoryScanner.wantsFile(Consumer, String)
              * 
              * addUniqueElements( consumer.getExcludePatterns(), allExcludes );
              */
-            addUniqueElements( consumer.getIncludePatterns(), allIncludes );
+            addUniqueElements( consumer.getIncludes(), allIncludes );
         }
 
         if ( extraFileInclusions != null )

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerInstance.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerInstance.java?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerInstance.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerInstance.java Tue Apr  3 08:21:33 2007
@@ -21,9 +21,10 @@
 
 import org.apache.commons.lang.SystemUtils;
 import org.apache.maven.archiva.common.utils.BaseFile;
+import org.apache.maven.archiva.consumers.ConsumerException;
+import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
+import org.apache.maven.archiva.model.ArchivaRepository;
 import org.apache.maven.archiva.model.RepositoryContentStatistics;
-import org.apache.maven.archiva.repository.ArchivaRepository;
-import org.apache.maven.archiva.repository.consumer.Consumer;
 import org.codehaus.plexus.util.DirectoryWalkListener;
 import org.codehaus.plexus.util.SelectorUtils;
 import org.codehaus.plexus.util.StringUtils;
@@ -60,17 +61,19 @@
         this.consumers = consumerList;
         stats = new RepositoryContentStatistics();
         stats.setRepositoryId( repository.getId() );
-        
 
         Iterator it = this.consumers.iterator();
         while ( it.hasNext() )
         {
-            Consumer consumer = (Consumer) it.next();
-
-            if ( !consumer.init( this.repository ) )
+            RepositoryContentConsumer consumer = (RepositoryContentConsumer) it.next();
+            try
+            {
+                consumer.beginScan( repository );
+            }
+            catch ( ConsumerException e )
             {
-                throw new IllegalStateException( "Consumer [" + consumer.getName() +
-                    "] is reporting that it is incompatible with the [" + repository.getId() + "] repository." );
+                // TODO: remove bad consumers from list
+                log.warn( "Consumer [" + consumer.getId() + "] cannot begin: " + e.getMessage(), e );
             }
         }
 
@@ -94,7 +97,7 @@
     public void directoryWalkStep( int percentage, File file )
     {
         log.debug( "Walk Step: " + percentage + ", " + file );
-        
+
         stats.increaseFileCount();
 
         // Timestamp finished points to the last successful scan, not this current one.
@@ -114,28 +117,27 @@
             Iterator itConsumers = this.consumers.iterator();
             while ( itConsumers.hasNext() )
             {
-                Consumer consumer = (Consumer) itConsumers.next();
+                RepositoryContentConsumer consumer = (RepositoryContentConsumer) itConsumers.next();
 
                 if ( wantsFile( consumer, StringUtils.replace( basefile.getRelativePath(), "\\", "/" ) ) )
                 {
                     try
                     {
-                        log.debug( "Sending to consumer: " + consumer.getName() );
-                        consumer.processFile( basefile );
+                        log.debug( "Sending to consumer: " + consumer.getId() );
+                        consumer.processFile( basefile.getRelativePath() );
                     }
                     catch ( Exception e )
                     {
                         /* Intentionally Catch all exceptions.
                          * So that the discoverer processing can continue.
                          */
-                        log.error( "Consumer [" + consumer.getName() + "] had an error when processing file [" +
-                            basefile.getAbsolutePath() + "]: " + e.getMessage(), e );
+                        log.error( "Consumer [" + consumer.getId() + "] had an error when processing file ["
+                                        + basefile.getAbsolutePath() + "]: " + e.getMessage(), e );
                     }
                 }
                 else
                 {
-                    log.debug(
-                        "Skipping consumer " + consumer.getName() + " for file " + basefile.getRelativePath() );
+                    log.debug( "Skipping consumer " + consumer.getId() + " for file " + basefile.getRelativePath() );
                 }
             }
         }
@@ -147,24 +149,27 @@
         stats.triggerFinished();
     }
 
-    private boolean wantsFile( Consumer consumer, String relativePath )
+    private boolean wantsFile( RepositoryContentConsumer consumer, String relativePath )
     {
         Iterator it;
 
         // Test excludes first.
-        it = consumer.getExcludePatterns().iterator();
-        while ( it.hasNext() )
+        if ( consumer.getExcludes() != null )
         {
-            String pattern = (String) it.next();
-            if ( SelectorUtils.matchPath( pattern, relativePath, isCaseSensitive ) )
+            it = consumer.getExcludes().iterator();
+            while ( it.hasNext() )
             {
-                // Definately does NOT WANT FILE.
-                return false;
+                String pattern = (String) it.next();
+                if ( SelectorUtils.matchPath( pattern, relativePath, isCaseSensitive ) )
+                {
+                    // Definately does NOT WANT FILE.
+                    return false;
+                }
             }
         }
 
         // Now test includes.
-        it = consumer.getIncludePatterns().iterator();
+        it = consumer.getIncludes().iterator();
         while ( it.hasNext() )
         {
             String pattern = (String) it.next();

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/AllTests.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/AllTests.java?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/AllTests.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/AllTests.java Tue Apr  3 08:21:33 2007
@@ -36,6 +36,10 @@
         TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.repository" );
         //$JUnit-BEGIN$
         suite.addTestSuite( RepositoryURLTest.class );
+        suite.addTest( org.apache.maven.archiva.repository.metadata.AllTests.suite() );
+        suite.addTest( org.apache.maven.archiva.repository.project.AllTests.suite() );
+        suite.addTest( org.apache.maven.archiva.repository.scanner.AllTests.suite() );
+        suite.addTest( org.apache.maven.archiva.repository.layout.AllTests.suite() );
         //$JUnit-END$
         return suite;
     }

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/RepositoryURLTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/RepositoryURLTest.java?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/RepositoryURLTest.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/RepositoryURLTest.java Tue Apr  3 08:21:33 2007
@@ -20,6 +20,8 @@
  */
 
 
+import org.apache.maven.archiva.model.RepositoryURL;
+
 import java.net.MalformedURLException;
 
 import junit.framework.TestCase;

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/AbstractBidirectionalRepositoryLayoutTestCase.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/AbstractBidirectionalRepositoryLayoutTestCase.java?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/AbstractBidirectionalRepositoryLayoutTestCase.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/AbstractBidirectionalRepositoryLayoutTestCase.java Tue Apr  3 08:21:33 2007
@@ -20,8 +20,8 @@
  */
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.repository.ArchivaArtifact;
-import org.apache.maven.archiva.repository.ArchivaRepository;
+import org.apache.maven.archiva.model.ArchivaArtifact;
+import org.apache.maven.archiva.model.ArchivaRepository;
 import org.codehaus.plexus.PlexusTestCase;
 
 import java.io.File;

Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/AllTests.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/AllTests.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/AllTests.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/AllTests.java Tue Apr  3 08:21:33 2007
@@ -0,0 +1,45 @@
+package org.apache.maven.archiva.repository.layout;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * AllTests - Useful for developers using IDEs. 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class AllTests
+{
+
+    public static Test suite()
+    {
+        TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.repository.layout" );
+        //$JUnit-BEGIN$
+        suite.addTestSuite( LegacyBidirectionalRepositoryLayoutTest.class );
+        suite.addTestSuite( DefaultBidirectionalRepositoryLayoutTest.class );
+        suite.addTestSuite( RepositoryLayoutUtilsTest.class );
+        //$JUnit-END$
+        return suite;
+    }
+
+}

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/AllTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/AllTests.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/AllTests.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayoutTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayoutTest.java?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayoutTest.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayoutTest.java Tue Apr  3 08:21:33 2007
@@ -19,7 +19,7 @@
  * under the License.
  */
 
-import org.apache.maven.archiva.repository.ArchivaArtifact;
+import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
 import org.apache.maven.archiva.repository.layout.LayoutException;
 
@@ -68,7 +68,7 @@
         assertEquals( "com/foo/foo-connector/2.1-SNAPSHOT/foo-connector-2.1-20060822.123456-35.jar",
                       layout.pathOf( artifact ) );
     }
-    
+
     public void testToArtifactBasicSimpleGroupId() throws LayoutException
     {
         ArchivaArtifact artifact = layout.toArtifact( "commons-lang/commons-lang/2.1/commons-lang-2.1.jar" );
@@ -95,11 +95,102 @@
         // The 'java-source' type is correct.  You might be thinking of extension, which we are not testing here.
         assertArtifact( artifact, "com.foo.lib", "foo-lib", "2.1-alpha-1", "sources", "java-source" );
     }
-    
+
     public void testToArtifactUsingUniqueSnapshot() throws LayoutException
     {
         ArchivaArtifact artifact =
             layout.toArtifact( "com/foo/foo-connector/2.1-SNAPSHOT/foo-connector-2.1-20060822.123456-35.jar" );
         assertSnapshotArtifact( artifact, "com.foo", "foo-connector", "2.1-20060822.123456-35", "", "jar" );
+    }
+
+    public void testInvalidMissingType()
+    {
+        try
+        {
+            layout.toArtifact( "invalid/invalid/1/invalid-1" );
+            fail( "Should have detected missing type." );
+        }
+        catch ( LayoutException e )
+        {
+            /* expected path */
+        }
+    }
+    
+    public void testInvalidNonSnapshotInSnapshotDir()
+    {
+        try
+        {
+            layout.toArtifact( "invalid/invalid/1.0-SNAPSHOT/invalid-1.0.jar" );
+            fail( "Should have detected non snapshot artifact inside of a snapshot dir." );
+        }
+        catch ( LayoutException e )
+        {
+            /* expected path */
+        }
+    }
+    
+    public void testInvalidPathTooShort()
+    {
+        try
+        {
+            layout.toArtifact( "invalid/invalid-1.0.jar" );
+            fail( "Should have detected that path is too short." );
+        }
+        catch ( LayoutException e )
+        {
+            /* expected path */
+        }
+    }
+    
+    public void testInvalidTimestampSnapshotNotInSnapshotDir()
+    {
+        try
+        {
+            layout.toArtifact( "invalid/invalid/1.0-20050611.123456-1/invalid-1.0-20050611.123456-1.jar" );
+            fail( "Shoult have detected Timestamped Snapshot artifact not inside of an Snapshot dir is invalid." );
+        }
+        catch ( LayoutException e )
+        {
+            /* expected path */
+        }
+    }
+    
+    public void testInvalidVersionPathMismatch()
+    {
+        try
+        {
+            layout.toArtifact( "invalid/invalid/1.0/invalid-2.0.jar" );
+            fail( "Should have detected version mismatch between path and artifact." );
+        }
+        catch ( LayoutException e )
+        {
+            /* expected path */
+        }
+    }
+    
+    public void testInvalidVersionPathMismatchAlt()
+    {
+        try
+        {
+            layout.toArtifact( "invalid/invalid/1.0/invalid-1.0b.jar" );
+            fail( "Should have version mismatch between directory and artifact." );
+        }
+        catch ( LayoutException e )
+        {
+            /* expected path */
+        }
+    }
+    
+    public void testInvalidArtifactIdForPath()
+    {
+        try
+        {
+            layout.toArtifact( "org/apache/maven/test/1.0-SNAPSHOT/wrong-artifactId-1.0-20050611.112233-1.jar" );
+            fail( "Should have detected wrong artifact Id." );
+        }
+        catch ( LayoutException e )
+        {
+            /* expected path */
+        }
     }
 }

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayoutTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayoutTest.java?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayoutTest.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayoutTest.java Tue Apr  3 08:21:33 2007
@@ -19,7 +19,7 @@
  * under the License.
  */
 
-import org.apache.maven.archiva.repository.ArchivaArtifact;
+import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
 
 /**
@@ -103,5 +103,54 @@
     {
         ArchivaArtifact artifact = layout.toArtifact( "directory-clients/poms/ldap-clients-0.9.1-SNAPSHOT.pom" );
         assertSnapshotArtifact( artifact, "directory-clients", "ldap-clients", "0.9.1-SNAPSHOT", "", "pom" );
+    }
+    
+    public void testInvalidNoType()
+    {
+        try
+        {
+            layout.toArtifact( "invalid/invalid/1/invalid-1" );
+            fail( "Should have detected no type." );
+        }
+        catch ( LayoutException e )
+        {
+            /* expected path */
+        }
+    }
+    
+    public void testInvalidArtifactPackaging()
+    {
+        try
+        {
+            layout.toArtifact( "org.apache.maven.test/jars/artifactId-1.0.jar.md5" );
+            fail( "Should have detected wrong package extension." );
+        }
+        catch ( LayoutException e )
+        {
+            /* expected path */
+        }
+    }
+    
+    public void testInvalidNoArtifactId()
+    {
+        try
+        {
+            layout.toArtifact( "groupId/jars/-1.0.jar" );
+            fail( "Should have detected artifactId is missing" );
+        }
+        catch ( LayoutException e )
+        {
+            /* expected path */
+        }
+        
+        try
+        {
+            layout.toArtifact( "groupId/jars/1.0.jar" );
+            fail( "Should have detected artifactId is missing" );
+        }
+        catch ( LayoutException e )
+        {
+            /* expected path */
+        }
     }
 }

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/RepositoryLayoutUtilsTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/RepositoryLayoutUtilsTest.java?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/RepositoryLayoutUtilsTest.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/RepositoryLayoutUtilsTest.java Tue Apr  3 08:21:33 2007
@@ -31,66 +31,72 @@
 {
     public void testSplitFilenameBasic() throws LayoutException
     {
-        assertSplit( RepositoryLayoutUtils.splitFilename( "commons-lang-2.1.jar", "commons-lang" ), "commons-lang",
-                     "2.1", "", "jar" );
+        assertFilenameParts( RepositoryLayoutUtils.splitFilename( "commons-lang-2.1.jar", "commons-lang" ),
+                             "commons-lang", "2.1", null, "jar" );
     }
 
     public void testSplitFilenameAlphaVersion() throws LayoutException
     {
-        assertSplit( RepositoryLayoutUtils.splitFilename( "commons-lang-2.0-alpha-1.jar", "commons-lang" ),
-                     "commons-lang", "2.0-alpha-1", "", "jar" );
+        assertFilenameParts( RepositoryLayoutUtils.splitFilename( "commons-lang-2.0-alpha-1.jar", "commons-lang" ),
+                             "commons-lang", "2.0-alpha-1", null, "jar" );
     }
 
     public void testSplitFilenameSnapshot() throws LayoutException
     {
-        assertSplit( RepositoryLayoutUtils.splitFilename( "foo-2.0-SNAPSHOT.jar", "foo" ), "foo", "2.0-SNAPSHOT", "",
-                     "jar" );
+        assertFilenameParts( RepositoryLayoutUtils.splitFilename( "foo-2.0-SNAPSHOT.jar", "foo" ), "foo",
+                             "2.0-SNAPSHOT", null, "jar" );
     }
 
     public void testSplitFilenameUniqueSnapshot() throws LayoutException
     {
-        assertSplit( RepositoryLayoutUtils.splitFilename( "fletch-2.0-20060822-123456-35.tar.gz", "fletch" ), "fletch",
-                     "2.0-20060822-123456-35", "", "tar.gz" );
+        assertFilenameParts( RepositoryLayoutUtils.splitFilename( "fletch-2.0-20060822-123456-35.tar.gz", "fletch" ),
+                             "fletch", "2.0-20060822-123456-35", null, "tar.gz" );
     }
 
     public void testSplitFilenameBasicClassifier() throws LayoutException
     {
-        assertSplit( RepositoryLayoutUtils.splitFilename( "commons-lang-2.1-sources.jar", "commons-lang" ),
-                     "commons-lang", "2.1", "sources", "jar" );
-        assertSplit( RepositoryLayoutUtils.splitFilename( "commons-lang-2.1-javadoc.jar", "commons-lang" ),
-                     "commons-lang", "2.1", "javadoc", "jar" );
+        assertFilenameParts( RepositoryLayoutUtils.splitFilename( "commons-lang-2.1-sources.jar", "commons-lang" ),
+                             "commons-lang", "2.1", "sources", "jar" );
+        assertFilenameParts( RepositoryLayoutUtils.splitFilename( "commons-lang-2.1-javadoc.jar", "commons-lang" ),
+                             "commons-lang", "2.1", "javadoc", "jar" );
     }
 
     public void testSplitFilenameAlphaClassifier() throws LayoutException
     {
-        assertSplit( RepositoryLayoutUtils.splitFilename( "commons-lang-2.0-alpha-1-sources.jar", "commons-lang" ),
-                     "commons-lang", "2.0-alpha-1", "sources", "jar" );
-        assertSplit( RepositoryLayoutUtils.splitFilename( "commons-lang-2.0-alpha-1-javadoc.jar", "commons-lang" ),
-                     "commons-lang", "2.0-alpha-1", "javadoc", "jar" );
+        assertFilenameParts( RepositoryLayoutUtils.splitFilename( "commons-lang-2.0-alpha-1-sources.jar",
+                                                                  "commons-lang" ), "commons-lang", "2.0-alpha-1",
+                             "sources", "jar" );
+        assertFilenameParts( RepositoryLayoutUtils.splitFilename( "commons-lang-2.0-alpha-1-javadoc.jar",
+                                                                  "commons-lang" ), "commons-lang", "2.0-alpha-1",
+                             "javadoc", "jar" );
     }
 
     public void testSplitFilenameSnapshotClassifier() throws LayoutException
     {
-        assertSplit( RepositoryLayoutUtils.splitFilename( "commons-lang-3.1-SNAPSHOT-sources.jar", "commons-lang" ),
-                     "commons-lang", "3.1-SNAPSHOT", "sources", "jar" );
-        assertSplit( RepositoryLayoutUtils.splitFilename( "commons-lang-3.1-SNAPSHOT-javadoc.jar", "commons-lang" ),
-                     "commons-lang", "3.1-SNAPSHOT", "javadoc", "jar" );
+        assertFilenameParts( RepositoryLayoutUtils.splitFilename( "commons-lang-3.1-SNAPSHOT-sources.jar",
+                                                                  "commons-lang" ), "commons-lang", "3.1-SNAPSHOT",
+                             "sources", "jar" );
+        assertFilenameParts( RepositoryLayoutUtils.splitFilename( "commons-lang-3.1-SNAPSHOT-javadoc.jar",
+                                                                  "commons-lang" ), "commons-lang", "3.1-SNAPSHOT",
+                             "javadoc", "jar" );
     }
 
     public void testSplitFilenameUniqueSnapshotClassifier() throws LayoutException
     {
-        assertSplit( RepositoryLayoutUtils.splitFilename( "commons-lang-3.1-SNAPSHOT-sources.jar", "commons-lang" ),
-                     "commons-lang", "3.1-SNAPSHOT", "sources", "jar" );
-        assertSplit( RepositoryLayoutUtils.splitFilename( "commons-lang-3.1-SNAPSHOT-javadoc.jar", "commons-lang" ),
-                     "commons-lang", "3.1-SNAPSHOT", "javadoc", "jar" );
+        assertFilenameParts( RepositoryLayoutUtils.splitFilename( "commons-lang-3.1-SNAPSHOT-sources.jar",
+                                                                  "commons-lang" ), "commons-lang", "3.1-SNAPSHOT",
+                             "sources", "jar" );
+        assertFilenameParts( RepositoryLayoutUtils.splitFilename( "commons-lang-3.1-SNAPSHOT-javadoc.jar",
+                                                                  "commons-lang" ), "commons-lang", "3.1-SNAPSHOT",
+                             "javadoc", "jar" );
     }
 
     public void testSplitFilenameApacheIncubator() throws LayoutException
     {
-        assertSplit( RepositoryLayoutUtils.splitFilename( "cxf-common-2.0-incubator-M1.pom", null ), "cxf-common",
-                     "2.0-incubator-M1", "", "pom" );
-        assertSplit( RepositoryLayoutUtils.splitFilename( "commonj-api_r1.1-1.0-incubator-M2.jar", null ),
-                     "commonj-api_r1.1", "1.0-incubator-M2", "", "jar" );
+        assertFilenameParts( RepositoryLayoutUtils.splitFilename( "cxf-common-2.0-incubator-M1.pom", null ),
+                             "cxf-common", "2.0-incubator-M1", null, "pom" );
+        assertFilenameParts( RepositoryLayoutUtils.splitFilename( "commonj-api_r1.1-1.0-incubator-M2.jar", null ),
+                             "commonj-api_r1.1", "1.0-incubator-M2", null, "jar" );
     }
 
     public void testSplitFilenameBlankInputs()
@@ -108,7 +114,7 @@
         {
             fail( "Should have thrown an IllegalArgumentException." );
         }
-        
+
         try
         {
             RepositoryLayoutUtils.splitFilename( "", null );
@@ -122,7 +128,7 @@
         {
             fail( "Should have thrown an IllegalArgumentException." );
         }
-        
+
         try
         {
             RepositoryLayoutUtils.splitFilename( "   ", null );
@@ -136,7 +142,7 @@
         {
             fail( "Should have thrown an IllegalArgumentException." );
         }
-        
+
         try
         {
             RepositoryLayoutUtils.splitFilename( " \t  \n  ", null );
@@ -151,7 +157,7 @@
             fail( "Should have thrown an IllegalArgumentException." );
         }
     }
-    
+
     public void testSplitFilenameBadInputs()
     {
         try
@@ -163,7 +169,7 @@
         {
             /* Expected Path */
         }
-        
+
         try
         {
             RepositoryLayoutUtils.splitFilename( "geronimo-store", null );
@@ -173,7 +179,7 @@
         {
             /* Expected Path */
         }
-        
+
         try
         {
             RepositoryLayoutUtils.splitFilename( "The Sixth Sick Sheiks Sixth Sheep is Sick.", null );
@@ -183,7 +189,7 @@
         {
             /* Expected Path */
         }
-        
+
         try
         {
             RepositoryLayoutUtils.splitFilename( "1.0.jar", null );
@@ -195,12 +201,12 @@
         }
     }
 
-    private void assertSplit( String[] actualSplit, String artifactId, String version, String classifier,
-                              String extension )
+    private void assertFilenameParts( FilenameParts actualParts, String artifactId, String version, String classifier,
+                                      String extension )
     {
-        assertEquals( "Split - artifactId", artifactId, actualSplit[0] );
-        assertEquals( "Split - version", version, actualSplit[1] );
-        assertEquals( "Split - classifier", classifier, actualSplit[2] );
-        assertEquals( "Split - extension", extension, actualSplit[3] );
+        assertEquals( "Split - artifactId", artifactId, actualParts.artifactId );
+        assertEquals( "Split - version", version, actualParts.version );
+        assertEquals( "Split - classifier", classifier, actualParts.classifier );
+        assertEquals( "Split - extension", extension, actualParts.extension );
     }
 }

Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/AllTests.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/AllTests.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/AllTests.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/AllTests.java Tue Apr  3 08:21:33 2007
@@ -0,0 +1,43 @@
+package org.apache.maven.archiva.repository.metadata;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * AllTests 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class AllTests
+{
+
+    public static Test suite()
+    {
+        TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.repository.metadata" );
+        //$JUnit-BEGIN$
+        suite.addTestSuite( RepositoryMetadataReaderTest.class );
+        //$JUnit-END$
+        return suite;
+    }
+
+}

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/AllTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/AllTests.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/AllTests.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message