X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=org.argeo.cms.e4.rap%2Fsrc%2Forg%2Fargeo%2Fcms%2Fe4%2Frap%2FAbstractRapE4App.java;h=5fe22ae33b0aa42da989676390e714f288a8ac08;hb=af817c9bebfa3187f9a64c3e6aadb933dac148c8;hp=c293f1ab02524b4516a5f9ca00c9935aeef6b9eb;hpb=08c2efb392a969f02008073f55d310c95bddade9;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/AbstractRapE4App.java b/org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/AbstractRapE4App.java index c293f1ab0..5fe22ae33 100644 --- a/org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/AbstractRapE4App.java +++ b/org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/AbstractRapE4App.java @@ -3,13 +3,14 @@ package org.argeo.cms.e4.rap; import java.util.HashMap; import java.util.Map; -import org.argeo.cms.ui.dialogs.CmsFeedback; +import org.argeo.cms.swt.dialogs.CmsFeedback; import org.eclipse.rap.e4.E4ApplicationConfig; import org.eclipse.rap.rwt.application.Application; import org.eclipse.rap.rwt.application.Application.OperationMode; import org.eclipse.rap.rwt.application.ApplicationConfiguration; import org.eclipse.rap.rwt.application.ExceptionHandler; import org.eclipse.rap.rwt.client.WebClient; +import org.osgi.framework.BundleContext; /** Base class for CMS RAP applications. */ public abstract class AbstractRapE4App implements ApplicationConfiguration { @@ -17,7 +18,18 @@ public abstract class AbstractRapE4App implements ApplicationConfiguration { private String path; private String lifeCycleUri = "bundleclass://org.argeo.cms.e4.rap/org.argeo.cms.e4.rap.CmsLoginLifecycle"; - Map baseProperties = new HashMap(); + private Map baseProperties = new HashMap(); + + private BundleContext bundleContext; + public final static String CONTEXT_NAME_PROPERTY = "contextName"; + private String contextName; + + /** + * To be overridden in order to add multiple entry points, directly or using + * {@link #addE4EntryPoint(Application, String, String, Map)}. + */ + protected void addEntryPoints(Application application) { + } public void configure(Application application) { application.setExceptionHandler(new ExceptionHandler() { @@ -35,14 +47,6 @@ public abstract class AbstractRapE4App implements ApplicationConfiguration { } } - /** - * To be overridden in order to add multiple entry points, directly or using - * {@link #addE4EntryPoint(Application, String, String, Map)}. - */ - protected void addEntryPoints(Application application) { - - } - protected Map getBaseProperties() { return baseProperties; } @@ -97,12 +101,36 @@ public abstract class AbstractRapE4App implements ApplicationConfiguration { this.lifeCycleUri = lifeCycleUri; } - public void init(Map properties) { + protected BundleContext getBundleContext() { + return bundleContext; + } + + protected void setBundleContext(BundleContext bundleContext) { + this.bundleContext = bundleContext; + } + + public String getContextName() { + return contextName; + } + + public void setContextName(String contextName) { + this.contextName = contextName; + } + + public void init(BundleContext bundleContext, Map properties) { + this.bundleContext = bundleContext; for (String key : properties.keySet()) { Object value = properties.get(key); if (value != null) baseProperties.put(key, value.toString()); } + + if (properties.containsKey(CONTEXT_NAME_PROPERTY)) { + assert properties.get(CONTEXT_NAME_PROPERTY) != null; + contextName = properties.get(CONTEXT_NAME_PROPERTY).toString(); + } else { + contextName = ""; + } } public void destroy(Map properties) {