incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r532100 - in /incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin: ./ src/main/csharp/ src/main/csharp/NMaven/Plugin/ src/main/csharp/NMaven/Plugin/Generator/ src/main/csharp/NMaven/Plugin/Injector/ src/main/csharp/NMaven/Plugin/Injec...
Date Tue, 24 Apr 2007 21:50:12 GMT
Author: sisbell
Date: Tue Apr 24 14:50:11 2007
New Revision: 532100

URL: http://svn.apache.org/viewvc?view=rev&rev=532100
Log:
Plugin now works with dynamic injector mappings. Had to make decision to use config or attributes:
went with attributes since it allows  easier plugin. Downside is that the plugin needs to
reside in the NMaven.Plugin.dll. Investigate checking of other assemblies.

Added:
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/IFieldInjector.cs
Removed:
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/FieldInjector.cs
Modified:
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/pom.xml
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven.Plugin.csproj
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/AbstractMojo.cs
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/ClassAttribute.cs
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/FieldAttribute.cs
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Generator/JavaClass.cs
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Generator/JavaClassUnmarshaller.cs
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Generator/JavaField.cs
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/Impl/FieldInjectorRepository.cs
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/MavenProjectInjector.cs
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/StringInjector.cs
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/PluginDomainManager.cs

Modified: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/pom.xml?view=diff&rev=532100&r1=532099&r2=532100
==============================================================================
--- incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/pom.xml (original)
+++ incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/pom.xml Tue Apr 24 14:50:11
2007
@@ -46,6 +46,14 @@
           <keyfile>sample.snk</keyfile>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.dotnet.plugins</groupId>
+        <artifactId>maven-install-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <isGacInstall>true</isGacInstall>
+        </configuration>
+      </plugin>      
     </plugins>
   </build>
   <profiles>

Modified: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven.Plugin.csproj
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven.Plugin.csproj?view=diff&rev=532100&r1=532099&r2=532100
==============================================================================
--- incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven.Plugin.csproj
(original)
+++ incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven.Plugin.csproj
Tue Apr 24 14:50:11 2007
@@ -36,10 +36,11 @@
     <Compile Include="..\..\..\..\NMaven.Plugin.Loader\src\main\csharp\NMaven\Plugin\Loader\PluginLoader.cs">
       <Link>PluginLoader.cs</Link>
     </Compile>
-    <Compile Include="NMaven\Plugin\Injector\FieldInjector.cs" />
+    <Compile Include="NMaven\Plugin\Injector\IFieldInjector.cs" />
     <Compile Include="NMaven\Plugin\Injector\MavenProjectInjector.cs" />
     <Compile Include="NMaven\Plugin\Injector\StringInjector.cs" />
     <Compile Include="NMaven\Plugin\Injector\Impl\FieldInjectorRepository.cs" />
+    <Compile Include="NMaven\Plugin\FieldInjectorAttribute.cs" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="NMaven" />

Modified: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/AbstractMojo.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/AbstractMojo.cs?view=diff&rev=532100&r1=532099&r2=532100
==============================================================================
--- incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/AbstractMojo.cs
(original)
+++ incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/AbstractMojo.cs
Tue Apr 24 14:50:11 2007
@@ -1,3 +1,4 @@
+#region Apache License, Version 2.0 
 //
 // Licensed to the Apache Software Foundation (ASF) under one
 // or more contributor license agreements.  See the NOTICE file
@@ -16,7 +17,7 @@
 // specific language governing permissions and limitations
 // under the License.
 //
-
+#endregion
 using System;
 using System.IO;
 using System.Reflection;
@@ -51,52 +52,11 @@
 				if(fieldInfo != null) 
 				{
 					IFieldInjector fieldInjector = fieldInjectorRepository.getFieldInjectorFor(fieldInfo);
-					
-					//string fieldType = this.getFieldTypeFor(fieldInfo);
-					//Console.WriteLine("Type = " + fieldType);
-					if(fieldType.Equals("java.lang.String") || fieldType.Equals("String"))
-					{
-						//IFieldInjector fieldInjector = new StringInjector();
-						fieldInjector.inject(fieldInfo, reader.ReadString() )	
-					}
-					else if(fieldType.Equals("org.apache.maven.project.MavenProject"))
-					{	
-						//IFieldInjector fieldInjector = new MavenProjectInjector();
-						fieldInjector.inject(fieldInfo, reader.ReadString());
-						//fieldInfo.SetValue(this, this.CreatePomModelFor(reader.ReadString()));
-					}											
-				}					
+					fieldInjector.Inject(this, fieldInfo, reader.ReadString() );									
+				}	
+				
 			}        	
         }
