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=0000000000000000000000000000000000000000;hp=978a8e2d337ea5a62d424df56620ab16b392e35d;hb=30f7e4a5a1bdb27156511eb9ea88d2ec492d7e01;hpb=a55bb0dc7e9fbcefb645d34ce24b326d1506a623 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 deleted file mode 100644 index 978a8e2..0000000 --- a/org.argeo.suite.e4.rap/src/org/argeo/suite/e4/rap/settings/AppDeployer.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.argeo.suite.e4.rap.settings; - -import java.util.Dictionary; -import java.util.Hashtable; -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.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; - - public void init(BundleContext bundleContext, Map properties) { - this.bundleContext = bundleContext; - - deploy(findBundle("org.argeo.suite.studio", null), properties); - deploy(findBundle("org.argeo.suite.docs", null), properties); - } - - public void destroy() { - - } - - @Override - public String getName() { - return "Argeo App Deployer"; - } - - @Override - public void updated(String pid, Dictionary properties) throws ConfigurationException { - Bundle bundle = findBundle(pid, properties); - deploy(bundle, LangUtils.dictToStringMap(properties)); - } - - protected void deploy(Bundle bundle, Map 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(bundleContext, bundle, null); - - Hashtable props = new Hashtable(); - props.put(AbstractRapE4App.CONTEXT_NAME_PROPERTY, app.getContextName()); - bundleContext.registerService(ApplicationConfiguration.class, app, props); - - if (log.isDebugEnabled()) - log.debug("Deployed Argeo App " + bundle.getSymbolicName() + " to " + app.getContextName()); - } - - @Override - public void deleted(String pid) { - } - - protected Bundle findBundle(String pid, Dictionary properties) { - Bundle bundle = null; - for (Bundle b : bundleContext.getBundles()) { - if (b.getSymbolicName().equals(pid)) { - bundle = b; - break; - } - } - if (bundle == null) - throw new IllegalStateException("Bundle " + pid + " not found"); - return bundle; - } -}