incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r618374 - in /incubator/nmaven/trunk/components: ./ maven-dotnet-extensions/ maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/ maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolch...
Date Mon, 04 Feb 2008 18:50:12 GMT
Author: sisbell
Date: Mon Feb  4 10:50:09 2008
New Revision: 618374

URL: http://svn.apache.org/viewvc?rev=618374&view=rev
Log:
Update toolchain implementation and API.

Added:
    incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/
    incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetConfigurationInfo.java
  (with props)
    incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetProviderInfo.java
  (with props)
    incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetTagName.java
  (with props)
    incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetToolchain.java
  (with props)
    incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/policies/
    incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/policies/ProgrammingLanguageMatchPolicy.java
  (with props)
    incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/policies/VendorMatchPolicy.java
  (with props)
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainAnnotation.java
  (with props)
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainMatchPolicyAnnotation.java
  (with props)
Removed:
    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/policies/ProgrammingLanguageMatchPolicy.java
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/VendorMatchPolicy.java
Modified:
    incubator/nmaven/trunk/components/maven-dotnet-extensions/pom.xml
    incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/resources/META-INF/nmaven/annotation-resources.txt
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/pom.xml
    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
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainMatchPolicy.java
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/IdMatchPolicy.java
    incubator/nmaven/trunk/components/pom.xml

