incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r616516 - in /incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain: ./ model/ policies/
Date Tue, 29 Jan 2008 20:53:56 GMT
Author: sisbell
Date: Tue Jan 29 12:53:42 2008
New Revision: 616516

URL: http://svn.apache.org/viewvc?rev=616516&view=rev
Log:
Changed the toolchain model. Complete impl.

Added:
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ConfigurationInfo.java
  (with props)
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ProviderInfo.java
  (with props)
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainNotFoundException.java
  (with props)
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/model/
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/model/DotnetConfigurationInfo.java
  (with props)
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/model/DotnetProviderInfo.java
  (with props)
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/model/DotnetToolchain.java
  (with props)
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/IdMatchPolicy.java
  (with props)
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/ProgrammingLanguageMatchPolicy.java
  (with props)
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/VendorMatchPolicy.java
  (with props)
Removed:
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/DotnetToolchain.java
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ProgrammingLanguageMatchPolicy.java
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/VendorMatchPolicy.java
Modified:
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/Toolchain.java
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainContext.java

Added: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ConfigurationInfo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ConfigurationInfo.java?rev=616516&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ConfigurationInfo.java
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ConfigurationInfo.java
Tue Jan 29 12:53:42 2008
@@ -0,0 +1,5 @@
+package org.apache.maven.dotnet.toolchain;
+
+public interface ConfigurationInfo
+{
+}

Propchange: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ConfigurationInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ProviderInfo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ProviderInfo.java?rev=616516&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ProviderInfo.java
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ProviderInfo.java
Tue Jan 29 12:53:42 2008
@@ -0,0 +1,6 @@
+package org.apache.maven.dotnet.toolchain;
+
+public interface ProviderInfo
+{
+    String getId();
+}

Propchange: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ProviderInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/Toolchain.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/Toolchain.java?rev=616516&r1=616515&r2=616516&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/Toolchain.java
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/Toolchain.java
Tue Jan 29 12:53:42 2008
@@ -4,7 +4,13 @@
 
 public interface Toolchain
 {
+    ConfigurationInfo getConfigurationInfo();
+
     ToolchainModel getToolchainModel();
 
-    public void init(ToolchainModel toolchainModel);
+    ProviderInfo getProviderInfo();
+
+    void init( ToolchainModel toolchainModel );
+
+    boolean verifyToolchain();
 }

Modified: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainContext.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainContext.java?rev=616516&r1=616515&r2=616516&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainContext.java
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainContext.java
Tue Jan 29 12:53:42 2008
@@ -2,6 +2,8 @@
 
 import org.apache.maven.toolchain.model.ToolchainModel;
 import org.apache.maven.toolchain.model.PersistedToolchains;
+import org.apache.maven.dotnet.toolchain.model.DotnetToolchain;
+import org.apache.maven.dotnet.toolchain.policies.IdMatchPolicy;
 
 import java.util.Collection;
 import java.util.List;
@@ -11,6 +13,27 @@
 {
     private PersistedToolchains toolchainModels;
 
+    public Toolchain getToolchainById( String id )
+        throws ToolchainNotFoundException
+    {
+        if ( id == null )
+        {
+            throw new IllegalArgumentException( "id" );
+        }
+
+        List<ToolchainMatchPolicy> matchPolicies = new ArrayList<ToolchainMatchPolicy>();
+        matchPolicies.add( new IdMatchPolicy( id ) );
+
+        Collection<Toolchain> toolchains = this.getToolchainsFor( matchPolicies );
+
+        if ( toolchains.toArray().length > 1 )
+        {
+            throw new ToolchainNotFoundException();
+        }
+
+        return (Toolchain) toolchains.toArray()[0];
+    }
+
     public Collection<Toolchain> getToolchainsFor( Collection<ToolchainMatchPolicy>
toolchainMatchPolicies )
     {
         List<Toolchain> toolchains = new ArrayList<Toolchain>();
@@ -28,6 +51,16 @@
         return toolchains;
     }
 
+    public void init( PersistedToolchains toolchainModels )
+    {
+        if ( toolchainModels == null )
+        {
+            throw new IllegalArgumentException( "toolchainModels" );
+        }
+
+        this.toolchainModels = toolchainModels;
+    }
+
     private static boolean isMatch( Toolchain toolchain, Collection<ToolchainMatchPolicy>
toolchainMatchPolicies )
     {
         for ( ToolchainMatchPolicy policy : toolchainMatchPolicies )
@@ -38,15 +71,5 @@
             }
         }
         return true;
