You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by jo...@apache.org on 2007/02/26 18:05:06 UTC

svn commit: r511901 - in /maven/archiva/trunk/archiva-repository-layer: ./ src/main/java/org/apache/maven/archiva/layer/ src/main/java/org/apache/maven/archiva/repository/ src/main/java/org/apache/maven/archiva/repository/connector/ src/test/java/org/a...

Author: joakime
Date: Mon Feb 26 09:05:04 2007
New Revision: 511901

URL: http://svn.apache.org/viewvc?view=rev&rev=511901
Log:
Adding repository layer components for refactoring work

Added:
    maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/
    maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/DefinedRepositories.java   (with props)
    maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/Repository.java   (with props)
    maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryException.java   (with props)
    maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryURL.java   (with props)
    maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/
    maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java   (with props)
    maven/archiva/trunk/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/
    maven/archiva/trunk/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/RepositoryURLTest.java   (with props)
Removed:
    maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/layer/Cache.java
    maven/archiva/trunk/archiva-repository-layer/src/test/java/org/apache/maven/archiva/layer/CacheTest.java
Modified:
    maven/archiva/trunk/archiva-repository-layer/pom.xml
    maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/layer/CachedRepositoryQueryLayer.java
    maven/archiva/trunk/archiva-repository-layer/src/test/java/org/apache/maven/archiva/layer/CachedRepositoryQueryLayerTest.java

Modified: maven/archiva/trunk/archiva-repository-layer/pom.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-repository-layer/pom.xml?view=diff&rev=511901&r1=511900&r2=511901
==============================================================================
--- maven/archiva/trunk/archiva-repository-layer/pom.xml (original)
+++ maven/archiva/trunk/archiva-repository-layer/pom.xml Mon Feb 26 09:05:04 2007
@@ -31,6 +31,15 @@
   <name>Archiva Repository Interface Layer</name>
   <dependencies>
     <dependency>
+      <groupId>org.apache.maven.archiva</groupId>
+      <artifactId>archiva-common</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus.cache</groupId>
+      <artifactId>plexus-cache-ehcache</artifactId>
+      <version>1.0-alpha-1</version>
+    </dependency>
+    <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-artifact</artifactId>
     </dependency>

Modified: maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/layer/CachedRepositoryQueryLayer.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/layer/CachedRepositoryQueryLayer.java?view=diff&rev=511901&r1=511900&r2=511901
==============================================================================
--- maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/layer/CachedRepositoryQueryLayer.java (original)
+++ maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/layer/CachedRepositoryQueryLayer.java Mon Feb 26 09:05:04 2007
@@ -21,40 +21,38 @@
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.codehaus.plexus.cache.Cache;
 
 import java.util.List;
 
-
 /**
- * CachedRepositoryQueryLayer 
+ * CachedRepositoryQueryLayer - simple wrapper around another non-cached Repository Query Layer.
  *
  * @version $Id$
+ * @plexus.component role="org.apache.maven.archiva.layer.RepositoryQueryLayer" role-hint="cached"
  */
 public class CachedRepositoryQueryLayer
     implements RepositoryQueryLayer
 {
+    /**
+     * @plexus.requirement
+     */
     private Cache cache;
 
-    public static final double CACHE_HIT_RATIO = 0.5;
-
+    /**
+     * @plexus.requirement
+     */
     private RepositoryQueryLayer layer;
 
     public CachedRepositoryQueryLayer( RepositoryQueryLayer layer )
     {
         this.layer = layer;
-
-        cache = new Cache( CACHE_HIT_RATIO );
     }
 
     public CachedRepositoryQueryLayer( RepositoryQueryLayer layer, Cache cache )
     {
         this.cache = cache;
         this.layer = layer;
-    }
-
-    public double getCacheHitRate()
-    {
-        return cache.getHitRate();
     }
 
     public boolean containsArtifact( Artifact artifact )

Added: maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/DefinedRepositories.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/DefinedRepositories.java?view=auto&rev=511901
==============================================================================
--- maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/DefinedRepositories.java (added)
+++ maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/DefinedRepositories.java Mon Feb 26 09:05:04 2007
@@ -0,0 +1,74 @@
+package org.apache.maven.archiva.repository;
+
+/*
+ * 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 java.util.List;
+
+/**
+ * DefinedRepositories - maintains the list of defined repositories. 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public interface DefinedRepositories
+{
+    /**
+     * Get the entire list of repositories.
+     * 
+     * @return the list of repositories.
+     */
+    public List getAllRepositories();
+    
+    /**
+     * Get the list of managed (local) repositories.
+     * 
+     * @return the list of managed (local) repositories.
+     */
+    public List getManagedRepositories();
+    
+    /**
+     * Get the list of remote repositories.
+     * 
+     * @return the list of remote repositories.
+     */
+    public List getRemoteRepositories();
+    
+    /**
+     * Add a repository.
+     * 
+     * @param repository the repository to add.
+     */
+    public void addRepository(Repository repository);
+    
+    /**
+     * Remove a repository.
+     * 
+     * @param repository the repository to add.
+     */
+    public void removeRepository(Repository repository);
+    
+    /**
+     * Get a repository using the provided repository key.
+     *  
+     * @param repositoryKey the repository key to find the repository via.
+     * @return the repository associated with the provided Repository Key, or null if not found.
+     */
+    public Repository getRepository( String repositoryKey );
+}

