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/04/11 22:26:37 UTC

svn commit: r527649 [1/3] - in /maven/archiva/branches/archiva-jpox-database-refactor/archiva-base: archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ archiva-configuration/src/main/mdo/ archiva-configuration/src/main/resources...

Author: joakime
Date: Wed Apr 11 13:26:34 2007
New Revision: 527649

URL: http://svn.apache.org/viewvc?view=rev&rev=527649
Log:
Model / Configuration / Repository Layer / Proxy Updates

Added:
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ProjectReferenceKey.java   (with props)
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java   (with props)
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java   (with props)
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/RepositoryProxyConnectors.java   (with props)
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/policy/
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/policy/ArtifactUpdatePolicy.java   (with props)
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/policy/ChecksumPolicy.java   (with props)
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/policy/PostfetchPolicy.java   (with props)
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/policy/PrefetchPolicy.java   (with props)
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java   (with props)
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/RepositoryProxyConnectorsTest.java   (with props)
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/BidirectionalRepositoryLayoutFactory.java   (with props)
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/BidirectionalRepositoryLayoutFactoryTest.java   (with props)
Removed:
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/DependencyKey.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultProxyRequestHandler.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxiedArtifactRepository.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyRequestHandler.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/consumer/
Modified:
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoader.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoaderTest.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaRepository.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/mdo/archiva-base.xml
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/pom.xml
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractArtifactExtensionMapping.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/BidirectionalRepositoryLayout.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayout.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayout.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelMerge.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilter.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionFilter.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/RepositoryProjectResolver.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/AllTests.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayoutTest.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayoutTest.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilterTest.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionExpanderTest.java
    maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400ReaderTest.java

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoader.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoader.java?view=diff&rev=527649&r1=527648&r2=527649
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoader.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoader.java Wed Apr 11 13:26:34 2007
@@ -62,7 +62,7 @@
                 String key = tok.nextToken();
                 if ( StringUtils.isNotEmpty( key ) )
                 {
-                    ProxyConfiguration proxy = new ProxyConfiguration();
+                    NetworkProxyConfiguration proxy = new NetworkProxyConfiguration();
                     proxy.setHost( getMandatoryProperty( props, "proxy." + key + ".host" ) );
                     proxy.setPort( Integer.parseInt( getMandatoryProperty( props, "proxy." + key + ".port" ) ) );
 
@@ -104,9 +104,9 @@
             proxyConnector.setSourceRepoId( "maven-proxy" );
             proxyConnector.setTargetRepoId( key );
             proxyConnector.setProxyId( proxyKey );
-            proxyConnector.setFailurePolicy( RepositoryProxyConnectorConfiguration.NOT_FOUND );
-            proxyConnector.setSnapshotsPolicy( String.valueOf( cachePeriod ) );
-            proxyConnector.setReleasesPolicy( RepositoryProxyConnectorConfiguration.NEVER );
+            // TODO: convert cachePeriod to closest "daily" or "hourly"
+            proxyConnector.setSnapshotsPolicy( "daily" );
+            proxyConnector.setReleasesPolicy( "never" );
             
             configuration.addProxyConnector( proxyConnector );
         }

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo?view=diff&rev=527649&r1=527648&r2=527649
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo Wed Apr 11 13:26:34 2007
@@ -67,7 +67,7 @@
           <name>networkProxies</name>
           <version>1.0.0+</version>
           <association>
-            <type>ProxyConfiguration</type>
+            <type>NetworkProxyConfiguration</type>
             <multiplicity>*</multiplicity>
           </association>
           <description>
@@ -320,79 +320,58 @@
           <version>1.0.0+</version>
           <type>String</type>
           <defaultValue>disabled</defaultValue>
