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%2FArgeoRapApp.java;fp=org.argeo.suite.e4.rap%2Fsrc%2Forg%2Fargeo%2Fsuite%2Fe4%2Frap%2Fsettings%2FArgeoRapApp.java;h=83a5bd0cf6726c81f8afe0f93eb427a487ad6613;hp=0000000000000000000000000000000000000000;hb=c2da92a9dcef3f64901f2a01f5f3dca671813e1c;hpb=6523266bddde8a69b97fc8cfbf660dfc41bdbbc1 diff --git a/org.argeo.suite.e4.rap/src/org/argeo/suite/e4/rap/settings/ArgeoRapApp.java b/org.argeo.suite.e4.rap/src/org/argeo/suite/e4/rap/settings/ArgeoRapApp.java new file mode 100644 index 0000000..83a5bd0 --- /dev/null +++ b/org.argeo.suite.e4.rap/src/org/argeo/suite/e4/rap/settings/ArgeoRapApp.java @@ -0,0 +1,50 @@ +package org.argeo.suite.e4.rap.settings; + +import java.util.Enumeration; + +import org.apache.commons.io.FilenameUtils; +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.eclipse.rap.rwt.application.Application; +import org.eclipse.rap.rwt.client.WebClient; +import org.osgi.framework.Bundle; + +/** Argeo RAP app. */ +public class ArgeoRapApp extends AbstractRapE4App { + private final static Log log = LogFactory.getLog(ArgeoRapApp.class); + + private Bundle bundle; + private CmsTheme cmsTheme; + private String baseE4xmi = "/e4xmi"; + + public ArgeoRapApp(Bundle bundle, CmsTheme cmsTheme) { + this.bundle = bundle; + this.cmsTheme = cmsTheme; + setLifeCycleUri("bundleclass://org.argeo.suite.e4.rap/org.argeo.suite.e4.rap.ArgeoSuiteLoginLifecycle"); + String contextName = "argeo/" + FilenameUtils.getExtension(bundle.getSymbolicName()); + setContextName(contextName); + } + + @Override + protected void addEntryPoints(Application application) { + if (cmsTheme != null) + cmsTheme.apply(application); + + String font = ""; + getBaseProperties().put(WebClient.HEAD_HTML, font); + + Enumeration paths = bundle.getEntryPaths(baseE4xmi); + while (paths.hasMoreElements()) { + String p = paths.nextElement(); + if (p.endsWith(".e4xmi")) { + String e4xmiPath = bundle.getSymbolicName() + '/' + p; + String name = '/' + FilenameUtils.removeExtension(FilenameUtils.getName(p)); + addE4EntryPoint(application, name, e4xmiPath, getBaseProperties()); + if (log.isDebugEnabled()) + log.debug("Registered " + e4xmiPath + " as " + getContextName() + name); + } + } + } +}