1 package org
.argeo
.suite
.e4
.rap
.settings
;
3 import java
.util
.Enumeration
;
6 import org
.apache
.commons
.io
.FilenameUtils
;
7 import org
.apache
.commons
.logging
.Log
;
8 import org
.apache
.commons
.logging
.LogFactory
;
9 import org
.argeo
.cms
.e4
.rap
.AbstractRapE4App
;
10 import org
.argeo
.cms
.ui
.CmsTheme
;
11 import org
.eclipse
.rap
.rwt
.application
.Application
;
12 import org
.eclipse
.rap
.rwt
.client
.WebClient
;
13 import org
.osgi
.framework
.Bundle
;
14 import org
.osgi
.framework
.BundleContext
;
17 public class ArgeoRapApp
extends AbstractRapE4App
{
18 private final static Log log
= LogFactory
.getLog(ArgeoRapApp
.class);
20 private CmsTheme cmsTheme
;
21 private String baseE4xmi
= "/e4xmi";
22 private Bundle bundle
;
24 public ArgeoRapApp(BundleContext bundleContext
, Bundle bundle
, CmsTheme cmsTheme
) {
25 setBundleContext(bundleContext
);
26 this.cmsTheme
= cmsTheme
;
28 setLifeCycleUri("bundleclass://org.argeo.suite.e4.rap/org.argeo.suite.e4.rap.ArgeoSuiteLoginLifecycle");
29 String contextName
= "apps/" + FilenameUtils
.getExtension(bundle
.getSymbolicName());
30 setContextName(contextName
);
33 public ArgeoRapApp() {
34 setLifeCycleUri("bundleclass://org.argeo.suite.e4.rap/org.argeo.suite.e4.rap.ArgeoSuiteLoginLifecycle");
38 public void init(BundleContext bundleContext
, Map
<String
, Object
> properties
) {
39 super.init(bundleContext
, properties
);
40 // super must be first
41 // if (getBaseProperties().containsKey(CmsTheme.CMS_THEME_BUNDLE_PROPERTY)) {
42 // String cmsThemeBundle = getBaseProperties().get(CmsTheme.CMS_THEME_BUNDLE_PROPERTY);
43 // cmsTheme = new CmsTheme(getBundleContext(), cmsThemeBundle);
45 // cmsTheme = new CmsTheme(getBundleContext(), CmsTheme.DEFAULT_CMS_THEME_BUNDLE);
47 bundle
= bundleContext
.getBundle();
51 protected void addEntryPoints(Application application
) {
52 // if (cmsTheme != null)
53 // cmsTheme.apply(application);
55 String font
= "<link rel='stylesheet' href='http://fonts.googleapis.com/css?family=Source+Sans+Pro'/>";
56 getBaseProperties().put(WebClient
.HEAD_HTML
, font
);
58 Enumeration
<String
> paths
= bundle
.getEntryPaths(baseE4xmi
);
59 while (paths
.hasMoreElements()) {
60 String p
= paths
.nextElement();
61 if (p
.endsWith(".e4xmi")) {
62 String e4xmiPath
= bundle
.getSymbolicName() + '/' + p
;
63 String name
= '/' + FilenameUtils
.removeExtension(FilenameUtils
.getName(p
));
64 addE4EntryPoint(application
, name
, e4xmiPath
, getBaseProperties());
65 if (log
.isDebugEnabled())
66 log
.debug("Registered " + e4xmiPath
+ " as " + getContextName() + name
);