-          <description>
-            The policy for snapshots: 
-              Can be one of the following keywords:
-                "disabled" - means retrieval isn't even attempted.
-                "daily"    - means snapshot is fetched, but only updated on
-                             a daily basis. (equivalent to "1440" minutes)
-                "hourly"   - means snapshot is fetched, but only updated on
-                             an hourly basis. (equivalent to "60" minutes)
-                "never"    - means snapshot is fetched once, but never updated.
-                             (equivalent to "-1" minutes)
-              Or it can be a number of minutes before updating of the snapshot.
-          </description>
+          <description>
+            <![CDATA[
+            <p>
+            The policy for snapshots, one of the following:
+              {@link org.apache.maven.archiva.proxy.policy.ArtifactUpdatePolicy#DISABLED disabled},
+              {@link org.apache.maven.archiva.proxy.policy.ArtifactUpdatePolicy#DAILY daily},
+              {@link org.apache.maven.archiva.proxy.policy.ArtifactUpdatePolicy#HOURLY hourly},
+              {@link org.apache.maven.archiva.proxy.policy.ArtifactUpdatePolicy#ONCE once}
+            </p>
+
+            @see org.apache.maven.archiva.proxy.policy.ArtifactUpdatePolicy
+            ]]>
+          </description>
         </field>
         <field>
           <name>releasesPolicy</name>
           <version>1.0.0+</version>
           <type>String</type>
           <defaultValue>never</defaultValue>
-          <description>
-            The policy for releases: 
-              Can be one of the following keywords:
-                "disabled" - means retrieval isn't even attempted.
-                "daily"    - means release is fetched, but only updated on
-                             a daily basis. (equivalent to "1440" minutes)
-                "hourly"   - means release is fetched, but only updated on
-                             an hourly basis. (equivalent to "60" minutes)
-                "never"    - means release is fetched once, but never updated.
-                             (equivalent to "-1" minutes)
-              Or it can be a number of minutes before updating of the release.
+          <description>
+            <![CDATA[
+            <p>
+            The policy for releases, one of the following:
+              {@link org.apache.maven.archiva.proxy.policy.ArtifactUpdatePolicy#DISABLED disabled},
+              {@link org.apache.maven.archiva.proxy.policy.ArtifactUpdatePolicy#DAILY daily},
+              {@link org.apache.maven.archiva.proxy.policy.ArtifactUpdatePolicy#HOURLY hourly},
+              {@link org.apache.maven.archiva.proxy.policy.ArtifactUpdatePolicy#ONCE once}
+            </p>
+
+            @see org.apache.maven.archiva.proxy.policy.ArtifactUpdatePolicy
+            ]]>
           </description>
         </field>
-        <field>
-          <name>failurePolicy</name>
-          <version>1.0.0+</version>
-          <type>String</type>
-          <defaultValue>not-found</defaultValue>
+        <field>
+          <name>checksumPolicy</name>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <defaultValue>fail</defaultValue>
           <description>
-            The policy for dealing with proxy failures.
-              Can be one of the following keywords:
-                "not-found" - means if the retrieval has a failure, an HTTP 404 
-                              (not found) is returned to the client of this
-                              archiva instance.
-                              This policy setting will allow other proxies
-                              to be checked for content.
-                "failure"   - means if the retrieval has a failure, an HTTP 500
-                              (server error) is returned to the client of this
-                              archiva instance.
-                              This policy setting will return immediately to the
-                              client of the archiva instance and not allow 
-                              furthor attempts on other proxies for this content.
-          </description>
+            <![CDATA[
+            <p>
+            The policy for dealing with checksums, one of the following: 
+              {@link org.apache.maven.archiva.proxy.policy.ChecksumPolicy#FAIL fail}, 
+              {@link org.apache.maven.archiva.proxy.policy.ChecksumPolicy#FIX fix}, or
+              {@link org.apache.maven.archiva.proxy.policy.ChecksumPolicy#IGNORE ignore}
+            </p>
+            
+            @see org.apache.maven.archiva.proxy.policy.ChecksumPolicy
+            ]]>
+          </description>
         </field>
       </fields>
-      <codeSegments>
-        <codeSegment>
-          <version>1.0.0+</version>
-          <code><![CDATA[
-          
-   public static final String NEVER = "never";
-   
-   public static final String DISABLED = "disabled";
-   
-   public static final String DAILY = "daily";
-   
-   public static final String HOURLY = "hourly";
-   
-   public static final String NOT_FOUND = "not-found";
-   
-   public static final String FAILURE = "failure";
-          
-          ]]></code>
-        </codeSegment>
-      </codeSegments>
     </class>
     
     <class>
@@ -438,7 +417,7 @@
       -->
     
     <class>
-      <name>ProxyConfiguration</name>
+      <name>NetworkProxyConfiguration</name>
       <version>1.0.0+</version>
       <fields>
         <field>
@@ -453,12 +432,12 @@
           <name>protocol</name>
           <version>1.0.0+</version>
           <description>
-            The network protocol to use with this proxy.
+            The network protocol to use with this proxy: "http", "socks-4"
           </description>
           <type>String</type>
           <required>true</required>
           <defaultValue>http</defaultValue>
-        </field>
+        </field>
         <field>
           <name>host</name>
           <version>1.0.0+</version>

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml?view=diff&rev=527649&r1=527648&r2=527649
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml Wed Apr 11 13:26:34 2007
@@ -47,16 +47,16 @@
       <targetRepoId>central</targetRepoId>
       <proxyId />
       <snapshotsPolicy>disabled</snapshotsPolicy>
-      <releasePolicy>never</releasePolicy>
-      <failurePolicy>not-found</failurePolicy>
+      <releasePolicy>once</releasePolicy>
+      <checksumPolicy>fix</checksumPolicy>
     </proxyConnector>
     <proxyConnector>
       <sourceRepoId>internal</sourceRepoId>
       <targetRepoId>maven2-repository.dev.java.net</targetRepoId>
       <proxyId />
       <snapshotsPolicy>disabled</snapshotsPolicy>
-      <releasePolicy>never</releasePolicy>
-      <failurePolicy>not-found</failurePolicy>
+      <releasePolicy>once</releasePolicy>
+      <checksumPolicy>fix</checksumPolicy>
       <whiteListPatterns>
         <whiteListPattern>javax/**</whiteListPattern>
       </whiteListPatterns>

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoaderTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoaderTest.java?view=diff&rev=527649&r1=527648&r2=527649
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoaderTest.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoaderTest.java Wed Apr 11 13:26:34 2007
@@ -42,7 +42,7 @@
         File confFile = getTestFile( "src/test/conf/maven-proxy-complete.conf" );
 
         Configuration configuration = new Configuration();
-        ProxyConfiguration proxy = new ProxyConfiguration();
+        NetworkProxyConfiguration proxy = new NetworkProxyConfiguration();
         proxy.setHost( "original-host" );
         configuration.addNetworkProxy( proxy ); // overwritten
 

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java?view=diff&rev=527649&r1=527648&r2=527649
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java Wed Apr 11 13:26:34 2007
@@ -54,6 +54,7 @@
         cloned.setPackaging( model.getPackaging() );
         cloned.setOrigin( model.getOrigin() );
 
+        cloned.setMailingLists( cloneMailingLists( model.getMailingLists() ) );
         cloned.setCiManagement( clone( model.getCiManagement() ) );
         cloned.setIndividuals( cloneIndividuals( model.getIndividuals() ) );
         cloned.setIssueManagement( clone( model.getIssueManagement() ) );
@@ -61,7 +62,7 @@
         cloned.setOrganization( clone( model.getOrganization() ) );
         cloned.setScm( clone( model.getScm() ) );
         cloned.setRepositories( cloneRepositories( model.getRepositories() ) );
-        cloned.setDependencies( cloneDependencies( model.getDependencies() ) );
+        cloned.setDependencyTree( clone( model.getDependencyTree() ) );
         cloned.setPlugins( clonePlugins( model.getPlugins() ) );
         cloned.setReports( cloneReports( model.getReports() ) );
         cloned.setDependencyManagement( cloneDependencies( model.getDependencyManagement() ) );
@@ -111,12 +112,15 @@
 
         Dependency cloned = new Dependency();
 
+        // Identification
         cloned.setGroupId( dependency.getGroupId() );
         cloned.setArtifactId( dependency.getArtifactId() );
         cloned.setVersion( dependency.getVersion() );
-
         cloned.setClassifier( dependency.getClassifier() );
         cloned.setType( dependency.getType() );
+
+        // The rest.
+        cloned.setTransitive( dependency.isTransitive() );
         cloned.setScope( dependency.getScope() );
         cloned.setOptional( dependency.isOptional() );
         cloned.setSystemPath( dependency.getSystemPath() );
@@ -126,6 +130,37 @@
         return cloned;
     }
 
+    public static DependencyEdge clone( DependencyEdge edge )
+    {
+        if ( edge == null )
+        {
+            return null;
+        }
+
+        DependencyEdge cloned = new DependencyEdge();
+
+        cloned.setFromDependency( clone( edge.getFromDependency() ) );
+        cloned.setToDependency( clone( edge.getToDependency() ) );
+        cloned.setType( edge.getType() );
+
+        return cloned;
+    }
+
+    public static DependencyTree clone( DependencyTree dependencyTree )
+    {
+        if ( dependencyTree == null )
+        {
+            return null;
+        }
+
+        DependencyTree cloned = new DependencyTree();
+
+        cloned.setDependencyNodes( cloneDependencies( dependencyTree.getDependencyNodes() ) );
+        cloned.setDependencyEdges( cloneDependencyEdges( dependencyTree.getDependencyEdges() ) );
+
+        return cloned;
+    }
+
     public static IssueManagement clone( IssueManagement issueManagement )
     {
         if ( issueManagement == null )
@@ -141,6 +176,25 @@
         return cloned;
     }
 
+    public static MailingList clone( MailingList mailingList )
+    {
+        if ( mailingList == null )
+        {
+            return null;
+        }
+
+        MailingList cloned = new MailingList();
+
+        cloned.setName( mailingList.getName() );
+        cloned.setSubscribeAddress( mailingList.getSubscribeAddress() );
+        cloned.setUnsubscribeAddress( mailingList.getUnsubscribeAddress() );
+        cloned.setPostAddress( mailingList.getPostAddress() );
+        cloned.setMainArchiveUrl( mailingList.getMainArchiveUrl() );
+        cloned.setOtherArchives( cloneSimpleStringList( mailingList.getOtherArchives() ) );
+
+        return cloned;
+    }
+
     public static Organization clone( Organization organization )
     {
         if ( organization == null )
@@ -242,12 +296,39 @@
         {
             Dependency dep = (Dependency) it.next();
 
-            Dependency cloned = clone( dep );
+            if ( dep == null )
+            {
+                // Skip null dependency.
+                continue;
+            }
+
+            ret.add( clone( dep ) );
+        }
+
+        return ret;
+    }
+
+    public static List cloneDependencyEdges( List dependencyEdges )
+    {
+        if ( dependencyEdges == null )
+        {
+            return null;
+        }
+
+        List ret = new ArrayList();
 
-            if ( cloned != null )
+        Iterator it = dependencyEdges.iterator();
+        while ( it.hasNext() )
+        {
+            DependencyEdge edge = (DependencyEdge) it.next();
+
+            if ( edge == null )
             {
-                ret.add( cloned );
+                // Skip empty edge.
+                continue;
             }
+
+            ret.add( clone( edge ) );
         }
 
         return ret;
@@ -336,6 +417,32 @@
         return ret;
     }
 
+    public static List cloneMailingLists( List mailingLists )
+    {
+        if ( mailingLists == null )
+        {
+            return null;
+        }
+
+        List ret = new ArrayList();
+
+        Iterator it = mailingLists.iterator();
+        while ( it.hasNext() )
+        {
+            MailingList mailingList = (MailingList) it.next();
+
+            if ( mailingList == null )
+            {
+                // Skip null mailing list.
+                continue;
+            }
+
+            ret.add( clone( mailingList ) );
+        }
+
+        return ret;
+    }
+
     public static List clonePlugins( List plugins )
     {
         return cloneArtifactReferences( plugins );
@@ -377,18 +484,24 @@
 
     public static List cloneRoles( List roles )
     {
-        if ( roles == null )
+        return cloneSimpleStringList( roles );
+    }
+
+    private static List cloneSimpleStringList( List simple )
+    {
+        if ( simple == null )
         {
             return null;
         }
 
         List ret = new ArrayList();
 
-        Iterator it = roles.iterator();
+        Iterator it = simple.iterator();
+
         while ( it.hasNext() )
         {
-            String roleName = (String) it.next();
-            ret.add( roleName );
+            String txt = (String) it.next();
+            ret.add( txt );
         }
 
         return ret;

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaRepository.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaRepository.java?view=diff&rev=527649&r1=527648&r2=527649
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaRepository.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaRepository.java Wed Apr 11 13:26:34 2007
@@ -19,8 +19,6 @@
  * under the License.
  */
 
-
-
 /**
  * ArchivaRepository 
  *
@@ -29,14 +27,10 @@
  */
 public class ArchivaRepository
 {
-//    protected ArtifactRepositoryPolicy releases;
-//
-//    protected ArtifactRepositoryPolicy snapshots;
-
     private ArchivaRepositoryModel model;
 
     private RepositoryURL url;
-    
+
     protected boolean blacklisted;
 
     /**
@@ -59,10 +53,7 @@
     /**
      * 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.
+     * @param model the model to use
      */
     public ArchivaRepository( ArchivaRepositoryModel model )
     {
@@ -102,26 +93,6 @@
         this.blacklisted = blacklisted;
     }
 
-//    public ArtifactRepositoryPolicy getReleases()
-//    {
-//        return releases;
-//    }
-//
-//    public void setReleases( ArtifactRepositoryPolicy releases )
-//    {
-//        this.releases = releases;
-//    }
-//
-//    public ArtifactRepositoryPolicy getSnapshots()
-//    {
-//        return snapshots;
-//    }
-//
-//    public void setSnapshots( ArtifactRepositoryPolicy snapshots )
-//    {
-//        this.snapshots = snapshots;
-//    }
-
     public boolean isRemote()
     {
         return this.url.getProtocol().equals( "file" );
@@ -130,5 +101,15 @@
     public boolean isManaged()
     {
         return this.url.getProtocol().equals( "file" );
+    }
+
+    public String getLayoutType()
+    {
+        return this.model.getLayoutName();
+    }
+
+    public String getName()
+    {
+        return this.model.getName();
     }
 }

Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ProjectReferenceKey.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ProjectReferenceKey.java?view=auto&rev=527649
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ProjectReferenceKey.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ProjectReferenceKey.java Wed Apr 11 13:26:34 2007
@@ -0,0 +1,45 @@
+package org.apache.maven.archiva.model.jpox;
+
+/*
+ * 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.AbstractProjectKey;
+
+import java.io.Serializable;
+
+/**
+ * ProjectReferenceKey - unique classid-key for JPOX. 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class ProjectReferenceKey
+    extends AbstractProjectKey
+    implements Serializable
+{
+    public ProjectReferenceKey()
+    {
+        super();
+    }
+
+    public ProjectReferenceKey( String key )
+    {
+        super( key );
+    }
+}

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ProjectReferenceKey.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ProjectReferenceKey.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/mdo/archiva-base.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/mdo/archiva-base.xml?view=diff&rev=527649&r1=527648&r2=527649
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/mdo/archiva-base.xml (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/mdo/archiva-base.xml Wed Apr 11 13:26:34 2007
@@ -572,6 +572,209 @@
         </field>
       </fields>
     </class>
+    
+    <!-- _______________________________________________________________
+         ____       __
+        |  _ \ ___ / _| ___ _ __ ___ _ __   ___ ___  ___
+        | |_) / _ \ |_ / _ \ '__/ _ \ '_ \ / __/ _ \/ __|
+        |  _ (  __/  _|  __/ | |  __/ | | | (_|  __/\__ \
+        |_| \_\___|_|  \___|_|  \___|_| |_|\___\___||___/
+     -->
+
+    <class stash.storable="true"
+           jpox.table="PROJECT_REFERENCE"
+           jpox.use-identifiers-as-primary-key="false"
+           jpox.identity-type="application"
+           jpox.identity-class="org.apache.maven.archiva.model.jpox.ProjectReferenceKey">
+      <name>ProjectReference</name>
+      <description>A reference to another (unversioned) Project</description>
+      <version>1.0.0+</version>
+      <fields>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>groupId</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
+          <description>
+            The Group ID of the repository content.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>artifactId</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
+          <description>
+            The Artifact ID of the repository content.
+          </description>
+        </field>
+      </fields>
+    </class>
+    
+    <class stash.storable="true"
+           jpox.table="VERSIONED_REFERENCE"
+           jpox.use-identifiers-as-primary-key="false"
+           jpox.identity-type="application"
+           jpox.identity-class="org.apache.maven.archiva.model.jpox.VersionedReferenceKey">
+      <name>VersionedReference</name>
+      <description>A reference to another Versioned Project</description>
+      <version>1.0.0+</version>
+      <fields>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>groupId</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
+          <description>
+            The Group ID of the repository content.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>artifactId</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
+          <description>
+            The Artifact ID of the repository content.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>version</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>false</required>
+          <description>
+            The version of the repository content.
+          </description>
+        </field>
+      </fields>
+    </class>
+    
+    <class stash.storable="true"
+           jpox.table="ARTIFACT_REFERENCE"
+           jpox.use-identifiers-as-primary-key="false"
+           jpox.identity-type="application"
+           jpox.identity-class="org.apache.maven.archiva.model.jpox.ArtifactReferenceKey">
+      <name>ArtifactReference</name>
+      <version>1.0.0+</version>
+      <fields>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>groupId</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
+          <description>
+            The Group ID of the repository content.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>artifactId</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
+          <description>
+            The Artifact ID of the repository content.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>version</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>false</required>
+          <description>
+            The version of the repository content.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>classifier</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
+          <description>
+            The classifier for this artifact.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent"
+               jpox.column="FILE_TYPE">
+          <name>type</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
+          <description>
+            The type of artifact.
+          </description>
+        </field>
+      </fields>
+      <codeSegments>
+        <codeSegment>
+          <version>1.0.0+</version>
+          <code><![CDATA[
+    public static String toKey( ArtifactReference artifactReference )
+    {
+        StringBuffer key = new StringBuffer();
+
+        key.append( artifactReference.getGroupId() ).append( ":" );
+        key.append( artifactReference.getArtifactId() ).append( ":" );
+        key.append( artifactReference.getVersion() ).append( ":" );
+        if ( artifactReference.getClassifier() != null )
+        {
+            key.append( artifactReference.getClassifier() );
+        }
+        key.append( ":" );
+        key.append( artifactReference.getType() );
+
+        return key.toString();
+    }
+
+    public static String toVersionlessKey( ArtifactReference artifactReference )
+    {
+        StringBuffer key = new StringBuffer();
+
+        key.append( artifactReference.getGroupId() ).append( ":" );
+        key.append( artifactReference.getArtifactId() ).append( ":" );
+        if ( artifactReference.getClassifier() != null )
+        {
+            key.append( artifactReference.getClassifier() );
+        }
+        key.append( ":" );
+        key.append( artifactReference.getType() );
+
+        return key.toString();
+    }
+          ]]></code>
+        </codeSegment>
+      </codeSegments>
+    </class>
 
     <!-- _______________________________________________________________
          __  __                         ____            _           _
@@ -719,6 +922,16 @@
           </association>
         </field>
         <field>
+          <name>mailingLists</name>
+          <version>1.0.0+</version>
+          <description>The mailing lists.</description>
+          <required>false</required>
+          <association>
+            <type>MailingList</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+        <field>
           <name>issueManagement</name>
           <version>1.0.0+</version>
           <description><![CDATA[The project's issue management system information.]]></description>
@@ -755,15 +968,14 @@
           </association>
         </field>
         <field>
-          <name>dependencies</name>
+          <name>dependencyTree</name>
           <version>1.0.0+</version>
           <description><![CDATA[
               This element describes all of the dependencies associated with a
               project.
           ]]></description>
           <association>
-            <type>Dependency</type>
-            <multiplicity>*</multiplicity>
+            <type>DependencyTree</type>
           </association>
         </field>
         <field>
@@ -836,124 +1048,70 @@
           </association>
         </field>
       </fields>
+      <codeSegments>
+        <codeSegment>
+          <version>1.0.0+</version>
+          <code><![CDATA[
+    public Dependency asDependency()
+    {
+        Dependency dep = new Dependency();
+        
+        dep.setGroupId( groupId );
+        dep.setArtifactId( artifactId );
+        dep.setVersion( version );
+        dep.setType( packaging );
+        
+        return dep;
+    }          
+          ]]></code>
+        </codeSegment>
+      </codeSegments>
     </class>
     
     <class stash.storable="true"
-           jpox.table="VERSIONED_REFERENCE"
-           jpox.use-identifiers-as-primary-key="false"
-           jpox.identity-type="application"
-           jpox.identity-class="org.apache.maven.archiva.model.jpox.VersionedReferenceKey">
-      <name>VersionedReference</name>
-      <description>A reference to another Versioned Project</description>
+           jpox.table="MAILING_LISTS">
+      <name>MailingList</name>
+      <description>A Mailing List</description>
       <version>1.0.0+</version>
       <fields>
-        <field jpox.primary-key="true"
-               jpox.value-strategy="off"
-               jpox.persistence-modifier="persistent">
-          <name>groupId</name>
-          <identifier>true</identifier>
-          <version>1.0.0+</version>
-          <type>String</type>
-          <required>true</required>
-          <description>
-            The Group ID of the repository content.
-          </description>
-        </field>
-        <field jpox.primary-key="true"
-               jpox.value-strategy="off"
-               jpox.persistence-modifier="persistent">
-          <name>artifactId</name>
-          <identifier>true</identifier>
+        <field>
+          <name>name</name>
           <version>1.0.0+</version>
+          <description>The name of the mailing list.</description>
           <type>String</type>
-          <required>true</required>
-          <description>
-            The Artifact ID of the repository content.
-          </description>
         </field>
-        <field jpox.primary-key="true"
-               jpox.value-strategy="off"
-               jpox.persistence-modifier="persistent">
-          <name>version</name>
-          <identifier>true</identifier>
+        <field>
+          <name>subscribeAddress</name>
           <version>1.0.0+</version>
+          <description>The email address to subscribe to this mailing list.</description>
           <type>String</type>
-          <required>false</required>
-          <description>
-            The version of the repository content.
-          </description>
         </field>
-      </fields>
-    </class>
-    
-    <class stash.storable="true"
-           jpox.table="ArtifactReference"
-           jpox.use-identifiers-as-primary-key="false"
-           jpox.identity-type="application"
-           jpox.identity-class="org.apache.maven.archiva.model.jpox.ArtifactReferenceKey">
-      <name>ArtifactReference</name>
-      <version>1.0.0+</version>
-      <fields>
-        <field jpox.primary-key="true"
-               jpox.value-strategy="off"
-               jpox.persistence-modifier="persistent">
-          <name>groupId</name>
-          <identifier>true</identifier>
+        <field>
+          <name>unsubscribeAddress</name>
           <version>1.0.0+</version>
+          <description>The email address to unsubscribe to this mailing list.</description>
           <type>String</type>
-          <required>true</required>
-          <description>
-            The Group ID of the repository content.
-          </description>
         </field>
-        <field jpox.primary-key="true"
-               jpox.value-strategy="off"
-               jpox.persistence-modifier="persistent">
-          <name>artifactId</name>
-          <identifier>true</identifier>
-          <version>1.0.0+</version>
-          <type>String</type>
-          <required>true</required>
-          <description>
-            The Artifact ID of the repository content.
-          </description>
-        </field>
-        <field jpox.primary-key="true"
-               jpox.value-strategy="off"
-               jpox.persistence-modifier="persistent">
-          <name>version</name>
-          <identifier>true</identifier>
+        <field>
+          <name>postAddress</name>
           <version>1.0.0+</version>
+          <description>The email address to post to this mailing list.</description>
           <type>String</type>
-          <required>false</required>
-          <description>
-            The version of the repository content.
-          </description>
         </field>
-        <field jpox.primary-key="true"
-               jpox.value-strategy="off"
-               jpox.persistence-modifier="persistent">
-          <name>classifier</name>
-          <identifier>true</identifier>
+        <field>
+          <name>mainArchiveUrl</name>
           <version>1.0.0+</version>
+          <description>The url to the archive for this mailing list.</description>
           <type>String</type>
-          <required>true</required>
-          <description>
-            The classifier for this artifact.
-          </description>
         </field>
-        <field jpox.primary-key="true"
-               jpox.value-strategy="off"
-               jpox.persistence-modifier="persistent"
-               jpox.column="FILE_TYPE">
-          <name>type</name>
-          <identifier>true</identifier>
+        <field>
+          <name>otherArchives</name>
           <version>1.0.0+</version>
-          <type>String</type>
-          <required>true</required>
-          <description>
-            The type of artifact.
-          </description>
+          <description>The email address to subscribe to this mailing list.</description>
+          <association>
+            <type>String</type>
+            <multiplicity>*</multiplicity>
+          </association>
         </field>
       </fields>
     </class>
@@ -1055,6 +1213,7 @@
         </field>
       </fields>
     </class>
+    
     <class>
       <name>CiManagement</name>
       <version>1.0.0+</version>
@@ -1076,6 +1235,7 @@
         </field>
       </fields>
     </class>
+    
     <class stash.storable="true">
       <name>Individual</name>
       <description>
@@ -1169,20 +1329,137 @@
         </field>
       </fields>
     </class>
+    
+    <class stash.storable="true"
+           jpox.table="DEPENDENCY_TREE">
+      <name>DependencyTree</name>
+      <description>The Dependency Tree</description>
+      <version>1.0.0+</version>
+      <fields>
+        <field>
+          <name>dependencyNodes</name>
+          <version>1.0.0+</version>
+          <description>The nodes for this dependency tree.</description>
+          <association>
+            <type>Dependency</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+        <field>
+          <name>dependencyEdges</name>
+          <version>1.0.0+</version>
+          <description>The edges for this dependency tree.</description>
+          <association>
+            <type>DependencyEdge</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+      </fields>
+      <codeSegments>
+        <codeSegment>
+          <version>1.0.0+</version>
+          <code><![CDATA[
+    /**
+     * True if the dependency tree is empty.
+     * 
+     * @return true if the dependency tree is empty.
+     */
+    public boolean isEmpty()
+    {
+        if ( this.dependencyNodes == null )
+        {
+            return true;
+        }
+
+        return this.dependencyNodes.isEmpty();
+    }          
+    
+    public void addDependencyEdge( Dependency fromNode, Dependency toNode )
+    {
+        if ( this.dependencyNodes == null )
+        {
+            this.dependencyNodes = new java.util.ArrayList();
+        }
+
+        if ( this.dependencyEdges == null )
+        {
+            this.dependencyEdges = new java.util.ArrayList();
+        }
+
+        java.util.Iterator it;
+
+        DependencyEdge edge = new DependencyEdge();
+        edge.setFromDependency( toArtifactReference( fromNode ) );
+        edge.setToDependency( toArtifactReference( toNode ) );
+
+        String key = DependencyEdge.toKey( edge );
+
+        // Test for existance of previous edge.
+        it = this.dependencyEdges.iterator();
+        while ( it.hasNext() )
+        {
+            DependencyEdge existingEdge = (DependencyEdge) it.next();
+            String existingKey = DependencyEdge.toKey( existingEdge );
+            if ( key.equals( existingKey ) )
+            {
+                // Key already exists.
+                // Update type and return.
+                existingEdge.setType( edge.getType() );
+                return;
+            }
+        }
+
+        // Test for existance of fromNode or toNode and add if not present.
+        String fromKey = Dependency.toVersionlessKey( fromNode );
+        String toKey = Dependency.toVersionlessKey( toNode );
+        
+        // Generate list of keys
+        java.util.List existingKeys = new java.util.ArrayList();
+
+        it = this.dependencyNodes.iterator();
+        while ( it.hasNext() )
+        {
+            Dependency existingDep = (Dependency) it.next();
+            String existingKey = Dependency.toVersionlessKey( existingDep );
+            existingKeys.add( existingKey );
+        }
+
+        // Now add nodes that are not present.
+        if ( !existingKeys.contains( fromKey ) )
+        {
+            this.dependencyNodes.add( fromNode );
+        }
+
+        if ( !existingKeys.contains( toKey ) )
+        {
+            this.dependencyNodes.add( toNode );
+        }
+    }
+    
+    public static ArtifactReference toArtifactReference( Dependency dependency )
+    {
+        ArtifactReference ref = new ArtifactReference();
+        
+        ref.setGroupId( dependency.getGroupId() );
+        ref.setArtifactId( dependency.getArtifactId() );
+        ref.setVersion( dependency.getVersion() );
+        ref.setClassifier( dependency.getClassifier() );
+        ref.setType( dependency.getType() );
+        
+        return ref;
+    }
+          ]]></code>
+        </codeSegment>
+      </codeSegments>
+    </class>
 
     <class stash.storable="true"
-           jpox.table="DEPENDENCY"
-           jpox.use-identifiers-as-primary-key="false"
-           jpox.identity-type="application"
-           jpox.identity-class="org.apache.maven.archiva.model.jpox.DependencyKey">
+           jpox.table="DEPENDENCY">
       <name>Dependency</name>
       <version>1.0.0+</version>
       <fields>
-        <field jpox.primary-key="true"
-               jpox.value-strategy="off"
-               jpox.persistence-modifier="persistent">
+        <field>
           <name>groupId</name>
-          <identifier>true</identifier>
           <version>1.0.0+</version>
           <type>String</type>
           <required>true</required>
@@ -1190,11 +1467,8 @@
             The Group ID of the repository content.
           </description>
         </field>
-        <field jpox.primary-key="true"
-               jpox.value-strategy="off"
-               jpox.persistence-modifier="persistent">
+        <field>
           <name>artifactId</name>
-          <identifier>true</identifier>
           <version>1.0.0+</version>
           <type>String</type>
           <required>true</required>
@@ -1202,11 +1476,8 @@
             The Artifact ID of the repository content.
           </description>
         </field>
-        <field jpox.primary-key="true"
-               jpox.value-strategy="off"
-               jpox.persistence-modifier="persistent">
+        <field>
           <name>version</name>
-          <identifier>true</identifier>
           <version>1.0.0+</version>
           <type>String</type>
           <required>false</required>
@@ -1214,11 +1485,8 @@
             The version of the repository content.
           </description>
         </field>
-        <field jpox.primary-key="true"
-               jpox.value-strategy="off"
-               jpox.persistence-modifier="persistent">
+        <field>
           <name>classifier</name>
-          <identifier>true</identifier>
           <version>1.0.0+</version>
           <type>String</type>
           <required>true</required>
@@ -1228,12 +1496,8 @@
             <code>jdk14</code> and <code>jdk15</code>.
           ]]></description>
         </field>
-        <field jpox.primary-key="true"
-               jpox.value-strategy="off"
-               jpox.persistence-modifier="persistent"
-               jpox.column="DEPENDENCY_TYPE">
+        <field jpox.column="DEPENDENCY_TYPE">
           <name>type</name>
-          <identifier>true</identifier>
           <version>1.0.0+</version>
           <type>String</type>
           <required>true</required>
@@ -1249,6 +1513,14 @@
           <defaultValue>jar</defaultValue>
         </field>
         <field>
+          <name>transitive</name>
+          <version>1.0.0+</version>
+          <required>true</required>
+          <description>True if the dependency node is only here due a transitive lookup</description>
+          <type>boolean</type>
+          <defaultValue>false</defaultValue>
+        </field>
+        <field>
           <name>url</name>
           <version>1.0.0+</version>
           <description><![CDATA[
@@ -1266,7 +1538,8 @@
             calculate the various classpaths used for compilation, testing, and so on. It also assists in determining
             which artifacts to include in a distribution of this project. For more information, see
             <a href="http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html">the
-            dependency mechanism</a>.]]>
+            dependency mechanism</a>.
+            ]]>
           </description>
           <type>String</type>
         </field>
@@ -1306,7 +1579,131 @@
           <defaultValue>false</defaultValue>
         </field>
       </fields>
+      <codeSegments>
+        <codeSegment>
+          <version>1.0.0+</version>
+          <code><![CDATA[
+    public String toString()
+    {
+        return Dependency.toKey( this );
+    }          
+          
+    public static String toKey( Dependency dep )
+    {
+        StringBuffer key = new StringBuffer();
+
+        key.append( dep.getGroupId() ).append( ":" );
+        key.append( dep.getArtifactId() ).append( ":" );
+        key.append( dep.getVersion() ).append( ":" );
+        if ( dep.getClassifier() != null )
+        {
+            key.append( dep.getClassifier() );
+        }
+        key.append( ":" );
+        key.append( dep.getType() );
+
+        return key.toString();
+    }
+
+    public static String toVersionlessKey( Dependency dep )
+    {
+        StringBuffer key = new StringBuffer();
+
+        key.append( dep.getGroupId() ).append( ":" );
+        key.append( dep.getArtifactId() ).append( ":" );
+        if ( dep.getClassifier() != null )
+        {
+            key.append( dep.getClassifier() );
+        }
+        key.append( ":" );
+        key.append( dep.getType() );
+
+        return key.toString();
+    }
+          ]]></code>
+        </codeSegment>
+      </codeSegments>
     </class>
+    
+    <class stash.storable="true"
+           jpox.table="DEPENDENCY_EDGE">
+      <name>DependencyEdge</name>
+      <version>1.0.0+</version>
+      <fields>
+        <field>
+          <name>fromDependency</name>
+          <version>1.0.0+</version>
+          <required>true</required>
+          <description>The dependency reference for the 'from' node</description>
+          <association>
+            <type>ArtifactReference</type>
+          </association>
+        </field>
+        <field>
+          <name>toDependency</name>
+          <version>1.0.0+</version>
+          <required>true</required>
+          <description>The dependency reference for the 'to' node</description>
+          <association>
+            <type>ArtifactReference</type>
+          </association>
+        </field>
+        <field jpox.column="EDGE_TYPE">
+          <name>type</name>
+          <version>1.0.0+</version>
+          <required>true</required>
+          <description><![CDATA[
+          <p>
+          The type of edge you have.
+          </p>
+          
+          <dl>
+            <dt><code>runtime</code></dt>
+            <dd>A dependency node that is required for runtime of the project</dd>
+            
+            <dt><code>test</code></dt>
+            <dd>A dependency node that is used by the project for testing purposes.</dd>
+            
+            <dt><code>build</code></dt>
+            <dd>A dependency node that is used in the build/extension capacity.</dd>
+            
+            <dt><code>plugin</code></dt>
+            <dd>A dependency node that is used as, or by a, declared plugin in this project.
+              This includes the plugin itself, and any defined plugins/plugin/dependencies/dependency references.
+            </dd>
+            
+            <dt><code>report</code></dt>
+            <dd>A dependency node that is used as, or by a, declared report in this project.
+              This includes the report itself, and any defined reporting/plugins/plugin/dependencies/dependency references.</dd>
+          </dl>
+          ]]></description>
+          <type>String</type>
+        </field>
+      </fields>
+      <codeSegments>
+        <codeSegment>
+          <version>1.0.0+</version>
+          <code><![CDATA[
+    public static String toKey( DependencyEdge edge )
+    {
+        StringBuffer key = new StringBuffer();
+
+        key.append( ArtifactReference.toVersionlessKey( edge.getFromDependency() ) );
+        key.append( "->" );
+        key.append( ArtifactReference.toVersionlessKey( edge.getToDependency() ) );
+
+        return key.toString();
+    }
+
+    public String toString()
+    {
+        return DependencyEdge.toKey( this );
+    }          
+          ]]></code>
+        </codeSegment>
+      </codeSegments>
+    </class>
+    
     <class stash.storable="true"
            jpox.table="EXCLUSIONS">
       <name>Exclusion</name>

Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/pom.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/pom.xml?view=diff&rev=527649&r1=527648&r2=527649
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/pom.xml (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/pom.xml Wed Apr 11 13:26:34 2007
@@ -31,7 +31,11 @@
   <dependencies>
     <dependency>
       <groupId>org.apache.maven.archiva</groupId>
-      <artifactId>archiva-common</artifactId>
+      <artifactId>archiva-configuration</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.archiva</groupId>
+      <artifactId>archiva-repository-layer</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.maven.wagon</groupId>

Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java?view=auto&rev=527649
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java Wed Apr 11 13:26:34 2007
@@ -0,0 +1,561 @@
+package org.apache.maven.archiva.proxy;
+
+/*
+ * 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.collections.CollectionUtils;
+import org.apache.commons.io.FileUtils;
+import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
+import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+import org.apache.maven.archiva.configuration.RepositoryProxyConnectorConfiguration;
+import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.model.ArtifactReference;
+import org.apache.maven.archiva.model.ProjectReference;
+import org.apache.maven.archiva.proxy.policy.PostfetchPolicy;
+import org.apache.maven.archiva.proxy.policy.PrefetchPolicy;
+import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
+import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
+import org.apache.maven.archiva.repository.layout.LayoutException;
+import org.apache.maven.wagon.ConnectionException;
+import org.apache.maven.wagon.Wagon;
+import org.apache.maven.wagon.WagonException;
+import org.apache.maven.wagon.authentication.AuthenticationException;
+import org.apache.maven.wagon.proxy.ProxyInfo;
+import org.apache.maven.wagon.repository.Repository;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
+import org.codehaus.plexus.registry.Registry;
+import org.codehaus.plexus.registry.RegistryListener;
+import org.codehaus.plexus.util.SelectorUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * DefaultRepositoryProxyConnectors 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ * 
+ * @plexus.component role-hint="default"
+ */
+public class DefaultRepositoryProxyConnectors
+    extends AbstractLogEnabled
+    implements RepositoryProxyConnectors, RegistryListener, Initializable
+{
+    private static final String FILENAME_MAVEN_METADATA = "maven-metadata.xml";
+
+    /**
+     * @plexus.requirement
+     */
+    private ArchivaConfiguration archivaConfiguration;
+
+    /**
+     * @plexus.requirement role="org.apache.maven.wagon.Wagon"
+     */
+    private Map/*<String,Wagon>*/wagons;
+
+    /**
+     * @plexus.requirement
+     */
+    private BidirectionalRepositoryLayoutFactory layoutFactory;
+
+    /**
+     * @plexus.requirement role="checksum"
+     */
+    private PrefetchPolicy checksumPolicy;
+
+    /**
+     * @plexus.requirement role="artifact-update"
+     */
+    private PostfetchPolicy updatePolicy;
+
+    private Map proxyConnectorMap = new HashMap();
+
+    private Map networkProxyMap = new HashMap();
+
+    private List propertyNameTriggers = new ArrayList();
+
+    public boolean fetchFromProxies( ArchivaRepository repository, ArtifactReference artifact )
+        throws ProxyException
+    {
+        if ( !repository.isManaged() )
+        {
+            throw new ProxyException( "Can only proxy managed repositories." );
+        }
+
+        File localFile;
+        try
+        {
+            BidirectionalRepositoryLayout sourceLayout = layoutFactory.getLayout( repository.getLayoutType() );
+            String sourcePath = sourceLayout.toPath( artifact );
+            localFile = new File( repository.getUrl().getPath(), sourcePath );
+        }
+        catch ( LayoutException e )
+        {
+            throw new ProxyException( "Unable to proxy due to bad source repository layout definition: "
+                + e.getMessage(), e );
+        }
+
+        boolean isSnapshot = VersionUtil.isSnapshot( artifact.getVersion() );
+
+        List connectors = getProxyConnectors( repository );
+        Iterator it = connectors.iterator();
+        while ( it.hasNext() )
+        {
+            ProxyConnector connector = (ProxyConnector) it.next();
+            ArchivaRepository targetRepository = connector.getTargetRepository();
+            try
+            {
+                BidirectionalRepositoryLayout targetLayout = layoutFactory.getLayout( targetRepository.getLayoutType() );
+                String targetPath = targetLayout.toPath( artifact );
+
+                if ( transferFile( connector, targetRepository, targetPath, localFile, isSnapshot ) )
+                {
+                    // Transfer was successful.  return.
+                    return true;
+                }
+            }
+            catch ( LayoutException e )
+            {
+                getLogger().error( "Unable to proxy due to bad layout definition: " + e.getMessage(), e );
+                return false;
+            }
+        }
+
+        return false;
+    }
+
+    public boolean fetchFromProxies( ArchivaRepository repository, ProjectReference metadata )
+        throws ProxyException
+    {
+        if ( !repository.isManaged() )
+        {
+            throw new ProxyException( "Can only proxy managed repositories." );
+        }
+
+        File localFile;
+        try
+        {
+            BidirectionalRepositoryLayout sourceLayout = layoutFactory.getLayout( repository.getLayoutType() );
+            String sourcePath = sourceLayout.toPath( metadata ) + FILENAME_MAVEN_METADATA;
+            localFile = new File( repository.getUrl().getPath(), sourcePath );
+        }
+        catch ( LayoutException e )
+        {
+            throw new ProxyException( "Unable to proxy due to bad source repository layout definition: "
+                + e.getMessage(), e );
+        }
+
+        List connectors = getProxyConnectors( repository );
+        Iterator it = connectors.iterator();
+        while ( it.hasNext() )
+        {
+            ProxyConnector connector = (ProxyConnector) it.next();
+            ArchivaRepository targetRepository = connector.getTargetRepository();
+            try
+            {
+                BidirectionalRepositoryLayout targetLayout = layoutFactory.getLayout( targetRepository.getLayoutType() );
+                String targetPath = targetLayout.toPath( metadata ) + FILENAME_MAVEN_METADATA;
+
+                if ( transferFile( connector, targetRepository, targetPath, localFile, false ) )
+                {
+                    // Transfer was successful.  return.
+                    return true;
+                }
+            }
+            catch ( LayoutException e )
+            {
+                getLogger().error( "Unable to proxy due to bad layout definition: " + e.getMessage(), e );
+                return false;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * Perform the transfer of the file.
+     * 
+     * @param connector
+     * @param targetRepository
+     * @param targetPath
+     * @param localFile
+     * @param isSnapshot
+     * @return
+     * @throws ProxyException 
+     */
+    private boolean transferFile( ProxyConnector connector, ArchivaRepository targetRepository, String targetPath,
+                                  File localFile, boolean isSnapshot )
+        throws ProxyException
+    {
+        if ( isSnapshot )
+        {
+            // Handle Snapshot Policy
+            if ( !updatePolicy.applyPolicy( connector.getSnapshotsPolicy(), localFile ) )
+            {
+                return false;
+            }
+        }
+        else
+        {
+            // Handle Release Policy
+            if ( !updatePolicy.applyPolicy( connector.getReleasesPolicy(), localFile ) )
+            {
+                return false;
+            }
+        }
+
+        // Is a whitelist defined?
+        if ( CollectionUtils.isNotEmpty( connector.getWhitelist() ) )
+        {
+            // Path must belong to whitelist.
+            if ( !matchesPattern( targetPath, connector.getWhitelist() ) )
+            {
+                getLogger().debug( "Path [" + targetPath + "] is not part of defined whitelist (skipping transfer)." );
+                return false;
+            }
+        }
+
+        // Is target path part of blacklist?
+        if ( matchesPattern( targetPath, connector.getBlacklist() ) )
+        {
+            getLogger().debug( "Path [" + targetPath + "] is part of blacklist (skipping transfer)." );
+            return false;
+        }
+
+        // Transfer the file.
+        Wagon wagon = null;
+
+        try
+        {
+            File temp = new File( localFile.getAbsolutePath() + ".tmp" );
+            temp.deleteOnExit();
+
+            String protocol = targetRepository.getUrl().getProtocol();
+            wagon = (Wagon) wagons.get( protocol );
+            if ( wagon == null )
+            {
+                throw new ProxyException( "Unsupported target repository protocol: " + protocol );
+            }
+
+            boolean connected = connectToRepository( connector, wagon, targetRepository );
+            if ( connected )
+            {
+                if ( localFile.exists() )
+                {
+                    getLogger().debug( "Retrieving " + targetPath + " from " + targetRepository.getName() );
+                    wagon.get( targetPath, temp );
+                }
+                else
+                {
+                    getLogger().debug(
+                                       "Retrieving " + targetPath + " from " + targetRepository.getName()
+                                           + " if updated" );
+                    wagon.getIfNewer( targetPath, temp, localFile.lastModified() );
+                }
+
+                // temp won't exist if we called getIfNewer and it was older, but its still a successful return
+                if ( temp.exists() )
+                {
+                    moveTempToTarget( temp, localFile );
+                }
+                else
+                {
+                    getLogger().debug(
+                                       "Attempt to retrieving " + targetPath + " from " + targetRepository.getName()
+                                           + " failed: local file does not exist." );
+                    return false;
+                }
+
+                getLogger().debug( "Successfully downloaded" );
+            }
+        }
+        catch ( WagonException e )
+        {
+            getLogger().warn( "Download failure:" + e.getMessage(), e );
+            return false;
+        }
+
+        // Handle checksum Policy.
+        return checksumPolicy.applyPolicy( connector.getChecksumPolicy(), localFile );
+    }
+
+    /**
+     * Used to move the temporary file to its real destination.  This is patterned from the way WagonManager handles
+     * its downloaded files.
+     *
+     * @param temp   The completed download file
+     * @param target The final location of the downloaded file
+     * @throws ProxyException when the temp file cannot replace the target file
+     */
+    private void moveTempToTarget( File temp, File target )
+        throws ProxyException
+    {
+        if ( target.exists() && !target.delete() )
+        {
+            throw new ProxyException( "Unable to overwrite existing target file: " + target.getAbsolutePath() );
+        }
+
+        if ( !temp.renameTo( target ) )
+        {
+            getLogger().warn( "Unable to rename tmp file to its final name... resorting to copy command." );
+
+            try
+            {
+                FileUtils.copyFile( temp, target );
+            }
+            catch ( IOException e )
+            {
+                throw new ProxyException( "Cannot copy tmp file to its final location", e );
+            }
+            finally
+            {
+                temp.delete();
+            }
+        }
+    }
+
+    private boolean connectToRepository( ProxyConnector connector, Wagon wagon, ArchivaRepository targetRepository )
+    {
+        boolean connected = false;
+
+        ProxyInfo networkProxy = null;
+        synchronized ( this.networkProxyMap )
+        {
+            networkProxy = (ProxyInfo) this.networkProxyMap.get( connector.getProxyId() );
+        }
+
+        try
+        {
+            Repository wagonRepository = new Repository( targetRepository.getId(), targetRepository.getUrl().toString() );
+            if ( networkProxy != null )
+            {
+                wagon.connect( wagonRepository, networkProxy );
+            }
+            else
+            {
+                wagon.connect( wagonRepository );
+            }
+            connected = true;
+        }
+        catch ( ConnectionException e )
+        {
+            getLogger().info( "Could not connect to " + targetRepository.getName() + ": " + e.getMessage() );
+        }
+        catch ( AuthenticationException e )
+        {
+            getLogger().info( "Could not connect to " + targetRepository.getName() + ": " + e.getMessage() );
+        }
+
+        return connected;
+    }
+
+    private boolean matchesPattern( String path, List patterns )
+    {
+        if ( CollectionUtils.isEmpty( patterns ) )
+        {
+            return false;
+        }
+
+        Iterator it = patterns.iterator();
+        while ( it.hasNext() )
+        {
+            String pattern = (String) it.next();
+            if ( SelectorUtils.matchPath( pattern, path, false ) )
+            {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    public List getProxyConnectors( ArchivaRepository repository )
+    {
+        synchronized ( this.proxyConnectorMap )
+        {
+            List ret = (List) this.proxyConnectorMap.get( repository.getId() );
+            if ( ret == null )
+            {
+                return Collections.EMPTY_LIST;
+            }
+            return ret;
+        }
+    }
+
+    public boolean hasProxies( ArchivaRepository repository )
+    {
+        synchronized ( this.proxyConnectorMap )
+        {
+            return this.proxyConnectorMap.containsKey( repository.getId() );
+        }
+    }
+
+    public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
+    {
+        if ( propertyNameTriggers.contains( propertyName ) )
+        {
+            initConnectorsAndNetworkProxies();
+        }
+    }
+
+    public void beforeConfigurationChange( Registry registry, String propertyName, Object propertyValue )
+    {
+        /* do nothing */
+    }
+
+    private void initConnectorsAndNetworkProxies()
+    {
+        Iterator it;
+
+        synchronized ( this.proxyConnectorMap )
+        {
+            this.proxyConnectorMap.clear();
+
+            List proxyConfigs = archivaConfiguration.getConfiguration().getProxyConnectors();
+            it = proxyConfigs.iterator();
+            while ( it.hasNext() )
+            {
+                RepositoryProxyConnectorConfiguration proxyConfig = (RepositoryProxyConnectorConfiguration) it.next();
+                String key = proxyConfig.getSourceRepoId();
+
+                // Create connector object.
+                ProxyConnector connector = new ProxyConnector();
+                connector.setSourceRepository( getRepository( proxyConfig.getSourceRepoId() ) );
+                connector.setTargetRepository( getRepository( proxyConfig.getTargetRepoId() ) );
+                connector.setSnapshotsPolicy( proxyConfig.getSnapshotsPolicy() );
+                connector.setReleasesPolicy( proxyConfig.getReleasesPolicy() );
+                connector.setChecksumPolicy( proxyConfig.getChecksumPolicy() );
+
+                // Copy any blacklist patterns.
+                List blacklist = new ArrayList();
+                if ( !CollectionUtils.isEmpty( proxyConfig.getBlackListPatterns() ) )
+                {
+                    blacklist.addAll( proxyConfig.getBlackListPatterns() );
+                }
+                connector.setBlacklist( blacklist );
+
+                // Copy any whitelist patterns.
+                List whitelist = new ArrayList();
+                if ( !CollectionUtils.isEmpty( proxyConfig.getWhiteListPatterns() ) )
+                {
+                    whitelist.addAll( proxyConfig.getWhiteListPatterns() );
+                }
+                connector.setWhitelist( whitelist );
+
+                // Get other connectors
+                List connectors = (List) this.proxyConnectorMap.get( key );
+                if ( connectors == null )
+                {
+                    // Create if we are the first.
+                    connectors = new ArrayList();
+                }
+
+                // Add the connector.
+                connectors.add( connector );
+
+                // Set the key to the list of connectors.
+                this.proxyConnectorMap.put( key, connectors );
+            }
+        }
+
+        synchronized ( this.networkProxyMap )
+        {
+            this.networkProxyMap.clear();
+
+            List networkProxies = archivaConfiguration.getConfiguration().getNetworkProxies();
+            it = networkProxies.iterator();
+            while ( it.hasNext() )
+            {
+                NetworkProxyConfiguration networkProxyConfig = (NetworkProxyConfiguration) it.next();
+                String key = networkProxyConfig.getId();
+
+                ProxyInfo proxy = new ProxyInfo();
+
+                proxy.setType( networkProxyConfig.getProtocol() );
+                proxy.setHost( networkProxyConfig.getHost() );
+                proxy.setPort( networkProxyConfig.getPort() );
+                proxy.setUserName( networkProxyConfig.getUsername() );
+                proxy.setPassword( networkProxyConfig.getPassword() );
+
+                this.networkProxyMap.put( key, proxy );
+            }
+        }
+    }
+
+    private ArchivaRepository getRepository( String repoId )
+    {
+        RepositoryConfiguration repoConfig = archivaConfiguration.getConfiguration().findRepositoryById( repoId );
+        if ( repoConfig == null )
+        {
+            return null;
+        }
+
+        ArchivaRepository repo = new ArchivaRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getUrl() );
+        return repo;
+    }
+
+    public void initialize()
+        throws InitializationException
+    {
+        propertyNameTriggers.add( "repositories" );
+        propertyNameTriggers.add( "repository" );
+        propertyNameTriggers.add( "id" );
+        propertyNameTriggers.add( "name" );
+        propertyNameTriggers.add( "url" );
+        propertyNameTriggers.add( "layout" );
+        propertyNameTriggers.add( "releases" );
+        propertyNameTriggers.add( "snapshots" );
+        propertyNameTriggers.add( "indexed" );
+
+        propertyNameTriggers.add( "proxyConnectors" );
+        propertyNameTriggers.add( "proxyConnector" );
+        propertyNameTriggers.add( "sourceRepoId" );
+        propertyNameTriggers.add( "targetRepoId" );
+        propertyNameTriggers.add( "proxyId" );
+        propertyNameTriggers.add( "snapshotsPolicy" );
+        propertyNameTriggers.add( "releasePolicy" );
+        propertyNameTriggers.add( "checksumPolicy" );
+        propertyNameTriggers.add( "whiteListPatterns" );
+        propertyNameTriggers.add( "whiteListPattern" );
+        propertyNameTriggers.add( "blackListPatterns" );
+        propertyNameTriggers.add( "blackListPattern" );
+
+        propertyNameTriggers.add( "networkProxies" );
+        propertyNameTriggers.add( "networkProxy" );
+        propertyNameTriggers.add( "protocol" );
+        propertyNameTriggers.add( "host" );
+        propertyNameTriggers.add( "port" );
+        propertyNameTriggers.add( "username" );
+        propertyNameTriggers.add( "password" );
+
+        archivaConfiguration.addChangeListener( this );
+        initConnectorsAndNetworkProxies();
+    }
+}

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java?view=auto&rev=527649
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java Wed Apr 11 13:26:34 2007
@@ -0,0 +1,131 @@
+package org.apache.maven.archiva.proxy;
+
+/*
+ * 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.ArchivaRepository;
+import org.apache.maven.archiva.repository.connector.RepositoryConnector;
+
+import java.util.List;
+
+/**
+ * This represents a connector for a repository to repository proxy.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class ProxyConnector
+    implements RepositoryConnector
+{
+    private ArchivaRepository sourceRepository;
+
+    private ArchivaRepository targetRepository;
+
+    private List blacklist;
+
+    private List whitelist;
+
+    private String snapshotsPolicy;
+
+    private String releasesPolicy;
+
+    private String checksumPolicy;
+    
+    private String proxyId;
+
+    public List getBlacklist()
+    {
+        return blacklist;
+    }
+
+    public void setBlacklist( List blacklist )
+    {
+        this.blacklist = blacklist;
+    }
+
+    public ArchivaRepository getSourceRepository()
+    {
+        return sourceRepository;
+    }
+
+    public void setSourceRepository( ArchivaRepository sourceRepository )
+    {
+        this.sourceRepository = sourceRepository;
+    }
+
+    public ArchivaRepository getTargetRepository()
+    {
+        return targetRepository;
+    }
+
+    public void setTargetRepository( ArchivaRepository targetRepository )
+    {
+        this.targetRepository = targetRepository;
+    }
+
+    public List getWhitelist()
+    {
+        return whitelist;
+    }
+
+    public void setWhitelist( List whitelist )
+    {
+        this.whitelist = whitelist;
+    }
+
+    public String getChecksumPolicy()
+    {
+        return checksumPolicy;
+    }
+
+    public void setChecksumPolicy( String failurePolicy )
+    {
+        this.checksumPolicy = failurePolicy;
+    }
+
+    public String getReleasesPolicy()
+    {
+        return releasesPolicy;
+    }
+
+    public void setReleasesPolicy( String releasesPolicy )
+    {
+        this.releasesPolicy = releasesPolicy;
+    }
+
+    public String getSnapshotsPolicy()
+    {
+        return snapshotsPolicy;
+    }
+
+    public void setSnapshotsPolicy( String snapshotsPolicy )
+    {
+        this.snapshotsPolicy = snapshotsPolicy;
+    }
+
+    public String getProxyId()
+    {
+        return proxyId;
+    }
+
+    public void setProxyId( String proxyId )
+    {
+        this.proxyId = proxyId;
+    }
+}

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain