FELIX-1657: Add option in fileinstall to start bundles transiently (START_TRANSIENT)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@959217 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java
index 28c643a..ffe7398 100644
--- a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java
+++ b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java
@@ -87,6 +87,7 @@
public final static String TMPDIR = "felix.fileinstall.tmpdir";
public final static String FILTER = "felix.fileinstall.filter";
public final static String START_NEW_BUNDLES = "felix.fileinstall.bundles.new.start";
+ public final static String USE_START_TRANSIENT = "felix.fileinstall.bundles.startTransient";
public final static String NO_INITIAL_DELAY = "felix.fileinstall.noInitialDelay";
static final SecureRandom random = new SecureRandom();
@@ -99,6 +100,7 @@
long poll;
int logLevel;
boolean startBundles;
+ boolean useStartTransient;
String filter;
BundleContext context;
String originatingFileName;
@@ -129,6 +131,7 @@
tmpDir = getFile(properties, TMPDIR, null);
prepareTempDir();
startBundles = getBoolean(properties, START_NEW_BUNDLES, true); // by default, we start bundles.
+ useStartTransient = getBoolean(properties, USE_START_TRANSIENT, false); // by default, we start bundles persistently.
filter = (String) properties.get(FILTER);
noInitialDelay = getBoolean(properties, NO_INITIAL_DELAY, false);
this.context.addBundleListener(this);
@@ -1101,7 +1104,7 @@
if (bundle != null)
{
if (bundle.getState() != Bundle.STARTING && bundle.getState() != Bundle.ACTIVE
- && FileInstall.getStartLevel().isBundlePersistentlyStarted(bundle)
+ && (useStartTransient || FileInstall.getStartLevel().isBundlePersistentlyStarted(bundle))
&& FileInstall.getStartLevel().getStartLevel() >= FileInstall.getStartLevel().getBundleStartLevel(bundle))
{
bundles.add(bundle);
@@ -1130,7 +1133,7 @@
{
try
{
- bundle.start();
+ bundle.start(useStartTransient ? Bundle.START_TRANSIENT : 0);
log(Logger.LOG_INFO, "Started bundle: " + bundle.getLocation(), null);
}
catch (BundleException e)