-    }
-
-    public void init( PersistedToolchains toolchainModels )
-    {
-        if ( toolchainModels == null )
-        {
-            throw new IllegalArgumentException( "toolchainModels" );
-        }
-
-        this.toolchainModels = toolchainModels;
     }
 }

Added: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainNotFoundException.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainNotFoundException.java?rev=616516&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainNotFoundException.java
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainNotFoundException.java
Tue Jan 29 12:53:42 2008
@@ -0,0 +1,5 @@
+package org.apache.maven.dotnet.toolchain;
+
+public class ToolchainNotFoundException extends Exception
+{
+}

Propchange: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainNotFoundException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/model/DotnetConfigurationInfo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/model/DotnetConfigurationInfo.java?rev=616516&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/model/DotnetConfigurationInfo.java
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/model/DotnetConfigurationInfo.java
Tue Jan 29 12:53:42 2008
@@ -0,0 +1,64 @@
+package org.apache.maven.dotnet.toolchain.model;
+
+import org.apache.maven.dotnet.toolchain.ConfigurationInfo;
+
+import java.io.File;
+
+
+public interface DotnetConfigurationInfo
+    extends ConfigurationInfo
+{
+    File getGacRoot();
+
+    File getInstallRoot();
+
+    void setGacRoot( File gacRoot );
+
+    void setInstallRoot( File installRoot );
+
+    public static class Factory
+    {
+        /**
+         * Constructor
+         */
+        private Factory()
+        {
+        }
+
+        /**
+         * Returns a default instance of toolchain configuration
+         *
+         * @return a default instance of toolchain configuration
+         */
+        public static DotnetConfigurationInfo createDefaultDotnetConfigurationInfo()
+        {
+            return new DotnetConfigurationInfo()
+            {
+                private File gacRoot;
+
+                private File installRoot;
+
+                public File getGacRoot()
+                {
+                    return gacRoot;
+                }
+
+                public File getInstallRoot()
+                {
+                    return installRoot;
+                }
+
+                public void setGacRoot( File gacRoot )
+                {
+                    this.gacRoot = gacRoot;
+                }
+
+                public void setInstallRoot( File installRoot )
+                {
+                    this.installRoot = installRoot;
+                }
+            };
+        }
+    }
+
+}

Propchange: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/model/DotnetConfigurationInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/model/DotnetProviderInfo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/model/DotnetProviderInfo.java?rev=616516&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/model/DotnetProviderInfo.java
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/model/DotnetProviderInfo.java
Tue Jan 29 12:53:42 2008
@@ -0,0 +1,75 @@
+package org.apache.maven.dotnet.toolchain.model;
+
+import org.apache.maven.dotnet.Vendor;
+import org.apache.maven.dotnet.ProgrammingLanguage;
+import org.apache.maven.dotnet.toolchain.ProviderInfo;
+
+public interface DotnetProviderInfo
+    extends ProviderInfo
+{
+    ProgrammingLanguage getProgrammingLanguage();
+
+    Vendor getVendor();
+
+    void setProgrammingLanguage(ProgrammingLanguage programmingLanguage);
+
+    void setVendor(Vendor vendor);
+
+    public static class Factory
+    {
+        /**
+         * Constructor
+         */
+        private Factory()
+        {
+        }
+
+        /**
+         * Returns a default instance of toolchain configuration
+         *
+         * @return a default instance of toolchain configuration
+         */
+        public static DotnetProviderInfo createDefaultDotnetProviderInfo()
+        {
+            return new DotnetProviderInfo()
+            {
+                private String id;
+
+                private ProgrammingLanguage programmingLanguage;
+
+                private Vendor vendor;
+
+                public String getId()
+                {
+                    return id;
+                }
+
+                public void setId(String id)
+                {
+                    this.id = id;
+                }
+
+                public ProgrammingLanguage getProgrammingLanguage()
+                {
+                    return programmingLanguage;
+                }
+
+                public Vendor getVendor()
+                {
+                    return vendor;
+                }
+
+                public void setProgrammingLanguage( ProgrammingLanguage programmingLanguage
)
+                {
+                    this.programmingLanguage = programmingLanguage;
+                }
+
+                public void setVendor( Vendor vendor )
+                {
+                    this.vendor = vendor;
+                }
+            };
+
+        }
+    }
+}

