maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ogusa...@apache.org
Subject svn commit: r762850 - in /maven/mercury/trunk: mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/api/ mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/version/ mercury-md/mercury-md-sat/src/main/java/org/apache/maven/merc...
Date Wed, 08 Apr 2009 04:11:27 GMT
Author: ogusakov
Date: Tue Apr  7 16:59:09 2009
New Revision: 762850

URL: http://svn.apache.org/viewvc?rev=762850&view=rev
Log:
[MERCURY-109] - altered generic configuration mechanism to allow passing in objects, not just
strings

Modified:
    maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/api/Configurable.java
    maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/api/ConfigurationUtil.java
    maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/version/MavenVersionRange.java
    maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyBuilder.java
    maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyBuilderFactory.java
    maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyTreeBuilder.java
    maven/mercury/trunk/mercury-plexus/src/main/java/org/apache/maven/mercury/plexus/DefaultPlexusMercury.java
    maven/mercury/trunk/mercury-util/src/main/java/org/apache/maven/mercury/util/Util.java

Modified: maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/api/Configurable.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/api/Configurable.java?rev=762850&r1=762849&r2=762850&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/api/Configurable.java
(original)
+++ maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/api/Configurable.java
Tue Apr  7 16:59:09 2009
@@ -18,8 +18,6 @@
  */
 package org.apache.maven.mercury.artifact.api;
 
-import java.util.Map;
-
 /**
  * provides a way to configure an object instance, if that object supports the idea
  * 
@@ -35,6 +33,6 @@
      * @param name of the configurable property
      * @param val configuration value
      */
-    public void setOption( String name, String val )
+    public void setOption( String name, Object val )
         throws ConfigurationException;
 }

Modified: maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/api/ConfigurationUtil.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/api/ConfigurationUtil.java?rev=762850&r1=762849&r2=762850&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/api/ConfigurationUtil.java
(original)
+++ maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/api/ConfigurationUtil.java
Tue Apr  7 16:59:09 2009
@@ -30,13 +30,13 @@
  */
 public class ConfigurationUtil
 {
-    public static void configure( Configurable impl, Map<String,String> config )
+    public static void configure( Configurable impl, Map<String,Object> config )
     throws ConfigurationException
     {
         if( impl == null || config == null )
             return;
         
-        for( Map.Entry<String, String> e : config.entrySet() )
+        for( Map.Entry<String, Object> e : config.entrySet() )
             impl.setOption( e.getKey(), e.getValue() );
     }
 }

Modified: maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/version/MavenVersionRange.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/version/MavenVersionRange.java?rev=762850&r1=762849&r2=762850&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/version/MavenVersionRange.java
(original)
+++ maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/version/MavenVersionRange.java
Tue Apr  7 16:59:09 2009
@@ -259,11 +259,11 @@
         return false;
     }
 
-    public void setOption( String name, String val )
+    public void setOption( String name, Object val )
     {
         if ( SYSTEM_PARAMETER_OSGI_VERSION.equals( name ) )
         {
-            _osgiVersion = Boolean.parseBoolean( System.getProperty( val, SYSTEM_PARAMETER_OSGI_VERSION_DEFAULT
) );
+            _osgiVersion = Boolean.parseBoolean( System.getProperty( (String)val, SYSTEM_PARAMETER_OSGI_VERSION_DEFAULT
) );
         }
     }
     

Modified: maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyBuilder.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyBuilder.java?rev=762850&r1=762849&r2=762850&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyBuilder.java
(original)
+++ maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyBuilder.java
Tue Apr  7 16:59:09 2009
@@ -43,6 +43,8 @@
   public static final String TREE_NODE_BUILD_EVENT = "tree.node.build";
 
   public static final String SYSTEM_PROPERTY_ALLOW_CIRCULAR_DEPENDENCIES = "mercury.circular.allow";
