incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r485313 [6/15] - in /incubator/nmaven/trunk: components/ components/dotnet-artifact/ components/dotnet-artifact/src/ components/dotnet-artifact/src/main/ components/dotnet-artifact/src/main/java/ components/dotnet-artifact/src/main/java/org...
Date Sun, 10 Dec 2006 23:44:12 GMT
Added: incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/impl/DotGNUCompiler.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/impl/DotGNUCompiler.java?view=auto&rev=485313
==============================================================================
--- incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/impl/DotGNUCompiler.java (added)
+++ incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/impl/DotGNUCompiler.java Sun Dec 10 15:43:51 2006
@@ -0,0 +1,156 @@
+/*
+ * 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.
+ */
+package org.apache.maven.dotnet.executable.compiler.impl;
+
+import org.apache.maven.dotnet.executable.ExecutionException;
+import org.apache.maven.dotnet.NMavenContext;
+import org.apache.maven.dotnet.executable.CommandExecutor;
+import org.apache.maven.dotnet.executable.compiler.CompilerConfig;
+import org.apache.maven.dotnet.executable.compiler.CompilerContext;
+import org.apache.maven.dotnet.executable.compiler.InvalidArtifactException;
+import org.apache.maven.dotnet.executable.compiler.CompilerExecutable;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.io.File;
+
+import org.apache.maven.artifact.Artifact;
+import org.codehaus.plexus.logging.Logger;
+
+/**
+ * Compiler for DotGNU.
+ *
+ * @author Shane Isbell
+ */
+public final class DotGNUCompiler
+    implements CompilerExecutable
+{
+
+    private CompilerContext compilerContext;
+
+    private Logger logger;
+
+    public void init( NMavenContext nmavenContext )
+    {
+        this.compilerContext = (CompilerContext) nmavenContext;
+        this.logger = nmavenContext.getLogger();
+    }
+
+    public File getCompiledArtifact()
+        throws InvalidArtifactException
+    {
+        File file = compilerContext.getArtifact();
+        if ( !file.exists() )
+        {
+            throw new InvalidArtifactException(
+                "NMAVEN-069-005: Artifact does not exist: Artifact = " + file.getAbsolutePath() );
+        }
+        return file;
+    }
+
+    public File getExecutionPath()
+    {
+        return ( compilerContext.getNetCompilerConfig().getExecutionPath() != null ) ? new File(
+            compilerContext.getNetCompilerConfig().getExecutionPath() ) : null;
+    }
+
+    public List<String> getCommands()
+        throws ExecutionException
+    {
+        if ( compilerContext == null )
+        {
+            throw new ExecutionException( "NMAVEN-069-000: Compiler has not been initialized with a context" );
+        }
+        CompilerConfig config = compilerContext.getNetCompilerConfig();
+        List<Artifact> resources = compilerContext.getLibraryDependencies();
+        List<Artifact> modules = compilerContext.getDirectModuleDependencies();
+
+        String sourceDirectory = compilerContext.getSourceDirectoryName();
+        String artifactFilePath = compilerContext.getArtifact().getAbsolutePath();
+        String targetArtifactType = config.getArtifactType().getArtifactTypeName();
+
+        List<String> commands = new ArrayList<String>();
+        commands.add( "/out:" + artifactFilePath );
+        commands.add( "/target:" + targetArtifactType );
+        commands.add( "/recurse:" + sourceDirectory + File.separator + "**" );
+        if ( !modules.isEmpty() )
+        {
+            StringBuffer sb = new StringBuffer();
+            for ( Iterator i = modules.iterator(); i.hasNext(); )
+            {
+                Artifact artifact = (Artifact) i.next();
+                String path = artifact.getFile().getAbsolutePath();
+                sb.append( path );
+                if ( i.hasNext() )
+                {
+                    sb.append( ";" );
+                }
+            }
+        }
+        if ( !resources.isEmpty() )
+        {
+            for ( Artifact artifact : resources )
+            {
+                String path = artifact.getFile().getAbsolutePath();
+                commands.add( "/reference:" + path );
+            }
+        }
+
+        for ( File file : compilerContext.getEmbeddedResources() )
+        {
+            commands.add( "/resource:" + file.getAbsolutePath() );
+        }
+        if ( config.getCommands() != null )
+        {
+            commands.addAll( config.getCommands() );
+        }
+        //TODO: Apply command filter
+        return commands;
+    }
+
+    public String getExecutable()
+        throws ExecutionException
+    {
+        if ( compilerContext == null )
+        {
+            throw new ExecutionException( "NMAVEN-069-001: Compiler has not been initialized with a context" );
+        }
+        return compilerContext.getCompilerCapability().getExecutable();
+    }
+
+    public void execute()
+        throws ExecutionException
+    {
+        logger.info( "NMAVEN-069-002: Compiling" );
+        if ( !( new File( compilerContext.getSourceDirectoryName() ).exists() ) )
+        {
+            logger.info( "NMAVEN-069-003: No source files to compile." );
+            return;
+        }
+        CommandExecutor commandExecutor = CommandExecutor.Factory.createDefaultCommmandExecutor();
+        commandExecutor.setLogger( logger );
+        commandExecutor.executeCommand( getExecutable(), getCommands(), getExecutionPath(), true );
+        logger.info( "NMAVEN-069-004: Compiling Artifact: Vendor = " +
+            compilerContext.getCompilerRequirement().getVendor() + ", Language = " +
+            compilerContext.getCompilerRequirement().getVendor() + ", Assembly Name = " +
+            compilerContext.getArtifact().getAbsolutePath() );
+    }
+
+}

Propchange: incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/impl/DotGNUCompiler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/impl/NemerleCompiler.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/impl/NemerleCompiler.java?view=auto&rev=485313
==============================================================================
--- incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/impl/NemerleCompiler.java (added)
+++ incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/impl/NemerleCompiler.java Sun Dec 10 15:43:51 2006
@@ -0,0 +1,144 @@
+/*
+ * 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.
+ */
+package org.apache.maven.dotnet.executable.compiler.impl;
+
+import org.apache.maven.dotnet.executable.ExecutionException;
+import org.apache.maven.dotnet.NMavenContext;
+import org.apache.maven.dotnet.executable.CommandExecutor;
+import org.apache.maven.dotnet.executable.compiler.CompilerConfig;
+import org.apache.maven.dotnet.executable.compiler.CompilerContext;
+import org.apache.maven.dotnet.executable.compiler.InvalidArtifactException;
+import org.apache.maven.dotnet.executable.compiler.CompilerExecutable;
+import org.apache.maven.artifact.Artifact;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.logging.Logger;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.io.File;
+
+/**
+ * Compiler for the Nemerle language (see http://nemerle.org/). Cannot use the DefaultCompiler for Nemerle
+ * because the Nemerle compiler does not support the recurse command.
+ *
+ * @author Shane Isbell
+ */
+public final class NemerleCompiler
+    implements CompilerExecutable
+{
+
+    private CompilerContext compilerContext;
+
+    private Logger logger;
+
+    public void init( NMavenContext nmavenContext )
+    {
+        this.compilerContext = (CompilerContext) nmavenContext;
+        this.logger = nmavenContext.getLogger();
+    }
+
+    public File getExecutionPath()
+    {
+        return ( compilerContext.getNetCompilerConfig().getExecutionPath() != null ) ? new File(
+            compilerContext.getNetCompilerConfig().getExecutionPath() ) : null;
+    }
+
+    public File getCompiledArtifact()
+        throws InvalidArtifactException
+    {
+        File file = compilerContext.getArtifact();
+        if ( !file.exists() )
+        {
+            throw new InvalidArtifactException(
+                "NMAVEN-070-004: Artifact does not exist: Artifact = " + file.getAbsolutePath() );
+        }
+        return file;
+    }
+
+    public List<String> getCommands()
+        throws ExecutionException
+    {
+        CompilerConfig config = compilerContext.getNetCompilerConfig();
+        List<Artifact> resources = compilerContext.getLibraryDependencies();
+        List<Artifact> modules = compilerContext.getDirectModuleDependencies();
+
+        String sourceDirectory = compilerContext.getSourceDirectoryName();
+        String artifactFilePath = compilerContext.getArtifact().getAbsolutePath();
+        String targetArtifactType = config.getArtifactType().getArtifactTypeName();
+
+        List<String> commands = new ArrayList<String>();
+        commands.add( "/out:" + artifactFilePath );
+        commands.add( "/target:" + targetArtifactType );
+
+        if ( !modules.isEmpty() )
+        {
+            StringBuffer sb = new StringBuffer();
+            for ( Artifact artifact : modules )
+            {
+                String path = artifact.getFile().getAbsolutePath();
+                sb.append( path ).append( ";" );
+            }
+            commands.add( "/addmodule:" + sb.toString() );
+        }
+        if ( !resources.isEmpty() )
+        {
+            for ( Artifact artifact : resources )
+            {
+                String path = artifact.getFile().getAbsolutePath();
+                commands.add( "/reference:" + path );
+            }
+        }
+        String[] files = FileUtils.getFilesFromExtension( sourceDirectory, new String[]{"n"} );
+        for ( String file : files )
+        {
+            commands.add( file );
+        }
+        commands.addAll( config.getCommands() );
+        return commands;
+    }
+
+    public String getExecutable()
+        throws ExecutionException
+    {
+        if ( compilerContext == null )
+        {
+            throw new ExecutionException( "NMAVEN-070-000: Compiler has not been initialized with a context" );
+        }
+        return compilerContext.getCompilerCapability().getExecutable();
+    }
+
+    public void execute()
+        throws ExecutionException
+    {
+        logger.info( "NMAVEN-070-001: Compiling" );
+        if ( !( new File( compilerContext.getSourceDirectoryName() ).exists() ) )
+        {
+            logger.info( "NMAVEN-070-002: No source files to compile." );
+            return;
+        }
+        CommandExecutor commandExecutor = CommandExecutor.Factory.createDefaultCommmandExecutor();
+        commandExecutor.setLogger( logger );
+        commandExecutor.executeCommand( getExecutable(), getCommands(), getExecutionPath(), true );
+        logger.info( "NMAVEN-070-003: Compiling Artifact: Vendor = " +
+            compilerContext.getCompilerRequirement().getVendor() + ", Language = " +
+            compilerContext.getCompilerRequirement().getVendor() + ", Assembly Name = " +
+            compilerContext.getArtifact().getAbsolutePath() );
+    }
+
+}

