Starts workbench thanks to a fragment
authorMathieu Baudier <mbaudier@argeo.org>
Wed, 28 Jan 2015 11:28:01 +0000 (11:28 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Wed, 28 Jan 2015 11:28:01 +0000 (11:28 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@7716 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

demo/argeo_node_rap.properties
org.argeo.cms/src/org/argeo/cms/internal/kernel/Kernel.java
org.argeo.eclipse.ui.workbench.rap/.project [new file with mode: 0644]
org.argeo.eclipse.ui.workbench.rap/META-INF/spring/osgi.xml [new file with mode: 0644]
org.argeo.eclipse.ui.workbench.rap/bnd.bnd [new file with mode: 0644]
org.argeo.eclipse.ui.workbench.rap/pom.xml [new file with mode: 0644]
pom.xml

index 7c3b662b2a97b9028ae16610b170f2de6636883b..49c4108c9383ca79cdcf4014f7d2b792279fc44a 100644 (file)
@@ -14,11 +14,11 @@ org.eclipse.equinox.http.registry,\
 
 org.osgi.service.http.port=7070
 org.eclipse.equinox.http.jetty.log.stderr.threshold=info
-org.eclipse.equinox.http.jetty.context.path=/ui
+#org.eclipse.equinox.http.jetty.context.path=/ui
 
 argeo.i18n.availableLocales=en,fr,de,ru,ar
 eclipse.registry.MultiLanguage=true
 
 log4j.configuration=file:../../log4j.properties
 osgi.console.enable.builtin=true
-org.eclipse.rap.workbenchAutostart=true
\ No newline at end of file
+org.eclipse.rap.workbenchAutostart=false
\ No newline at end of file
index 4b893f13d0b6e195be13c8354b8ab2dc756d8cb0..848206f5c5248833707a99838b92bceb3210d031 100644 (file)
@@ -1,7 +1,5 @@
 package org.argeo.cms.internal.kernel;
 
-import java.util.Hashtable;
-
 import javax.jcr.RepositoryFactory;
 
 import org.apache.commons.logging.Log;
@@ -10,8 +8,6 @@ import org.argeo.ArgeoException;
 import org.argeo.jackrabbit.OsgiJackrabbitRepositoryFactory;
 import org.argeo.security.core.InternalAuthentication;
 import org.eclipse.rap.rwt.application.ApplicationConfiguration;
-import org.eclipse.rap.rwt.osgi.ApplicationLauncher;
-import org.eclipse.rap.ui.internal.servlet.WorkbenchApplicationConfiguration;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 import org.springframework.security.core.context.SecurityContextHolder;
@@ -27,10 +23,9 @@ import org.springframework.security.core.context.SecurityContextHolder;
  * <li>OS access</li>
  * </ul>
  */
-@SuppressWarnings("restriction")
 final class Kernel {
        private final static Log log = LogFactory.getLog(Kernel.class);
-       private static final String PROP_WORKBENCH_AUTOSTART = "org.eclipse.rap.workbenchAutostart";
+//     private static final String PROP_WORKBENCH_AUTOSTART = "org.eclipse.rap.workbenchAutostart";
 
        private final BundleContext bundleContext;
 
@@ -64,11 +59,11 @@ final class Kernel {
                                        repositoryFactory, null);
                        nodeHttp.publish();
 
-                       if ("false".equals(bundleContext
-                                       .getProperty(PROP_WORKBENCH_AUTOSTART))) {
-                               WorkbenchApplicationConfiguration wac = new WorkbenchApplicationConfiguration();
-                               registerWorkbench(wac);
-                       }
+//                     if ("false".equals(bundleContext
+//                                     .getProperty(PROP_WORKBENCH_AUTOSTART))) {
+//                             WorkbenchApplicationConfiguration wac = new WorkbenchApplicationConfiguration();
+//                             registerWorkbench(wac);
+//                     }
                } catch (Exception e) {
                        log.error("Cannot initialize Argeo CMS", e);
                        throw new ArgeoException("Cannot initialize", e);
@@ -95,16 +90,16 @@ final class Kernel {
                                + (duration % 1000) + "s ##");
        }
 
-       private void registerWorkbench(final WorkbenchApplicationConfiguration wac) {
-               new Thread("Worbench Launcher") {
-                       public void run() {
-                               Hashtable<String, String> props = new Hashtable<String, String>();
-                               props.put(ApplicationLauncher.PROPERTY_CONTEXT_NAME, "ui");
-                               workbenchReg = bundleContext.registerService(
-                                               ApplicationConfiguration.class, wac, props);
-                       }
-               }.start();
-       }
+//     private void registerWorkbench(final WorkbenchApplicationConfiguration wac) {
+//             new Thread("Worbench Launcher") {
+//                     public void run() {
+//                             Hashtable<String, String> props = new Hashtable<String, String>();
+//                             props.put(ApplicationLauncher.PROPERTY_CONTEXT_NAME, "ui");
+//                             workbenchReg = bundleContext.registerService(
+//                                             ApplicationConfiguration.class, wac, props);
+//                     }
+//             }.start();
+//     }
 
        private void directorsCut() {
                final long ms = 128l + (long) (Math.random() * 128d);
diff --git a/org.argeo.eclipse.ui.workbench.rap/.project b/org.argeo.eclipse.ui.workbench.rap/.project
new file mode 100644 (file)
index 0000000..751e9d7
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.argeo.eclipse.ui.workbench.rap</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments />
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments />
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+       </natures>
+</projectDescription>
diff --git a/org.argeo.eclipse.ui.workbench.rap/META-INF/spring/osgi.xml b/org.argeo.eclipse.ui.workbench.rap/META-INF/spring/osgi.xml
new file mode 100644 (file)
index 0000000..206a72a
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans:beans xmlns="http://www.springframework.org/schema/osgi"\r
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"\r
+       xmlns:util="http://www.springframework.org/schema/util"\r
+       xsi:schemaLocation="http://www.springframework.org/schema/osgi  \r
+       http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd\r
+       http://www.springframework.org/schema/beans   \r
+       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
+       http://www.springframework.org/schema/util\r
+       http://www.springframework.org/schema/util/spring-util-2.5.xsd">\r
+\r
+       <service interface="org.eclipse.rap.rwt.application.ApplicationConfiguration">\r
+               <service-properties>\r
+                       <beans:entry key="contextName" value="ui" />\r
+               </service-properties>\r
+               <beans:bean\r
+                       class="org.eclipse.rap.ui.internal.servlet.WorkbenchApplicationConfiguration" />\r
+       </service>\r
+</beans:beans>
\ No newline at end of file
diff --git a/org.argeo.eclipse.ui.workbench.rap/bnd.bnd b/org.argeo.eclipse.ui.workbench.rap/bnd.bnd
new file mode 100644 (file)
index 0000000..1b2939e
--- /dev/null
@@ -0,0 +1,4 @@
+Bundle-SymbolicName: org.argeo.eclipse.ui.workbench.rap;singleton:=true
+Bundle-ActivationPolicy: lazy
+
+Fragment-Host: org.eclipse.rap.ui.workbench
diff --git a/org.argeo.eclipse.ui.workbench.rap/pom.xml b/org.argeo.eclipse.ui.workbench.rap/pom.xml
new file mode 100644 (file)
index 0000000..eea1f60
--- /dev/null
@@ -0,0 +1,11 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+       <parent>
+               <groupId>org.argeo.commons</groupId>
+               <version>2.1.13-SNAPSHOT</version>
+               <artifactId>argeo-commons</artifactId>
+               <relativePath>..</relativePath>
+       </parent>
+       <artifactId>org.argeo.eclipse.ui.workbench.rap</artifactId>
+       <name>Commons Eclipse UI Workbench RAP</name>
+</project>
diff --git a/pom.xml b/pom.xml
index 464b30736f1eb7c5790d27baf43910343225be97..faf7d18e610b44a1f4957bafb5d1103b7508e616 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -44,6 +44,7 @@
                <module>org.argeo.cms</module>
                <!-- Workbench -->
                <module>org.argeo.eclipse.ui.workbench</module>
+               <module>org.argeo.eclipse.ui.workbench.rap</module>
                <!-- <module>org.argeo.security.equinox</module> -->
                <module>org.argeo.security.ui</module>
                <module>org.argeo.security.ui.admin</module>