+
+  public static final String CONFIGURATION_PROPERTY_VERSION_MAP = "mercury.version.map";
   //------------------------------------------------------------------------
   /**
    * build the tree, using the repositories specified in the

Modified: maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyBuilderFactory.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyBuilderFactory.java?rev=762850&r1=762849&r2=762850&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyBuilderFactory.java
(original)
+++ maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyBuilderFactory.java
Tue Apr  7 16:59:09 2009
@@ -74,7 +74,7 @@
       , Collection<MetadataTreeArtifactFilter> filters
       , List<Comparator<MetadataTreeNode>> comparators
       , Map<String,ArtifactListProcessor> processors
-      , Map<String,String> config 
+      , Map<String,Object> config 
                      )
   throws RepositoryException
   {

Modified: maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyTreeBuilder.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyTreeBuilder.java?rev=762850&r1=762849&r2=762850&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyTreeBuilder.java
(original)
+++ maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyTreeBuilder.java
Tue Apr  7 16:59:09 2009
@@ -90,6 +90,9 @@
     
     private boolean _allowCircularDependencies = Boolean.parseBoolean( System.getProperty(
SYSTEM_PROPERTY_ALLOW_CIRCULAR_DEPENDENCIES, "false" ) );
     
+    /** mandated versions in the format G:A -> V */
+    private Map<String, String> _versionMap;
+    
     class TruckLoad
     {
         List<ArtifactMetadata> cp;
@@ -677,10 +680,13 @@
             _reader.close();
     }
 
-    public void setOption( String name, String val )
+    @SuppressWarnings("unchecked")
+    public void setOption( String name, Object val )
         throws ConfigurationException
     {
         if( SYSTEM_PROPERTY_ALLOW_CIRCULAR_DEPENDENCIES.equals( name ) )
-            _allowCircularDependencies = Boolean.parseBoolean( val );
+            _allowCircularDependencies = Boolean.parseBoolean( (String)val );
+        else if( CONFIGURATION_PROPERTY_VERSION_MAP.equals( name ) )
+            _versionMap = (Map<String, String>) val;
     }
 }

Modified: maven/mercury/trunk/mercury-plexus/src/main/java/org/apache/maven/mercury/plexus/DefaultPlexusMercury.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-plexus/src/main/java/org/apache/maven/mercury/plexus/DefaultPlexusMercury.java?rev=762850&r1=762849&r2=762850&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-plexus/src/main/java/org/apache/maven/mercury/plexus/DefaultPlexusMercury.java
(original)
+++ maven/mercury/trunk/mercury-plexus/src/main/java/org/apache/maven/mercury/plexus/DefaultPlexusMercury.java
Tue Apr  7 16:59:09 2009
@@ -283,7 +283,7 @@
         {
             DependencyBuilder depBuilder =
                 DependencyBuilderFactory.create( DependencyBuilderFactory.JAVA_DEPENDENCY_MODEL,
repos, null, null, null
-                    , Util.mapOf( new String [][] { {DependencyBuilder.SYSTEM_PROPERTY_ALLOW_CIRCULAR_DEPENDENCIES,
""+_allowCircularDependencies} } ) 
+                    , Util.mapOf( new Object [][] { {DependencyBuilder.SYSTEM_PROPERTY_ALLOW_CIRCULAR_DEPENDENCIES,
""+_allowCircularDependencies} } ) 
                                                 );
 
             List<ArtifactMetadata> res = depBuilder.resolveConflicts( scope, artifacts,
inclusions, exclusions );

Modified: maven/mercury/trunk/mercury-util/src/main/java/org/apache/maven/mercury/util/Util.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-util/src/main/java/org/apache/maven/mercury/util/Util.java?rev=762850&r1=762849&r2=762850&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-util/src/main/java/org/apache/maven/mercury/util/Util.java
(original)
+++ maven/mercury/trunk/mercury-util/src/main/java/org/apache/maven/mercury/util/Util.java
Tue Apr  7 16:59:09 2009
@@ -91,15 +91,15 @@
        return (int)(Math.round( sz / 1024.))+" kb";
    }
    
-   public static Map<String,String> mapOf( String [][] entries )
+   public static Map<String,Object> mapOf( Object [][] entries )
    {
        if( entries == null )
            return null;
        
-       Map<String,String> map = new HashMap<String, String>( entries.length );
+       Map<String,Object> map = new HashMap<String, Object>( entries.length );
        
-       for( String [] kv : entries )
-           map.put( kv[0], kv[1] );
+       for( Object [] kv : entries )
+           map.put( (String)kv[0], kv[1] );
        
        return map;
    }



Mime
View raw message