summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Campo2008-02-14 06:43:33 (EST)
committerChristian Campo2008-02-14 06:43:33 (EST)
commit69e335a01e8d0da6da159f1fce5cc8a62cf50c81 (patch)
treef97a5996e3bcf0df509a5dad764c7e8e2ce83bea
parente9b352bdba3e23a70394108abefb1245181d74ed (diff)
downloadorg.eclipse.riena-69e335a01e8d0da6da159f1fce5cc8a62cf50c81.zip
org.eclipse.riena-69e335a01e8d0da6da159f1fce5cc8a62cf50c81.tar.gz
org.eclipse.riena-69e335a01e8d0da6da159f1fce5cc8a62cf50c81.tar.bz2
only check for certain bundles if there is no system property set, added some javadoc
-rw-r--r--org.eclipse.riena.core/src/org/eclipse/riena/core/util/ContainerModel.java25
1 files changed, 19 insertions, 6 deletions
diff --git a/org.eclipse.riena.core/src/org/eclipse/riena/core/util/ContainerModel.java b/org.eclipse.riena.core/src/org/eclipse/riena/core/util/ContainerModel.java
index f8dde9a..145315d 100644
--- a/org.eclipse.riena.core/src/org/eclipse/riena/core/util/ContainerModel.java
+++ b/org.eclipse.riena.core/src/org/eclipse/riena/core/util/ContainerModel.java
@@ -14,6 +14,16 @@ import org.eclipse.riena.internal.core.Activator;
import org.osgi.framework.Bundle;
import org.osgi.service.log.LogService;
+/**
+ * This class can be used by other to find out whether the container they are
+ * running in is a Riena client or a Riena server container. The consequence can
+ * be things like storing objects in a singleton (for client) vs storing them in
+ * a ThreadLocal (server) or others. The class can be driven be the
+ * system.property "riena.container.model" that can be set to "client" or
+ * "server". The ContainerModel also checks to see whether there is a bundle
+ * called org.eclipse.equinox.http in which case it assumes a server model. In
+ * any case, it creates a LOG_INFO entry to post what it has chosen.
+ */
public class ContainerModel {
private static final int CLIENT = 1;
@@ -22,14 +32,17 @@ public class ContainerModel {
private static int containerModel = CLIENT;
static {
String s = System.getProperty("riena.container.model");
- if (s != null && s.equals("server")) {
- containerModel = SERVER;
- }
- Bundle[] bundles = Activator.getContext().getBundles();
- for (Bundle bundle : bundles) {
- if (bundle.getSymbolicName().startsWith("org.eclipse.equinox.http")) {
+ if (s != null) {
+ if (s.equals("server")) {
containerModel = SERVER;
}
+ } else {
+ Bundle[] bundles = Activator.getContext().getBundles();
+ for (Bundle bundle : bundles) {
+ if (bundle.getSymbolicName().startsWith("org.eclipse.equinox.http")) {
+ containerModel = SERVER;
+ }
+ }
}
if (containerModel == SERVER) {
Activator.getDefault().getLogger(ContainerModel.class.getName()).log(LogService.LOG_INFO,