You are viewing a plain text version of this content. The canonical link for it is here.
Posted to nmaven-commits@incubator.apache.org by si...@apache.org on 2007/04/23 23:35:02 UTC

svn commit: r531656 - in /incubator/nmaven/branches/SI_XPT/components/dotnet-plugin: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/maven/ src/main/java/org/apache/maven/dotnet/ src/main/java/org/...

Author: sisbell
Date: Mon Apr 23 16:35:00 2007
New Revision: 531656

URL: http://svn.apache.org/viewvc?view=rev&rev=531656
Log:
Classes that the autogenerated plugins will use for interacting with the .NET plugins.

Added:
    incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/
    incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/pom.xml   (with props)
    incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/
    incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/
    incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/
    incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/
    incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/
    incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/
    incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/
    incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/
    incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/AbstractMojo.java   (with props)
    incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/DotNetMojo.java   (with props)
    incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/resources/
    incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/resources/META-INF/
    incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/resources/META-INF/plexus/
    incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/resources/META-INF/plexus/components.xml   (with props)

Added: incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/pom.xml?view=auto&rev=531656
==============================================================================
--- incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/pom.xml (added)
+++ incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/pom.xml Mon Apr 23 16:35:00 2007
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?><!--
+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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" 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.14-SNAPSHOT</version>
+    <artifactId>dotnet-components</artifactId>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.dotnet</groupId>
+  <artifactId>dotnet-plugin</artifactId>
+  <version>0.14-SNAPSHOT</version>
+  <name>dotnet-plugin</name>
+  <description>
+    NMaven
+  </description>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>2.1-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.1-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.dotnet</groupId>
+      <artifactId>dotnet-executable</artifactId>
+      <version>0.14-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.dotnet</groupId>
+      <artifactId>dotnet-vendor</artifactId>
+      <version>0.14-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file

Propchange: incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/AbstractMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/AbstractMojo.java?view=auto&rev=531656
==============================================================================
--- incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/AbstractMojo.java (added)
+++ incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/AbstractMojo.java Mon Apr 23 16:35:00 2007
@@ -0,0 +1,111 @@
+package org.apache.maven.dotnet.plugin;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.dotnet.vendor.VendorInfo;
+import org.apache.maven.dotnet.vendor.VendorFactory;
+import org.apache.maven.dotnet.executable.ExecutionException;
+import org.apache.maven.dotnet.executable.NetExecutableFactory;
+import org.apache.maven.dotnet.PlatformUnsupportedException;
+import org.apache.maven.project.MavenProject;
+import org.w3c.dom.Document;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.dom.DOMSource;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+public abstract class AbstractMojo
+    extends org.apache.maven.plugin.AbstractMojo
+    implements DotNetMojo
+{
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        DocumentBuilder builder = null;
+        try
+        {
+            builder = factory.newDocumentBuilder();
+        }
+        catch ( ParserConfigurationException e )
+        {
+            e.printStackTrace();
+        }
+        Document document = builder.newDocument();
+
+        File paramFile = null;
+        FileOutputStream fos = null;
+        try
+        {
+            paramFile = File.createTempFile( "Plugin", ".xml" );
+            fos = new FileOutputStream( paramFile );
+        }
+        catch ( IOException e )
+        {
+            e.printStackTrace();
+        }
+
+        StreamResult result = new StreamResult();
+        result.setOutputStream( fos );
+        Transformer xformer = null;
+        try
+        {
+            xformer = TransformerFactory.newInstance().newTransformer();
+        }
+        catch ( TransformerConfigurationException e )
+        {
+            e.printStackTrace();
+        }
+
+        try
+        {
+            xformer.transform( this.getDOMSourceFor( document ), result );
+        }
+        catch ( TransformerException e )
+        {
+            e.printStackTrace();
+        }
+        try
+        {
+            fos.close();
+        }
+        catch ( IOException e )
+        {
+            e.printStackTrace();
+        }
+        try
+        {
+            VendorInfo vendorInfo = VendorInfo.Factory.createDefaultVendorInfo();
+            vendorInfo.setVendor( VendorFactory.createVendorFromName( "MICROSOFT" ) );
+            getNetExecutableFactory().getPluginLoaderFor( "NMaven.Plugin", "NMaven.Plugin.Solution", vendorInfo,
+                                                     getMavenProject(), getLocalRepository(), paramFile,
+                                                     "SolutionMojo" ).execute();
+        }
+        catch ( PlatformUnsupportedException e )
+        {
+            throw new MojoExecutionException( "", e );
+        }
+        catch ( ExecutionException e )
+        {
+            throw new MojoExecutionException( "", e );
+        }
+    }
+
+    public abstract String getLocalRepository();
+
+    public abstract MavenProject getMavenProject();
+
+    public abstract DOMSource getDOMSourceFor( Document document );
+
+    public abstract NetExecutableFactory getNetExecutableFactory();
+
+}

Propchange: incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/AbstractMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/DotNetMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/DotNetMojo.java?view=auto&rev=531656
==============================================================================
--- incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/DotNetMojo.java (added)
+++ incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/DotNetMojo.java Mon Apr 23 16:35:00 2007
@@ -0,0 +1,23 @@
+package org.apache.maven.dotnet.plugin;
+
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.dotnet.executable.NetExecutableFactory;
+import org.w3c.dom.Document;
+
+import javax.xml.transform.dom.DOMSource;
+
+public interface DotNetMojo
+{
+    /**
+     * Role used to register component implementations with the container.
+     */
+    String ROLE = DotNetMojo.class.getName();
+
+    String getLocalRepository();
+
+    MavenProject getMavenProject();
+
+    DOMSource getDOMSourceFor( Document document );
+
+    NetExecutableFactory getNetExecutableFactory();
+}

Propchange: incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/DotNetMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/resources/META-INF/plexus/components.xml?view=auto&rev=531656
==============================================================================
--- incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/resources/META-INF/plexus/components.xml (added)
+++ incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/resources/META-INF/plexus/components.xml Mon Apr 23 16:35:00 2007
@@ -0,0 +1,13 @@
+<component-set>
+  <components>
+    <component>
+      <role>org.apache.maven.dotnet.plugin.DotNetMojo</role>
+      <implementation>org.apache.maven.dotnet.plugin.AbstractMojo</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.dotnet.executable.NetExecutableFactory</role>
+        </requirement>
+      </requirements>
+    </component>
+  </components>
+</component-set>

Propchange: incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
    svn:eol-style = native