You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2014/08/08 17:33:40 UTC

svn commit: r1616805 - in /maven/plugins/trunk/maven-ejb-plugin/src: main/java/org/apache/maven/plugin/ejb/ test/java/org/apache/maven/plugin/ejb/stub/

Author: khmarbaise
Date: Fri Aug  8 15:33:39 2014
New Revision: 1616805

URL: http://svn.apache.org/r1616805
Log:
- Reformatted the whole code.

Modified:
    maven/plugins/trunk/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java
    maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/ArtifactStub.java
    maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBasicStub.java
    maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBuildStub.java
    maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectResourcesStub.java
    maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/ModelStub.java

Modified: maven/plugins/trunk/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java?rev=1616805&r1=1616804&r2=1616805&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java (original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java Fri Aug  8 15:33:39 2014
@@ -53,16 +53,15 @@ import org.codehaus.plexus.util.FileUtil
  * @author <a href="evenisse@apache.org">Emmanuel Venisse</a>
  * @version $Id$
  */
-@Mojo( name = "ejb", requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true,
-       defaultPhase = LifecyclePhase.PACKAGE )
+@Mojo( name = "ejb", requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true, defaultPhase = LifecyclePhase.PACKAGE )
 public class EjbMojo
     extends AbstractMojo
 {
     // TODO: will null work instead?
-    private static final String[] DEFAULT_INCLUDES = new String[]{ "**/**" };
+    private static final String[] DEFAULT_INCLUDES = new String[] { "**/**" };
 
-    private static final String[] DEFAULT_CLIENT_EXCLUDES =
-        new String[]{ "**/*Bean.class", "**/*CMP.class", "**/*Session.class", "**/package.html" };
+    private static final String[] DEFAULT_CLIENT_EXCLUDES = new String[] { "**/*Bean.class", "**/*CMP.class",
+        "**/*Session.class", "**/package.html" };
 
     /**
      * The directory for the generated EJB.
@@ -83,8 +82,7 @@ public class EjbMojo
     private String jarName;
 
     /**
-     * Classifier to add to the artifact generated. If given, the artifact will
-     * be an attachment instead.
+     * Classifier to add to the artifact generated. If given, the artifact will be an attachment instead.
      */
     @Parameter( property = "ejb.classifier" )
     private String classifier;
@@ -93,7 +91,7 @@ public class EjbMojo
      * You can define the location of <code>ejb-jar.xml</code> file.
      */
     @Parameter( property = "ejb.ejbJar", defaultValue = "META-INF/ejb-jar.xml" )
-    //The initalization is needed to get the unit tests running which seemed to lack lookup for the defaultValue.
+    // The initalization is needed to get the unit tests running which seemed to lack lookup for the defaultValue.
     private String ejbJar = "META-INF/ejb-jar.xml";
 
     /**
@@ -105,14 +103,17 @@ public class EjbMojo
     /**
      * The files and directories to exclude from the client jar. Usage:
      * <p/>
+     * 
      * <pre>
      * &lt;clientExcludes&gt;
      * &nbsp;&nbsp;&lt;clientExclude&gt;**&#47;*Ejb.class&lt;&#47;clientExclude&gt;
      * &nbsp;&nbsp;&lt;clientExclude&gt;**&#47;*Bean.class&lt;&#47;clientExclude&gt;
      * &lt;&#47;clientExcludes&gt;
      * </pre>
-     * <br/>Attribute is used only if client jar is generated.
-     * <br/>Default exclusions: **&#47;*Bean.class, **&#47;*CMP.class, **&#47;*Session.class, **&#47;package.html
+     * 
+     * <br/>
+     * Attribute is used only if client jar is generated. <br/>
+     * Default exclusions: **&#47;*Bean.class, **&#47;*CMP.class, **&#47;*Session.class, **&#47;package.html
      */
     @Parameter
     private List<String> clientExcludes;
@@ -120,13 +121,16 @@ public class EjbMojo
     /**
      * The files and directories to include in the client jar. Usage:
      * <p/>
+     * 
      * <pre>
      * &lt;clientIncludes&gt;
      * &nbsp;&nbsp;&lt;clientInclude&gt;**&#47;*&lt;&#47;clientInclude&gt;
      * &lt;&#47;clientIncludes&gt;
      * </pre>
-     * <br/>Attribute is used only if client jar is generated.
-     * <br/>Default value: **&#47;**
+     * 
+     * <br/>
+     * Attribute is used only if client jar is generated. <br/>
+     * Default value: **&#47;**
      */
     @Parameter
     private List<String> clientIncludes;
@@ -134,13 +138,16 @@ public class EjbMojo
     /**
      * The files and directories to exclude from the main EJB jar. Usage:
      * <p/>
+     * 
      * <pre>
      * &lt;excludes&gt;
      *   &lt;exclude&gt;**&#47;*Ejb.class&lt;&#47;exclude&gt;
      *   &lt;exclude&gt;**&#47;*Bean.class&lt;&#47;exclude&gt;
      * &lt;&#47;excludes&gt;
      * </pre>
-     * <br/>Default exclusions: META-INF&#47;ejb-jar.xml, **&#47;package.html
+     * 
+     * <br/>
+     * Default exclusions: META-INF&#47;ejb-jar.xml, **&#47;package.html
      */
     @Parameter
     private List<String> excludes;
@@ -158,11 +165,11 @@ public class EjbMojo
     private JarArchiver jarArchiver;
 
     /**
-     * What EJB version should the EJB Plugin generate? Valid values are "2.x" or "3.x"
-     * (where x is a digit).  When ejbVersion is "3.x", the
-     * <code>ejb-jar.xml</code> file is optional.
+     * What EJB version should the EJB Plugin generate? Valid values are "2.x" or "3.x" (where x is a digit). When
+     * ejbVersion is "3.x", the <code>ejb-jar.xml</code> file is optional.
      * <p/>
      * Usage:
+     * 
      * <pre>
      * &lt;ejbVersion&gt;3.0&lt;&#47;ejbVersion&gt;
      * </pre>
@@ -185,15 +192,14 @@ public class EjbMojo
     private MavenProjectHelper projectHelper;
 
     /**
-     * The archive configuration to use.
-     * See <a href="http://maven.apache.org/shared/maven-archiver/index.html">Maven Archiver Reference</a>.
+     * The archive configuration to use. See <a href="http://maven.apache.org/shared/maven-archiver/index.html">Maven
+     * Archiver Reference</a>.
      */
     @Parameter
     private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
 
     /**
-     * To escape interpolated value with windows path.
-     * c:\foo\bar will be replaced with c:\\foo\\bar.
+     * To escape interpolated value with windows path. c:\foo\bar will be replaced with c:\\foo\\bar.
      *
      * @since 2.3
      */
@@ -201,8 +207,7 @@ public class EjbMojo
     private boolean escapeBackslashesInFilePath;
 
     /**
-     * An expression preceded with this String won't be interpolated.
-     * \${foo} will be replaced with ${foo}.
+     * An expression preceded with this String won't be interpolated. \${foo} will be replaced with ${foo}.
      *
      * @since 2.3
      */
@@ -245,7 +250,7 @@ public class EjbMojo
     public void execute()
         throws MojoExecutionException
     {
-        
+
         if ( !outputDirectory.exists() )
         {
             getLog().warn( "The created EJB jar will be empty cause the " + outputDirectory.getPath()
@@ -271,25 +276,24 @@ public class EjbMojo
         /* test EJB version compliance */
         if ( !ejbVersion.matches( "\\A[2-3]\\.[0-9]\\z" ) )
         {
-            throw new MojoExecutionException(
-                "ejbVersion is not valid: " + ejbVersion + ". Must be 2.x or 3.x (where x is a digit)" );
+            throw new MojoExecutionException( "ejbVersion is not valid: " + ejbVersion
+                + ". Must be 2.x or 3.x (where x is a digit)" );
         }
 
         if ( ejbVersion.matches( "\\A2\\.[0-9]\\z" ) && !deploymentDescriptor.exists() )
         {
-            throw new MojoExecutionException(
-                "Error assembling EJB: " + ejbJar + " is required for ejbVersion 2.x" );
+            throw new MojoExecutionException( "Error assembling EJB: " + ejbJar + " is required for ejbVersion 2.x" );
         }
 
         try
         {
-            //TODO: This should be handled different.
+            // TODO: This should be handled different.
             String[] mainJarExcludes = new String[] { ejbJar, "**/package.html" };
 
             if ( excludes != null && !excludes.isEmpty() )
             {
                 excludes.add( ejbJar );
-                mainJarExcludes = (String[]) excludes.toArray(new String[excludes.size()]);
+                mainJarExcludes = (String[]) excludes.toArray( new String[excludes.size()] );
             }
 
             archiver.getArchiver().addDirectory( outputDirectory, DEFAULT_INCLUDES, mainJarExcludes );
@@ -302,10 +306,9 @@ public class EjbMojo
                     getLog().debug( "Filtering deployment descriptor." );
                     MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution();
                     mavenResourcesExecution.setEscapeString( escapeString );
-                    List filterWrappers = mavenFileFilter.getDefaultFilterWrappers( project, filters,
-                                                                                    escapeBackslashesInFilePath,
-                                                                                    this.session,
-                                                                                    mavenResourcesExecution );
+                    List filterWrappers =
+                        mavenFileFilter.getDefaultFilterWrappers( project, filters, escapeBackslashesInFilePath,
+                                                                  this.session, mavenResourcesExecution );
 
                     // Create a temporary file that we can copy-and-filter
                     File unfilteredDeploymentDescriptor = new File( outputDirectory, ejbJar + ".unfiltered" );
@@ -339,7 +342,8 @@ public class EjbMojo
         }
         catch ( MavenFilteringException e )
         {
-            throw new MojoExecutionException( "There was a problem filtering the deployment descriptor: " + e.getMessage(), e );
+            throw new MojoExecutionException( "There was a problem filtering the deployment descriptor: "
+                + e.getMessage(), e );
         }
 
         // Handle the classifier if necessary
@@ -367,12 +371,12 @@ public class EjbMojo
 
             if ( clientIncludes != null && !clientIncludes.isEmpty() )
             {
-                includes = (String[]) clientIncludes.toArray(new String[clientIncludes.size()]);
+                includes = (String[]) clientIncludes.toArray( new String[clientIncludes.size()] );
             }
 
             if ( clientExcludes != null && !clientExcludes.isEmpty() )
             {
-                excludes = (String[]) clientExcludes.toArray(new String[clientExcludes.size()]);
+                excludes = (String[]) clientExcludes.toArray( new String[clientExcludes.size()] );
             }
 
             File clientJarFile = new File( basedir, clientJarName + "-client.jar" );
@@ -393,23 +397,23 @@ public class EjbMojo
             }
             catch ( ArchiverException e )
             {
-                throw new MojoExecutionException(
-                    "There was a problem creating the EJB client archive: " + e.getMessage(), e );
+                throw new MojoExecutionException( "There was a problem creating the EJB client archive: "
+                    + e.getMessage(), e );
             }
             catch ( ManifestException e )
             {
-                throw new MojoExecutionException(
-                    "There was a problem creating the EJB client archive: " + e.getMessage(), e );
+                throw new MojoExecutionException( "There was a problem creating the EJB client archive: "
+                    + e.getMessage(), e );
             }
             catch ( IOException e )
             {
-                throw new MojoExecutionException(
-                    "There was a problem creating the EJB client archive: " + e.getMessage(), e );
+                throw new MojoExecutionException( "There was a problem creating the EJB client archive: "
+                    + e.getMessage(), e );
             }
             catch ( DependencyResolutionRequiredException e )
             {
-                throw new MojoExecutionException(
-                    "There was a problem creating the EJB client archive: " + e.getMessage(), e );
+                throw new MojoExecutionException( "There was a problem creating the EJB client archive: "
+                    + e.getMessage(), e );
             }
 
             // TODO: shouldn't need classifer
@@ -427,8 +431,8 @@ public class EjbMojo
     /**
      * Returns the EJB Jar file to generate, based on an optional classifier.
      *
-     * @param basedir    the output directory
-     * @param finalName  the name of the ear file
+     * @param basedir the output directory
+     * @param finalName the name of the ear file
      * @param classifier an optional classifier
      * @return the EJB file to generate
      */

Modified: maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/ArtifactStub.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/ArtifactStub.java?rev=1616805&r1=1616804&r2=1616805&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/ArtifactStub.java (original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/ArtifactStub.java Fri Aug  8 15:33:39 2014
@@ -34,7 +34,6 @@ import org.apache.maven.artifact.version
 import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
 import org.apache.maven.artifact.versioning.VersionRange;
 
-
 /**
  * Stub
  */
@@ -80,7 +79,6 @@ public class ArtifactStub
 
     VersionRange versionRange;
 
-
     public ArtifactStub()
     {
         type = "testtype";
@@ -277,7 +275,6 @@ public class ArtifactStub
         resolvedVersion = version;
     }
 
-
     public void setArtifactHandler( ArtifactHandler handler )
     {
 

Modified: maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBasicStub.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBasicStub.java?rev=1616805&r1=1616804&r2=1616805&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBasicStub.java (original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBasicStub.java Fri Aug  8 15:33:39 2014
@@ -71,7 +71,7 @@ public class MavenProjectBasicStub
 
         artifact.populate( this );
 
-        // this is ugly but needed to ensure that the copy constructor 
+        // this is ugly but needed to ensure that the copy constructor
         // works correctly
         initializeParentFields();
     }
@@ -105,7 +105,7 @@ public class MavenProjectBasicStub
 
     public File getBasedir()
     {
-        // create an isolated environment 
+        // create an isolated environment
         // see setupTestEnvironment for details
         return new File( testRootDir );
     }
@@ -148,7 +148,7 @@ public class MavenProjectBasicStub
     // to prevent the MavenProject copy constructor from blowing up
     private void initializeParentFields()
     {
-        // the pom should be located in the isolated dummy root         
+        // the pom should be located in the isolated dummy root
         super.setFile( new File( getBasedir(), "pom.xml" ) );
         super.setDependencyArtifacts( new HashSet() );
         super.setArtifacts( new HashSet() );

Modified: maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBuildStub.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBuildStub.java?rev=1616805&r1=1616804&r2=1616805&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBuildStub.java (original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBuildStub.java Fri Aug  8 15:33:39 2014
@@ -88,7 +88,7 @@ public class MavenProjectBuildStub
         targetClassesList = new ArrayList();
         dataMap = new HashMap();
         setupBuild();
-        
+
         model.setBuild( build );
     }
 
@@ -150,10 +150,7 @@ public class MavenProjectBuildStub
     }
 
     /**
-     * returns true if the path is relative
-     * and false if absolute
-     * also returns false if it is relative to
-     * the parent
+     * returns true if the path is relative and false if absolute also returns false if it is relative to the parent
      *
      * @param path
      * @return
@@ -173,7 +170,7 @@ public class MavenProjectBuildStub
     private void setupBuild()
     {
         // check getBasedir method for the exact path
-        // we need to recreate the dir structure in 
+        // we need to recreate the dir structure in
         // an isolated environment
         srcDirectory = testRootDir + "/src";
         buildDirectory = testRootDir + "/target";
@@ -207,7 +204,7 @@ public class MavenProjectBuildStub
         createFiles( resourcesDirectory, testResourcesDirectory );
         setupRootFiles();
 
-        // setup target dir        
+        // setup target dir
         if ( !FileUtils.fileExists( outputDirectory ) )
         {
             FileUtils.mkdir( outputDirectory );
@@ -225,17 +222,20 @@ public class MavenProjectBuildStub
     {
         File currentDirectory;
 
-        for (Object aDirectoryList : directoryList) {
-            currentDirectory = new File(parent, "/" + aDirectoryList);
+        for ( Object aDirectoryList : directoryList )
+        {
+            currentDirectory = new File( parent, "/" + aDirectoryList );
 
-            if (!currentDirectory.exists()) {
+            if ( !currentDirectory.exists() )
+            {
                 currentDirectory.mkdirs();
             }
 
             // duplicate dir structure in test resources
-            currentDirectory = new File(testparent, "/" + aDirectoryList);
+            currentDirectory = new File( testparent, "/" + aDirectoryList );
 
-            if (!currentDirectory.exists()) {
+            if ( !currentDirectory.exists() )
+            {
                 currentDirectory.mkdirs();
             }
         }
@@ -247,16 +247,16 @@ public class MavenProjectBuildStub
 
         switch ( type )
         {
-            case SOURCE_FILE :
+            case SOURCE_FILE:
                 retVal = sourceFileList;
                 break;
-            case OUTPUT_FILE :
+            case OUTPUT_FILE:
                 retVal = targetClassesList;
                 break;
-            case RESOURCES_FILE :
+            case RESOURCES_FILE:
                 retVal = resourcesFileList;
                 break;
-            case ROOT_FILE :
+            case ROOT_FILE:
                 retVal = rootFileList;
                 break;
         }
@@ -275,21 +275,27 @@ public class MavenProjectBuildStub
             return;
         }
 
-        for (Object aList : list) {
-            currentFile = new File(parent, (String) aList);
+        for ( Object aList : list )
+        {
+            currentFile = new File( parent, (String) aList );
 
             // create the necessary parent directories
             // before we create the files
-            if (!currentFile.getParentFile().exists()) {
+            if ( !currentFile.getParentFile().exists() )
+            {
                 currentFile.getParentFile().mkdirs();
             }
 
-            if (!currentFile.exists()) {
-                try {
+            if ( !currentFile.exists() )
+            {
+                try
+                {
                     currentFile.createNewFile();
-                    populateFile(currentFile, RESOURCES_FILE);
-                } catch (IOException io) {
-                    //TODO: handle exception
+                    populateFile( currentFile, RESOURCES_FILE );
+                }
+                catch ( IOException io )
+                {
+                    // TODO: handle exception
                 }
             }
         }

Modified: maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectResourcesStub.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectResourcesStub.java?rev=1616805&r1=1616804&r2=1616805&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectResourcesStub.java (original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectResourcesStub.java Fri Aug  8 15:33:39 2014
@@ -21,7 +21,6 @@ package org.apache.maven.plugin.ejb.stub
 
 import org.apache.maven.model.Resource;
 
-
 /**
  * Stub
  */
@@ -89,7 +88,7 @@ public class MavenProjectResourcesStub
     {
         Resource resource = new Resource();
 
-        // see MavenProjectBasicStub for details 
+        // see MavenProjectBasicStub for details
         // of getBasedir
 
         // setup default resources
@@ -103,10 +102,10 @@ public class MavenProjectResourcesStub
     {
         Resource resource = new Resource();
 
-        // see MavenProjectBasicStub for details 
-        // of getBasedir      
+        // see MavenProjectBasicStub for details
+        // of getBasedir
 
-        // setup default test resources         
+        // setup default test resources
         resource.setDirectory( getBasedir().getPath() + "/src/test/resources" );
         resource.setFiltering( false );
         resource.setTargetPath( null );

Modified: maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/ModelStub.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/ModelStub.java?rev=1616805&r1=1616804&r2=1616805&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/ModelStub.java (original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/ModelStub.java Fri Aug  8 15:33:39 2014
@@ -64,7 +64,7 @@ public class ModelStub
 
     public Parent getParent()
     {
-        //return new Parent();
+        // return new Parent();
         return null;
     }