import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.argeo.cms.e4.rap.AbstractRapE4App;
-import org.argeo.cms.util.CmsTheme;
+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<String, String> 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() {
@Override
public void updated(String pid, Dictionary<String, ?> 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<String, String> 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<String, String> props = new Hashtable<String, String>();
props.put(AbstractRapE4App.CONTEXT_NAME_PROPERTY, app.getContextName());