Propchange: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/model/DotnetProviderInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/model/DotnetToolchain.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/model/DotnetToolchain.java?rev=616516&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/model/DotnetToolchain.java
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/model/DotnetToolchain.java
Tue Jan 29 12:53:42 2008
@@ -0,0 +1,87 @@
+package org.apache.maven.dotnet.toolchain.model;
+
+import org.apache.maven.toolchain.model.ToolchainModel;
+import org.apache.maven.dotnet.Vendor;
+import org.apache.maven.dotnet.ProgrammingLanguage;
+import org.apache.maven.dotnet.toolchain.Toolchain;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+import java.util.List;
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.io.File;
+
+public class DotnetToolchain
+    implements Toolchain
+{
+    private ToolchainModel toolchainModel;
+
+    private DotnetProviderInfo toolchainProvider;
+
+    private DotnetConfigurationInfo toolchainConfiguration;
+
+    public ToolchainModel getToolchainModel()
+    {
+        return toolchainModel;
+    }
+
+    public DotnetProviderInfo getProviderInfo()
+    {
+        return toolchainProvider;
+    }
+
+    public DotnetConfigurationInfo getConfigurationInfo()
+    {
+        return toolchainConfiguration;
+    }
+
+    public void init( ToolchainModel toolchainModel )
+    {
+        if ( toolchainModel == null )
+        {
+            throw new IllegalArgumentException( "toolchainModel" );
+        }
+
+        this.toolchainModel = toolchainModel;
+        toolchainProvider = DotnetProviderInfo.Factory.createDefaultDotnetProviderInfo();
+        toolchainConfiguration = DotnetConfigurationInfo.Factory.createDefaultDotnetConfigurationInfo();
+
+        Xpp3Dom providesModel = (Xpp3Dom) toolchainModel.getProvides();
+        List<Xpp3Dom> provides = new ArrayList<Xpp3Dom>( Arrays.asList( providesModel.getChildren()
) );
+        for ( Xpp3Dom dom : provides )
+        {
+            if ( dom.getName().equals( "vendor" ) )
+            {
+                toolchainProvider.setVendor( Vendor.valueOf( dom.getValue() ) );
+            }
+            else if ( dom.getName().equals( "version" ) )
+            {
+
+            }
+            else if ( dom.getName().equals( "language" ) )
+            {
+                toolchainProvider.setProgrammingLanguage( ProgrammingLanguage.valueOf( dom.getValue()
) );
+            }
+        }
+
+        Xpp3Dom configurationModel = (Xpp3Dom) toolchainModel.getConfiguration();
+        List<Xpp3Dom> configurations = new ArrayList<Xpp3Dom>( Arrays.asList(
configurationModel.getChildren() ) );
+        for ( Xpp3Dom dom : configurations )
+        {
+            if ( dom.getName().equals( "installRoot" ) )
+            {
+                toolchainConfiguration.setInstallRoot( new File( dom.getValue() ) );
+            }
+            else if ( dom.getName().equals( "gacRoot" ) )
+            {
+                toolchainConfiguration.setGacRoot( new File( dom.getValue() ) );
+            }
+        }
+    }
+
+    public boolean verifyToolchain()
+    {
+        return true;
+        //return ( installRoot != null && installRoot.exists() && vendor
!= null && !vendor.equals( Vendor.NULL ) );
+    }
+}