Propchange: maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/DefinedRepositories.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/DefinedRepositories.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/DefinedRepositories.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/Repository.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/Repository.java?view=auto&rev=511901
==============================================================================
--- maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/Repository.java (added)
+++ maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/Repository.java Mon Feb 26 09:05:04 2007
@@ -0,0 +1,211 @@
+package org.apache.maven.archiva.repository;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+
+/**
+ * Repository 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class Repository
+    implements ArtifactRepository
+{
+    protected String id;
+
+    protected String name;
+
+    protected String source;
+
+    protected RepositoryURL url;
+
+    protected ArtifactRepositoryLayout layout;
+
+    protected ArtifactRepositoryPolicy releases;
+
+    protected ArtifactRepositoryPolicy snapshots;
+
+    protected boolean blacklisted;
+
+    /* .\ Constructor \.__________________________________________________ */
+
+    /**
+     * Construct a Repository.
+     * 
+     * @param id the unique identifier for this repository.
+     * @param name the name for this repository.
+     * @param url the base URL for this repository (this should point to the top level URL for the entire repository)
+     * @param layout the layout technique for this repository.
+     */
+    public Repository( String id, String name, String url, ArtifactRepositoryLayout layout )
+    {
+        this.id = id;
+        this.name = name;
+        this.url = new RepositoryURL( url );
+        this.layout = layout;
+    }
+
+    /* .\ Information \.__________________________________________________ */
+
+    /**
+     * Get the unique ID for this repository.
+     * 
+     * @return the unique ID for this repository.
+     */
+    public String getId()
+    {
+        return id;
+    }
+
+    /**
+     * Get the Name of this repository.
+     * This is usually the human readable name for the repository.
+     * 
+     * @return the name of this repository.
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+    public String getUrl()
+    {
+        return url.toString();
+    }
+
+    public void setLayout( ArtifactRepositoryLayout layout )
+    {
+        this.layout = layout;
+    }
+
+    public ArtifactRepositoryLayout getLayout()
+    {
+        return layout;
+    }
+
+    public void setSource( String source )
+    {
+        this.source = source;
+    }
+
+    public String getSource()
+    {
+        return source;
+    }
+
+    /* .\ Tasks \.________________________________________________________ */
+
+    public String pathOf( Artifact artifact )
+    {
+        return getLayout().pathOf( artifact );
+    }
+
+    /* .\ State \.________________________________________________________ */
+
+    public void setBlacklisted( boolean blacklisted )
+    {
+        this.blacklisted = blacklisted;
+    }
+
+    public boolean isBlacklisted()
+    {
+        return blacklisted;
+    }
+
+    public boolean isManaged()
+    {
+        return this.url.getProtocol().equals( "file" );
+    }
+
+    public boolean isRemote()
+    {
+        return !this.url.getProtocol().equals( "file" );
+    }
+
+    public void setSnapshots( ArtifactRepositoryPolicy snapshots )
+    {
+        this.snapshots = snapshots;
+    }
+
+    public ArtifactRepositoryPolicy getSnapshots()
+    {
+        return snapshots;
+    }
+
+    public void setReleases( ArtifactRepositoryPolicy releases )
+    {
+        this.releases = releases;
+    }
+
+    public ArtifactRepositoryPolicy getReleases()
+    {
+        return releases;
+    }
+
+    public boolean equals( Object other )
+    {
+        return ( other == this || ( ( other instanceof Repository ) && ( (Repository) other ).getId().equals( getId() ) ) );
+    }
+
+    public int hashCode()
+    {
+        return getId().hashCode();
+    }
+
+    /* .\ ArtifactRepository Requirements \.______________________________ */
+
+    public String getBasedir()
+    {
+        return url.getPath();
+    }
+
+    public String getKey()
+    {
+        return getId();
+    }
+
+    public String getProtocol()
+    {
+        return url.getProtocol();
+    }
+
+    public boolean isUniqueVersion()
+    {
+        // TODO: Determine Importance
+        return false;
+    }
+
+    public String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata )
+    {
+        return layout.pathOfRemoteRepositoryMetadata( artifactMetadata );
+    }
+
+    public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
+    {
+        return layout.pathOfLocalRepositoryMetadata( metadata, repository );
+    }
+
+}

