Login/logout working in new Argeo Suite.
[gpl/argeo-suite.git] / org.argeo.suite.e4.rap / src / org / argeo / suite / e4 / rap / settings / AppDeployer.java
index f19220b8e600d7a2606f93327ee1dc6951b51d26..978a8e2d337ea5a62d424df56620ab16b392e35d 100644 (file)
@@ -7,13 +7,16 @@ import java.util.Map;
 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 {
        private final static Log log = LogFactory.getLog(AppDeployer.class);
        private BundleContext bundleContext;
@@ -21,8 +24,8 @@ public class AppDeployer implements ManagedServiceFactory {
        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() {
@@ -37,13 +40,19 @@ public class AppDeployer implements ManagedServiceFactory {
        @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(CmsTheme.CMS_THEME_BUNDLE_PROPERTY)) {
+//                     String cmsThemeBundle = properties.get(CmsTheme.CMS_THEME_BUNDLE_PROPERTY);
+//                     cmsTheme = new CmsTheme(bundleContext, cmsThemeBundle);
+//             } else {
+//                     cmsTheme = new CmsTheme(bundleContext, CmsTheme.DEFAULT_CMS_THEME_BUNDLE);
+//             }
 
-               ArgeoRapApp app = new ArgeoRapApp(bundle, cmsTheme);
+               ArgeoRapApp app = new ArgeoRapApp(bundleContext, bundle, null);
 
                Hashtable<String, String> props = new Hashtable<String, String>();
                props.put(AbstractRapE4App.CONTEXT_NAME_PROPERTY, app.getContextName());