summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Campo2008-01-22 05:15:42 (EST)
committerChristian Campo2008-01-22 05:15:42 (EST)
commit514f632b7be239cb56a7893b71073ef606a2d6e7 (patch)
tree09693ec70634de7c605da0c311ac9e4025e6c81b
parent2027789400a0836c08c4f392e4894fbd9f778add (diff)
downloadorg.eclipse.riena-514f632b7be239cb56a7893b71073ef606a2d6e7.zip
org.eclipse.riena-514f632b7be239cb56a7893b71073ef606a2d6e7.tar.gz
org.eclipse.riena-514f632b7be239cb56a7893b71073ef606a2d6e7.tar.bz2
new Riena-ForceAutostart option in MANIFEST that makes org.eclipse.riena.core Activator start all those bundles in the classpath
-rw-r--r--org.eclipse.riena.communication.factory.hessian/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.riena.communication.publisher.hessian/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.riena.core/src/org/eclipse/riena/internal/core/Activator.java26
3 files changed, 24 insertions, 4 deletions
diff --git a/org.eclipse.riena.communication.factory.hessian/META-INF/MANIFEST.MF b/org.eclipse.riena.communication.factory.hessian/META-INF/MANIFEST.MF
index 09b7726..6509c2d 100644
--- a/org.eclipse.riena.communication.factory.hessian/META-INF/MANIFEST.MF
+++ b/org.eclipse.riena.communication.factory.hessian/META-INF/MANIFEST.MF
@@ -9,3 +9,4 @@ Import-Package: com.caucho.hessian.client,
org.osgi.framework;version="1.4.0"
Require-Bundle: org.eclipse.riena.communication.core,
org.eclipse.osgi.services
+Riena-ForceStart: true
diff --git a/org.eclipse.riena.communication.publisher.hessian/META-INF/MANIFEST.MF b/org.eclipse.riena.communication.publisher.hessian/META-INF/MANIFEST.MF
index 4feb499..8c7b839 100644
--- a/org.eclipse.riena.communication.publisher.hessian/META-INF/MANIFEST.MF
+++ b/org.eclipse.riena.communication.publisher.hessian/META-INF/MANIFEST.MF
@@ -13,3 +13,4 @@ Import-Package: com.caucho.hessian.io,
javax.servlet.http;version="2.4.0",
org.osgi.framework;version="1.4.0"
Eclipse-BuddyPolicy: registered
+Riena-ForceStart: true
diff --git a/org.eclipse.riena.core/src/org/eclipse/riena/internal/core/Activator.java b/org.eclipse.riena.core/src/org/eclipse/riena/internal/core/Activator.java
index 71989ba..98f0c4b 100644
--- a/org.eclipse.riena.core/src/org/eclipse/riena/internal/core/Activator.java
+++ b/org.eclipse.riena.core/src/org/eclipse/riena/internal/core/Activator.java
@@ -17,6 +17,7 @@ import org.eclipse.equinox.log.Logger;
import org.eclipse.riena.core.logging.LogUtil;
import org.eclipse.riena.internal.core.config.ConfigFromExtensions;
import org.eclipse.riena.internal.core.config.ConfigSymbolReplace;
+import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceRegistration;
@@ -45,16 +46,33 @@ public class Activator extends Plugin {
plugin = this;
CONTEXT = context;
+ Bundle[] bundles = context.getBundles();
+ for (Bundle bundle : bundles) {
+ String forceStart = (String) bundle.getHeaders().get("Riena-ForceStart");
+ if (forceStart != null && forceStart.equals("true")) {
+ if (bundle.getState() == Bundle.RESOLVED) {
+ bundle.start();
+ System.out.println(bundle.getSymbolicName() + " forced autostart successfully");
+ } else {
+ if (bundle.getState() == Bundle.INSTALLED) {
+ System.err.println(bundle.getSymbolicName() + " has Riena-ForceStart but is only in state INSTALLED (not RESOLVED).");
+ } else {
+ if (bundle.getState() == Bundle.ACTIVE) {
+ System.out.println(bundle.getSymbolicName() + " no forced autostart. Bundle is already ACTIVE.");
+ }
+ }
+ }
+ }
+ }
+
// register ConfigSymbolReplace that replaces symbols in config strings
ConfigSymbolReplace csr = new ConfigSymbolReplace();
Hashtable<String, String> ht = new Hashtable<String, String>();
ht.put(Constants.SERVICE_PID, "org.eclipse.riena.config.symbols");
// register as configurable osgi service
- configSymbolReplace = context.registerService(ManagedService.class
- .getName(), csr, ht);
+ configSymbolReplace = context.registerService(ManagedService.class.getName(), csr, ht);
// register as config admin configuration plugin
- configurationPlugin = context.registerService(ConfigurationPlugin.class
- .getName(), csr, null);
+ configurationPlugin = context.registerService(ConfigurationPlugin.class.getName(), csr, null);
// execute the class that reads through the extensions and executes them
// as config admin packages
new ConfigFromExtensions(context).doConfig();