Propchange: maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/Repository.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/Repository.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/Repository.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryException.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryException.java?view=auto&rev=511901
==============================================================================
--- maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryException.java (added)
+++ maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryException.java Mon Feb 26 09:05:04 2007
@@ -0,0 +1,52 @@
+package org.apache.maven.archiva.repository;
+
+/*
+ * 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.
+ */
+
+/**
+ * RepositoryException 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class RepositoryException
+    extends Exception
+{
+
+    public RepositoryException()
+    {
+        super();
+    }
+
+    public RepositoryException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+    public RepositoryException( String message )
+    {
+        super( message );
+    }
+
+    public RepositoryException( Throwable cause )
+    {
+        super( cause );
+    }
+
+}

Propchange: maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryURL.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryURL.java?view=auto&rev=511901
==============================================================================
--- maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryURL.java (added)
+++ maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryURL.java Mon Feb 26 09:05:04 2007
@@ -0,0 +1,156 @@
+package org.apache.maven.archiva.repository;
+
+/*
+ * 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.
+ */
+
+
+/**
+ * RepositoryURL - Mutable (and protocol forgiving) URL object.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class RepositoryURL
+{
+    private String url;
+
+    private String protocol;
+
+    private String host;
+
+    private String port;
+
+    private String username;
+
+    private String password;
+
+    private String path;
+
+    public RepositoryURL( String url )
+    {
+        this.url = url;
+
+        // .\ Parse the URL \.____________________________________________
+
+        int pos;
+
+        pos = url.indexOf( "://" );
+        if ( pos == ( -1 ) )
+        {
+            throw new IllegalArgumentException( "Invalid URL, unable to parse protocol:// from " + url );
+        }
+
+        protocol = url.substring( 0, pos );
+
+        // attempt to find the start of the 'path'
+        pos = url.indexOf( "/", protocol.length() + 3 );
+
+        // no path specified - ex "http://localhost"
+        if ( pos == ( -1 ) )
+        {
+            // set pos to end of string. (needed for 'middle section')
+            pos = url.length();
+            // default path
+            path = "/";
+        }
+        else
+        {
+            // get actual path.
+            path = url.substring( pos );
+        }
+
+        // get the middle section ( username : password @ hostname : port )
+        String middle = url.substring( protocol.length() + 3, pos );
+
+        pos = middle.indexOf( '@' );
+
+        // we have an authentication section.
+        if ( pos > 0 )
+        {
+            String authentication = middle.substring( 0, pos );
+            middle = middle.substring( pos + 1 ); // lop off authentication for host:port search
+
+            pos = authentication.indexOf( ':' );
+
+            // we have a password.
+            if ( pos > 0 )
+            {
+                username = authentication.substring( 0, pos );
+                password = authentication.substring( pos + 1 );
+            }
+            else
+            {
+                username = authentication;
+            }
+        }
+
+        pos = middle.indexOf( ':' );
+
+        // we have a defined port
+        if ( pos > 0 )
+        {
+            host = middle.substring( 0, pos );
+            port = middle.substring( pos + 1 );
+        }
+        else
+        {
+            host = middle;
+        }
+    }
+
+    public String toString()
+    {
+        return url;
+    }
+
+    public String getUsername()
+    {
+        return username;
+    }
+
+    public String getPassword()
+    {
+        return password;
+    }
+
+    public String getHost()
+    {
+        return host;
+    }
+
+    public String getPath()
+    {
+        return path;
+    }
+
+    public String getPort()
+    {
+        return port;
+    }
+
+    public String getProtocol()
+    {
+        return protocol;
+    }
+
+    public String getUrl()
+    {
+        return url;
+    }
+}

Propchange: maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryURL.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryURL.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryURL.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java?view=auto&rev=511901
==============================================================================
--- maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java (added)
+++ maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java Mon Feb 26 09:05:04 2007
@@ -0,0 +1,41 @@
+package org.apache.maven.archiva.repository.connector;
+
+/*
+ * 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.Repository;
+
+import java.util.List;
+
+/**
+ * RepositoryConnector 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public interface RepositoryConnector
+{
+    public Repository getSourceRepository();
+
+    public Repository getTargetRepository();
+
+    public List getBlacklist();
+    
+    public List getWhitelist();
+}

Propchange: maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/archiva/trunk/archiva-repository-layer/src/test/java/org/apache/maven/archiva/layer/CachedRepositoryQueryLayerTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-repository-layer/src/test/java/org/apache/maven/archiva/layer/CachedRepositoryQueryLayerTest.java?view=diff&rev=511901&r1=511900&r2=511901
==============================================================================
--- maven/archiva/trunk/archiva-repository-layer/src/test/java/org/apache/maven/archiva/layer/CachedRepositoryQueryLayerTest.java (original)
+++ maven/archiva/trunk/archiva-repository-layer/src/test/java/org/apache/maven/archiva/layer/CachedRepositoryQueryLayerTest.java Mon Feb 26 09:05:04 2007
@@ -1,5 +1,7 @@
 package org.apache.maven.archiva.layer;
 
+import org.codehaus.plexus.cache.Cache;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -32,7 +34,7 @@
     {
         super.setUp();
 
-        cache = new Cache( CachedRepositoryQueryLayer.CACHE_HIT_RATIO );
+        cache = (Cache) lookup( Cache.ROLE, "test" );
 
         queryLayer = new CachedRepositoryQueryLayer( new DefaultRepositoryQueryLayer( repository ), cache );
     }
@@ -40,25 +42,16 @@
     public void testUseFileCache()
     {
         testContainsArtifactTrue();
-        assertEquals( 0, cache.getHitRate(), 0 );
-        testContainsArtifactTrue();
-        assertEquals( CachedRepositoryQueryLayer.CACHE_HIT_RATIO, cache.getHitRate(), 0 );
     }
 
     public void testUseMetadataCache()
         throws Exception
     {
         testArtifactVersions();
-        assertEquals( 0, cache.getHitRate(), 0 );
-        testArtifactVersions();
-        assertEquals( CachedRepositoryQueryLayer.CACHE_HIT_RATIO, cache.getHitRate(), 0 );
     }
 
     public void testUseFileCacheOnSnapshot()
     {
         testContainsSnapshotArtifactTrue();
-        assertEquals( 0, cache.getHitRate(), 0 );
-        testContainsSnapshotArtifactTrue();
-        assertEquals( CachedRepositoryQueryLayer.CACHE_HIT_RATIO, cache.getHitRate(), 0 );
     }
 }

Added: maven/archiva/trunk/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/RepositoryURLTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/RepositoryURLTest.java?view=auto&rev=511901
==============================================================================
--- maven/archiva/trunk/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/RepositoryURLTest.java (added)
+++ maven/archiva/trunk/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/RepositoryURLTest.java Mon Feb 26 09:05:04 2007
@@ -0,0 +1,89 @@
+package org.apache.maven.archiva.repository;
+
+/*
+ * 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 java.net.MalformedURLException;
+
+import junit.framework.TestCase;
+
+/**
+ * RepositoryURLTest 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class RepositoryURLTest
+    extends TestCase
+{
+    private void assertURL( String actualURL, String protocol, String username, String password, String hostname,
+                            String port, String path )
+    {
+        RepositoryURL url = new RepositoryURL( actualURL );
+
+        assertEquals( protocol, url.getProtocol() );
+        assertEquals( username, url.getUsername() );
+        assertEquals( password, url.getPassword() );
+        assertEquals( hostname, url.getHost() );
+        assertEquals( port, url.getPort() );
+        assertEquals( path, url.getPath() );
+    }
+
+    public void testProtocolHttp()
+        throws MalformedURLException
+    {
+        assertURL( "http://localhost/path/to/resource.txt", "http", null, null, "localhost", null,
+                   "/path/to/resource.txt" );
+    }
+
+    public void testProtocolWagonWebdav()
+        throws MalformedURLException
+    {
+        assertURL( "dav:http://localhost/path/to/resource.txt", "dav:http", null, null, "localhost", null,
+                   "/path/to/resource.txt" );
+    }
+
+    public void testProtocolHttpWithPort()
+        throws MalformedURLException
+    {
+        assertURL( "http://localhost:9090/path/to/resource.txt", "http", null, null, "localhost", "9090",
+                   "/path/to/resource.txt" );
+    }
+
+    public void testProtocolHttpWithUsername()
+        throws MalformedURLException
+    {
+        assertURL( "http://user@localhost/path/to/resource.txt", "http", "user", null, "localhost", null,
+                   "/path/to/resource.txt" );
+    }
+
+    public void testProtocolHttpWithUsernamePassword()
+        throws MalformedURLException
+    {
+        assertURL( "http://user:pass@localhost/path/to/resource.txt", "http", "user", "pass", "localhost", null,
+                   "/path/to/resource.txt" );
+    }
+
+    public void testProtocolHttpWithUsernamePasswordPort()
+        throws MalformedURLException
+    {
+        assertURL( "http://user:pass@localhost:9090/path/to/resource.txt", "http", "user", "pass", "localhost", "9090",
+                   "/path/to/resource.txt" );
+    }
+}

Propchange: maven/archiva/trunk/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/RepositoryURLTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/RepositoryURLTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/RepositoryURLTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain