set framework version to build's ${pom.version} ...
o enabled resource filtering
o added new properties file containing the felix.version property set to the
pom version
o removed old constant in FelixConstants for the version value
o added method to set new constant in Felx but loaded from properties file
o patched places where code depended on old constant that was removed
git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@384513 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/org.apache.felix.framework/pom.xml b/org.apache.felix.framework/pom.xml
index 84bb50e..a4a07f1 100644
--- a/org.apache.felix.framework/pom.xml
+++ b/org.apache.felix.framework/pom.xml
@@ -20,4 +20,12 @@
<version>${pom.version}</version>
</dependency>
</dependencies>
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </build>
</project>
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
index bd9b765..de98707 100644
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -3324,12 +3324,44 @@
System.getProperty("os.arch"));
m_configMutable.put(FelixConstants.FRAMEWORK_PROCESSOR, s);
- // The framework version property.
+
m_configMutable.put(
- FelixConstants.FELIX_VERSION_PROPERTY,
- FelixConstants.FELIX_VERSION_VALUE);
+ FelixConstants.FELIX_VERSION_PROPERTY, getVersion() );
}
+
+ private static final String FELIX_VERSION_VALUE;
+
+ static
+ {
+ FELIX_VERSION_VALUE = getVersion0();
+ }
+
+
+ private static String getVersion0()
+ {
+ // The framework version property.
+ Properties props = new Properties();
+ InputStream in = Felix.class.getResourceAsStream( "Felix.properties" );
+ try
+ {
+ props.load( in );
+ }
+ catch ( IOException e )
+ {
+ e.printStackTrace();
+ }
+
+ return props.getProperty( FelixConstants.FELIX_VERSION_PROPERTY, "unknown" );
+ }
+
+
+ public static String getVersion()
+ {
+ return FELIX_VERSION_VALUE;
+ }
+
+
private void processAutoProperties()
{
// The auto-install property specifies a space-delimited list of
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/SystemBundle.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/SystemBundle.java
index 5053bdc..6f9b759 100644
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/SystemBundle.java
+++ b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/SystemBundle.java
@@ -126,7 +126,7 @@
// Initialize header map as a case insensitive map.
Map map = new StringMap(false);
- map.put(FelixConstants.BUNDLE_VERSION, FelixConstants.FELIX_VERSION_VALUE);
+ map.put(FelixConstants.BUNDLE_VERSION, Felix.getVersion() );
map.put(FelixConstants.BUNDLE_SYMBOLICNAME, FelixConstants.SYSTEM_BUNDLE_SYMBOLICNAME);
map.put(FelixConstants.BUNDLE_NAME, "System Bundle");
map.put(FelixConstants.BUNDLE_DESCRIPTION,
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/Install.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/Install.java
index 4610d73..3369d3d 100644
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/Install.java
+++ b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/installer/Install.java
@@ -24,6 +24,7 @@
import javax.swing.*;
import javax.swing.border.BevelBorder;
+import org.apache.felix.framework.Felix;
import org.apache.felix.framework.installer.artifact.*;
import org.apache.felix.framework.installer.editor.BooleanEditor;
import org.apache.felix.framework.installer.editor.FileEditor;
@@ -107,7 +108,7 @@
"User documentation",
true,
"http://download.forge.objectweb.org/oscar/oscar-doc-"
- + FelixConstants.FELIX_VERSION_VALUE + ".jar");
+ + Felix.getVersion() + ".jar");
list.add(prop);
// Add the documentation URL property.
@@ -115,7 +116,7 @@
"API documentation",
true,
"http://download.forge.objectweb.org/oscar/oscar-api-"
- + FelixConstants.FELIX_VERSION_VALUE + ".jar");
+ + Felix.getVersion() + ".jar");
list.add(prop);
return list;
@@ -283,7 +284,7 @@
public static void main(String[] argv) throws Exception
{
String msg = "<html>"
- + "<center><h1>Felix " + FelixConstants.FELIX_VERSION_VALUE + "</h1></center>"
+ + "<center><h1>Felix " + Felix.getVersion() + "</h1></center>"
+ "You can download example bundles at the Felix impl prompt by<br>"
+ "using the <b><tt>obr</tt></b> command to access the OSGi Bundle Repository;<br>"
+ "type <b><tt>obr help</tt></b> at the Felix impl prompt for details."
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/FelixConstants.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/FelixConstants.java
index e751f3e..a86b939 100644
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/FelixConstants.java
+++ b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/FelixConstants.java
@@ -20,12 +20,11 @@
{
// Framework constants and values.
public static final String FRAMEWORK_VERSION_VALUE = "4.0";
- public static final String FRAMEWORK_VENDOR_VALUE = "Apache";
+ public static final String FRAMEWORK_VENDOR_VALUE = "Apache Software Foundation";
// Framework constants and values.
public static final String FELIX_VERSION_PROPERTY = "felix.version";
- public static final String FELIX_VERSION_VALUE = "0.7.0";
-
+
// Miscellaneous manifest constants.
public static final String DIRECTIVE_SEPARATOR = ":=";
public static final String ATTRIBUTE_SEPARATOR = "=";
diff --git a/org.apache.felix.framework/src/main/resources/org/apache/felix/framework/Felix.properties b/org.apache.felix.framework/src/main/resources/org/apache/felix/framework/Felix.properties
new file mode 100644
index 0000000..768c415
--- /dev/null
+++ b/org.apache.felix.framework/src/main/resources/org/apache/felix/framework/Felix.properties
@@ -0,0 +1 @@
+felix.version=${pom.version}
diff --git a/pom.xml b/pom.xml
index 8ebd3a4..6507cd2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
<name>Apache Felix (parent)</name>
<version>0.8-SNAPSHOT</version>
<modules>
- <module>javax.servlet</module>
+ <!-- <module>javax.servlet</module> -->
<module>tools/maven2/maven-osgi-plugin</module>
<module>org.osgi</module>
<module>org.apache.felix.framework</module>
@@ -41,6 +41,7 @@
<distributionManagement>
<snapshotRepository>
+ <name>Apache Snapshots</name>
<id>apache.snapshots</id>
<url>
scpexe://apache.org/www/cvs.apache.org/maven-snapshot-repository
@@ -48,7 +49,7 @@
</snapshotRepository>
<repository>
<name>ASF Mirrored M2 Distributions</name>
- <id>apache.releases</id>
+ <id>apache.distributions</id>
<url>
scpexe://minotaur.apache.org/www/www.apache.org/dist/maven-repository
</url>