You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2012/01/08 14:19:38 UTC
svn commit: r1228837 -
/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/
Author: rfscholte
Date: Sun Jan 8 13:19:38 2012
New Revision: 1228837
URL: http://svn.apache.org/viewvc?rev=1228837&view=rev
Log:
Add more generics
Modified:
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/ApplicationXmlWriter.java
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarModuleFactory.java
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/GenerateApplicationXmlMojo.java
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JarModule.java
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JbossAppXmlWriter.java
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JbossConfiguration.java
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/WebModule.java
Modified: maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/ApplicationXmlWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/ApplicationXmlWriter.java?rev=1228837&r1=1228836&r2=1228837&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/ApplicationXmlWriter.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/ApplicationXmlWriter.java Sun Jan 8 13:19:38 2012
@@ -19,12 +19,11 @@ package org.apache.maven.plugin.ear;
* under the License.
*/
+import java.io.Writer;
+
import org.apache.maven.plugin.ear.util.JavaEEVersion;
import org.codehaus.plexus.util.xml.XMLWriter;
-import java.io.Writer;
-import java.util.Iterator;
-
/**
* An <tt>XmlWriter</tt> based implementation used to generate an
* <tt>application.xml</tt> file
@@ -102,18 +101,13 @@ final class ApplicationXmlWriter
}
// Do not change this unless you really know what you're doing :)
-
- final Iterator moduleIt = context.getEarModules().iterator();
- while ( moduleIt.hasNext() )
+ for ( EarModule module : context.getEarModules() )
{
- EarModule module = (EarModule) moduleIt.next();
module.appendModule( writer, version.getVersion(), generateModuleId );
}
- final Iterator securityRoleIt = context.getSecurityRoles().iterator();
- while ( securityRoleIt.hasNext() )
+ for ( SecurityRole securityRole : context.getSecurityRoles() )
{
- SecurityRole securityRole = (SecurityRole) securityRoleIt.next();
securityRole.appendSecurityRole( writer );
}
Modified: maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarModuleFactory.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarModuleFactory.java?rev=1228837&r1=1228836&r2=1228837&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarModuleFactory.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarModuleFactory.java Sun Jan 8 13:19:38 2012
@@ -67,6 +67,7 @@ public final class EarModuleFactory
* @return an ear module for this artifact
* @throws UnknownArtifactTypeException if the artifact is not handled
*/
+ @SuppressWarnings( "deprecation" )
public static EarModule newEarModule( Artifact artifact, JavaEEVersion javaEEVersion, String defaultLibBundleDir,
Boolean includeInApplicationXml,
ArtifactTypeMappingService typeMappingService )
Modified: maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java?rev=1228837&r1=1228836&r2=1228837&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java Sun Jan 8 13:19:38 2012
@@ -51,7 +51,6 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Iterator;
import java.util.List;
import java.util.zip.ZipException;
@@ -293,14 +292,12 @@ public class EarMojo
final JavaEEVersion javaEEVersion = JavaEEVersion.getJavaEEVersion( version );
// Initializes unpack types
- List unpackTypesList = new ArrayList();
+ List<String> unpackTypesList = new ArrayList<String>();
if ( unpackTypes != null )
{
unpackTypesList = Arrays.asList( unpackTypes.split( "," ) );
- final Iterator it = unpackTypesList.iterator();
- while ( it.hasNext() )
+ for ( String type : unpackTypesList )
{
- String type = (String) it.next();
if ( !EarModuleFactory.standardArtifactTypes.contains( type ) )
{
throw new MojoExecutionException(
@@ -313,9 +310,8 @@ public class EarMojo
// Copy modules
try
{
- for ( Iterator iter = getModules().iterator(); iter.hasNext(); )
+ for ( EarModule module: getModules() )
{
- EarModule module = (EarModule) iter.next();
if ( module instanceof JavaModule )
{
getLog().warn( "JavaModule is deprecated (" + module + "), please use JarModule instead." );
@@ -483,7 +479,8 @@ public class EarMojo
*/
protected String[] getExcludes()
{
- List excludeList = new ArrayList( FileUtils.getDefaultExcludesAsList() );
+ @SuppressWarnings( "unchecked" )
+ List<String> excludeList = new ArrayList<String>( FileUtils.getDefaultExcludesAsList() );
if ( earSourceExcludes != null && !"".equals( earSourceExcludes ) )
{
excludeList.addAll( Arrays.asList( StringUtils.split( earSourceExcludes, "," ) ) );
@@ -731,7 +728,7 @@ public class EarMojo
Manifest mf = new Manifest( new FileReader( manifestFile ) );
Attribute classPath = mf.getMainSection()
.getAttribute( "Class-Path" );
- List classPathElements = new ArrayList();
+ List<String> classPathElements = new ArrayList<String>();
if ( classPath != null )
{
@@ -745,10 +742,8 @@ public class EarMojo
}
// Modify the classpath entries in the manifest
- for ( Iterator iter = getModules().iterator(); iter.hasNext(); )
+ for ( EarModule o : getModules() )
{
- Object o = iter.next();
-
if ( o instanceof JarModule )
{
JarModule jm = ( JarModule ) o;
@@ -818,4 +813,4 @@ public class EarMojo
throw new MojoFailureException( e.getMessage() );
}
}
-}
+}
\ No newline at end of file
Modified: maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/GenerateApplicationXmlMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/GenerateApplicationXmlMojo.java?rev=1228837&r1=1228836&r2=1228837&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/GenerateApplicationXmlMojo.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/GenerateApplicationXmlMojo.java Sun Jan 8 13:19:38 2012
@@ -219,10 +219,10 @@ public class GenerateApplicationXmlMojo
* @return a list of SecurityRole object(s)
* @throws EarPluginException if the configuration is invalid
*/
- private List buildSecurityRoles()
+ private List<SecurityRole> buildSecurityRoles()
throws EarPluginException
{
- final List result = new ArrayList();
+ final List<SecurityRole> result = new ArrayList<SecurityRole>();
if ( security == null )
{
return result;
@@ -259,4 +259,4 @@ public class GenerateApplicationXmlMojo
}
}
-}
+}
\ No newline at end of file
Modified: maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JarModule.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JarModule.java?rev=1228837&r1=1228836&r2=1228837&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JarModule.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JarModule.java Sun Jan 8 13:19:38 2012
@@ -74,7 +74,7 @@ public class JarModule
}
}
- public void resolveArtifact( Set artifacts )
+ public void resolveArtifact( Set<Artifact> artifacts )
throws EarPluginException, MojoFailureException
{
// Let's resolve the artifact
Modified: maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JbossAppXmlWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JbossAppXmlWriter.java?rev=1228837&r1=1228836&r2=1228837&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JbossAppXmlWriter.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JbossAppXmlWriter.java Sun Jan 8 13:19:38 2012
@@ -19,13 +19,12 @@ package org.apache.maven.plugin.ear;
* under the License.
*/
-import org.codehaus.plexus.util.xml.XMLWriter;
-
import java.io.File;
import java.io.Writer;
-import java.util.Iterator;
import java.util.List;
+import org.codehaus.plexus.util.xml.XMLWriter;
+
/**
* An <tt>XmlWriter</tt> based implementation used to generate a
* <tt>jboss-app.xml</tt> file
@@ -56,7 +55,7 @@ final class JbossAppXmlWriter
super( encoding );
}
- public void write( File destinationFile, JbossConfiguration jbossConfiguration, List earModules )
+ public void write( File destinationFile, JbossConfiguration jbossConfiguration, List<EarModule> earModules )
throws EarPluginException
{
final Writer w = initializeWriter( destinationFile );
@@ -162,14 +161,12 @@ final class JbossAppXmlWriter
// Modules
- List dataSources = jbossConfiguration.getDataSources();
+ List<String> dataSources = jbossConfiguration.getDataSources();
// Write out data source modules first
if ( dataSources != null )
{
- final Iterator it = dataSources.iterator();
- while ( it.hasNext() )
+ for ( String dsPath : dataSources )
{
- String dsPath = (String) it.next();
writer.startElement( MODULE_ELEMENT );
writer.startElement( SERVICE_ELEMENT );
writer.writeText( dsPath );
@@ -179,10 +176,8 @@ final class JbossAppXmlWriter
}
// Write the JBoss specific modules
- final Iterator it = earModules.iterator();
- while ( it.hasNext() )
+ for ( EarModule earModule : earModules )
{
- EarModule earModule = (EarModule) it.next();
if ( JbossEarModule.class.isInstance( earModule ) )
{
JbossEarModule jbossEarModule = (JbossEarModule) earModule;
@@ -193,4 +188,4 @@ final class JbossAppXmlWriter
close( w );
}
-}
+}
\ No newline at end of file
Modified: maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JbossConfiguration.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JbossConfiguration.java?rev=1228837&r1=1228836&r2=1228837&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JbossConfiguration.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JbossConfiguration.java Sun Jan 8 13:19:38 2012
@@ -88,12 +88,12 @@ class JbossConfiguration
private final String moduleOrder;
- private final List dataSources;
+ private final List<String> dataSources;
private final String libraryDirectory;
public JbossConfiguration( String version, String securityDomain, String unauthenticatedPrincipal, String jmxName,
- String loaderRepository, String moduleOrder, List dataSources, String libraryDirectory,
+ String loaderRepository, String moduleOrder, List<String> dataSources, String libraryDirectory,
String loaderRepositoryConfig, String loaderRepositoryClass, String configParserClass )
throws EarPluginException
{
@@ -305,7 +305,7 @@ class JbossConfiguration
*
* @return the list of datasources paths
*/
- public List getDataSources()
+ public List<String> getDataSources()
{
return dataSources;
}
Modified: maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/WebModule.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/WebModule.java?rev=1228837&r1=1228836&r2=1228837&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/WebModule.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/WebModule.java Sun Jan 8 13:19:38 2012
@@ -71,7 +71,7 @@ public class WebModule
writer.endElement(); // module
}
- public void resolveArtifact( Set artifacts )
+ public void resolveArtifact( Set<Artifact> artifacts )
throws EarPluginException, MojoFailureException
{
// Let's resolve the artifact