X-Git-Url: http://git.argeo.org/?p=gpl%2Fargeo-suite.git;a=blobdiff_plain;f=org.argeo.suite.e4.rap%2Fsrc%2Forg%2Fargeo%2Fsuite%2Fe4%2Frap%2Fsettings%2FAppDeployer.java;fp=org.argeo.suite.e4.rap%2Fsrc%2Forg%2Fargeo%2Fsuite%2Fe4%2Frap%2Fsettings%2FAppDeployer.java;h=c1588119efd1a8a8ef178c8c94f5e55eec59ac1c;hp=f19220b8e600d7a2606f93327ee1dc6951b51d26;hb=53baf6f0165a51fd6b0f1067606816a7153de117;hpb=7c20b4411872cbd6df7afb90575d6020ef90f31d diff --git a/org.argeo.suite.e4.rap/src/org/argeo/suite/e4/rap/settings/AppDeployer.java b/org.argeo.suite.e4.rap/src/org/argeo/suite/e4/rap/settings/AppDeployer.java index f19220b..c158811 100644 --- a/org.argeo.suite.e4.rap/src/org/argeo/suite/e4/rap/settings/AppDeployer.java +++ b/org.argeo.suite.e4.rap/src/org/argeo/suite/e4/rap/settings/AppDeployer.java @@ -8,21 +8,28 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.argeo.cms.e4.rap.AbstractRapE4App; import org.argeo.cms.ui.util.CmsTheme; +import org.argeo.util.LangUtils; import org.eclipse.rap.rwt.application.ApplicationConfiguration; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.service.cm.ConfigurationException; import org.osgi.service.cm.ManagedServiceFactory; +/** + * Managed service factory deploying Argeo RAP app based on OSGi configurations. + */ public class AppDeployer implements ManagedServiceFactory { + public final static String CMS_THEME_BUNDLE_PROPERTY = "argeo.cms.theme.bundle"; + public final static String DEFAULT_CMS_THEME_BUNDLE = "org.argeo.theme.argeo2"; + private final static Log log = LogFactory.getLog(AppDeployer.class); private BundleContext bundleContext; public void init(BundleContext bundleContext, Map properties) { this.bundleContext = bundleContext; - deploy(findBundle("org.argeo.suite.studio", null)); - deploy(findBundle("org.argeo.suite.docs", null)); + deploy(findBundle("org.argeo.suite.studio", null), properties); + deploy(findBundle("org.argeo.suite.docs", null), properties); } public void destroy() { @@ -37,13 +44,19 @@ public class AppDeployer implements ManagedServiceFactory { @Override public void updated(String pid, Dictionary properties) throws ConfigurationException { Bundle bundle = findBundle(pid, properties); - deploy(bundle); + deploy(bundle, LangUtils.dictToStringMap(properties)); } - protected void deploy(Bundle bundle) { - CmsTheme cmsTheme = new CmsTheme(bundleContext, "org.argeo.theme.argeo2"); + protected void deploy(Bundle bundle, Map properties) { + CmsTheme cmsTheme; + if (properties.containsKey(CMS_THEME_BUNDLE_PROPERTY)) { + String cmsThemeBundle = properties.get(CMS_THEME_BUNDLE_PROPERTY); + cmsTheme = new CmsTheme(bundleContext, cmsThemeBundle); + } else { + cmsTheme = new CmsTheme(bundleContext, DEFAULT_CMS_THEME_BUNDLE); + } - ArgeoRapApp app = new ArgeoRapApp(bundle, cmsTheme); + ArgeoRapApp app = new ArgeoRapApp(bundleContext, bundle, cmsTheme); Hashtable props = new Hashtable(); props.put(AbstractRapE4App.CONTEXT_NAME_PROPERTY, app.getContextName());