Apply Felix coding conventions (where appropriate: some maven plugin parameters can't use the m_ convention)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@616192 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java
index d9b49e7..4aa9f86 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java
@@ -66,13 +66,12 @@
*/
public class BundleAllPlugin extends ManifestPlugin
{
-
private static final String LS = System.getProperty( "line.separator" );
private static final Pattern SNAPSHOT_VERSION_PATTERN = Pattern.compile( "[0-9]{8}_[0-9]{6}_[0-9]+" );
/**
- * Local Repository.
+ * Local repository.
*
* @parameter expression="${localRepository}"
* @required
@@ -81,7 +80,7 @@
private ArtifactRepository localRepository;
/**
- * Remote repositories
+ * Remote repositories.
*
* @parameter expression="${project.remoteArtifactRepositories}"
* @required
@@ -92,34 +91,34 @@
/**
* @component
*/
- private ArtifactFactory factory;
+ private ArtifactFactory m_factory;
/**
* @component
*/
- private ArtifactMetadataSource artifactMetadataSource;
+ private ArtifactMetadataSource m_artifactMetadataSource;
/**
* @component
*/
- private ArtifactCollector collector;
+ private ArtifactCollector m_collector;
/**
* Artifact resolver, needed to download jars.
*
* @component
*/
- private ArtifactResolver artifactResolver;
+ private ArtifactResolver m_artifactResolver;
/**
* @component
*/
- private DependencyTreeBuilder dependencyTreeBuilder;
+ private DependencyTreeBuilder m_dependencyTreeBuilder;
/**
* @component
*/
- private MavenProjectBuilder mavenProjectBuilder;
+ private MavenProjectBuilder m_mavenProjectBuilder;
/**
* Ignore missing artifacts that are not required by current project but are required by the
@@ -129,7 +128,7 @@
*/
private boolean ignoreMissingArtifacts;
- private Set artifactsBeingProcessed = new HashSet();
+ private Set m_artifactsBeingProcessed = new HashSet();
public void execute() throws MojoExecutionException
@@ -167,19 +166,19 @@
return null;
}
- if ( artifactsBeingProcessed.contains( project.getArtifact() ) )
+ if ( m_artifactsBeingProcessed.contains( project.getArtifact() ) )
{
getLog().warn( "Ignoring artifact due to dependency cycle " + project.getArtifact() );
return null;
}
- artifactsBeingProcessed.add( project.getArtifact() );
+ m_artifactsBeingProcessed.add( project.getArtifact() );
DependencyNode dependencyTree;
try
{
- dependencyTree = dependencyTreeBuilder.buildDependencyTree( project, localRepository, factory,
- artifactMetadataSource, null, collector );
+ dependencyTree = m_dependencyTreeBuilder.buildDependencyTree( project, localRepository, m_factory,
+ m_artifactMetadataSource, null, m_collector );
}
catch ( DependencyTreeBuilderException e )
{
@@ -247,11 +246,11 @@
MavenProject childProject;
try
{
- childProject = mavenProjectBuilder.buildFromRepository( artifact, remoteRepositories, localRepository,
- true );
+ childProject = m_mavenProjectBuilder.buildFromRepository( artifact, remoteRepositories,
+ localRepository, true );
if ( childProject.getDependencyArtifacts() == null )
{
- childProject.setDependencyArtifacts( childProject.createArtifacts( factory, null, null ) );
+ childProject.setDependencyArtifacts( childProject.createArtifacts( m_factory, null, null ) );
}
}
catch ( ProjectBuildingException e )
@@ -318,7 +317,7 @@
* @param project
* @throws MojoExecutionException
*/
- BundleInfo bundle( MavenProject project ) throws MojoExecutionException
+ protected BundleInfo bundle( MavenProject project ) throws MojoExecutionException
{
Artifact artifact = project.getArtifact();
getLog().info( "Bundling " + artifact );
@@ -500,7 +499,7 @@
* @param bundleName bundle file name
* @return if both represent the same artifact and version, forgetting about the snapshot timestamp
*/
- boolean snapshotMatch( Artifact artifact, String bundleName )
+ protected boolean snapshotMatch( Artifact artifact, String bundleName )
{
String artifactBundleName = getBundleName( artifact );
int i = artifactBundleName.indexOf( "SNAPSHOT" );
@@ -544,12 +543,13 @@
* String, String, String) that ignores the scope parameter, that's why we use the one with
* the extra null parameter
*/
- Artifact resolvedArtifact = factory.createDependencyArtifact( artifact.getGroupId(), artifact.getArtifactId(),
- versionRange, artifact.getType(), artifact.getClassifier(), artifact.getScope(), null );
+ Artifact resolvedArtifact = m_factory.createDependencyArtifact( artifact.getGroupId(),
+ artifact.getArtifactId(), versionRange, artifact.getType(), artifact.getClassifier(), artifact.getScope(),
+ null );
try
{
- artifactResolver.resolve( resolvedArtifact, remoteRepositories, localRepository );
+ m_artifactResolver.resolve( resolvedArtifact, remoteRepositories, localRepository );
}
catch ( ArtifactResolutionException e )
{
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleInfo.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleInfo.java
index 42f83b5..b75d978 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleInfo.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleInfo.java
@@ -33,12 +33,11 @@
*/
public class BundleInfo
{
-
/**
* {@link Map} < {@link String}, {@link Set} < {@link Artifact} > >
* Used to check for duplicated exports. Key is package name and value list of artifacts where it's exported.
*/
- private Map exportedPackages = new HashMap();
+ private Map m_exportedPackages = new HashMap();
public void addExportedPackage( String packageName, Artifact artifact )
@@ -47,15 +46,15 @@
if ( artifacts == null )
{
artifacts = new HashSet();
- exportedPackages.put( packageName, artifacts );
+ m_exportedPackages.put( packageName, artifacts );
}
artifacts.add( artifact );
}
- Map getExportedPackages()
+ protected Map getExportedPackages()
{
- return exportedPackages;
+ return m_exportedPackages;
}
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
index 2ddda68..ff22e7b 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
@@ -73,7 +73,6 @@
*/
public class BundlePlugin extends AbstractMojo
{
-
/**
* Directory where the manifest will be written
*
@@ -98,12 +97,12 @@
/**
* @component
*/
- private ArchiverManager archiverManager;
+ private ArchiverManager m_archiverManager;
/**
* @component
*/
- private ArtifactHandlerManager artifactHandlerManager;
+ private ArtifactHandlerManager m_artifactHandlerManager;
/**
* Project types which this plugin supports.
@@ -156,7 +155,7 @@
/**
* @component
*/
- private Maven2OsgiConverter maven2OsgiConverter;
+ private Maven2OsgiConverter m_maven2OsgiConverter;
private static final String MAVEN_RESOURCES = "{maven-resources}";
private static final String MAVEN_RESOURCES_REGEX = "\\{maven-resources\\}";
@@ -168,19 +167,19 @@
protected Maven2OsgiConverter getMaven2OsgiConverter()
{
- return this.maven2OsgiConverter;
+ return m_maven2OsgiConverter;
}
- void setMaven2OsgiConverter( Maven2OsgiConverter maven2OsgiConverter )
+ protected void setMaven2OsgiConverter( Maven2OsgiConverter maven2OsgiConverter )
{
- this.maven2OsgiConverter = maven2OsgiConverter;
+ m_maven2OsgiConverter = maven2OsgiConverter;
}
protected MavenProject getProject()
{
- return this.project;
+ return project;
}
@@ -192,38 +191,37 @@
Properties properties = new Properties();
// ignore project types not supported, useful when the plugin is configured in the parent pom
- if ( !this.supportedProjectTypes.contains( this.getProject().getArtifact().getType() ) )
+ if ( !supportedProjectTypes.contains( getProject().getArtifact().getType() ) )
{
- this.getLog().debug(
- "Ignoring project " + this.getProject().getArtifact() + " : type "
- + this.getProject().getArtifact().getType()
- + " is not supported by bundle plugin, supported types are " + this.supportedProjectTypes );
+ getLog().debug(
+ "Ignoring project " + getProject().getArtifact() + " : type " + getProject().getArtifact().getType()
+ + " is not supported by bundle plugin, supported types are " + supportedProjectTypes );
return;
}
- this.execute( this.project, this.instructions, properties );
+ execute( getProject(), instructions, properties );
}
- protected void execute( MavenProject project, Map instructions, Properties properties )
+ protected void execute( MavenProject currentProject, Map theInstructions, Properties theProperties )
throws MojoExecutionException
{
try
{
- this.execute( project, instructions, properties, this.getClasspath( project ) );
+ execute( currentProject, theInstructions, theProperties, getClasspath( currentProject ) );
}
catch ( IOException e )
{
- throw new MojoExecutionException( "Error calculating classpath for project " + project, e );
+ throw new MojoExecutionException( "Error calculating classpath for project " + currentProject, e );
}
}
/* transform directives from their XML form to the expected BND syntax (eg. _include becomes -include) */
- protected Map transformDirectives( Map instructions )
+ protected static Map transformDirectives( Map originalInstructions )
{
Map transformedInstructions = new HashMap();
- for ( Iterator i = instructions.entrySet().iterator(); i.hasNext(); )
+ for ( Iterator i = originalInstructions.entrySet().iterator(); i.hasNext(); )
{
Map.Entry e = ( Map.Entry ) i.next();
@@ -249,26 +247,26 @@
}
- protected void execute( MavenProject project, Map instructions, Properties properties, Jar[] classpath )
+ protected void execute( MavenProject currentProject, Map theInstructions, Properties theProperties, Jar[] classpath )
throws MojoExecutionException
{
try
{
- File jarFile = new File( this.getBuildDirectory(), this.getBundleName( project ) );
+ File jarFile = new File( getBuildDirectory(), getBundleName( currentProject ) );
- properties.putAll( this.getDefaultProperties( project ) );
+ theProperties.putAll( getDefaultProperties( currentProject ) );
- String bsn = project.getGroupId() + "." + project.getArtifactId();
- if ( !instructions.containsKey( Analyzer.PRIVATE_PACKAGE ) )
+ String bsn = currentProject.getGroupId() + "." + currentProject.getArtifactId();
+ if ( !theInstructions.containsKey( Analyzer.PRIVATE_PACKAGE ) )
{
- properties.put( Analyzer.EXPORT_PACKAGE, bsn + ".*" );
+ theProperties.put( Analyzer.EXPORT_PACKAGE, bsn + ".*" );
}
- properties.putAll( this.transformDirectives( instructions ) );
+ theProperties.putAll( transformDirectives( theInstructions ) );
// pass maven resource paths onto BND analyzer
- final String mavenResourcePaths = this.getMavenResourcePaths( project );
- final String includeResource = ( String ) properties.get( Analyzer.INCLUDE_RESOURCE );
+ final String mavenResourcePaths = getMavenResourcePaths( currentProject );
+ final String includeResource = ( String ) theProperties.get( Analyzer.INCLUDE_RESOURCE );
if ( includeResource != null )
{
if ( includeResource.indexOf( MAVEN_RESOURCES ) >= 0 )
@@ -280,47 +278,47 @@
String cleanedResource = removeMavenResourcesTag( includeResource );
if ( cleanedResource.length() > 0 )
{
- properties.put( Analyzer.INCLUDE_RESOURCE, cleanedResource );
+ theProperties.put( Analyzer.INCLUDE_RESOURCE, cleanedResource );
}
else
{
- properties.remove( Analyzer.INCLUDE_RESOURCE );
+ theProperties.remove( Analyzer.INCLUDE_RESOURCE );
}
}
else
{
String combinedResource = includeResource
.replaceAll( MAVEN_RESOURCES_REGEX, mavenResourcePaths );
- properties.put( Analyzer.INCLUDE_RESOURCE, combinedResource );
+ theProperties.put( Analyzer.INCLUDE_RESOURCE, combinedResource );
}
}
else if ( mavenResourcePaths.length() > 0 )
{
- this.getLog().warn(
+ getLog().warn(
Analyzer.INCLUDE_RESOURCE + ": overriding " + mavenResourcePaths + " with " + includeResource
+ " (add " + MAVEN_RESOURCES + " if you want to include the maven resources)" );
}
}
else if ( mavenResourcePaths.length() > 0 )
{
- properties.put( Analyzer.INCLUDE_RESOURCE, mavenResourcePaths );
+ theProperties.put( Analyzer.INCLUDE_RESOURCE, mavenResourcePaths );
}
Builder builder = new Builder();
- builder.setBase( project.getBasedir() );
- builder.setProperties( properties );
+ builder.setBase( currentProject.getBasedir() );
+ builder.setProperties( theProperties );
builder.setClasspath( classpath );
- Collection embeddableArtifacts = getEmbeddableArtifacts( project, properties );
+ Collection embeddableArtifacts = getEmbeddableArtifacts( currentProject, theProperties );
if ( embeddableArtifacts.size() > 0 )
{
// add BND instructions to embed selected dependencies
- new DependencyEmbedder( embeddableArtifacts ).processHeaders( properties );
+ new DependencyEmbedder( embeddableArtifacts ).processHeaders( theProperties );
}
builder.build();
Jar jar = builder.getJar();
- this.doMavenMetadata( project, jar );
+ doMavenMetadata( currentProject, jar );
builder.setJar( jar );
List errors = builder.getErrors();
@@ -329,17 +327,17 @@
for ( Iterator w = warnings.iterator(); w.hasNext(); )
{
String msg = ( String ) w.next();
- this.getLog().warn( "Warning building bundle " + project.getArtifact() + " : " + msg );
+ getLog().warn( "Warning building bundle " + currentProject.getArtifact() + " : " + msg );
}
for ( Iterator e = errors.iterator(); e.hasNext(); )
{
String msg = ( String ) e.next();
- this.getLog().error( "Error building bundle " + project.getArtifact() + " : " + msg );
+ getLog().error( "Error building bundle " + currentProject.getArtifact() + " : " + msg );
}
if ( errors.size() > 0 )
{
- String failok = properties.getProperty( "-failok" );
+ String failok = theProperties.getProperty( "-failok" );
if ( null == failok || "false".equalsIgnoreCase( failok ) )
{
jarFile.delete();
@@ -353,8 +351,9 @@
/*
* Grab customized manifest entries from the maven-jar-plugin configuration
*/
- MavenArchiveConfiguration archiveConfig = JarPluginConfiguration.getArchiveConfiguration( project );
- String mavenManifestText = new MavenArchiver().getManifest( project, archiveConfig ).toString();
+ MavenArchiveConfiguration archiveConfig = JarPluginConfiguration
+ .getArchiveConfiguration( currentProject );
+ String mavenManifestText = new MavenArchiver().getManifest( currentProject, archiveConfig ).toString();
Manifest mavenManifest = new Manifest();
// First grab the external manifest file (if specified)
@@ -410,15 +409,15 @@
jarFile.getParentFile().mkdirs();
builder.getJar().write( jarFile );
- Artifact bundleArtifact = project.getArtifact();
+ Artifact bundleArtifact = currentProject.getArtifact();
bundleArtifact.setFile( jarFile );
if ( unpackBundle )
{
- File outputDir = this.getOutputDirectory();
+ File outputDir = getOutputDirectory();
if ( null == outputDir )
{
- outputDir = new File( this.getBuildDirectory(), "classes" );
+ outputDir = new File( getBuildDirectory(), "classes" );
}
try
@@ -432,7 +431,7 @@
outputDir.mkdirs();
}
- UnArchiver unArchiver = archiverManager.getUnArchiver( "jar" );
+ UnArchiver unArchiver = m_archiverManager.getUnArchiver( "jar" );
unArchiver.setDestDirectory( outputDir );
unArchiver.setSourceFile( jarFile );
unArchiver.extract();
@@ -459,7 +458,7 @@
}
// workaround for MNG-1682: force maven to install artifact using the "jar" handler
- bundleArtifact.setArtifactHandler( artifactHandlerManager.getArtifactHandler( "jar" ) );
+ bundleArtifact.setArtifactHandler( m_artifactHandlerManager.getArtifactHandler( "jar" ) );
}
catch ( MojoFailureException e )
{
@@ -474,7 +473,7 @@
}
- private String removeMavenResourcesTag( String includeResource )
+ private static String removeMavenResourcesTag( String includeResource )
{
StringBuffer buf = new StringBuffer();
@@ -496,7 +495,7 @@
}
- private Map getProperies( Model projectModel, String prefix, Object model )
+ private static Map getProperties( Model projectModel, String prefix, Object model )
{
Map properties = new HashMap();
Method methods[] = Model.class.getDeclaredMethods();
@@ -528,7 +527,7 @@
}
- private StringBuffer printLicenses( List licenses )
+ private static StringBuffer printLicenses( List licenses )
{
if ( licenses == null || licenses.size() == 0 )
return null;
@@ -554,18 +553,18 @@
* @param jar
* @throws IOException
*/
- private void doMavenMetadata( MavenProject project, Jar jar ) throws IOException
+ private void doMavenMetadata( MavenProject currentProject, Jar jar ) throws IOException
{
- String path = "META-INF/maven/" + project.getGroupId() + "/" + project.getArtifactId();
- File pomFile = new File( this.baseDir, "pom.xml" );
+ String path = "META-INF/maven/" + currentProject.getGroupId() + "/" + currentProject.getArtifactId();
+ File pomFile = new File( baseDir, "pom.xml" );
jar.putResource( path + "/pom.xml", new FileResource( pomFile ) );
Properties p = new Properties();
- p.put( "version", project.getVersion() );
- p.put( "groupId", project.getGroupId() );
- p.put( "artifactId", project.getArtifactId() );
+ p.put( "version", currentProject.getVersion() );
+ p.put( "groupId", currentProject.getGroupId() );
+ p.put( "artifactId", currentProject.getArtifactId() );
ByteArrayOutputStream out = new ByteArrayOutputStream();
- p.store( out, "Generated by org.apache.felix.plugin.bundle" );
+ p.store( out, "Generated by org.apache.felix.bundleplugin" );
jar
.putResource( path + "/pom.properties",
new EmbeddedResource( out.toByteArray(), System.currentTimeMillis() ) );
@@ -577,13 +576,13 @@
* @throws ZipException
* @throws IOException
*/
- protected Jar[] getClasspath( MavenProject project ) throws ZipException, IOException
+ protected Jar[] getClasspath( MavenProject currentProject ) throws ZipException, IOException
{
List list = new ArrayList();
- if ( this.getOutputDirectory() != null && this.getOutputDirectory().exists() )
+ if ( getOutputDirectory() != null && getOutputDirectory().exists() )
{
- list.add( new Jar( ".", this.getOutputDirectory() ) );
+ list.add( new Jar( ".", getOutputDirectory() ) );
}
final Set artifacts;
@@ -593,7 +592,7 @@
}
else
{
- artifacts = project.getArtifacts();
+ artifacts = currentProject.getArtifacts();
}
for ( Iterator it = artifacts.iterator(); it.hasNext(); )
@@ -605,11 +604,12 @@
|| Artifact.SCOPE_SYSTEM.equals( artifact.getScope() )
|| Artifact.SCOPE_PROVIDED.equals( artifact.getScope() ) )
{
- File file = this.getFile( artifact );
+ File file = getFile( artifact );
if ( file == null )
{
getLog().warn(
- "File is not available for artifact " + artifact + " in project " + project.getArtifact() );
+ "File is not available for artifact " + artifact + " in project "
+ + currentProject.getArtifact() );
continue;
}
Jar jar = new Jar( artifact.getArtifactId(), file );
@@ -634,7 +634,7 @@
}
- private void header( Properties properties, String key, Object value )
+ private static void header( Properties properties, String key, Object value )
{
if ( value == null )
return;
@@ -654,102 +654,102 @@
*/
protected String convertVersionToOsgi( String version )
{
- return this.getMaven2OsgiConverter().getVersion( version );
+ return getMaven2OsgiConverter().getVersion( version );
}
/**
* TODO this should return getMaven2Osgi().getBundleFileName( project.getArtifact() )
*/
- protected String getBundleName( MavenProject project )
+ protected String getBundleName( MavenProject currentProject )
{
- return project.getBuild().getFinalName() + ".jar";
+ return currentProject.getBuild().getFinalName() + ".jar";
}
protected String getBuildDirectory()
{
- return this.buildDirectory;
+ return buildDirectory;
}
- void setBuildDirectory( String buildirectory )
+ protected void setBuildDirectory( String _buildirectory )
{
- this.buildDirectory = buildirectory;
+ buildDirectory = _buildirectory;
}
- protected Properties getDefaultProperties( MavenProject project )
+ protected Properties getDefaultProperties( MavenProject currentProject )
{
Properties properties = new Properties();
String bsn;
try
{
- bsn = maven2OsgiConverter.getBundleSymbolicName( project.getArtifact() );
+ bsn = getMaven2OsgiConverter().getBundleSymbolicName( currentProject.getArtifact() );
}
catch ( Exception e )
{
- bsn = project.getGroupId() + "." + project.getArtifactId();
+ bsn = currentProject.getGroupId() + "." + currentProject.getArtifactId();
}
// Setup defaults
properties.put( Analyzer.BUNDLE_SYMBOLICNAME, bsn );
properties.put( Analyzer.IMPORT_PACKAGE, "*" );
- properties.put( Analyzer.BUNDLE_VERSION, project.getVersion() );
+ properties.put( Analyzer.BUNDLE_VERSION, currentProject.getVersion() );
// remove the verbose Include-Resource entry from generated manifest
properties.put( Analyzer.REMOVE_HEADERS, Analyzer.INCLUDE_RESOURCE );
- this.header( properties, Analyzer.BUNDLE_DESCRIPTION, project.getDescription() );
- StringBuffer licenseText = this.printLicenses( project.getLicenses() );
+ header( properties, Analyzer.BUNDLE_DESCRIPTION, currentProject.getDescription() );
+ StringBuffer licenseText = printLicenses( currentProject.getLicenses() );
if ( licenseText != null )
{
- this.header( properties, Analyzer.BUNDLE_LICENSE, licenseText );
+ header( properties, Analyzer.BUNDLE_LICENSE, licenseText );
}
- this.header( properties, Analyzer.BUNDLE_NAME, project.getName() );
+ header( properties, Analyzer.BUNDLE_NAME, currentProject.getName() );
- if ( project.getOrganization() != null )
+ if ( currentProject.getOrganization() != null )
{
- this.header( properties, Analyzer.BUNDLE_VENDOR, project.getOrganization().getName() );
- if ( project.getOrganization().getUrl() != null )
+ header( properties, Analyzer.BUNDLE_VENDOR, currentProject.getOrganization().getName() );
+ if ( currentProject.getOrganization().getUrl() != null )
{
- this.header( properties, Analyzer.BUNDLE_DOCURL, project.getOrganization().getUrl() );
+ header( properties, Analyzer.BUNDLE_DOCURL, currentProject.getOrganization().getUrl() );
}
}
- properties.putAll( project.getProperties() );
- properties.putAll( project.getModel().getProperties() );
- properties.putAll( this.getProperies( project.getModel(), "project.build.", project.getBuild() ) );
- properties.putAll( this.getProperies( project.getModel(), "pom.", project.getModel() ) );
- properties.putAll( this.getProperies( project.getModel(), "project.", project ) );
- properties.put( "project.baseDir", this.baseDir );
- properties.put( "project.build.directory", this.getBuildDirectory() );
- properties.put( "project.build.outputdirectory", this.getOutputDirectory() );
+ properties.putAll( currentProject.getProperties() );
+ properties.putAll( currentProject.getModel().getProperties() );
+ properties.putAll( getProperties( currentProject.getModel(), "project.build.", currentProject.getBuild() ) );
+ properties.putAll( getProperties( currentProject.getModel(), "pom.", currentProject.getModel() ) );
+ properties.putAll( getProperties( currentProject.getModel(), "project.", currentProject ) );
+ properties.put( "project.baseDir", baseDir );
+ properties.put( "project.build.directory", getBuildDirectory() );
+ properties.put( "project.build.outputdirectory", getOutputDirectory() );
return properties;
}
- void setBasedir( File basedir )
+ protected void setBasedir( File _basedir )
{
- this.baseDir = basedir;
+ baseDir = _basedir;
}
- File getOutputDirectory()
+ protected File getOutputDirectory()
{
- return this.outputDirectory;
+ return outputDirectory;
}
- void setOutputDirectory( File outputDirectory )
+ protected void setOutputDirectory( File _outputDirectory )
{
- this.outputDirectory = outputDirectory;
+ outputDirectory = _outputDirectory;
}
- String getMavenResourcePaths( MavenProject project )
+ private static String getMavenResourcePaths( MavenProject project )
{
final String basePath = project.getBasedir().getAbsolutePath();
@@ -842,7 +842,7 @@
}
- Collection getEmbeddableArtifacts( MavenProject project, Properties properties )
+ private static Collection getEmbeddableArtifacts( MavenProject project, Properties properties )
{
String embedTransitive = properties.getProperty( DependencyEmbedder.EMBED_TRANSITIVE );
if ( Boolean.valueOf( embedTransitive ).booleanValue() )
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java
index c770ebe..1364612 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java
@@ -39,7 +39,7 @@
*
* @author stuart.mcculloch@jayway.net (Stuart McCulloch)
*/
-public class DependencyEmbedder
+public final class DependencyEmbedder
{
public static final String EMBED_DEPENDENCY = "Embed-Dependency";
public static final String EMBED_DIRECTORY = "Embed-Directory";
@@ -50,54 +50,54 @@
/**
* Dependency artifacts.
*/
- private final Collection dependencyArtifacts;
+ private final Collection m_dependencyArtifacts;
/**
* Inlined artifacts.
*/
- private final Collection inlinedArtifacts;
+ private final Collection m_inlinedArtifacts;
/**
* Embedded artifacts.
*/
- private final Collection embeddedArtifacts;
+ private final Collection m_embeddedArtifacts;
public DependencyEmbedder( Collection dependencyArtifacts )
{
- this.dependencyArtifacts = dependencyArtifacts;
+ m_dependencyArtifacts = dependencyArtifacts;
- this.inlinedArtifacts = new HashSet();
- this.embeddedArtifacts = new HashSet();
+ m_inlinedArtifacts = new HashSet();
+ m_embeddedArtifacts = new HashSet();
}
public void processHeaders( Properties properties ) throws MojoExecutionException
{
- this.inlinedArtifacts.clear();
- this.embeddedArtifacts.clear();
+ m_inlinedArtifacts.clear();
+ m_embeddedArtifacts.clear();
String embedDependencyHeader = properties.getProperty( EMBED_DEPENDENCY );
if ( null != embedDependencyHeader && embedDependencyHeader.length() > 0 )
{
Map embedInstructions = OSGiHeader.parseHeader( embedDependencyHeader );
- this.processEmbedInstructions( embedInstructions );
+ processEmbedInstructions( embedInstructions );
- for ( Iterator i = this.inlinedArtifacts.iterator(); i.hasNext(); )
+ for ( Iterator i = m_inlinedArtifacts.iterator(); i.hasNext(); )
{
- DependencyEmbedder.inlineDependency( properties, ( Artifact ) i.next() );
+ inlineDependency( properties, ( Artifact ) i.next() );
}
- for ( Iterator i = this.embeddedArtifacts.iterator(); i.hasNext(); )
+ for ( Iterator i = m_embeddedArtifacts.iterator(); i.hasNext(); )
{
- DependencyEmbedder.embedDependency( properties, ( Artifact ) i.next() );
+ embedDependency( properties, ( Artifact ) i.next() );
}
}
}
protected static abstract class DependencyFilter
{
- Instruction instruction;
- String defaultValue;
+ private final Instruction m_instruction;
+ private final String m_defaultValue;
public DependencyFilter( String expression )
@@ -108,8 +108,8 @@
public DependencyFilter( String expression, String defaultValue )
{
- this.instruction = Instruction.getPattern( expression );
- this.defaultValue = defaultValue;
+ m_instruction = Instruction.getPattern( expression );
+ m_defaultValue = defaultValue;
}
@@ -128,19 +128,20 @@
abstract boolean matches( Artifact dependency );
- boolean matches( String text )
+ private boolean matches( String text )
{
if ( null == text )
{
- text = defaultValue;
+ text = m_defaultValue;
}
- boolean result = this.instruction.matches( text );
- return this.instruction.isNegated() ? !result : result;
+
+ boolean result = m_instruction.matches( text );
+ return m_instruction.isNegated() ? !result : result;
}
}
- protected void processEmbedInstructions( Map embedInstructions ) throws MojoExecutionException
+ private void processEmbedInstructions( Map embedInstructions ) throws MojoExecutionException
{
DependencyFilter filter;
for ( Iterator clauseIterator = embedInstructions.entrySet().iterator(); clauseIterator.hasNext(); )
@@ -148,7 +149,7 @@
boolean inline = false;
// must use a fresh *modifiable* collection for each unique clause
- Collection filteredDependencies = new HashSet( this.dependencyArtifacts );
+ Collection filteredDependencies = new HashSet( m_dependencyArtifacts );
// CLAUSE: REGEXP --> { ATTRIBUTE MAP }
Map.Entry clause = ( Map.Entry ) clauseIterator.next();
@@ -264,20 +265,20 @@
if ( inline )
{
- this.inlinedArtifacts.addAll( filteredDependencies );
+ m_inlinedArtifacts.addAll( filteredDependencies );
}
else
{
- this.embeddedArtifacts.addAll( filteredDependencies );
+ m_embeddedArtifacts.addAll( filteredDependencies );
}
}
// remove any inlined artifacts from the embedded list
- this.embeddedArtifacts.removeAll( this.inlinedArtifacts );
+ m_embeddedArtifacts.removeAll( m_inlinedArtifacts );
}
- public static void embedDependency( Properties properties, Artifact dependency )
+ private void embedDependency( Properties properties, Artifact dependency )
{
File sourceFile = dependency.getFile();
@@ -353,7 +354,7 @@
}
- public static void inlineDependency( Properties properties, Artifact dependency )
+ private void inlineDependency( Properties properties, Artifact dependency )
{
File sourceFile = dependency.getFile();
@@ -379,12 +380,12 @@
public Collection getInlinedArtifacts()
{
- return this.inlinedArtifacts;
+ return m_inlinedArtifacts;
}
public Collection getEmbeddedArtifacts()
{
- return this.embeddedArtifacts;
+ return m_embeddedArtifacts;
}
}
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/JarPluginConfiguration.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/JarPluginConfiguration.java
index 0461b54..696d5ca 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/JarPluginConfiguration.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/JarPluginConfiguration.java
@@ -36,7 +36,7 @@
*
* @author stuart.mcculloch@jayway.net (Stuart McCulloch)
*/
-public class JarPluginConfiguration
+public final class JarPluginConfiguration
{
public static MavenArchiveConfiguration getArchiveConfiguration( MavenProject project )
{
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
index 93bf4c6..56ef91c 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
@@ -50,7 +50,7 @@
Manifest manifest;
try
{
- manifest = this.getManifest( project, instructions, properties, classpath );
+ manifest = getManifest( project, instructions, properties, classpath );
}
catch ( FileNotFoundException e )
{
@@ -62,7 +62,7 @@
throw new MojoExecutionException( "Error trying to generate Manifest", e );
}
- File outputFile = new File( this.manifestLocation, "MANIFEST.MF" );
+ File outputFile = new File( manifestLocation, "MANIFEST.MF" );
try
{
@@ -77,20 +77,20 @@
public Manifest getManifest( MavenProject project, Jar[] classpath ) throws IOException
{
- return this.getManifest( project, null, null, classpath );
+ return getManifest( project, null, null, classpath );
}
public Manifest getManifest( MavenProject project, Map instructions, Properties properties, Jar[] classpath )
throws IOException
{
- return this.getAnalyzer( project, instructions, properties, classpath ).getJar().getManifest();
+ return getAnalyzer( project, instructions, properties, classpath ).getJar().getManifest();
}
protected Analyzer getAnalyzer( MavenProject project, Jar[] classpath ) throws IOException
{
- return this.getAnalyzer( project, new HashMap(), new Properties(), classpath );
+ return getAnalyzer( project, new HashMap(), new Properties(), classpath );
}
@@ -99,7 +99,7 @@
{
PackageVersionAnalyzer analyzer = new PackageVersionAnalyzer();
- Properties props = this.getDefaultProperties( project );
+ Properties props = getDefaultProperties( project );
props.putAll( properties );
if ( !instructions.containsKey( Analyzer.IMPORT_PACKAGE ) )
@@ -107,7 +107,7 @@
props.put( Analyzer.IMPORT_PACKAGE, "*" );
}
- props.putAll( this.transformDirectives( instructions ) );
+ props.putAll( transformDirectives( instructions ) );
analyzer.setProperties( props );
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/OBRInstall.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/OBRInstall.java
index 2b5d764..c0822da 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/OBRInstall.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/OBRInstall.java
@@ -39,7 +39,7 @@
*
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-public class OBRInstall extends AbstractMojo
+public final class OBRInstall extends AbstractMojo
{
/**
* OBR Repository.
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/PackageVersionAnalyzer.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/PackageVersionAnalyzer.java
index 73fca8a..1a25255 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/PackageVersionAnalyzer.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/PackageVersionAnalyzer.java
@@ -33,19 +33,10 @@
* @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
* @version $Id$
*/
-public class PackageVersionAnalyzer extends Builder
+public final class PackageVersionAnalyzer extends Builder
{
-
- /**
+ /*
* Remove META-INF subfolders from exports and set package versions to bundle version.
- *
- * @param dot
- * @param bundleClasspath
- * @param contained
- * @param referred
- * @param uses
- * @return
- * @throws IOException
*/
public Map analyzeBundleClasspath( Jar dot, Map bundleClasspath, Map contained, Map referred, Map uses )
throws IOException
@@ -72,9 +63,7 @@
values.put( "version", bundleVersion );
}
}
-
}
return classSpace;
}
-
}
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/WrapPlugin.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/WrapPlugin.java
index 80b4818..97d2a64 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/WrapPlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/WrapPlugin.java
@@ -23,19 +23,16 @@
/**
- *
* @goal wrap
* @phase package
* @requiresDependencyResolution runtime
* @description build an OSGi bundle jar for direct dependencies
*/
-public class WrapPlugin extends BundleAllPlugin
+public final class WrapPlugin extends BundleAllPlugin
{
-
public void execute() throws MojoExecutionException
{
BundleInfo bundleInfo = bundleAll( getProject(), 1 );
logDuplicatedPackages( bundleInfo );
}
-
}
diff --git a/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java b/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
index 7587c11..fa2c5f8 100644
--- a/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
+++ b/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
@@ -139,7 +139,7 @@
instructions.put( "z", null );
instructions.put( "_z", null );
- Map transformedInstructions = plugin.transformDirectives( instructions );
+ Map transformedInstructions = BundlePlugin.transformDirectives( instructions );
assertEquals( "1", transformedInstructions.get( "a" ) );
assertEquals( "3", transformedInstructions.get( "-a" ) );