Author: sisbell
Date: Tue Dec  4 12:28:00 2007
New Revision: 601074

URL: http://svn.apache.org/viewvc?rev=601074&view=rev
Log:
Removed references to registry config and added use of annotations.

Added:
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblyInfoMarshallerAnnotation.java
   (with props)
Removed:
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/AssemblyPluginsRepository.java
Modified:
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblerContext.java
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblyInfo.java
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblyInfoException.java
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblyInfoMarshaller.java
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/AssemblerContextImpl.java
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/DefaultAssemblyInfoMarshaller.java
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/JavaAssemblyInfoMarshaller.java
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/VBAssemblyInfoMarshaller.java

Modified: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblerContext.java
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblerContext.java?rev=601074&r1=601073&r2=601074&view=diff
==============================================================================
--- 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblerContext.java
 (original)
+++ 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblerContext.java
 Tue Dec  4 12:28:00 2007
@@ -18,9 +18,8 @@
  */
 package org.apache.maven.dotnet.assembler;
 
-import org.apache.maven.dotnet.InitializationException;
-import org.apache.maven.dotnet.PlatformUnsupportedException;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.dotnet.compiler.ProgrammingLanguage;
 
 /**
  * Provides services for generating of AssemblyInfo.* file.
@@ -39,35 +38,25 @@
      * Returns the assembly info associated with this context.
      *
      * @return the assembly info associated with this context.
+
      */
     AssemblyInfo getAssemblyInfo();
 
     /**
      * Returns the marshaller for the given language
      *
-     * @param language the .NET language
+     * @param programmingLanguage the .NET language
      * @return the marshaller for the specified language
      * @throws AssemblyInfoException if no marshaller can be found for the 
specified language
      */
-    AssemblyInfoMarshaller getAssemblyInfoMarshallerFor( String language )
+    AssemblyInfoMarshaller getAssemblyInfoMarshallerFor( ProgrammingLanguage 
programmingLanguage )
         throws AssemblyInfoException;
 
     /**
-     * Returns the class extension (cs, vb) for the specified language.
-     *
-     * @param language the class language. Must match language within the 
assembly-plugins.xml file.
-     * @return the class extension (cs, vb) for the specified language.
-     * @throws PlatformUnsupportedException the language is not supported
-     */
-    String getClassExtensionFor(String language) throws 
PlatformUnsupportedException;
-
-    /**
      * Initializes the context
      *
      * @param mavenProject the maven project
-     * @throws InitializationException if the context cannot be initialized
      */
-    void init( MavenProject mavenProject )
-        throws InitializationException;
+    void init( MavenProject mavenProject );
 
 }

Modified: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblyInfo.java
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblyInfo.java?rev=601074&r1=601073&r2=601074&view=diff
==============================================================================
--- 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblyInfo.java
 (original)
+++ 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblyInfo.java
 Tue Dec  4 12:28:00 2007
