You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2008/10/10 17:38:59 UTC
svn commit: r703502 - in /felix/trunk:
framework/src/main/java/org/apache/felix/framework/
framework/src/main/java/org/apache/felix/framework/cache/
main/src/main/java/org/apache/felix/main/ main/src/main/resources/
Author: rickhall
Date: Fri Oct 10 08:38:59 2008
New Revision: 703502
URL: http://svn.apache.org/viewvc?rev=703502&view=rev
Log:
Implements support for flushing the cache on framework initialization.
(FELIX-755)
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java
felix/trunk/main/src/main/java/org/apache/felix/main/Main.java
felix/trunk/main/src/main/resources/config.properties
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java?rev=703502&r1=703501&r2=703502&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java Fri Oct 10 08:38:59 2008
@@ -685,6 +685,25 @@
throw new BundleException("Error creating bundle cache.", ex);
}
+ // If this is the first time init is called, check to see if
+ // we need to flush the bundle cache.
+ if (state == Bundle.INSTALLED)
+ {
+ String flush = (String) m_configMap.get(Constants.FRAMEWORK_STORAGE_CLEAN);
+ if ((flush != null)
+ && flush.equalsIgnoreCase(Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT))
+ {
+ try
+ {
+ m_cache.flush();
+ }
+ catch (Exception ex)
+ {
+ throw new BundleException("Unable to flush bundle cache.", ex);
+ }
+ }
+ }
+
// Initialize installed bundle data structures.
m_installedBundleMap = new HashMap();
m_installedBundleIndex = new TreeMap();
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java?rev=703502&r1=703501&r2=703502&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java Fri Oct 10 08:38:59 2008
@@ -100,6 +100,19 @@
return m_secureAction;
}
+ public synchronized void flush() throws Exception
+ {
+ // Dispose of all existing archives.
+ for (int i = 0; (m_archives != null) && (i < m_archives.length); i++)
+ {
+ m_archives[i].dispose();
+ }
+ // Delete the cache directory.
+ deleteDirectoryTree(m_cacheDir);
+ // Reinitialize the cache.
+ initialize();
+ }
+
public synchronized BundleArchive[] getArchives()
throws Exception
{
Modified: felix/trunk/main/src/main/java/org/apache/felix/main/Main.java
URL: http://svn.apache.org/viewvc/felix/trunk/main/src/main/java/org/apache/felix/main/Main.java?rev=703502&r1=703501&r2=703502&view=diff
==============================================================================
--- felix/trunk/main/src/main/java/org/apache/felix/main/Main.java (original)
+++ felix/trunk/main/src/main/java/org/apache/felix/main/Main.java Fri Oct 10 08:38:59 2008
@@ -465,10 +465,7 @@
e.hasMoreElements(); )
{
String key = (String) e.nextElement();
- if (key.startsWith("felix.") ||
- key.equals("org.osgi.framework.system.packages") ||
- key.equals("org.osgi.framework.storage") ||
- key.equals("org.osgi.framework.bootdelegation"))
+ if (key.startsWith("felix.") || key.startsWith("org.osgi.framework."))
{
configProps.setProperty(key, System.getProperty(key));
}
Modified: felix/trunk/main/src/main/resources/config.properties
URL: http://svn.apache.org/viewvc/felix/trunk/main/src/main/resources/config.properties?rev=703502&r1=703501&r2=703502&view=diff
==============================================================================
--- felix/trunk/main/src/main/resources/config.properties (original)
+++ felix/trunk/main/src/main/resources/config.properties Fri Oct 10 08:38:59 2008
@@ -41,6 +41,11 @@
# current working directory.
#felix.cache.rootdir=${dollar}{user.dir}
+# The following property controls whether the bundle cache is flushed
+# the first time the framework is initialized. Possible values are
+# "none" and "onFirstInit"; the default is "none".
+#org.osgi.framework.storage.clean=onFirstInit
+
felix.auto.start.1= \
file:bundle/org.apache.felix.shell-1.1.0-SNAPSHOT.jar \
file:bundle/org.apache.felix.shell.tui-1.1.0-SNAPSHOT.jar \