Propchange: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/model/DotnetToolchain.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/IdMatchPolicy.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/IdMatchPolicy.java?rev=616516&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/IdMatchPolicy.java
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/IdMatchPolicy.java
Tue Jan 29 12:53:42 2008
@@ -0,0 +1,26 @@
+package org.apache.maven.dotnet.toolchain.policies;
+
+import org.apache.maven.dotnet.toolchain.ToolchainMatchPolicy;
+import org.apache.maven.dotnet.toolchain.Toolchain;
+
+public class IdMatchPolicy
+    implements ToolchainMatchPolicy
+{
+
+    private String id;
+
+    public IdMatchPolicy( String id )
+    {
+        this.id = id;
+    }
+
+    public boolean match( Toolchain toolchain )
+    {
+        if ( toolchain == null )
+        {
+            throw new IllegalArgumentException( "toolchain" );
+        }
+
+        return toolchain.getProviderInfo().getId().equals( id );
+    }
+}

Propchange: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/IdMatchPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/ProgrammingLanguageMatchPolicy.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/ProgrammingLanguageMatchPolicy.java?rev=616516&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/ProgrammingLanguageMatchPolicy.java
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/ProgrammingLanguageMatchPolicy.java
Tue Jan 29 12:53:42 2008
@@ -0,0 +1,28 @@
+package org.apache.maven.dotnet.toolchain.policies;
+
+import org.apache.maven.dotnet.ProgrammingLanguage;
+import org.apache.maven.dotnet.toolchain.Toolchain;
+import org.apache.maven.dotnet.toolchain.ToolchainMatchPolicy;
+import org.apache.maven.dotnet.toolchain.model.DotnetToolchain;
+
+public class ProgrammingLanguageMatchPolicy
+    implements ToolchainMatchPolicy
+{
+    private ProgrammingLanguage programmingLanguage;
+
+    public ProgrammingLanguageMatchPolicy( ProgrammingLanguage programmingLanguage )
+    {
+        this.programmingLanguage = programmingLanguage;
+    }
+
+    public boolean match( Toolchain toolchain )
+    {
+        if ( toolchain == null || ! ( toolchain instanceof DotnetToolchain ) )
+        {
+            throw new IllegalArgumentException( "toolchain" );
+        }
+
+        DotnetToolchain dotnetToolchain = (DotnetToolchain) toolchain;
+        return programmingLanguage.equals(dotnetToolchain.getProviderInfo().getProgrammingLanguage());
+    }
+}

Propchange: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/ProgrammingLanguageMatchPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/VendorMatchPolicy.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/VendorMatchPolicy.java?rev=616516&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/VendorMatchPolicy.java
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/VendorMatchPolicy.java
Tue Jan 29 12:53:42 2008
@@ -0,0 +1,28 @@
+package org.apache.maven.dotnet.toolchain.policies;
+
+import org.apache.maven.dotnet.Vendor;
+import org.apache.maven.dotnet.toolchain.Toolchain;
+import org.apache.maven.dotnet.toolchain.ToolchainMatchPolicy;
+import org.apache.maven.dotnet.toolchain.model.DotnetToolchain;
+
+public class VendorMatchPolicy
+    implements ToolchainMatchPolicy
+{
+    private Vendor vendor;
+
+    public VendorMatchPolicy( Vendor vendor )
+    {
+        this.vendor = vendor;
+    }
+
+    public boolean match( Toolchain toolchain )
+    {
+        if ( toolchain == null || ! ( toolchain instanceof DotnetToolchain ) )
+        {
+            throw new IllegalArgumentException( "toolchain" );
+        }
+
+        DotnetToolchain dotnetToolchain = (DotnetToolchain) toolchain;
+        return vendor.equals(dotnetToolchain.getProviderInfo().getVendor());
+    }
+}

Propchange: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/VendorMatchPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message