Propchange: incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/impl/NemerleCompiler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/impl/PhpCompiler.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/impl/PhpCompiler.java?view=auto&rev=485313
==============================================================================
--- incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/impl/PhpCompiler.java (added)
+++ incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/impl/PhpCompiler.java Sun Dec 10 15:43:51 2006
@@ -0,0 +1,121 @@
+/*
+ * 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.
+ */
+package org.apache.maven.dotnet.executable.compiler.impl;
+
+import org.apache.maven.dotnet.executable.ExecutionException;
+import org.apache.maven.dotnet.NMavenContext;
+import org.apache.maven.dotnet.executable.CommandExecutor;
+import org.apache.maven.dotnet.executable.compiler.CompilerConfig;
+import org.apache.maven.dotnet.executable.compiler.CompilerContext;
+import org.apache.maven.dotnet.executable.compiler.InvalidArtifactException;
+import org.apache.maven.dotnet.executable.compiler.CompilerExecutable;
+import org.apache.maven.artifact.Artifact;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.logging.Logger;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.io.File;
+
+/**
+ * Compiler for PHP (http://php4mono.sourceforge.net/)
+ *
+ * @author Shane Isbell
+ */
+public final class PhpCompiler
+    implements CompilerExecutable
+{
+
+    private CompilerContext compilerContext;
+
+    public void init( NMavenContext nmavenContext )
+    {
+        this.compilerContext = (CompilerContext) nmavenContext;
+    }
+
+    public File getExecutionPath()
+    {
+        return new File( compilerContext.getNetCompilerConfig().getExecutionPath() );
+    }
+
+    public List<String> getCommands()
+        throws ExecutionException
+    {
+        return null;
+    }
+
+    public String getExecutable()
+        throws ExecutionException
+    {
+        return null;
+    }
+
+    public File getCompiledArtifact()
+        throws InvalidArtifactException
+    {
+        File file = compilerContext.getArtifact();
+        if ( !file.exists() )
+        {
+            throw new InvalidArtifactException(
+                "NMAVEN-068-004: Artifact does not exist: Artifact = " + file.getAbsolutePath() );
+        }
+        return file;
+    }
+
+    public void execute()
+        throws ExecutionException
+    {
+        Logger logger = compilerContext.getLogger();
+        CompilerConfig config = compilerContext.getNetCompilerConfig();
+        List<Artifact> resources = compilerContext.getLibraryDependencies();
+
+        String sourceDirectory = compilerContext.getSourceDirectoryName();
+        String artifactFilePath = compilerContext.getArtifact().getAbsolutePath();
+        String targetArtifactType = config.getArtifactType().getArtifactTypeName();
+
+        if ( !( new File( sourceDirectory ).exists() ) )
+        {
+            logger.info( "NMAVEN-080-000: No source files to compile." );
+            return;
+        }
+
+        List<String> commands = new ArrayList<String>();
+        commands.add( "/out:" + artifactFilePath );
+        commands.add( "/target:" + targetArtifactType );
+
+        if ( !resources.isEmpty() )
+        {
+            for ( Artifact artifact : resources )
+            {
+                String path = artifact.getFile().getAbsolutePath();
+                commands.add( "/reference:" + path );
+            }
+        }
+        String[] files = FileUtils.getFilesFromExtension( sourceDirectory, new String[]{"php"} );
+        for ( String file : files )
+        {
+            commands.add( file );
+        }
+
+        logger.info( commands.toString() );
+        CommandExecutor commandExecutor = CommandExecutor.Factory.createDefaultCommmandExecutor();
+        commandExecutor.setLogger( logger );
+        commandExecutor.executeCommand( compilerContext.getCompilerCapability().getExecutable(), commands );
+    }
+}