-        
-
-        	/*
-			XmlTextReader reader = 
-				new XmlTextReader(@"C:\Documents and Settings\shane\nmaven-apache\SI_XPT\assemblies\NMaven.Plugin\src\test\resources\text.xml");
-
-			TestMojo m = new TestMojo();
-			
-			while(reader.Read() == true)
-			{	
-				FieldInfo fieldInfo = GetFieldInfoFor(m, reader.Name);
-				if(fieldInfo != null) fieldInfo.SetValue(m, reader.ReadString());
-			}
-		
-			System.Attribute[] attributes =
-				System.Attribute.GetCustomAttributes(typeof(TestMojo));
-			Console.WriteLine("Attributes = " + attributes.Length);
-			foreach(Attribute attribute in attributes) {
-				
-				FieldAttribute mojo = (FieldAttribute) attribute;
-				
-				//Console.WriteLine("LR: " + mojo.Name);
-			}
-					
-			m.print();   
-                                  */
-                                 
-
-
         
         private FieldInfo GetFieldInfoFor(Type type, String name)
         {

Modified: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/ClassAttribute.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/ClassAttribute.cs?view=diff&rev=532100&r1=532099&r2=532100
==============================================================================
--- incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/ClassAttribute.cs
(original)
+++ incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/ClassAttribute.cs
Tue Apr 24 14:50:11 2007
@@ -1,3 +1,23 @@
+#region Apache License, Version 2.0 
+//
+// 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.
+//
+#endregion
 using System;
 
 namespace NMaven.Plugin

Modified: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/FieldAttribute.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/FieldAttribute.cs?view=diff&rev=532100&r1=532099&r2=532100
==============================================================================
--- incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/FieldAttribute.cs
(original)
+++ incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/FieldAttribute.cs
Tue Apr 24 14:50:11 2007
@@ -1,3 +1,23 @@
+#region Apache License, Version 2.0 
+//
+// 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.
+//
+#endregion
 using System;
 
 namespace NMaven.Plugin

Modified: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Generator/JavaClass.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Generator/JavaClass.cs?view=diff&rev=532100&r1=532099&r2=532100
==============================================================================
--- incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Generator/JavaClass.cs
(original)
+++ incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Generator/JavaClass.cs
Tue Apr 24 14:50:11 2007
@@ -1,4 +1,23 @@
-
+#region Apache License, Version 2.0 
+//
+// 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.
+//
+#endregion
 using System;
 using System.Collections.Generic;
 

Modified: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Generator/JavaClassUnmarshaller.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Generator/JavaClassUnmarshaller.cs?view=diff&rev=532100&r1=532099&r2=532100
==============================================================================
--- incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Generator/JavaClassUnmarshaller.cs
(original)
+++ incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Generator/JavaClassUnmarshaller.cs
Tue Apr 24 14:50:11 2007
@@ -1,3 +1,23 @@
+#region Apache License, Version 2.0 
+//
+// 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.
+//
+#endregion
 using System;
 using System.Collections.Generic;
 using System.IO;

Modified: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Generator/JavaField.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Generator/JavaField.cs?view=diff&rev=532100&r1=532099&r2=532100
==============================================================================
--- incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Generator/JavaField.cs
(original)
+++ incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Generator/JavaField.cs
Tue Apr 24 14:50:11 2007
@@ -1,3 +1,23 @@
+#region Apache License, Version 2.0 
+//
+// 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.
+//
+#endregion
 using System;
 using System.Collections.Generic;
 

Added: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/IFieldInjector.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/IFieldInjector.cs?view=auto&rev=532100
==============================================================================
--- incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/IFieldInjector.cs
(added)
+++ incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/IFieldInjector.cs
Tue Apr 24 14:50:11 2007
@@ -0,0 +1,35 @@
+#region Apache License, Version 2.0 
+//
+// 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.
+//
+#endregion
+using System;
+using System.Reflection;
+
+namespace NMaven.Plugin.Injector
+{
+	/// <summary>
+	/// Description of FieldInjector.
+	/// </summary>
+	public interface IFieldInjector
+	{
+		void Inject(object targetObject, FieldInfo fieldInfo, object fieldObject);
+		
+		string GetJavaClassName();
+	}
+}

Modified: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/Impl/FieldInjectorRepository.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/Impl/FieldInjectorRepository.cs?view=diff&rev=532100&r1=532099&r2=532100
==============================================================================
--- incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/Impl/FieldInjectorRepository.cs
(original)
+++ incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/Impl/FieldInjectorRepository.cs
Tue Apr 24 14:50:11 2007
@@ -1,13 +1,27 @@
-/*
- * Created by SharpDevelop.
- * User: shane
- * Date: 4/23/2007
- * Time: 1:34 PM
- * 
- * To change this template use Tools | Options | Coding | Edit Standard Headers.
- */
-
+#region Apache License, Version 2.0 
+//
+// 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.
+//
+#endregion
 using System;
+using System.Reflection;
+using System.Collections.Generic;
+using System.Collections;
 
 namespace NMaven.Plugin.Injector.Impl
 {
@@ -15,14 +29,40 @@
 	/// Description of FieldInjectorRepository.
 	/// </summary>
 	public class FieldInjectorRepository
-	{
+	{		
 		public FieldInjectorRepository()
 		{
 		}
 		
 		public IFieldInjector getFieldInjectorFor(FieldInfo fieldInfo)
 		{
-			
+			//String fieldTypeName = fieldInfo.FieldType.FullName;
+			Type[] types = this.GetType().Assembly.GetTypes();
+			foreach(Type type in types)
+			{
+				if(type.GetInterface("NMaven.Plugin.Injector.IFieldInjector") == null) 
+				{
+					Console.WriteLine("Not correct interface: Name = " + type.Name);
+					continue;
+				}
+				
+			    foreach (Attribute attribute in type.GetCustomAttributes(false))
+		        {	 
+			    	Console.WriteLine("Looking at attribute: Name = " + attribute.GetType().Name);
+			    	if(attribute is FieldInjectorAttribute)
+			    	{
+			    		Console.WriteLine("Found Field Injector");
+			    		FieldInjectorAttribute fieldInjectorAttribute = (FieldInjectorAttribute) attribute;

+			    		Console.WriteLine(fieldInfo.FieldType.FullName + ":" + fieldInjectorAttribute.TargetClassName);
+			    		if(fieldInfo.FieldType.FullName.Equals(fieldInjectorAttribute.TargetClassName))
+			    		{
+			    			Console.WriteLine("Returning field injector");
+			    			return (IFieldInjector) type.GetConstructor(System.Type.EmptyTypes).Invoke(null);
+			    		}
+			    	}
+		        }  
+			}
+			return null;
 		}
 		
 
@@ -34,7 +74,6 @@
 				return fieldAttribute.Type;
 	        }  
 	    	return null;
-       }
-       
+       }       
 	}
 }

