FELIX-472: extract fields
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@616273 13f79535-47bb-0310-9956-ffa450edef68
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 1364612..ca10558 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java
@@ -47,6 +47,10 @@
public static final String EMBED_STRIP_VERSION = "Embed-StripVersion";
public static final String EMBED_TRANSITIVE = "Embed-Transitive";
+ private String m_embedDirectory;
+ private String m_embedStripGroup;
+ private String m_embedStripVersion;
+
/**
* Dependency artifacts.
*/
@@ -80,6 +84,10 @@
String embedDependencyHeader = properties.getProperty( EMBED_DEPENDENCY );
if ( null != embedDependencyHeader && embedDependencyHeader.length() > 0 )
{
+ m_embedDirectory = properties.getProperty( EMBED_DIRECTORY );
+ m_embedStripGroup = properties.getProperty( EMBED_STRIP_GROUP, "true" );
+ m_embedStripVersion = properties.getProperty( EMBED_STRIP_VERSION );
+
Map embedInstructions = OSGiHeader.parseHeader( embedDependencyHeader );
processEmbedInstructions( embedInstructions );
@@ -281,7 +289,6 @@
private void embedDependency( Properties properties, Artifact dependency )
{
File sourceFile = dependency.getFile();
-
if ( null != sourceFile && sourceFile.exists() )
{
String bundleClassPath = properties.getProperty( Analyzer.BUNDLE_CLASSPATH );
@@ -305,22 +312,19 @@
includeResource += ",";
}
- String embedDirectory = properties.getProperty( EMBED_DIRECTORY );
- String embedStripGroup = properties.getProperty( EMBED_STRIP_GROUP, "true" );
- String embedStripVersion = properties.getProperty( EMBED_STRIP_VERSION );
-
+ String embedDirectory = m_embedDirectory;
if ( "".equals( embedDirectory ) || ".".equals( embedDirectory ) )
{
embedDirectory = null;
}
- if ( false == Boolean.valueOf( embedStripGroup ).booleanValue() )
+ if ( false == Boolean.valueOf( m_embedStripGroup ).booleanValue() )
{
embedDirectory = new File( embedDirectory, dependency.getGroupId() ).getPath();
}
File targetFile;
- if ( Boolean.valueOf( embedStripVersion ).booleanValue() )
+ if ( Boolean.valueOf( m_embedStripVersion ).booleanValue() )
{
String extension = dependency.getArtifactHandler().getExtension();
if ( extension != null )
@@ -357,7 +361,6 @@
private void inlineDependency( Properties properties, Artifact dependency )
{
File sourceFile = dependency.getFile();
-
if ( null != sourceFile && sourceFile.exists() )
{
String includeResource = properties.getProperty( Analyzer.INCLUDE_RESOURCE );