@@ -23,8 +23,6 @@
 /**
  * Provides the information to be included within the assembly. Class can be 
extended to add additional assembly info
  * parameters.
- *
- * @author Shane Isbell
  */
 public class AssemblyInfo
 {
@@ -149,7 +147,6 @@
     {
         this.informationalVersion = informationalVersion;
     }
-
 
     public String getDescription()
     {

Modified: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblyInfoException.java
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblyInfoException.java?rev=601074&r1=601073&r2=601074&view=diff
==============================================================================
--- 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblyInfoException.java
 (original)
+++ 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblyInfoException.java
 Tue Dec  4 12:28:00 2007
@@ -20,8 +20,6 @@
 
 /**
  * Exception thrown when there is a problem processing the assembly info.
- *
- * @author Shane Isbell
  */
 public class AssemblyInfoException
     extends Exception

Modified: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblyInfoMarshaller.java
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblyInfoMarshaller.java?rev=601074&r1=601073&r2=601074&view=diff
==============================================================================
--- 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblyInfoMarshaller.java
 (original)
+++ 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblyInfoMarshaller.java
 Tue Dec  4 12:28:00 2007
@@ -18,17 +18,15 @@
  */
 package org.apache.maven.dotnet.assembler;
 
+import org.apache.maven.dotnet.compiler.ProgrammingLanguage;
+
 import java.io.OutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.dotnet.model.assembly.plugins.AssemblyPlugin;
+import java.io.File;
 
 /**
  * Provides services for creating an AssemblyInfo class.
- *
- * @author Shane Isbell
  */
 public interface AssemblyInfoMarshaller
 {
@@ -36,11 +34,11 @@
      * Writes the assembly info to AssemblyInfo.[language-extension].
      *
      * @param assemblyInfo the assembly info
-     * @param mavenProject the maven project
+     * @param buildDirectory the build directory
      * @param outputStream the output stream to write to (currently unused)
      * @throws IOException if there was a problem writing out the class file
      */
-    void marshal( AssemblyInfo assemblyInfo, MavenProject mavenProject, 
OutputStream outputStream )
+    void marshal( AssemblyInfo assemblyInfo, File buildDirectory, OutputStream 
outputStream )
         throws IOException;
 
     /**
@@ -50,14 +48,8 @@
      * @return an AssemblyInfo object for the specified input stream
      * @throws IOException if there was a problem reading the AssemblyInfo 
class file
      */
-    AssemblyInfo unmarshall( InputStream inputStream) throws IOException;    
+    AssemblyInfo unmarshall( InputStream inputStream) throws IOException;
 
-    /**
-     * Initializes the marshaller.
-     *
-     * @param plugin the assembly plugin model associated with this marshaller 
(plugin specified within the
-     *               assembly-plugins.xml file)
-     */
-    void init( AssemblyPlugin plugin );
+    void init( ProgrammingLanguage programmingLanguage, File 
buildSourcesDirectory );
 
 }

Added: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblyInfoMarshallerAnnotation.java
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblyInfoMarshallerAnnotation.java?rev=601074&view=auto
==============================================================================
--- 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblyInfoMarshallerAnnotation.java
 (added)
+++ 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblyInfoMarshallerAnnotation.java
 Tue Dec  4 12:28:00 2007
@@ -0,0 +1,12 @@
+package org.apache.maven.dotnet.assembler;
+
+import org.apache.maven.dotnet.compiler.ProgrammingLanguage;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
[EMAIL PROTECTED](RetentionPolicy.RUNTIME)
+public @interface AssemblyInfoMarshallerAnnotation
+{
+    ProgrammingLanguage[] programmingLanguaqes();
+}

Propchange: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblyInfoMarshallerAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/AssemblerContextImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/AssemblerContextImpl.java?rev=601074&r1=601073&r2=601074&view=diff
==============================================================================
--- 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/AssemblerContextImpl.java
 (original)
+++ 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/AssemblerContextImpl.java
 Tue Dec  4 12:28:00 2007
@@ -22,18 +22,18 @@
 import org.apache.maven.dotnet.assembler.AssemblyInfo;
 import org.apache.maven.dotnet.assembler.AssemblyInfoMarshaller;
 import org.apache.maven.dotnet.assembler.AssemblyInfoException;
-import org.apache.maven.dotnet.InitializationException;
-import org.apache.maven.dotnet.PlatformUnsupportedException;
-import org.apache.maven.dotnet.model.assembly.plugins.AssemblyPlugin;
+import org.apache.maven.dotnet.assembler.AssemblyInfoMarshallerAnnotation;
+import org.apache.maven.dotnet.compiler.ProgrammingLanguage;
+import org.apache.maven.dotnet.compiler.BuildDirectories;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.model.Organization;
 
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.logging.LogEnabled;
 import org.codehaus.plexus.logging.Logger;
-import org.apache.maven.dotnet.registry.RepositoryRegistry;
 
 import java.io.*;
+import java.util.Arrays;
 
 /**
  * Provides an implementation of the <code>AssemblerContext</code>.
@@ -44,13 +44,6 @@
     implements AssemblerContext, LogEnabled
 {
 
-    private static final String SNAPSHOT_SUFFIX = "SNAPSHOT";
-
-    /**
-     * A registry component of repository (config) files
-     */
-    private RepositoryRegistry repositoryRegistry;
-
     /**
      * The maven project
      */
@@ -62,12 +55,6 @@
     private Logger logger;
 
     /**
-     * The assembly plugins repository used for accessing assembly plugin 
information, which in turn is used for
-     * generating an <code>AssemblyInfo</code> object.
-     */
-    private AssemblyPluginsRepository repository;
-
-    /**
      * Constructor. This method is intended to by invoked by the 
plexus-container, not by the application developer.
      */
     public AssemblerContextImpl()
@@ -87,17 +74,17 @@
      */
     public AssemblyInfo getAssemblyInfo()
     {
-        String basedir = mavenProject.getBasedir().toString();
         AssemblyInfo assemblyInfo = new AssemblyInfo();
         String description = mavenProject.getDescription();
         String version = mavenProject.getVersion();
         String name = mavenProject.getName();
-        Organization org = mavenProject.getOrganization();
-        String company = ( org != null ) ? org.getName() : "";
+        Organization organization = mavenProject.getOrganization();
+        String company = ( organization != null ) ? organization.getName() : 
"";
         String copyright = null;
         String informationalVersion = "";
         String configuration = "";
 
+        String basedir = mavenProject.getBasedir().toString();
         File file = new File( basedir + "/COPYRIGHT.txt" );
         if ( file.exists() )
         {
@@ -140,67 +127,55 @@
     }
 
     /**
-     * @see AssemblerContext#getAssemblyInfoMarshallerFor(String)
+     * @see AssemblerContext#getAssemblyInfoMarshallerFor(ProgrammingLanguage)
      */
-    public AssemblyInfoMarshaller getAssemblyInfoMarshallerFor( String 
language )
+    public AssemblyInfoMarshaller getAssemblyInfoMarshallerFor( 
ProgrammingLanguage programmingLanguage )
         throws AssemblyInfoException
     {
-        AssemblyPlugin plugin = repository.getAssemblyPluginFor( language );
-        String className = plugin.getPluginClass();
-        AssemblyInfoMarshaller marshaller;
-        try
+        Class assemblyInfoMarshallerClass = null;
+        for ( Class c : AssemblyInfoMarshaller.class.getClasses() )
+        {
+            AssemblyInfoMarshallerAnnotation annotation =
+                (AssemblyInfoMarshallerAnnotation) c.getAnnotation( 
AssemblyInfoMarshallerAnnotation.class );
+            if ( annotation != null )
+            {
+                if ( Arrays.asList( annotation.programmingLanguaqes() 
).contains( programmingLanguage ) )
+                {
+                    assemblyInfoMarshallerClass = c;
+                }
+            }
+        }
+        if ( assemblyInfoMarshallerClass == null )
         {
-            Class cc = Class.forName( className );
-            marshaller = (AssemblyInfoMarshaller) cc.newInstance();
-            marshaller.init( plugin );
+            throw new AssemblyInfoException( "" );
         }
-        catch ( ClassNotFoundException e )
+
+        AssemblyInfoMarshaller marshaller;
+        try
         {
-            throw new AssemblyInfoException(
-                "NMAVEN-020-002: Unable to create AssemblyInfoMarshaller: 
Class Name = " + className, e );
+            marshaller = (AssemblyInfoMarshaller) 
assemblyInfoMarshallerClass.newInstance();
+            marshaller.init( programmingLanguage, new File( 
mavenProject.getBuild().getDirectory(),
+                                                            
BuildDirectories.BUILD_SOURCES.getBuildDirectoryName() ) );
         }
         catch ( InstantiationException e )
         {
-            throw new AssemblyInfoException(
-                "NMAVEN-020-003: Unable to create AssemblyInfoMarshaller: 
Class Name = " + className, e );
+            throw new AssemblyInfoException( "NMAVEN-020-003: Unable to create 
AssemblyInfoMarshaller: Class Name = " +
+                assemblyInfoMarshallerClass.getName(), e );
         }
         catch ( IllegalAccessException e )
         {
-            throw new AssemblyInfoException(
-                "NMAVEN-020-004: Unable to create AssemblyInfoMarshaller: 
Class Name = " + className, e );
+            throw new AssemblyInfoException( "NMAVEN-020-004: Unable to create 
AssemblyInfoMarshaller: Class Name = " +
+                assemblyInfoMarshallerClass.getName(), e );
         }
 
         return marshaller;
     }
 
     /**
-     * @see AssemblerContext#getClassExtensionFor(String)
-     */
-    public String getClassExtensionFor( String language )
-        throws PlatformUnsupportedException
-    {
-        try
-        {
-            return repository.getAssemblyPluginFor( language ).getExtension();
-        }
-        catch ( AssemblyInfoException e )
-        {
-            throw new PlatformUnsupportedException( "NMAVEN-020-006: Language 
not supported: Language = " + language,
-                                                    e );
-        }
-    }
-
-    /**
      * @see AssemblerContext#init(org.apache.maven.project.MavenProject)
      */
     public void init( MavenProject mavenProject )
-        throws InitializationException
     {
         this.mavenProject = mavenProject;
-        repository = (AssemblyPluginsRepository) repositoryRegistry.find( 
"assembly-plugins" );
-        if ( repository == null )
-        {
-            throw new InitializationException( "NMAVEN-020-005: Unable to find 
the assembly-plugins.xml file" );
-        }
     }
 }

Modified: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/DefaultAssemblyInfoMarshaller.java
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/DefaultAssemblyInfoMarshaller.java?rev=601074&r1=601073&r2=601074&view=diff
==============================================================================
--- 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/DefaultAssemblyInfoMarshaller.java
 (original)
+++ 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/DefaultAssemblyInfoMarshaller.java
 Tue Dec  4 12:28:00 2007
@@ -20,7 +20,8 @@
 
 import org.apache.maven.dotnet.assembler.AssemblyInfoMarshaller;
 import org.apache.maven.dotnet.assembler.AssemblyInfo;
-import org.apache.maven.dotnet.model.assembly.plugins.AssemblyPlugin;
+import org.apache.maven.dotnet.compiler.BuildDirectories;
+import org.apache.maven.dotnet.compiler.ProgrammingLanguage;
 
 import java.io.OutputStream;
 import java.io.IOException;
@@ -30,30 +31,19 @@
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
 
-import org.apache.maven.project.MavenProject;
-
 /**
  * Provides services for writing out the AssemblyInfo entries using the 
bracket convention [assembly:
- *
- * @author Shane Isbell
  */
-final class DefaultAssemblyInfoMarshaller
+public final class DefaultAssemblyInfoMarshaller
     implements AssemblyInfoMarshaller
 {
+    private ProgrammingLanguage programmingLanguage;
 
-    /**
-     * The assembly plugin model that contains information used in writing of 
the AssemblyInfo class.
-     */
-    private AssemblyPlugin plugin;
+    private File buildSourcesDirectory;
 
-    /**
-     * @see 
AssemblyInfoMarshaller#marshal(org.apache.maven.dotnet.assembler.AssemblyInfo, 
org.apache.maven.project.MavenProject,
-     *      java.io.OutputStream)
-     */
-    public void marshal( AssemblyInfo assemblyInfo, MavenProject mavenProject, 
OutputStream outputStream )
+    public void marshal( AssemblyInfo assemblyInfo, File buildDirectory, 
OutputStream outputStream )
         throws IOException
     {
-        String src = mavenProject.getBuild().getDirectory() + "/build-sources";
         StringBuffer sb = new StringBuffer();
         sb.append( "using System.Reflection;\r\n" )
             .append( "using System.Runtime.CompilerServices;\r\n" )
@@ -75,15 +65,14 @@
         {
             sb.append( createEntry( "KeyFile", 
assemblyInfo.getKeyFile().getAbsolutePath().replace( "\\", "\\\\" ) ) );
         }
-        FileOutputStream man = null;
+        FileOutputStream assemblyInfoFileStream = null;
         try
         {
-            String groupIdAsDir = mavenProject.getGroupId().replace( ".", 
File.separator );
-            File file = new File( src + "/META-INF/" + groupIdAsDir );
-            file.mkdirs();
-            man = new FileOutputStream(
-                src + "/META-INF/" + groupIdAsDir + File.separator + 
"AssemblyInfo." + plugin.getExtension() );
-            man.write( sb.toString().getBytes() );
+            File metaInfoDir = new File( buildSourcesDirectory, "META-INF" );
+            metaInfoDir.mkdirs();
+            assemblyInfoFileStream = new FileOutputStream(
+                metaInfoDir + File.separator + "AssemblyInfo." + 
programmingLanguage.getClassFileExtension() );
+            assemblyInfoFileStream.write( sb.toString().getBytes() );
         }
         catch ( IOException e )
         {
@@ -92,22 +81,14 @@
         }
         finally
         {
-            if ( man != null )
+            if ( assemblyInfoFileStream != null )
             {
-                man.close();
+                assemblyInfoFileStream.close();
             }
         }
     }
 
     /**
-     * @see 
AssemblyInfoMarshaller#init(org.apache.maven.dotnet.model.assembly.plugins.AssemblyPlugin)
-     */
-    public void init( AssemblyPlugin plugin )
-    {
-        this.plugin = plugin;
-    }
-
-    /**
      * @see AssemblyInfoMarshaller#unmarshall(java.io.InputStream)
      */
     public AssemblyInfo unmarshall( InputStream inputStream )
@@ -131,15 +112,21 @@
         return assemblyInfo;
     }
 
+    public void init( ProgrammingLanguage programmingLanguage, File 
buildSourcesDirectory )
+    {
+        this.programmingLanguage = programmingLanguage;
+        this.buildSourcesDirectory = buildSourcesDirectory;
+    }
+
     /**
      * Sets the specified value within the specified assembly info
      *
      * @param assemblyInfo the assembly info to set information on
-     * @param name the name of the assembly info field: AssemblyTitle, 
AssemblyDescription, ...
-     * @param value the value associated with the specified name
+     * @param name         the name of the assembly info field: AssemblyTitle, 
AssemblyDescription, ...
+     * @param value        the value associated with the specified name
      * @throws IOException if the assembly info is invalid
      */
-    private void setAssemblyInfo( AssemblyInfo assemblyInfo, String name, 
String value )
+    private static void setAssemblyInfo( AssemblyInfo assemblyInfo, String 
name, String value )
         throws IOException
     {
         if ( !name.startsWith( "Assembly" ) )
@@ -204,7 +191,7 @@
      * @param value the value of the assembly entry
      * @return an assembly entry with a name-value pair surrounded by brackets
      */
-    private String createEntry( String name, String value )
+    private static String createEntry( String name, String value )
     {
         StringBuffer sb = new StringBuffer();
         sb.append( "[assembly: Assembly" ).append( name ).append( "(\"" 
).append( value ).append( "\")]" ).append(

Modified: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/JavaAssemblyInfoMarshaller.java
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/JavaAssemblyInfoMarshaller.java?rev=601074&r1=601073&r2=601074&view=diff
==============================================================================
--- 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/JavaAssemblyInfoMarshaller.java
 (original)
+++ 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/JavaAssemblyInfoMarshaller.java
 Tue Dec  4 12:28:00 2007
@@ -20,7 +20,7 @@
 
 import org.apache.maven.dotnet.assembler.AssemblyInfoMarshaller;
 import org.apache.maven.dotnet.assembler.AssemblyInfo;
-import org.apache.maven.dotnet.model.assembly.plugins.AssemblyPlugin;
+import org.apache.maven.dotnet.compiler.ProgrammingLanguage;
 
 import java.io.OutputStream;
 import java.io.IOException;
@@ -28,30 +28,21 @@
 import java.io.File;
 import java.io.InputStream;
 
-import org.apache.maven.project.MavenProject;
-
 /**
  * Provides services for writing out the AssemblyInfo entries for Java, where 
each entry begins with '/**@'  and ends with '*\/'
  *
  * @author Shane Isbell
  */
-final class JavaAssemblyInfoMarshaller
+public final class JavaAssemblyInfoMarshaller
     implements AssemblyInfoMarshaller
 {
+    private ProgrammingLanguage programmingLanguage;
 
-    /**
-     * The assembly plugin model that contains information used in writing of 
the AssemblyInfo class.
-     */
-    private AssemblyPlugin plugin;
+    private File buildSourcesDirectory;
 
-    /**
-     * @see 
AssemblyInfoMarshaller#marshal(org.apache.maven.dotnet.assembler.AssemblyInfo, 
org.apache.maven.project.MavenProject,
-     *      java.io.OutputStream)
-     */
-    public void marshal( AssemblyInfo assemblyInfo, MavenProject mavenProject, 
OutputStream outputStream )
+    public void marshal( AssemblyInfo assemblyInfo, File buildDirectory, 
OutputStream outputStream )
         throws IOException
     {
-        String src = mavenProject.getBasedir() + "/target/build-sources";
         StringBuffer sb = new StringBuffer();
         sb.append( "import System.Reflection;\r\n" )
             .append( "import System.Runtime.CompilerServices.*;r\n" )
@@ -64,44 +55,43 @@
             .append( createEntry( "Culture", assemblyInfo.getCulture() ) )
             .append( createEntry( "Version", assemblyInfo.getVersion() ) )
             .append( createEntry( "Configuration", 
assemblyInfo.getConfiguration() ) );
-        FileOutputStream man = null;
+
+        FileOutputStream assemblyInfoFileStream = null;
         try
         {
-            String groupIdAsDir = mavenProject.getGroupId().replace( ".", 
File.separator );
-            File file = new File( src + "/META-INF/" + groupIdAsDir );
-            file.mkdirs();
-            man = new FileOutputStream(
-                src + "/META-INF/" + groupIdAsDir + File.separator + 
"AssemblyInfo." + plugin.getExtension() );
-            man.write( sb.toString().getBytes() );
+            File metaInfoDir = new File( buildSourcesDirectory, "META-INF" );
+            metaInfoDir.mkdirs();
+            assemblyInfoFileStream = new FileOutputStream(
+                metaInfoDir + File.separator + "AssemblyInfo." + 
programmingLanguage.getClassFileExtension() );
+            assemblyInfoFileStream.write( sb.toString().getBytes() );
         }
         catch ( IOException e )
         {
-            throw new IOException();
+            e.printStackTrace();
+            throw new IOException( "NMAVEN-022-000: Failed to generate 
AssemblyInfo" );
         }
         finally
         {
-            if ( man != null )
+            if ( assemblyInfoFileStream != null )
             {
-                man.close();
+                assemblyInfoFileStream.close();
             }
         }
     }
-    
+
     /**
      * @see AssemblyInfoMarshaller#unmarshall(java.io.InputStream)
      */
     public AssemblyInfo unmarshall( InputStream inputStream )
         throws IOException
     {
-        throw new IOException("This method is not implemented");
+        throw new IOException( "This method is not implemented" );
     }
 
-    /**
-     * @see 
AssemblyInfoMarshaller#init(org.apache.maven.dotnet.model.assembly.plugins.AssemblyPlugin)
-     */
-    public void init( AssemblyPlugin plugin )
+    public void init( ProgrammingLanguage programmingLanguage, File 
buildSourcesDirectory )
     {
-        this.plugin = plugin;
+        this.programmingLanguage = programmingLanguage;
+        this.buildSourcesDirectory = buildSourcesDirectory;
     }
 
     /**

Modified: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/VBAssemblyInfoMarshaller.java
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/VBAssemblyInfoMarshaller.java?rev=601074&r1=601073&r2=601074&view=diff
==============================================================================
--- 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/VBAssemblyInfoMarshaller.java
 (original)
+++ 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/VBAssemblyInfoMarshaller.java
 Tue Dec  4 12:28:00 2007
@@ -20,7 +20,7 @@
 
 import org.apache.maven.dotnet.assembler.AssemblyInfoMarshaller;
 import org.apache.maven.dotnet.assembler.AssemblyInfo;
-import org.apache.maven.dotnet.model.assembly.plugins.AssemblyPlugin;
+import org.apache.maven.dotnet.compiler.ProgrammingLanguage;
 
 import java.io.OutputStream;
 import java.io.IOException;
@@ -28,31 +28,22 @@
 import java.io.File;
 import java.io.InputStream;
 
-import org.apache.maven.project.MavenProject;
-
 /**
  * Provides services for writing out the AssemblyInfo entries for VB using the 
angle bracket convention <assembly:
  *
  * @author Shane Isbell
  */
 
-final class VBAssemblyInfoMarshaller
+public final class VBAssemblyInfoMarshaller
     implements AssemblyInfoMarshaller
 {
+    private ProgrammingLanguage programmingLanguage;
 
-    /**
-     * The assembly plugin model that contains information used in writing of 
the AssemblyInfo class.
-     */
-    private AssemblyPlugin plugin;
+    private File buildSourcesDirectory;
 
-    /**
-     * @see 
AssemblyInfoMarshaller#marshal(org.apache.maven.dotnet.assembler.AssemblyInfo, 
org.apache.maven.project.MavenProject,
-     *      java.io.OutputStream)
-     */
-    public void marshal( AssemblyInfo assemblyInfo, MavenProject mavenProject, 
OutputStream outputStream )
+    public void marshal( AssemblyInfo assemblyInfo, File buildDirectory, 
OutputStream outputStream )
         throws IOException
     {
-        String src = mavenProject.getBasedir() + "/target/build-sources";
         StringBuffer sb = new StringBuffer();
         sb.append( "Imports System.Reflection\r\n" )
             .append( "Imports System.Runtime.InteropServices\r\n" )
@@ -64,45 +55,43 @@
             .append( createEntry( "Trademark", assemblyInfo.getTrademark() ) )
             .append( createEntry( "Culture", assemblyInfo.getCulture() ) )
             .append( createEntry( "Version", assemblyInfo.getVersion() ) );
-        //.append(createEntry("Configuration", 
assemblyInfo.getConfiguration()));
-        FileOutputStream man = null;
+
+        FileOutputStream assemblyInfoFileStream = null;
         try
         {
-            String groupIdAsDir = mavenProject.getGroupId().replace( ".", 
File.separator );
-            File file = new File( src + "/META-INF/" + groupIdAsDir );
-            file.mkdirs();
-            man = new FileOutputStream(
-                src + "/META-INF/" + groupIdAsDir + File.separator + 
"AssemblyInfo." + plugin.getExtension() );
-            man.write( sb.toString().getBytes() );
+            File metaInfoDir = new File( buildSourcesDirectory, "META-INF" );
+            metaInfoDir.mkdirs();
+            assemblyInfoFileStream = new FileOutputStream(
+                metaInfoDir + File.separator + "AssemblyInfo." + 
programmingLanguage.getClassFileExtension() );
+            assemblyInfoFileStream.write( sb.toString().getBytes() );
         }
         catch ( IOException e )
         {
-            throw new IOException();
+            e.printStackTrace();
+            throw new IOException( "NMAVEN-022-000: Failed to generate 
AssemblyInfo" );
         }
         finally
         {
-            if ( man != null )
+            if ( assemblyInfoFileStream != null )
             {
-                man.close();
+                assemblyInfoFileStream.close();
             }
         }
     }
 
     /**
      * @see AssemblyInfoMarshaller#unmarshall(java.io.InputStream)
-     */    
+     */
     public AssemblyInfo unmarshall( InputStream inputStream )
         throws IOException
     {
-        throw new IOException("This method is not implemented");
+        throw new IOException( "This method is not implemented" );
     }
-    
-    /**
-     * @see 
AssemblyInfoMarshaller#init(org.apache.maven.dotnet.model.assembly.plugins.AssemblyPlugin)
-     */
-    public void init( AssemblyPlugin plugin )
+
+    public void init( ProgrammingLanguage programmingLanguage, File 
buildSourcesDirectory )
     {
-        this.plugin = plugin;
+        this.programmingLanguage = programmingLanguage;
+        this.buildSourcesDirectory = buildSourcesDirectory;
     }
 
     /**


Reply via email to