Modified: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/MavenProjectInjector.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/MavenProjectInjector.cs?view=diff&rev=532100&r1=532099&r2=532100
==============================================================================
--- incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/MavenProjectInjector.cs
(original)
+++ incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/MavenProjectInjector.cs
Tue Apr 24 14:50:11 2007
@@ -1,23 +1,46 @@
+#region Apache License, Version 2.0 
+//
+// 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.
+//
+#endregion
 using System;
 using System.IO;
 using System.Reflection;
 using System.Xml;
 using System.Xml.Serialization;
 
+using NMaven.Plugin;
+
 namespace NMaven.Plugin.Injector
 {
 	/// <summary>
 	/// Description of MavenProjectInjector.
 	/// </summary>
+	[FieldInjectorAttribute("NMaven.Model.Model")]
 	public class MavenProjectInjector : IFieldInjector 
 	{
 		public MavenProjectInjector()
 		{
 		}
 		
-		public void inject(FieldInfo fieldInfo, object fieldObject)
+		public void Inject(object targetObject, FieldInfo fieldInfo, object fieldObject)
 		{
-			fieldInfo.SetValue(this, this.CreatePomModelFor( ((string) fieldObject) ));
+			fieldInfo.SetValue(targetObject, this.CreatePomModelFor( ((string) fieldObject) ));
 		}
 		
    		private NMaven.Model.Model CreatePomModelFor(string fileName)
@@ -25,6 +48,11 @@
 			TextReader reader = new StreamReader(fileName);
 		    XmlSerializer serializer = new XmlSerializer(typeof(NMaven.Model.Model));
 			return (NMaven.Model.Model) serializer.Deserialize(reader);	
+		}  
+   		
+		public string GetJavaClassName() 
+		{
+			return "org.apache.maven.project.MavenProject";				
 		}   		
 	}
 }

