Author: rickhall
Date: Thu May 28 20:00:24 2009
New Revision: 779753
URL: http://svn.apache.org/viewvc?rev=779753&view=rev
Log:
Add support for enabling bundle activation policy when starting the bundle;
this is achieved by using "start -p" to enabled the bundle's declared
activation policy. (FELIX-1181)
Modified:
felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/StartCommandImpl.java
felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/StopCommandImpl.java
Modified:
felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/StartCommandImpl.java
URL:
http://svn.apache.org/viewvc/felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/StartCommandImpl.java?rev=779753&r1=779752&r2=779753&view=diff
==============================================================================
---
felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/StartCommandImpl.java
(original)
+++
felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/StartCommandImpl.java
Thu May 28 20:00:24 2009
@@ -29,6 +29,7 @@
public class StartCommandImpl extends InstallCommandImpl implements Command
{
private static final String TRANSIENT_SWITCH = "-t";
+ private static final String POLICY_SWITCH = "-p";
private BundleContext m_context = null;
@@ -45,7 +46,7 @@
public String getUsage()
{
- return "start [-t] <id> [<id> <URL> ...]";
+ return "start [-t | -p] <id> [<id> <URL> ...]";
}
public String getShortDescription()
@@ -67,15 +68,23 @@
tokens.add(st.nextToken());
}
- // Default switch value.
- boolean isTransient = false;
+ // Default switch values.
+ int options = 0;
// Check for "transient" switch.
if (tokens.contains(TRANSIENT_SWITCH))
{
// Remove the switch and set boolean flag.
tokens.remove(TRANSIENT_SWITCH);
- isTransient = true;
+ options |= Bundle.START_TRANSIENT;
+ }
+
+ // Check for "start policy" switch.
+ if (tokens.contains(POLICY_SWITCH))
+ {
+ // Remove the switch and set boolean flag.
+ tokens.remove(POLICY_SWITCH);
+ options |= Bundle.START_ACTIVATION_POLICY;
}
// There should be at least one bundle id.
@@ -102,7 +111,7 @@
if (bundle != null)
{
- bundle.start(isTransient ? Bundle.START_TRANSIENT : 0);
+ bundle.start(options);
}
else
{
Modified:
felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/StopCommandImpl.java
URL:
http://svn.apache.org/viewvc/felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/StopCommandImpl.java?rev=779753&r1=779752&r2=779753&view=diff
==============================================================================
---
felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/StopCommandImpl.java
(original)
+++
felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/StopCommandImpl.java
Thu May 28 20:00:24 2009
@@ -67,14 +67,14 @@
}
// Default switch value.
- boolean isTransient = false;
+ int options = 0;
// Check for "transient" switch.
if (tokens.contains(TRANSIENT_SWITCH))
{
// Remove the switch and set boolean flag.
tokens.remove(TRANSIENT_SWITCH);
- isTransient = true;
+ options |= Bundle.STOP_TRANSIENT;
}
// There should be at least one bundle id.
@@ -90,7 +90,7 @@
Bundle bundle = m_context.getBundle(l);
if (bundle != null)
{
- bundle.stop(isTransient ? Bundle.STOP_TRANSIENT : 0);
+ bundle.stop(options);
}
else
{