incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r531660 - in /incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader: ./ NMaven.Plugin.Loader/ src/ src/main/ src/main/csharp/ src/main/csharp/NMaven/ src/main/csharp/NMaven/Plugin/ src/main/csharp/NMaven/Plugin/Loader/
Date Mon, 23 Apr 2007 23:48:16 GMT
Author: sisbell
Date: Mon Apr 23 16:48:15 2007
New Revision: 531660

URL: http://svn.apache.org/viewvc?view=rev&rev=531660
Log:
Initial import of the plugin loader.

Added:
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/NMaven.Plugin.Loader/
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/NMaven.Plugin.Loader/NMaven.Plugin.Loader.sln
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/pom.xml   (with props)
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/src/
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/src/main/
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/src/main/csharp/
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/src/main/csharp/NMaven/
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/src/main/csharp/NMaven/Plugin/
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/src/main/csharp/NMaven/Plugin/Loader/
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/src/main/csharp/NMaven/Plugin/Loader/PluginLoader.cs

Added: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/NMaven.Plugin.Loader/NMaven.Plugin.Loader.sln
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/NMaven.Plugin.Loader/NMaven.Plugin.Loader.sln?view=auto&rev=531660
==============================================================================
--- incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/NMaven.Plugin.Loader/NMaven.Plugin.Loader.sln
(added)
+++ incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/NMaven.Plugin.Loader/NMaven.Plugin.Loader.sln
Mon Apr 23 16:48:15 2007
@@ -0,0 +1,10 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# SharpDevelop 2.0.0.1710
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+	EndGlobalSection
+EndGlobal

Added: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/pom.xml?view=auto&rev=531660
==============================================================================
--- incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/pom.xml (added)
+++ incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/pom.xml Mon Apr 23 16:48:15
2007
@@ -0,0 +1,39 @@
+<?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">
+  <parent>
+    <groupId>NMaven</groupId>
+    <version>0.14</version>
+    <artifactId>NMaven.Assemblies</artifactId>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>NMaven.Plugin</groupId>
+  <artifactId>NMaven.Plugin.Loader</artifactId>
+  <packaging>exe</packaging>
+  <version>0.14</version>
+  <name>NMaven.Plugin.Loader</name>
+  <dependencies>
+    <dependency>
+      <groupId>NMaven.Plugin</groupId>
+      <artifactId>NMaven.Plugin</artifactId>
+      <type>library</type>
+      <version>0.14</version>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file

Propchange: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/src/main/csharp/NMaven/Plugin/Loader/PluginLoader.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/src/main/csharp/NMaven/Plugin/Loader/PluginLoader.cs?view=auto&rev=531660
==============================================================================
--- incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/src/main/csharp/NMaven/Plugin/Loader/PluginLoader.cs
(added)
+++ incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.Loader/src/main/csharp/NMaven/Plugin/Loader/PluginLoader.cs
Mon Apr 23 16:48:15 2007
@@ -0,0 +1,111 @@
+using System;
+using System.IO;
+using System.Reflection;
+using System.Runtime.Remoting;
+using NMaven.Plugin;
+
+namespace NMaven.Plugin.Loader
+{
+	/// <summary>
+	/// Description of PluginLoader.
+	/// </summary>
+	public class PluginLoader
+	{
+		public PluginLoader()
+		{
+		}
+
+		public void load(FileInfo paramFile, FileInfo assemblyFile, string mojoName)
+		{
+			Console.WriteLine("Loading Loader: " + assemblyFile.DirectoryName);
+			AppDomainSetup setup = new AppDomainSetup();
+			setup.ApplicationBase = assemblyFile.DirectoryName;
+
+			AppDomain domain = AppDomain.CreateDomain("Loader", null, setup);
+			PluginDomainManager domainManager = (PluginDomainManager) domain.DomainManager;
+            domainManager.LoadPlugin(assemblyFile);
+			ObjectHandle oh = domain.CreateInstanceFrom(assemblyFile.FullName, mojoName);
+			AbstractMojo o = (AbstractMojo) oh.Unwrap();
+			o.injectFields(paramFile.FullName);
+			o.Execute();
+			//Console.WriteLine("Type = " + o.getT());
+			/*
+			foreach(MethodInfo methodInfo in o.GetType().GetMethods())
+			{
+				Console.WriteLine(methodInfo.Name);
+			}
+			MethodInfo executeMethod = o.GetType().GetMethod("Execute");
+			executeMethod.Invoke(o, null);
+*/
+			//PluginDomainManager domainManager = new PluginDomainManager();
+			//AppDomain domain = domainManager.CreateDomain("Loader", null, setup);
+			//domain.CreateInstance();
+			/*
+			PluginDomainManager domainManager = (PluginDomainManager) domain.DomainManager;
+			
+			if(domainManager == null)
+			{
+				Console.WriteLine("DM is null");
+				return;
+			}
+						
+			domainManager.Load(paramFile, assemblyFile);
+			*/
+	/*		
+			Assembly assembly = null;
+			try 
+			{
+				assembly = domain.Load(@"NMaven.Plugin.Solution");				
+			}
+			catch(FileNotFoundException e)
+			{
+				Console.WriteLine(e.Message);
+				return;
+			}
+			
+			Type plugin = assembly.GetType("NMaven.Plugin.Solution.SolutionPlugin");
+			
+			object o = Activator.CreateInstance(plugin);
+			MethodInfo executeMethod = plugin.GetMethod("Execute");
+			executeMethod.Invoke(o, null);
+			*/
+			//Read in XML file, Executable Assembly Info (Directory, ArtifactId);
+/*			
+			string[] args = new string[2];
+			args[0] = @"C:\Documents and Settings\shane\nmaven-apache\SI_XPT\integration-tests\tests\it0020\target\assembly-resources\resgen";
+			args[1] = @"C:\tmp\test.resx";
+			FileInfo fileInfo = new FileInfo(@"C:\Documents and Settings\shane\.m2\repository\NMaven\Plugin\NMaven.Plugin.Resx\0.14\NMaven.Plugin.Resx.exe");
+			
+			AppDomainSetup setup = new AppDomainSetup();
+			setup.ApplicationBase = fileInfo.DirectoryName;		
+			setup.ConfigurationFile = @"NMaven.Plugin.Resx.exe.config";
+			AppDomain domain = AppDomain.CreateDomain("Loader", null, setup);
+		    int i = domain.ExecuteAssembly(@"NMaven.Plugin.Resx.exe", null, args);
+			Console.WriteLine("INT = " + i);	
+	*/
+		}
+		
+		public static void Main(string[] args)
+		{
+			string paramFile = GetArgFor("parameterFile", args);
+			string assemblyFile = GetArgFor("assemblyFile", args);
+			string mojoName = GetArgFor("mojoName", args);
+			Console.WriteLine("ParamFile = {0}, AssemblyFile = {1}, MojoName = {2}", 
+			                  paramFile, assemblyFile, mojoName);
+			
+			PluginLoader pluginLoader = new PluginLoader();
+			pluginLoader.load(new FileInfo(paramFile), new FileInfo(assemblyFile), mojoName);
+		}
+		
+		private static string GetArgFor(string name, string[] args)
+		{
+			char[] delim = {'='};
+			foreach(string arg in args)
+			{
+                string[] tokens = arg.Split(delim);
+                if (tokens[0].Equals(name)) return tokens[1];
+			}
+            return null;
+		}		
+	}
+}



Mime
View raw message