Modified: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/StringInjector.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/StringInjector.cs?view=diff&rev=532100&r1=532099&r2=532100
==============================================================================
--- incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/StringInjector.cs
(original)
+++ incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/StringInjector.cs
Tue Apr 24 14:50:11 2007
@@ -1,20 +1,48 @@
+#region Apache License, Version 2.0 
+//
+// 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.
+//
+#endregion
 using System;
 using System.Reflection;
 
-namespace .NMaven.Plugin.Injector
+using NMaven.Plugin;
+
+namespace NMaven.Plugin.Injector
 {
 	/// <summary>
 	/// Description of StringInjector.
 	/// </summary>
+	[FieldInjectorAttribute("System.String")]
 	public class StringInjector : IFieldInjector
 	{
 		public StringInjector()
 		{
 		}
 		
-		public void inject(FieldInfo fieldInfo, object fieldObject)
+		public void Inject(object targetObject, FieldInfo fieldInfo, object fieldObject)
+		{
+			fieldInfo.SetValue(targetObject, (string) fieldObject );
+		}	
+		
+		public string GetJavaClassName() 
 		{
-			fieldInfo.SetValue(this, (string) fieldObject );
-		}		
+			return "java.lang.String";			
+		}
 	}
 }

Modified: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/PluginDomainManager.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/PluginDomainManager.cs?view=diff&rev=532100&r1=532099&r2=532100
==============================================================================
--- incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/PluginDomainManager.cs
(original)
+++ incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/PluginDomainManager.cs
Tue Apr 24 14:50:11 2007
@@ -1,3 +1,23 @@
+#region Apache License, Version 2.0 
+//
+// 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.
+//
+#endregion
 using System;
 using System.IO;
 using System.Reflection;
@@ -5,15 +25,22 @@
 namespace NMaven.Plugin
 {
 	/// <summary>
-	/// Description of PluginDomainManager.
+	/// Allows loading of .NET Maven Plugins (and its dependencies) into a separate application
domain.
 	/// </summary>
 	public class PluginDomainManager : AppDomainManager
 	{
+		/// <summary>
+		/// Default constructor
+		/// </summary>
 		public PluginDomainManager() : base()
 		{
 			Console.WriteLine("Creating Plugin Domain Manager");
 		}
-
+		
+		/// <summary>
+		/// Loads the specified .NET Maven plugin into the plugin domain 
+		/// </summary>
+		/// <param name="assemblyFile">the .NET Maven plugin</param>
 		public void LoadPlugin(FileInfo assemblyFile)
 		{
 			
@@ -28,16 +55,6 @@
 				Console.WriteLine("FNE: " + e.Message);
 				return;
 			}
-			
-			//ObjectHandler h = AppDomain.CurrentDomain.CreateInstanceFrom();
-			
-	/*		
-			Type plugin = assembly.GetType("NMaven.Plugin.Solution.SolutionPlugin");
-			
-			object o = Activator.CreateInstance(plugin);
-			MethodInfo executeMethod = plugin.GetMethod("Execute");
-			executeMethod.Invoke(o, null);	
-		*/
 		}
 	}
 }



Mime
View raw message