Propchange: incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/impl/PhpCompiler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CapabilityMatcherImpl.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CapabilityMatcherImpl.java?view=auto&rev=485313
==============================================================================
--- incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CapabilityMatcherImpl.java (added)
+++ incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CapabilityMatcherImpl.java Sun Dec 10 15:43:51 2006
@@ -0,0 +1,218 @@
+/*
+ * 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.
+ */
+package org.apache.maven.dotnet.executable.impl;
+
+import org.apache.maven.dotnet.PlatformUnsupportedException;
+import org.apache.maven.dotnet.InitializationException;
+import org.apache.maven.dotnet.executable.*;
+import org.apache.maven.dotnet.executable.compiler.*;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.codehaus.plexus.logging.LogEnabled;
+import org.codehaus.plexus.logging.Logger;
+import org.apache.maven.dotnet.registry.RepositoryRegistry;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * @author Shane Isbell
+ */
+public class CapabilityMatcherImpl
+    implements CapabilityMatcher, LogEnabled
+{
+
+    private Logger logger;
+
+    protected MavenProject project;
+
+    protected RepositoryRegistry repositoryRegistry;
+
+    public void enableLogging( Logger logger )
+    {
+        this.logger = logger;
+    }
+
+    public void init( MavenProject project )
+        throws InitializationException
+    {
+        this.project = project;
+    }
+
+    public CompilerCapability matchCompilerCapabilityFor( CompilerRequirement compilerRequirement,
+                                                          List<ExecutableMatchPolicy> matchPolicies )
+        throws PlatformUnsupportedException
+    {
+        if ( matchPolicies == null )
+        {
+            matchPolicies = new ArrayList<ExecutableMatchPolicy>();
+        }
+        matchPolicies.add( MatchPolicyFactory.createOperatingSystemPolicy( System.getProperty( "os.name" ) ) );
+        matchPolicies.add( MatchPolicyFactory.createVendorPolicy( compilerRequirement.getVendor() ) );
+        matchPolicies.add( MatchPolicyFactory.createLanguagePolicy( ( compilerRequirement ).getLanguage() ) );
+        matchPolicies.add(
+            MatchPolicyFactory.createFrameworkVersionPolicy( compilerRequirement.getFrameworkVersion() ) );
+        matchPolicies.add( MatchPolicyFactory.createProfilePolicy( compilerRequirement.getProfile() ) );
+        return (CompilerCapability) matchFromExecutableCapabilities( getCompilerCapabilities(), matchPolicies );
+    }
+
+    public CompilerCapability matchCompilerCapabilityFor( CompilerRequirement executableRequirement )
+        throws PlatformUnsupportedException
+    {
+        return matchCompilerCapabilityFor( executableRequirement, new ArrayList<ExecutableMatchPolicy>() );
+    }
+
+    /**
+     * Returns the <code>PlatformCapability</code> for the given vendor and language.
+     *
+     * @param executableRequirement
+     * @return the <code>PlatformCapability</code> for the given vendor and language.
+     * @throws org.apache.maven.dotnet.PlatformUnsupportedException
+     *          if the vendor and language (as specified in plugin-compilers.xml)
+     *          are not available for the invoking operating system.
+     */
+    public ExecutableCapability matchExecutableCapabilityFor( ExecutableRequirement executableRequirement )
+        throws PlatformUnsupportedException
+    {
+        return matchExecutableCapabilityFor( executableRequirement, new ArrayList<ExecutableMatchPolicy>() );
+    }
+
+    /**
+     * Returns the <code>PlatformCapability</code> for the given vendor, language and match policies. For this query to return
+     * a platform capability ALL must match (general AND condition). The matchPolicies allow the developer to customize
+     * the query results by any of the PlatformCapability properties.
+     *
+     * @param executableRequirement
+     * @param matchPolicies         policies for matching capabilities
+     * @return the <code>PlatformCapability</code> for the given vendor, language and match policies.
+     * @throws PlatformUnsupportedException if the vendor and language (as specified in plugin-compilers.xml)
+     *                                      are not available for the invoking operating system and/or any of the match policies fail.
+     */
+    public ExecutableCapability matchExecutableCapabilityFor( ExecutableRequirement executableRequirement,
+                                                              List<ExecutableMatchPolicy> matchPolicies )
+        throws PlatformUnsupportedException
+    {
+        if ( matchPolicies == null )
+        {
+            matchPolicies = new ArrayList<ExecutableMatchPolicy>();
+        }
+        matchPolicies.add( MatchPolicyFactory.createOperatingSystemPolicy( System.getProperty( "os.name" ) ) );
+        matchPolicies.add( MatchPolicyFactory.createVendorPolicy( executableRequirement.getVendor() ) );
+        matchPolicies.add(
+            MatchPolicyFactory.createFrameworkVersionPolicy( executableRequirement.getFrameworkVersion() ) );
+        matchPolicies.add( MatchPolicyFactory.createProfilePolicy( executableRequirement.getProfile() ) );
+        return matchFromExecutableCapabilities( getExecutableCapabilities(), matchPolicies );
+    }
+
+
+    private ExecutableCapability matchFromExecutableCapabilities( List<ExecutableCapability> executableCapabilities,
+                                                                  List<ExecutableMatchPolicy> matchPolicies )
+        throws PlatformUnsupportedException
+    {
+        for ( ExecutableCapability executableCapability : executableCapabilities )
+        {
+            logger.debug( "NMAVEN-065-005: Attempting to match capability: " + executableCapability );
+            if ( matchExecutableCapability( executableCapability, matchPolicies ) )
+            {
+                logger.debug( "NMAVEN-065-001: Made a Platform Capability Match: " + executableCapability );
+                return executableCapability;
+            }
+        }
+        throw new PlatformUnsupportedException( "NMAVEN-065-002: Could not match platform: OS = " +
+            System.getProperty( "os.name" ) + ", Number of Capabilities = " + executableCapabilities.size() +
+            ", Number of Policies = " + matchPolicies.size() );
+    }
+
+
+    private boolean matchExecutableCapability( ExecutableCapability executableCapability,
+                                               List<ExecutableMatchPolicy> matchPolicies )
+    {
+        for ( ExecutableMatchPolicy executableMatchPolicy : matchPolicies )
+        {
+            boolean match = executableMatchPolicy.match( executableCapability );
+            if ( !match )
+            {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Returns all platform capabilities (as defined in the compiler-plugins.xml file). This is more than the platform
+     * capabilities for the invoking platform.
+     *
+     * @return all platform capabilities (as defined in the compiler-plugins.xml file).
+     */
+    private List<ExecutableCapability> getCompilerCapabilities()
+        throws PlatformUnsupportedException
+    {
+        CompilerPluginsRepository pluginsRepository =
+            (CompilerPluginsRepository) repositoryRegistry.find( "compiler-plugins" );
+        CompilerPluginsRepository pluginsRepositoryExt =
+            (CompilerPluginsRepository) repositoryRegistry.find( "compiler-plugins-ext" );
+        List<ExecutableCapability> primary = new ArrayList<ExecutableCapability>();
+        if ( pluginsRepository != null )
+        {
+            primary = pluginsRepository.getCompilerCapabilities();
+        }
+
+        if ( pluginsRepositoryExt != null )
+        {
+            primary.addAll( pluginsRepositoryExt.getCompilerCapabilities() );
+        }
+        if ( primary.isEmpty() )
+        {
+            throw new PlatformUnsupportedException( "NMAVEN-065-003: No compiler capabilities configured" );
+        }
+        return primary;
+    }
+
+
+    /**
+     * Returns all platform capabilities (as defined in the compiler-plugins.xml file). This is more than the platform
+     * capabilities for the invoking platform.
+     *
+     * @return all platform capabilities (as defined in the compiler-plugins.xml file).
+     */
+    private List<ExecutableCapability> getExecutableCapabilities()
+        throws PlatformUnsupportedException
+    {
+        ExecutablePluginsRepository pluginsRepository =
+            (ExecutablePluginsRepository) repositoryRegistry.find( "executable-plugins" );
+        ExecutablePluginsRepository pluginsRepositoryExt =
+            (ExecutablePluginsRepository) repositoryRegistry.find( "executable-plugins-ext" );
+        List<ExecutableCapability> primary = new ArrayList<ExecutableCapability>();
+        if ( pluginsRepository != null )
+        {
+            primary = pluginsRepository.getCapabilities();
+        }
+
+        if ( pluginsRepositoryExt != null )
+        {
+            primary.addAll( pluginsRepositoryExt.getCapabilities() );
+        }
+        if ( primary.isEmpty() )
+        {
+            throw new PlatformUnsupportedException( "NMAVEN-065-004: No executable capabilities configured" );
+        }
+        return primary;
+    }
+
+}

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

Added: incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CompilerContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CompilerContextImpl.java?view=auto&rev=485313
==============================================================================
--- incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CompilerContextImpl.java (added)
+++ incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CompilerContextImpl.java Sun Dec 10 15:43:51 2006
@@ -0,0 +1,298 @@
+/*
+ * 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.
+ */
+package org.apache.maven.dotnet.executable.impl;
+
+import org.apache.maven.dotnet.executable.ExecutionException;
+import org.apache.maven.dotnet.executable.CapabilityMatcher;
+import org.apache.maven.dotnet.executable.CommandFilter;
+import org.apache.maven.dotnet.PlatformUnsupportedException;
+import org.apache.maven.dotnet.executable.compiler.*;
+import org.apache.maven.dotnet.executable.compiler.InvalidArtifactException;
+import org.apache.maven.dotnet.artifact.ArtifactContext;
+import org.apache.maven.dotnet.artifact.ArtifactException;
+
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.dotnet.registry.Repository;
+import org.apache.maven.dotnet.registry.RepositoryRegistry;
+import org.apache.maven.dotnet.RepositoryNotFoundException;
+import org.codehaus.plexus.logging.LogEnabled;
+import org.codehaus.plexus.logging.Logger;
+
+import java.util.*;
+import java.io.File;
+
+/**
+ * @author Shane Isbell
+ */
+public final class CompilerContextImpl
+    implements CompilerContext, LogEnabled
+{
+
+    private MavenProject project;
+
+    private CompilerConfig config;
+
+    private List<Artifact> libraries;
+
+    private List<Artifact> modules;
+
+    private CompilerExecutable netCompiler;
+
+    private CompilerCapability compilerCapability;
+
+    private CompilerRequirement compilerRequirement;
+
+    private CommandFilter commandFilter;
+
+    private ArtifactContext artifactContext;
+
+    private RepositoryRegistry repositoryRegistry;
+
+    private Logger logger;
+
+    private List<File> linkedResources;
+
+    private List<File> embeddedResources;
+
+    private File win32icon;
+
+    private List<File> win32resources;
+
+    public List<File> getLinkedResources()
+    {
+        return linkedResources;
+    }
+
+    public List<File> getEmbeddedResources()
+    {
+        return embeddedResources;
+    }
+
+    public File getWin32Icon()
+    {
+        return win32icon;
+    }
+
+    public List<File> getWin32Resources()
+    {
+        return win32resources;
+    }
+
+    public void enableLogging( Logger logger )
+    {
+        this.logger = logger;
+    }
+
+    public CompilerRequirement getCompilerRequirement()
+    {
+        return compilerRequirement;
+    }
+
+    public List<String> getCoreAssemblyNames()
+    {
+        return compilerCapability.getCoreAssemblies();
+    }
+
+    public List<Artifact> getModuleDependencies()
+    {
+        return modules;
+    }
+
+    public List<Artifact> getDirectModuleDependencies()
+    {
+        List<Artifact> artifacts;
+        try
+        {
+            artifacts = artifactContext.getNetModulesFor( project.getArtifact() );
+        }
+        catch ( ArtifactException e )
+        {
+            logger.error( "NMAVEN-061-000: Improper Initialization of the Net Modules", e );
+            return null;
+            //TODO: How to handle this: usually implies improper init of ArtifactContext
+        }
+        if ( config.isTestCompile() && config.getArtifactType().equals( ArtifactType.MODULE ) )
+        {
+            artifacts.add( project.getArtifact() );
+        }
+        return artifacts;
+    }
+
+    public List<Artifact> getLibraryDependencies()
+    {
+        if ( config.isTestCompile() && config.getArtifactType().equals( ArtifactType.LIBRARY ) &&
+            project.getArtifact().getFile() != null && project.getArtifact().getFile().exists() &&
+            !libraries.contains( project.getArtifact() ) )
+        {
+            libraries.add( project.getArtifact() );
+        }
+        return libraries;
+    }
+
+    public Logger getLogger()
+    {
+        return logger;
+    }
+
+    public CompilerConfig getNetCompilerConfig()
+    {
+        return config;
+    }
+
+    public CompilerCapability getCompilerCapability()
+    {
+        return compilerCapability;
+    }
+
+    public String getSourceDirectoryName()
+    {
+        return ( config.isTestCompile() ) ? project.getBuild().getDirectory() + File.separator + "build-test-sources"
+            : project.getBuild().getDirectory() + File.separator + "build-sources";
+    }
+
+    /**
+     * This method will return a File where File.isExist() returns false, if NetCompile.compile has not been
+     * invoked.
+     *
+     * @return
+     * @throws InvalidArtifactException
+     */
+    public File getArtifact()
+        throws InvalidArtifactException
+    {
+        ArtifactType artifactType = config.getArtifactType();
+        if ( artifactType == null || artifactType.equals( ArtifactType.NULL ) )
+        {
+            throw new InvalidArtifactException( "NMAVEN-061-001: Artifact Type cannot be null" );
+        }
+
+        //TODO: The test-plugin has a dependency on this fileName/dir. If we change it here, it will break the plugin. Fix this encapsulation issue.
+        String fileName = ( config.isTestCompile() ) ? project.getBuild().getDirectory() + File.separator +
+            project.getArtifactId() + "-test.dll" : project.getBuild().getDirectory() + File.separator +
+            project.getArtifactId() + "." + artifactType.getExtension();
+        return new File( fileName );
+    }
+
+    public CompilerExecutable getCompilerExecutable()
+        throws ExecutionException
+    {
+        return netCompiler;
+    }
+
+    public CommandFilter getCommandFilter()
+    {
+        return commandFilter;
+    }
+
+
+    public MavenProject getMavenProject()
+    {
+        return project;
+    }
+
+    public Repository find( String repositoryName )
+        throws RepositoryNotFoundException
+    {
+        Repository repository = repositoryRegistry.find( repositoryName );
+        if ( repository == null )
+        {
+            throw new RepositoryNotFoundException(
+                "NMAVEN-061-002: Could not find repository: Name = " + repositoryName );
+        }
+        return repository;
+    }
+
+    public void init( CompilerRequirement compilerRequirement, CompilerConfig config, MavenProject project,
+                      CapabilityMatcher capabilityMatcher )
+        throws PlatformUnsupportedException
+    {
+
+        this.project = project;
+        this.config = config;
+        this.compilerRequirement = compilerRequirement;
+        libraries = new ArrayList<Artifact>();
+        modules = new ArrayList<Artifact>();
+        artifactContext.init( project, config.getLocalRepository() );
+
+        Set<Artifact> artifacts = project.getDependencyArtifacts();
+        for ( Artifact artifact : artifacts )
+        {
+            String type = artifact.getType();
+            if ( type.equals( "module" ) )
+            {
+                modules.add( artifact );
+            }
+            else if ( type.equals( "library" ) )
+            {
+                libraries.add( artifact );
+            }
+        }
+
+        compilerCapability = capabilityMatcher.matchCompilerCapabilityFor( compilerRequirement );
+        String className = compilerCapability.getPluginClassName();
+
+        try
+        {
+            Class cc = Class.forName( className );
+            netCompiler = (CompilerExecutable) cc.newInstance();
+            netCompiler.init( this );//TODO: Add ArtifactInfo?
+        }
+        catch ( ClassNotFoundException e )
+        {
+            throw new PlatformUnsupportedException(
+                "NMAVEN-061-004: Unable to create NetCompiler: Class Name = " + className, e );
+        }
+        catch ( InstantiationException e )
+        {
+            throw new PlatformUnsupportedException(
+                "NMAVEN-061-005: Unable to create NetCompiler: Class Name = " + className, e );
+        }
+        catch ( IllegalAccessException e )
+        {
+            throw new PlatformUnsupportedException(
+                "NMAVEN-061-006: Unable to create NetCompiler: Class Name = " + className, e );
+        }
+        commandFilter =
+            CommandFilter.Factory.createDefaultCommandFilter( compilerCapability.getCommandCapability(), logger );
+
+        String basedir = project.getBuild().getDirectory() + File.separator + "assembly-resources" + File.separator;
+        linkedResources = new File( basedir, "linkresource" ).exists() ? Arrays.asList(
+            new File( basedir, "linkresource" ).listFiles() ) : new ArrayList<File>();
+        embeddedResources = new File( basedir, "resource" ).exists() ? Arrays.asList(
+            new File( basedir, "resource" ).listFiles() ) : new ArrayList<File>();
+        win32resources = new File( basedir, "win32res" ).exists() ? Arrays.asList(
+            new File( basedir, "win32res" ).listFiles() ) : new ArrayList<File>();
+        File win32IconDir = new File( basedir, "win32icon" );
+        if ( win32IconDir.exists() )
+        {
+            File[] icons = win32IconDir.listFiles();
+            if ( icons.length > 1 )
+            {
+                throw new PlatformUnsupportedException(
+                    "NMAVEN-061-007: There is more than one win32icon in resource directory: Number = " + icons
+                        .length );
+            }
+            if ( icons.length == 1 )
+            {
+                win32icon = icons[0];
+            }
+        }
+    }
+}

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

Added: incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CompilerPluginsRepository.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CompilerPluginsRepository.java?view=auto&rev=485313
==============================================================================
--- incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CompilerPluginsRepository.java (added)
+++ incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CompilerPluginsRepository.java Sun Dec 10 15:43:51 2006
@@ -0,0 +1,146 @@
+/*
+ * 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.
+ */
+package org.apache.maven.dotnet.executable.impl;
+
+import org.apache.maven.dotnet.registry.Repository;
+import org.apache.maven.dotnet.registry.RepositoryRegistry;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.io.*;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Iterator;
+import java.util.ArrayList;
+
+import org.apache.maven.dotnet.vendor.Vendor;
+import org.apache.maven.dotnet.executable.CommandCapability;
+import org.apache.maven.dotnet.executable.ExecutableCapability;
+import org.apache.maven.dotnet.executable.compiler.CompilerCapability;
+import org.apache.maven.dotnet.model.compiler.plugins.io.xpp3.CompilerPluginXpp3Reader;
+import org.apache.maven.dotnet.model.compiler.plugins.CompilerPluginsModel;
+import org.apache.maven.dotnet.model.compiler.plugins.CompilerPlugin;
+import org.apache.maven.dotnet.model.compiler.plugins.Platform;
+import org.apache.maven.dotnet.model.compiler.plugins.CommandFilter;
+
+
+/**
+ * Repository for reading and providing access to the compiler-plugins.xml config file.
+ *
+ * @author Shane Isbell
+ */
+public final class CompilerPluginsRepository
+    implements Repository
+{
+
+    private List compilerPlugins;
+
+    public void load( InputStream inputStream, Hashtable properties )
+        throws IOException
+    {
+        CompilerPluginXpp3Reader xpp3Reader = new CompilerPluginXpp3Reader();
+        Reader reader = new InputStreamReader( inputStream );
+        CompilerPluginsModel plugins;
+        try
+        {
+            plugins = xpp3Reader.read( reader );
+        }
+        catch ( XmlPullParserException e )
+        {
+            e.printStackTrace();
+            throw new IOException( "NMAVEN-062-000: Could not read plugins-compiler.xml" );
+        }
+        compilerPlugins = plugins.getCompilerPlugins();
+    }
+
+    public void setRepositoryRegistry( RepositoryRegistry repositoryRegistry )
+    {
+    }
+
+    /**
+     * Returns config information as list of platform capabilities.
+     *
+     * @return config information as list of platform capabilities.
+     */
+    List<ExecutableCapability> getCompilerCapabilities()
+    {
+        List<ExecutableCapability> platformCapabilities = new ArrayList<ExecutableCapability>();
+        for ( Iterator i = compilerPlugins.iterator(); i.hasNext(); )
+        {
+            CompilerPlugin plugin = (CompilerPlugin) i.next();
+            String language = plugin.getLanguage();
+            String pluginClassName = plugin.getPluginClass();
+            String executable = plugin.getExecutable();
+            String compilerVendor = plugin.getVendor();
+            String identifier = plugin.getIdentifier();
+            String profile = plugin.getProfile();
+            List<String> frameworkVersions = plugin.getFrameworkVersions();
+            List<String> coreAssemblies = plugin.getAssemblies();
+            String defaultAssemblyPath = plugin.getDefaultAssemblyPath();
+
+            List platforms = plugin.getPlatforms();
+            for ( Iterator j = platforms.iterator(); j.hasNext(); )
+            {
+                CompilerCapability platformCapability =
+                    (CompilerCapability) CompilerCapability.Factory.createDefaultExecutableCapability();
+                Platform platform = (Platform) j.next();
+                String os = platform.getOperatingSystem();
+
+                platformCapability.setLanguage( language );
+                platformCapability.setOperatingSystem( os );
+                platformCapability.setPluginClassName( pluginClassName );
+                platformCapability.setExecutable( executable );
+                platformCapability.setIdentifier( identifier );
+                platformCapability.setFrameworkVersions( frameworkVersions );
+                platformCapability.setProfile( profile );
+                platformCapability.setAssemblyPath( defaultAssemblyPath );
+                String arch = platform.getArchitecture();
+                CommandFilter filter = plugin.getCommandFilter();
+                platformCapability.setCoreAssemblies( coreAssemblies );
+
+                List<String> includes = ( filter != null ) ? filter.getIncludes() : new ArrayList<String>();
+                List<String> excludes = ( filter != null ) ? filter.getExcludes() : new ArrayList<String>();
+                platformCapability.setCommandCapability(
+                    CommandCapability.Factory.createDefaultCommandCapability( includes, excludes ) );
+                if ( arch != null )
+                {
+                    platformCapability.setArchitecture( arch );
+                }
+                if ( compilerVendor.trim().equalsIgnoreCase( "microsoft" ) )
+                {
+                    platformCapability.setVendor( Vendor.MICROSOFT );
+                }
+                else if ( compilerVendor.trim().equalsIgnoreCase( "mono" ) )
+                {
+                    platformCapability.setVendor( Vendor.MONO );
+                }
+                else if ( compilerVendor.trim().equalsIgnoreCase( "dotgnu" ) )
+                {
+                    platformCapability.setVendor( Vendor.DOTGNU );
+                }
+                else
+                {
+                    System.out.println( "NMAVEN-062-001: Unknown Vendor, skipping: Name = " + compilerVendor );
+                    continue;
+                }
+                platformCapabilities.add( platformCapability );
+            }
+        }
+        return platformCapabilities;
+    }
+}

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

Added: incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/DefaultNetExecutable.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/DefaultNetExecutable.java?view=auto&rev=485313
==============================================================================
--- incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/DefaultNetExecutable.java (added)
+++ incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/DefaultNetExecutable.java Sun Dec 10 15:43:51 2006
@@ -0,0 +1,99 @@
+/*
+ * 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.
+ */
+package org.apache.maven.dotnet.executable.impl;
+
+import org.apache.maven.dotnet.executable.ExecutionException;
+import org.apache.maven.dotnet.executable.*;
+import org.apache.maven.dotnet.NMavenContext;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.logging.Logger;
+
+import java.util.List;
+import java.io.File;
+
+/**
+ * @author Shane Isbell
+ */
+public class DefaultNetExecutable
+    implements NetExecutable
+{
+
+    private ExecutableContext executableContext;
+
+    private MavenProject project;
+
+    private Logger logger;
+
+    public List<String> getCommands()
+        throws ExecutionException
+    {
+        CommandFilter filter = executableContext.getCommandFilter();
+        return filter.filter( executableContext.getExecutableConfig().getCommands() );
+    }
+
+    public File getExecutionPath()
+    {
+        return ( executableContext.getExecutableConfig().getExecutionPath() != null ) ? new File(
+            executableContext.getExecutableConfig().getExecutionPath() ) : null;
+    }
+
+    public void execute()
+        throws ExecutionException
+    {
+        List<String> commands = getCommands();
+
+        CommandExecutor commandExecutor = CommandExecutor.Factory.createDefaultCommmandExecutor();
+        try
+        {
+            commandExecutor.setLogger( logger );
+            commandExecutor.executeCommand( getExecutable(), getCommands(), getExecutionPath(), true );
+        }
+        catch ( ExecutionException e )
+        {
+            throw new ExecutionException( "NMAVEN-063-000: Command = " + commands, e );
+        }
+        if ( commandExecutor.getStandardOut().contains( "error" ) )
+        {
+            throw new ExecutionException( "NMAVEN-063-001: Command = " + commands );
+        }
+    }
+
+
+    public String getExecutable()
+        throws ExecutionException
+    {
+        if ( executableContext == null )
+        {
+            throw new ExecutionException( "NMAVEN-063-002: Executable has not been initialized with a context" );
+        }
+        return executableContext.getExecutableCapability().getExecutable();
+        // String executionPath = executableContext.getExecutableConfig().getExecutionPath();
+        // return (executionPath != null && !executionPath.trim().equals("")) ? executionPath
+        //         + executableContext.getExecutableCapability().getExecutable()
+        //         : executableContext.getExecutableCapability().getExecutable();
+    }
+
+
+    public void init( NMavenContext nmavenContext )
+    {
+        this.executableContext = (ExecutableContext) nmavenContext;
+        this.project = executableContext.getMavenProject();
+        this.logger = executableContext.getLogger();
+    }
+}

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

Added: incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/DefaultRepositoryNetExecutable.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/DefaultRepositoryNetExecutable.java?view=auto&rev=485313
==============================================================================
--- incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/DefaultRepositoryNetExecutable.java (added)
+++ incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/DefaultRepositoryNetExecutable.java Sun Dec 10 15:43:51 2006
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+package org.apache.maven.dotnet.executable.impl;
+
+import org.apache.maven.dotnet.executable.ExecutionException;
+import org.apache.maven.dotnet.executable.CommandExecutor;
+import org.apache.maven.dotnet.executable.*;
+import org.apache.maven.dotnet.NMavenContext;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.logging.Logger;
+
+import java.util.List;
+import java.io.File;
+
+/**
+ *
+ * @author Shane Isbell
+ */
+public class DefaultRepositoryNetExecutable
+    implements NetExecutable
+{
+
+    private RepositoryExecutableContext executableContext;
+
+    private MavenProject project;
+
+    private Logger logger;
+
+    public List<String> getCommands()
+        throws ExecutionException
+    {
+        return executableContext.getExecutableConfig().getCommands();
+    }
+
+    public File getExecutionPath()
+    {
+        return null;
+    }
+
+    public void execute()
+        throws ExecutionException
+    {
+        List<String> commands = getCommands();
+
+        CommandExecutor commandExecutor = CommandExecutor.Factory.createDefaultCommmandExecutor();
+        File executable = new File( getExecutable() );
+        String exe = executable.getName();
+        try
+        {
+            commandExecutor.setLogger( logger );
+            commandExecutor.executeCommand( exe, getCommands(), executable.getParentFile(), true );
+        }
+        catch ( ExecutionException e )
+        {
+            throw new ExecutionException( "NMAVEN-063-000: Executable = " + exe + ", Command = " + commands, e );
+        }
+        if ( commandExecutor.getStandardOut().contains( "error" ) )
+        {
+            throw new ExecutionException( "NMAVEN-063-001: Executable = " + exe + ",Command = " + commands );
+        }
+    }
+
+
+    public String getExecutable()
+        throws ExecutionException
+    {
+        if ( executableContext == null )
+        {
+            throw new ExecutionException( "NMAVEN-063-002: Executable has not been initialized with a context" );
+        }
+
+        String executionPath = executableContext.getExecutableConfig().getExecutionPath();
+        if ( executionPath == null || executionPath.trim().equals( "" ) )
+        {
+            throw new ExecutionException( "NMAVEN-063-002: Executable path has not been set" );
+        }
+        return executionPath;
+    }
+
+
+    public void init( NMavenContext nmavenContext )
+    {
+        this.executableContext = (RepositoryExecutableContext) nmavenContext;
+        this.project = executableContext.getMavenProject();
+        this.logger = executableContext.getLogger();
+    }
+}

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

Added: incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/ExecutableContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/ExecutableContextImpl.java?view=auto&rev=485313
==============================================================================
--- incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/ExecutableContextImpl.java (added)
+++ incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/ExecutableContextImpl.java Sun Dec 10 15:43:51 2006
@@ -0,0 +1,143 @@
+/*
+ * 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.
+ */
+package org.apache.maven.dotnet.executable.impl;
+
+import org.apache.maven.dotnet.executable.*;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.dotnet.registry.Repository;
+import org.apache.maven.dotnet.registry.RepositoryRegistry;
+import org.apache.maven.dotnet.PlatformUnsupportedException;
+import org.apache.maven.dotnet.RepositoryNotFoundException;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.logging.LogEnabled;
+
+/**
+ *
+ * @author Shane Isbell
+ */
+public class ExecutableContextImpl
+    implements ExecutableContext, LogEnabled
+{
+
+    private MavenProject project;
+
+    private ExecutableRequirement executableRequirement;
+
+    private RepositoryRegistry repositoryRegistry;
+
+    private ExecutableCapability executableCapability;
+
+    private NetExecutable netExecutable;
+
+    private CommandFilter commandFilter;
+
+    private ExecutableConfig executableConfig;
+
+    private Logger logger;
+
+    public void enableLogging( Logger logger )
+    {
+        this.logger = logger;
+    }
+
+    public Logger getLogger()
+    {
+        return logger;
+    }
+
+    public ExecutableConfig getExecutableConfig()
+    {
+        return executableConfig;
+    }
+
+    public ExecutableCapability getExecutableCapability()
+    {
+        return executableCapability;
+    }
+
+    public ExecutableRequirement getExecutableRequirement()
+    {
+        return executableRequirement;
+    }
+
+    public NetExecutable getNetExecutable()
+        throws ExecutionException
+    {
+        return netExecutable;
+    }
+
+    public MavenProject getMavenProject()
+    {
+        return project;
+    }
+
+    public CommandFilter getCommandFilter()
+    {
+        return commandFilter;
+    }
+
+    public Repository find( String repositoryName )
+        throws RepositoryNotFoundException
+    {
+        Repository repository = repositoryRegistry.find( repositoryName );
+        if ( repository == null )
+        {
+            throw new RepositoryNotFoundException(
+                "NMAVEN-064-000: Could not find repository: Name = " + repositoryName );
+        }
+        return repository;
+    }
+
+    public void init( ExecutableRequirement executableRequirement, ExecutableConfig executableConfig,
+                      MavenProject project, CapabilityMatcher capabilityMatcher )
+        throws PlatformUnsupportedException
+    {
+
+        this.project = project;
+        this.executableRequirement = executableRequirement;
+        this.executableConfig = executableConfig;
+
+        executableCapability = capabilityMatcher.matchExecutableCapabilityFor( executableRequirement );
+        String className = executableCapability.getPluginClassName();
+
+        try
+        {
+            Class cc = Class.forName( className );
+            netExecutable = (NetExecutable) cc.newInstance();
+            netExecutable.init( this );
+        }
+        catch ( ClassNotFoundException e )
+        {
+            throw new PlatformUnsupportedException(
+                "NMAVEN-064-001: Unable to create NetCompiler: Class Name = " + className, e );
+        }
+        catch ( InstantiationException e )
+        {
+            throw new PlatformUnsupportedException(
+                "NMAVEN-064-002: Unable to create NetCompiler: Class Name = " + className, e );
+        }
+        catch ( IllegalAccessException e )
+        {
+            throw new PlatformUnsupportedException(
+                "NMAVEN-064-003: Unable to create NetCompiler: Class Name = " + className, e );
+        }
+        commandFilter =
+            CommandFilter.Factory.createDefaultCommandFilter( executableCapability.getCommandCapability(), logger );
+    }
+}

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

Added: incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/ExecutablePluginsRepository.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/ExecutablePluginsRepository.java?view=auto&rev=485313
==============================================================================
--- incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/ExecutablePluginsRepository.java (added)
+++ incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/ExecutablePluginsRepository.java Sun Dec 10 15:43:51 2006
@@ -0,0 +1,137 @@
+/*
+ * 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.
+ */
+package org.apache.maven.dotnet.executable.impl;
+
+import org.apache.maven.dotnet.registry.Repository;
+import org.apache.maven.dotnet.registry.RepositoryRegistry;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.InputStreamReader;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.apache.maven.dotnet.model.compiler.plugins.io.xpp3.ExecutablePluginXpp3Reader;
+import org.apache.maven.dotnet.model.compiler.plugins.*;
+import org.apache.maven.dotnet.executable.ExecutableCapability;
+import org.apache.maven.dotnet.executable.CommandCapability;
+import org.apache.maven.dotnet.vendor.Vendor;
+
+/**
+ * @author Shane Isbell
+ */
+public final class ExecutablePluginsRepository
+    implements Repository
+{
+
+    private List<ExecutablePlugin> executablePlugins;
+
+    /**
+     * Loads the repository
+     *
+     * @param inputStream a stream of the repository file (typically from *.xml)
+     * @param properties  additional user-supplied parameters used to customize the behavior of the repository
+     * @throws java.io.IOException if there is a problem loading the repository
+     */
+    public void load( InputStream inputStream, Hashtable properties )
+        throws IOException
+    {
+        ExecutablePluginXpp3Reader xpp3Reader = new ExecutablePluginXpp3Reader();
+        Reader reader = new InputStreamReader( inputStream );
+        ExecutablePluginsModel plugins = null;
+        try
+        {
+            plugins = xpp3Reader.read( reader );
+        }
+        catch ( XmlPullParserException e )
+        {
+            e.printStackTrace();
+            throw new IOException( "NMAVEN-067-000: Could not read executable-plugins.xml" );
+        }
+        executablePlugins = plugins.getExecutablePlugins();
+    }
+
+    public void setRepositoryRegistry( RepositoryRegistry repositoryRegistry )
+    {
+    }
+
+    List<ExecutableCapability> getCapabilities()
+    {
+        List<ExecutableCapability> platformCapabilities = new ArrayList<ExecutableCapability>();
+        for ( ExecutablePlugin plugin : executablePlugins )
+        {
+            String pluginClassName = plugin.getPluginClass();
+            String executable = plugin.getExecutable();
+            String compilerVendor = plugin.getVendor();
+            String identifier = plugin.getIdentifier();
+            String profile = plugin.getProfile();
+            List<String> frameworkVersions = plugin.getFrameworkVersions();
+
+            List platforms = plugin.getPlatforms();
+            for ( Iterator j = platforms.iterator(); j.hasNext(); )
+            {
+                ExecutableCapability platformCapability =
+                    ExecutableCapability.Factory.createDefaultExecutableCapability();
+                Platform platform = (Platform) j.next();
+                String os = platform.getOperatingSystem();
+
+                platformCapability.setOperatingSystem( os );
+                platformCapability.setPluginClassName( pluginClassName );
+                platformCapability.setExecutable( executable );
+                platformCapability.setIdentifier( identifier );
+                platformCapability.setFrameworkVersions( frameworkVersions );
+                platformCapability.setProfile( profile );
+                String arch = platform.getArchitecture();
+                CommandFilter filter = plugin.getCommandFilter();
+
+                List<String> includes = ( filter != null ) ? filter.getIncludes() : new ArrayList<String>();
+                List<String> excludes = ( filter != null ) ? filter.getExcludes() : new ArrayList<String>();
+                platformCapability.setCommandCapability(
+                    CommandCapability.Factory.createDefaultCommandCapability( includes, excludes ) );
+                if ( arch != null )
+                {
+                    platformCapability.setArchitecture( arch );
+                }
+                if ( compilerVendor.trim().equalsIgnoreCase( "microsoft" ) )
+                {
+                    platformCapability.setVendor( Vendor.MICROSOFT );
+                }
+                else if ( compilerVendor.trim().equalsIgnoreCase( "mono" ) )
+                {
+                    platformCapability.setVendor( Vendor.MONO );
+                }
+                else if ( compilerVendor.trim().equalsIgnoreCase( "dotgnu" ) )
+                {
+                    platformCapability.setVendor( Vendor.DOTGNU );
+                }
+                else
+                {
+                    System.out.println( "NMAVEN-067-001: Unknown Vendor, skipping: Name = " + compilerVendor );
+                    continue;
+                }
+                platformCapabilities.add( platformCapability );
+            }
+        }
+        return platformCapabilities;
+    }
+}

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

Added: incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/MatchPolicyFactory.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/MatchPolicyFactory.java?view=auto&rev=485313
==============================================================================
--- incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/MatchPolicyFactory.java (added)
+++ incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/MatchPolicyFactory.java Sun Dec 10 15:43:51 2006
@@ -0,0 +1,140 @@
+/*
+ * 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.
+ */
+package org.apache.maven.dotnet.executable.impl;
+
+import org.apache.maven.dotnet.executable.ExecutableMatchPolicy;
+import org.apache.maven.dotnet.vendor.Vendor;
+import org.apache.maven.dotnet.executable.ExecutableCapability;
+import org.apache.maven.dotnet.executable.compiler.CompilerCapability;
+
+/**
+ * Creates executable match policies.
+ *
+ * @author Shane Isbell
+ */
+final class MatchPolicyFactory
+{
+
+    /**
+     * Constructor
+     */
+    private MatchPolicyFactory()
+    {
+    }
+
+    /**
+     * Creates a policy to match profiles.
+     *
+     * @param profile
+     * @return a policy to match profiles.
+     */
+    static ExecutableMatchPolicy createProfilePolicy( final String profile )
+    {
+        return new ExecutableMatchPolicy()
+        {
+            public boolean match( ExecutableCapability executableCapability )
+            {
+                String p = executableCapability.getProfile().toLowerCase().trim();
+                return ( profile.toLowerCase().trim().equals( p ) );
+            }
+        };
+    }
+
+    /**
+     * Creates a policy to match the operating system
+     *
+     * @param operatingSystem
+     * @return a policy to match the operating system
+     */
+    static ExecutableMatchPolicy createOperatingSystemPolicy( final String operatingSystem )
+    {
+        return new ExecutableMatchPolicy()
+        {
+            public boolean match( ExecutableCapability executableCapability )
+            {
+                String os = executableCapability.getOperatingSystem().toLowerCase().trim();
+                return ( operatingSystem.toLowerCase().trim().contains( os ) );
+            }
+        };
+    }
+
+    /**
+     * Creates a policy to match the framework version
+     *
+     * @param frameworkVersion
+     * @return a policy to match the framework version
+     */
+    static ExecutableMatchPolicy createFrameworkVersionPolicy( final String frameworkVersion )
+    {
+        return new ExecutableMatchPolicy()
+        {
+            public boolean match( ExecutableCapability executableCapability )
+            {
+                for ( String fv : executableCapability.getFrameworkVersions() )
+                {
+                    if ( frameworkVersion.toLowerCase().trim().equals( fv.trim() ) )
+                    {
+                        return true;
+                    }
+                }
+                return false;
+            }
+        };
+    }
+
+    /**
+     * Creates a match policy to match the vendor
+     *
+     * @param vendor
+     * @return a match policy to match the vendor
+     */
+    static ExecutableMatchPolicy createVendorPolicy( final Vendor vendor )
+    {
+        return new ExecutableMatchPolicy()
+        {
+            public boolean match( ExecutableCapability executableCapability )
+            {
+                return vendor.getVendorName().toLowerCase().trim()
+                    .contains( executableCapability.getVendor().getVendorName().toLowerCase().trim() );
+            }
+        };
+    }
+
+    /**
+     * Creates a match policy to match the .NET language
+     *
+     * @param language
+     * @return a match policy to match the .NET language
+     */
+    static ExecutableMatchPolicy createLanguagePolicy( final String language )
+    {
+        return new ExecutableMatchPolicy()
+        {
+            public boolean match( ExecutableCapability executableCapability )
+            {
+                if ( !( executableCapability instanceof CompilerCapability ) )
+                {
+                    return true;
+                }
+                CompilerCapability capability = (CompilerCapability) executableCapability;
+                return language.toLowerCase().trim().equals( capability.getLanguage().toLowerCase().trim() );
+            }
+        };
+    }
+}

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

Added: incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/NetExecutableFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/NetExecutableFactoryImpl.java?view=auto&rev=485313
==============================================================================
--- incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/NetExecutableFactoryImpl.java (added)
+++ incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/NetExecutableFactoryImpl.java Sun Dec 10 15:43:51 2006
@@ -0,0 +1,282 @@
+/*
+ * 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.
+ */
+package org.apache.maven.dotnet.executable.impl;
+
+import org.apache.maven.dotnet.executable.*;
+import org.apache.maven.dotnet.executable.compiler.CompilerRequirement;
+import org.apache.maven.dotnet.executable.compiler.CompilerConfig;
+import org.apache.maven.dotnet.executable.compiler.CompilerContext;
+import org.apache.maven.dotnet.executable.compiler.CompilerExecutable;
+import org.apache.maven.dotnet.vendor.*;
+import org.apache.maven.dotnet.vendor.IllegalStateException;
+import org.apache.maven.dotnet.registry.RepositoryRegistry;
+import org.apache.maven.dotnet.artifact.ArtifactContext;
+import org.apache.maven.dotnet.artifact.AssemblyRepositoryLayout;
+import org.apache.maven.dotnet.InitializationException;
+import org.apache.maven.dotnet.PlatformUnsupportedException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.artifact.Artifact;
+import org.codehaus.plexus.logging.LogEnabled;
+import org.codehaus.plexus.logging.Logger;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.io.File;
+
+/**
+ * Provides an implementation of <code>NetExecutableFactory</code>.
+ *
+ * @author Shane Isbell
+ */
+public class NetExecutableFactoryImpl
+    implements NetExecutableFactory, LogEnabled
+{
+
+    private CapabilityMatcher capabilityMatcher;
+
+    private ArtifactContext artifactContext;
+
+    private RepositoryExecutableContext repositoryExecutableContext;
+
+    private ExecutableContext executableContext;
+
+    private CompilerContext compilerContext;
+
+    private RepositoryRegistry repositoryRegistry;
+
+    private VendorInfoRepository vendorInfoRepository;
+
+    private StateMachineProcessor processor;
+
+    private boolean isFactoryInited = false;
+
+    private Logger logger;
+
+    public void enableLogging( Logger logger )
+    {
+        this.logger = logger;
+    }
+
+    /**
+     * @see 
+     */
+    public CompilerExecutable getCompilerExecutableFor( CompilerRequirement compilerRequirement,
+                                                        CompilerConfig compilerConfig, MavenProject project,
+                                                        File assemblyPath )
+        throws PlatformUnsupportedException
+    {
+        if ( !isFactoryInited )
+        {
+            try
+            {
+                capabilityMatcher.init( project );
+                isFactoryInited = true;
+            }
+            catch ( InitializationException e )
+            {
+                throw new PlatformUnsupportedException( "NMAVEN-066-002: Unable to load the Executable Factory:", e );
+            }
+        }
+        VendorInfo vendorInfo = VendorInfo.Factory.createDefaultVendorInfo();
+        vendorInfo.setVendorVersion( compilerRequirement.getVendorVersion() );
+        vendorInfo.setFrameworkVersion( compilerRequirement.getFrameworkVersion() );
+        vendorInfo.setVendor( compilerRequirement.getVendor() );
+        try
+        {
+            processor.process( vendorInfo );
+        }
+        catch ( IllegalStateException e )
+        {
+            throw new PlatformUnsupportedException( "NMAVEN-066-011: Illegal State: Vendor Info = " + vendorInfo, e );
+        }
+
+        if ( vendorInfo.getVendor() == null )
+        {
+            throw new PlatformUnsupportedException( "NMAVEN-066-012: Vendor could not be found: " + vendorInfo );
+        }
+
+        logger.info( "NMAVEN-066-012: Found Vendor = " + vendorInfo );
+        compilerRequirement.setVendor( vendorInfo.getVendor() );
+        compilerRequirement.setVendorVersion( vendorInfo.getVendorVersion() );
+        compilerRequirement.setFrameworkVersion( vendorInfo.getFrameworkVersion() );
+
+        if ( vendorInfoRepository != null && vendorInfoRepository.exists() )
+        {
+            File installRoot = vendorInfoRepository.getInstallRootFor( vendorInfo );
+            if ( installRoot != null )
+            {
+                compilerConfig.setExecutionPath( installRoot.getAbsolutePath() );
+            }
+        }
+
+        compilerContext.init( compilerRequirement, compilerConfig, project, capabilityMatcher );
+        if ( assemblyPath != null )
+        {
+            compilerContext.getCompilerCapability().setAssemblyPath( assemblyPath.getAbsolutePath() );
+        }
+        try
+        {
+            return compilerContext.getCompilerExecutable();
+        }
+        catch ( ExecutionException e )
+        {
+            throw new PlatformUnsupportedException( "NMAVEN-066-007: Unable to find net executable", e );
+        }
+    }
+
+    public NetExecutable getNetExecutableFromRepository( String groupId, String artifactId, VendorInfo vendorInfo,
+                                                         MavenProject project, String localRepository,
+                                                         List<String> commands )
+        throws PlatformUnsupportedException
+    {
+        if ( !isFactoryInited )
+        {
+            try
+            {
+                capabilityMatcher.init( project );
+                isFactoryInited = true;
+            }
+            catch ( InitializationException e )
+            {
+                throw new PlatformUnsupportedException( "NMAVEN-066-009: Unable to load the Executable Factory:", e );
+            }
+        }
+
+        try
+        {
+            processor.process( vendorInfo );
+        }
+        catch ( IllegalStateException e )
+        {
+            throw new PlatformUnsupportedException( "NMAVEN-066-010: Illegal State: Vendor Info = " + vendorInfo, e );
+        }
+        Artifact artifact = artifactContext.getArtifactsFor( groupId, artifactId, null, null ).get( 0 );
+        logger.debug( "NMAVEN-066-003: Found Vendor: " + vendorInfo );
+
+        AssemblyRepositoryLayout layout = new AssemblyRepositoryLayout();
+        File artifactPath = new File( localRepository + File.separator + layout.pathOf( artifact ) );
+        List<String> modifiedCommands = new ArrayList<String>();
+        String exe;
+        if ( vendorInfo.getVendor().equals( Vendor.MONO ) )
+        {
+            if ( vendorInfo.getExecutablePath() != null && !vendorInfo.getExecutablePath().exists() )
+            {
+                logger.info(
+                    "NMAVEN-066-005: Executable path for mono does not exist. Will attempt to execute MONO using" +
+                        " the main PATH variable: Bad Executable Path = " +
+                        vendorInfo.getExecutablePath().getAbsolutePath() );
+            }
+            exe = ( vendorInfo.getExecutablePath() != null && vendorInfo.getExecutablePath().exists() ) ?
+                vendorInfo.getExecutablePath().getAbsolutePath() + File.separator + "mono" : "mono";
+            modifiedCommands.add( artifactPath.getAbsolutePath() );
+            for ( String command : commands )
+            {
+                modifiedCommands.add( command );
+            }
+        }
+        else
+        {
+            exe = artifactPath.getAbsolutePath();
+            modifiedCommands = commands;
+        }
+
+        ExecutableConfig executableConfig = ExecutableConfig.Factory.createDefaultExecutableConfig();
+        executableConfig.setExecutionPath( exe );
+        executableConfig.setCommands( modifiedCommands );
+
+        try
+        {
+            repositoryExecutableContext.init( executableConfig, project );
+        }
+        catch ( InitializationException e )
+        {
+            throw new PlatformUnsupportedException(
+                "NMAVEN-066-006: Unable to initialize the repository executable context", e );
+        }
+
+        try
+        {
+            return repositoryExecutableContext.getNetExecutable();
+        }
+        catch ( ExecutionException e )
+        {
+            throw new PlatformUnsupportedException( "NMAVEN-066-004: Unable to find net executable", e );
+        }
+
+    }
+
+    public NetExecutable getNetExecutableFor( String vendor, String frameworkVersion, String profile,
+                                              MavenProject project, List<String> commands, File netHome )
+        throws PlatformUnsupportedException
+    {
+        if ( !isFactoryInited )
+        {
+            try
+            {
+                capabilityMatcher.init( project );
+            }
+            catch ( InitializationException e )
+            {
+                throw new PlatformUnsupportedException( "NMAVEN-066-000: Unable to load the Executable Factory:", e );
+            }
+            isFactoryInited = true;
+        }
+
+        VendorInfo vendorInfo = VendorInfo.Factory.createDefaultVendorInfo();
+        vendorInfo.setVendorVersion( "" );
+        vendorInfo.setFrameworkVersion( frameworkVersion );
+        if ( vendor != null )
+        {
+            vendorInfo.setVendor( VendorFactory.createVendorFromName( vendor ) );
+        }
+
+        try
+        {
+            processor.process( vendorInfo );
+        }
+        catch ( IllegalStateException e )
+        {
+            throw new PlatformUnsupportedException( "NMAVEN-066-010: Illegal State: Vendor Info = " + vendorInfo, e );
+        }
+        logger.debug( "NMAVEN-066-003: Found Vendor: " + vendorInfo );
+        ExecutableRequirement executableRequirement =
+            ExecutableRequirement.Factory.createDefaultExecutableRequirement();
+        executableRequirement.setVendor( vendorInfo.getVendor() );
+        executableRequirement.setFrameworkVersion( vendorInfo.getFrameworkVersion() );
+        executableRequirement.setVendorVersion( vendorInfo.getVendorVersion() );
+        executableRequirement.setProfile( profile );
+
+        ExecutableConfig executableConfig = ExecutableConfig.Factory.createDefaultExecutableConfig();
+        executableConfig.setCommands( commands );
+        if ( netHome != null )
+        {
+            executableConfig.setExecutionPath( netHome.getAbsolutePath() );
+        }
+        executableContext.init( executableRequirement, executableConfig, project, capabilityMatcher );
+
+        try
+        {
+            return executableContext.getNetExecutable();
+        }
+        catch ( ExecutionException e )
+        {
+            throw new PlatformUnsupportedException( "NMAVEN-066-001: Unable to find net executable", e );
+        }
+    }
+}

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



Mime
View raw message