Modified: incubator/nmaven/trunk/components/maven-dotnet-extensions/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-extensions/pom.xml?rev=618374&r1=618373&r2=618374&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-extensions/pom.xml (original)
+++ incubator/nmaven/trunk/components/maven-dotnet-extensions/pom.xml Mon Feb  4 10:50:09
2008
@@ -45,5 +45,10 @@
       <artifactId>maven-dotnet-core</artifactId>
       <version>${pom.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven.dotnet</groupId>
+      <artifactId>maven-dotnet-toolchain</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
   </dependencies> 
 </project>

Added: incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetConfigurationInfo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetConfigurationInfo.java?rev=618374&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetConfigurationInfo.java
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetConfigurationInfo.java
Mon Feb  4 10:50:09 2008
@@ -0,0 +1,63 @@
+package org.apache.maven.dotnet.extensions.toolchain;
+
+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-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetConfigurationInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetProviderInfo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetProviderInfo.java?rev=618374&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetProviderInfo.java
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetProviderInfo.java
Mon Feb  4 10:50:09 2008
@@ -0,0 +1,79 @@
+package org.apache.maven.dotnet.extensions.toolchain;
+
+import org.apache.maven.dotnet.Vendor;
+import org.apache.maven.dotnet.ProgrammingLanguage;
+import org.apache.maven.dotnet.toolchain.ProviderInfo;
+
+public interface DotnetProviderInfo
+    extends ProviderInfo
+{
+    String getId();
+
+    ProgrammingLanguage getProgrammingLanguage();
+
+    Vendor getVendor();
+
+    void setId(String id);
+    
+    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-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetProviderInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetTagName.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetTagName.java?rev=618374&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetTagName.java
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetTagName.java
Mon Feb  4 10:50:09 2008
@@ -0,0 +1,21 @@
+package org.apache.maven.dotnet.extensions.toolchain;
+
+public enum DotnetTagName
+{
+    Language( "language" ),
+    Vendor( "vendor" ),
+    Version( "version" ),
+    InstallRoot( "installRoot" );
+
+    private final String tagName;
+
+    DotnetTagName( String tagName )
+    {
+        this.tagName = tagName;
+    }
+
+    public String getTagName()
+    {
+        return tagName;
+    }
+}

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

Added: incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetToolchain.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetToolchain.java?rev=618374&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetToolchain.java
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetToolchain.java
Mon Feb  4 10:50:09 2008
@@ -0,0 +1,84 @@
+package org.apache.maven.dotnet.extensions.toolchain;
+
+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.apache.maven.dotnet.toolchain.ToolchainAnnotation;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+import java.util.List;
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.io.File;
+
+@ToolchainAnnotation(toolchainType = "dotnet")
+public class DotnetToolchain
+    implements Toolchain
+{
+    private ToolchainModel toolchainModel;
+
+    private DotnetProviderInfo toolchainProvider;
+
+    private DotnetConfigurationInfo toolchainConfiguration;
+
+    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( DotnetTagName.Vendor.getTagName() ) )
+            {
+                toolchainProvider.setVendor( Vendor.valueOf( dom.getValue() ) );
+            }
+            else if ( dom.getName().equals( DotnetTagName.Version.getTagName() ) )
+            {
+
+            }
+            else if ( dom.getName().equals( DotnetTagName.Language.getTagName()) )
+            {
+                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-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetToolchain.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/policies/ProgrammingLanguageMatchPolicy.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/policies/ProgrammingLanguageMatchPolicy.java?rev=618374&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/policies/ProgrammingLanguageMatchPolicy.java
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/policies/ProgrammingLanguageMatchPolicy.java
Mon Feb  4 10:50:09 2008
@@ -0,0 +1,35 @@
+package org.apache.maven.dotnet.extensions.toolchain.policies;
+
+import org.apache.maven.dotnet.ProgrammingLanguage;
+import org.apache.maven.dotnet.extensions.toolchain.DotnetToolchain;
+import org.apache.maven.dotnet.toolchain.Toolchain;
+import org.apache.maven.dotnet.toolchain.ToolchainMatchPolicy;
+import org.apache.maven.dotnet.toolchain.ToolchainMatchPolicyAnnotation;
+
+@ToolchainMatchPolicyAnnotation(tagName = "language", toolchainType = "dotnet")
+public class ProgrammingLanguageMatchPolicy
+    implements ToolchainMatchPolicy
+{
+    private ProgrammingLanguage programmingLanguage;
+
+    public ProgrammingLanguageMatchPolicy( String programmingLanguage )
+    {
+        //TODO:
+    }
+
+    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-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/policies/ProgrammingLanguageMatchPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/policies/VendorMatchPolicy.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/policies/VendorMatchPolicy.java?rev=618374&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/policies/VendorMatchPolicy.java
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/policies/VendorMatchPolicy.java
Mon Feb  4 10:50:09 2008
@@ -0,0 +1,35 @@
+package org.apache.maven.dotnet.extensions.toolchain.policies;
+
+import org.apache.maven.dotnet.Vendor;
+import org.apache.maven.dotnet.extensions.toolchain.DotnetToolchain;
+import org.apache.maven.dotnet.toolchain.Toolchain;
+import org.apache.maven.dotnet.toolchain.ToolchainMatchPolicy;
+import org.apache.maven.dotnet.toolchain.ToolchainMatchPolicyAnnotation;
+
+@ToolchainMatchPolicyAnnotation(tagName = "vendor", toolchainType = "dotnet")
+public class VendorMatchPolicy
+    implements ToolchainMatchPolicy
+{
+    private Vendor vendor;
+
+    public VendorMatchPolicy(String vendor)
+    {
+        //TODO:
+    }
+
+    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-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/policies/VendorMatchPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/resources/META-INF/nmaven/annotation-resources.txt
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/resources/META-INF/nmaven/annotation-resources.txt?rev=618374&r1=618373&r2=618374&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/resources/META-INF/nmaven/annotation-resources.txt
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/resources/META-INF/nmaven/annotation-resources.txt
Mon Feb  4 10:50:09 2008
@@ -1,4 +1,8 @@
 org.apache.maven.dotnet.extensions.assembler.DefaultAssemblyInfoMarshaller
 org.apache.maven.dotnet.extensions.assembler.JavaAssemblyInfoMarshaller
 org.apache.maven.dotnet.extensions.assembler.VBAssemblyInfoMarshaller
-org.apache.maven.dotnet.extensions.compiler.CSharpClassCompiler
\ No newline at end of file
+org.apache.maven.dotnet.extensions.compiler.CSharpClassCompiler
+org.apache.maven.dotnet.toolchain.policies.IdMatchPolicy
+org.apache.maven.dotnet.extensions.toolchain.policies.ProgrammingLanguageMatchPolicy
+org.apache.maven.dotnet.extensions.toolchain.policies.VendorMatchPolicy
+org.apache.maven.dotnet.extensions.toolchain.DotnetToolchain
\ No newline at end of file

Modified: incubator/nmaven/trunk/components/maven-dotnet-toolchain/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-toolchain/pom.xml?rev=618374&r1=618373&r2=618374&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-toolchain/pom.xml (original)
+++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/pom.xml Mon Feb  4 10:50:09 2008
@@ -18,17 +18,23 @@
 specific language governing permissions and limitations
 under the License.
 -->
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">  
-  <parent> 
-    <groupId>org.apache.maven.dotnet</groupId>  
-    <version>0.15-incubating-SNAPSHOT</version>  
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.apache.maven.dotnet</groupId>
+    <version>0.15-incubating-SNAPSHOT</version>
     <artifactId>maven-dotnet-components</artifactId>
-  </parent>  
-  <modelVersion>4.0.0</modelVersion>  
-  <groupId>org.apache.maven.dotnet</groupId>  
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.dotnet</groupId>
   <artifactId>maven-dotnet-toolchain</artifactId>
   <name>maven-dotnet-toolchain</name>
   <description>NMaven</description>
   <dependencies>
-  </dependencies> 
+    <dependency>
+      <groupId>org.apache.maven.dotnet</groupId>
+      <artifactId>maven-dotnet-toolchain-model</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+  </dependencies>
 </project>

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=618374&r1=618373&r2=618374&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
Mon Feb  4 10:50:09 2008
@@ -6,8 +6,6 @@
 {
     ConfigurationInfo getConfigurationInfo();
 
-    ToolchainModel getToolchainModel();
-
     ProviderInfo getProviderInfo();
 
     void init( ToolchainModel toolchainModel );

Added: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainAnnotation.java?rev=618374&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainAnnotation.java
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainAnnotation.java
Mon Feb  4 10:50:09 2008
@@ -0,0 +1,13 @@
+package org.apache.maven.dotnet.toolchain;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface ToolchainAnnotation
+{
+    String toolchainType();
+}

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

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=618374&r1=618373&r2=618374&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
Mon Feb  4 10:50:09 2008
@@ -2,17 +2,26 @@
 
 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;
 import java.util.ArrayList;
+import java.util.Map;
+import java.util.Enumeration;
+import java.net.URL;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
 
 public class ToolchainContext
 {
     private PersistedToolchains toolchainModels;
 
+    private Class toolchainClass;
+
+    private List<Class> matchPolicyClasses;
+
     public Toolchain getToolchainById( String id )
         throws ToolchainNotFoundException
     {
@@ -34,31 +43,96 @@
         return (Toolchain) toolchains.toArray()[0];
     }
 
+    public Collection<ToolchainMatchPolicy> getToolchainMatchPoliciesForParameters(
Map<String, String> parameters )
+    {
+        List<ToolchainMatchPolicy> toolchainMatchPolicies = new ArrayList<ToolchainMatchPolicy>();
+
+        for ( String key : parameters.keySet() )
+        {
+            for ( Class matchPolicyClass : matchPolicyClasses )
+            {
+                ToolchainMatchPolicyAnnotation matchAnnotation =
+                    (ToolchainMatchPolicyAnnotation) matchPolicyClass.getAnnotation(
+                        ToolchainMatchPolicyAnnotation.class );
+                if ( matchAnnotation != null && matchAnnotation.tagName().equals(
key ) )
+                {
+                    //TODO:
+                    //instantiate
+                    //add to collection
+                }
+            }
+        }
+        return toolchainMatchPolicies;
+    }
+
     public Collection<Toolchain> getToolchainsFor( Collection<ToolchainMatchPolicy>
toolchainMatchPolicies )
     {
         List<Toolchain> toolchains = new ArrayList<Toolchain>();
         for ( ToolchainModel model : (List<ToolchainModel>) toolchainModels.getToolchains()
)
         {
-            Toolchain toolchain = new DotnetToolchain();//exact type should be configured
in toolchains.xml
+            Toolchain toolchain = null;// = new DotnetToolchain();//TODO:
             toolchain.init( model );
 
             if ( toolchainMatchPolicies == null || isMatch( toolchain, toolchainMatchPolicies
) )
             {
                 toolchains.add( toolchain );
             }
-
         }
         return toolchains;
     }
 
-    public void init( PersistedToolchains toolchainModels )
+    public void init( PersistedToolchains toolchainModels, String toolchainType )
+        throws IOException
     {
         if ( toolchainModels == null )
         {
             throw new IllegalArgumentException( "toolchainModels" );
         }
 
+        if ( toolchainType == null )
+        {
+            throw new IllegalArgumentException( "toolchainType" );
+        }
+
         this.toolchainModels = toolchainModels;
+        this.matchPolicyClasses = new ArrayList<Class>();
+
+        Enumeration<URL> resources =
+            this.getClass().getClassLoader().getResources( "/META-INF/nmaven/annotation-resources.txt"
);
+
+        while ( resources.hasMoreElements() )
+        {
+            URL url = resources.nextElement();
+            BufferedReader reader = new BufferedReader( new InputStreamReader( url.openStream()
) );
+            String annotatedClassName;
+            while ( ( annotatedClassName = reader.readLine() ) != null )
+            {
+                Class annotatedClass;
+                try
+                {
+                    annotatedClass = Class.forName( annotatedClassName );
+                }
+                catch ( ClassNotFoundException e )
+                {
+                    throw new IOException( e.getMessage() );
+                }
+
+                ToolchainAnnotation annotation =
+                    (ToolchainAnnotation) annotatedClass.getAnnotation( ToolchainAnnotation.class
);
+                if ( annotation != null && annotation.toolchainType().equals( toolchainType
) )
+                {
+                    toolchainClass = annotatedClass;
+                }
+
+                ToolchainMatchPolicyAnnotation matchAnnotation =
+                    (ToolchainMatchPolicyAnnotation) annotatedClass.getAnnotation(
+                        ToolchainMatchPolicyAnnotation.class );
+                if ( matchAnnotation != null && matchAnnotation.toolchainType().equals(
toolchainType ) )
+                {
+                    matchPolicyClasses.add( annotatedClass );
+                }
+            }
+        }
     }
 
     private static boolean isMatch( Toolchain toolchain, Collection<ToolchainMatchPolicy>
toolchainMatchPolicies )

Modified: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainMatchPolicy.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainMatchPolicy.java?rev=618374&r1=618373&r2=618374&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainMatchPolicy.java
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainMatchPolicy.java
Mon Feb  4 10:50:09 2008
@@ -3,4 +3,5 @@
 public interface ToolchainMatchPolicy
 {
     boolean match( Toolchain toolchain );
+
 }

Added: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainMatchPolicyAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainMatchPolicyAnnotation.java?rev=618374&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainMatchPolicyAnnotation.java
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainMatchPolicyAnnotation.java
Mon Feb  4 10:50:09 2008
@@ -0,0 +1,15 @@
+package org.apache.maven.dotnet.toolchain;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface ToolchainMatchPolicyAnnotation
+{
+    String tagName();
+
+    String toolchainType();
+}

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

Modified: 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=618374&r1=618373&r2=618374&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/IdMatchPolicy.java
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/policies/IdMatchPolicy.java
Mon Feb  4 10:50:09 2008
@@ -2,7 +2,9 @@
 
 import org.apache.maven.dotnet.toolchain.ToolchainMatchPolicy;
 import org.apache.maven.dotnet.toolchain.Toolchain;
+import org.apache.maven.dotnet.toolchain.ToolchainMatchPolicyAnnotation;
 
+@ToolchainMatchPolicyAnnotation(tagName = "id", toolchainType = "any")
 public class IdMatchPolicy
     implements ToolchainMatchPolicy
 {

Modified: incubator/nmaven/trunk/components/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/pom.xml?rev=618374&r1=618373&r2=618374&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/pom.xml (original)
+++ incubator/nmaven/trunk/components/pom.xml Mon Feb  4 10:50:09 2008
@@ -38,6 +38,8 @@
     <module>maven-dotnet-core</module>
     <module>maven-dotnet-compiler</module>
     <module>maven-dotnet-extensions</module>
+    <module>maven-dotnet-toolchain</module>
+    <module>maven-dotnet-toolchain-model</module>
   </modules>
   <profiles>
     <profile>



Mime
View raw message