Using profiles. Twitter demo can execute and test properly in FX profile now model
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Sun, 28 Apr 2013 21:17:04 +0200
branchmodel
changeset 1043bd80952bfd11
parent 1042 33b2625bf03a
child 1044 1e6d2b0faea6
Using profiles. Twitter demo can execute and test properly in FX profile now
javaquery/demo-twitter/pom.xml
launcher/api/src/main/java/org/apidesign/bck2brwsr/launcher/Launcher.java
launcher/fx/pom.xml
launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/BaseHTTPLauncher.java
launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/FXBrwsrLauncher.java
launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/fximpl/Console.java
rt/mojo/pom.xml
rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/BrswrMojo.java
     1.1 --- a/javaquery/demo-twitter/pom.xml	Sun Apr 28 20:31:31 2013 +0200
     1.2 +++ b/javaquery/demo-twitter/pom.xml	Sun Apr 28 21:17:04 2013 +0200
     1.3 @@ -12,10 +12,10 @@
     1.4    <version>0.7-SNAPSHOT</version>
     1.5    <packaging>jar</packaging>
     1.6  
     1.7 -  <name>Bck2Brwsr's Twttr</name>
     1.8 +  <name>Fx/Bck2Brwsr's Twttr</name>
     1.9    <description>
    1.10        Rewrite of knockoutjs example to use model written in Java and
    1.11 -      execute using Bck2Brwsr virtual machine.
    1.12 +      execute using FxBrwsr or Bck2Brwsr.
    1.13    </description>
    1.14  
    1.15    <repositories>
    1.16 @@ -48,89 +48,85 @@
    1.17    </properties>
    1.18    <build>
    1.19        <plugins>
    1.20 -            <plugin>
    1.21 -                <groupId>org.apidesign.bck2brwsr</groupId>
    1.22 -                <artifactId>bck2brwsr-maven-plugin</artifactId>
    1.23 -                <version>${project.version}</version>
    1.24 -                <executions>
    1.25 -                    <execution>
    1.26 -                        <goals>
    1.27 -                            <goal>brwsr</goal>
    1.28 -                            <goal>j2js</goal>
    1.29 -                        </goals>
    1.30 -                    </execution>
    1.31 -                </executions>
    1.32 -                <configuration>
    1.33 -                    <startpage>org/apidesign/bck2brwsr/demo/twitter/index.html</startpage>
    1.34 -                    <javascript>${project.build.directory}/bck2brwsr.js</javascript>
    1.35 -                    <obfuscation>${bck2brwsr.obfuscationlevel}</obfuscation>
    1.36 -                </configuration>
    1.37 -            </plugin>
    1.38 -         <plugin>
    1.39 -            <groupId>org.apache.maven.plugins</groupId>
    1.40 -            <artifactId>maven-compiler-plugin</artifactId>
    1.41 -            <version>2.3.2</version>
    1.42 -            <configuration>
    1.43 -               <source>1.7</source>
    1.44 -               <target>1.7</target>
    1.45 -            </configuration>
    1.46 -         </plugin>
    1.47 -         <plugin>
    1.48 -             <groupId>org.apache.maven.plugins</groupId>
    1.49 -             <artifactId>maven-jar-plugin</artifactId>
    1.50 -             <version>2.4</version>
    1.51 -             <configuration>
    1.52 -                 <archive>
    1.53 -                     <manifest>
    1.54 -                         <addClasspath>true</addClasspath>
    1.55 -                         <classpathPrefix>lib/</classpathPrefix>
    1.56 -                     </manifest>
    1.57 -                 </archive>
    1.58 -             </configuration>
    1.59 -         </plugin>
    1.60 -         <plugin>
    1.61 -           <groupId>org.apache.maven.plugins</groupId>
    1.62 -           <artifactId>maven-deploy-plugin</artifactId>
    1.63 -           <version>2.7</version>
    1.64 -           <configuration>
    1.65 -             <skip>true</skip>
    1.66 -           </configuration>
    1.67 -         </plugin>      
    1.68 -         <plugin>
    1.69 -             <artifactId>maven-assembly-plugin</artifactId>
    1.70 -             <version>2.4</version>
    1.71 -             <executions>
    1.72 -                 <execution>
    1.73 -                     <id>distro-assembly</id>
    1.74 -                     <phase>package</phase>
    1.75 -                     <goals>
    1.76 -                         <goal>single</goal>
    1.77 -                     </goals>
    1.78 -                     <configuration>
    1.79 -                         <descriptors>
    1.80 -                             <descriptor>bck2brwsr-assembly.xml</descriptor>
    1.81 -                         </descriptors>
    1.82 -                     </configuration>
    1.83 -                 </execution>
    1.84 -             </executions>                
    1.85 -         </plugin>      
    1.86 +          <plugin>
    1.87 +              <groupId>org.apidesign.bck2brwsr</groupId>
    1.88 +              <artifactId>bck2brwsr-maven-plugin</artifactId>
    1.89 +              <version>${project.version}</version>
    1.90 +              <executions>
    1.91 +                  <execution>
    1.92 +                      <goals>
    1.93 +                          <goal>brwsr</goal>
    1.94 +                      </goals>
    1.95 +                  </execution>
    1.96 +              </executions>
    1.97 +              <configuration>
    1.98 +                  <startpage>org/apidesign/bck2brwsr/demo/twitter/index.html</startpage>
    1.99 +                  <launcher>${brwsr}</launcher>
   1.100 +              </configuration>
   1.101 +          </plugin>
   1.102 +          <plugin>
   1.103 +              <groupId>org.apache.maven.plugins</groupId>
   1.104 +              <artifactId>maven-compiler-plugin</artifactId>
   1.105 +              <version>2.3.2</version>
   1.106 +              <configuration>
   1.107 +                  <source>1.7</source>
   1.108 +                  <target>1.7</target>
   1.109 +              </configuration>
   1.110 +          </plugin>
   1.111 +          <plugin>
   1.112 +              <groupId>org.apache.maven.plugins</groupId>
   1.113 +              <artifactId>maven-surefire-plugin</artifactId>
   1.114 +              <version>2.14.1</version>
   1.115 +              <configuration>
   1.116 +                  <systemPropertyVariables>
   1.117 +                      <vmtest.brwsrs>${brwsr}</vmtest.brwsrs>
   1.118 +                  </systemPropertyVariables>
   1.119 +              </configuration>
   1.120 +          </plugin>
   1.121 +          <plugin>
   1.122 +              <groupId>org.apache.maven.plugins</groupId>
   1.123 +              <artifactId>maven-jar-plugin</artifactId>
   1.124 +              <version>2.4</version>
   1.125 +              <configuration>
   1.126 +                  <archive>
   1.127 +                      <manifest>
   1.128 +                          <addClasspath>true</addClasspath>
   1.129 +                          <classpathPrefix>lib/</classpathPrefix>
   1.130 +                      </manifest>
   1.131 +                  </archive>
   1.132 +              </configuration>
   1.133 +          </plugin>
   1.134 +          <plugin>
   1.135 +              <groupId>org.apache.maven.plugins</groupId>
   1.136 +              <artifactId>maven-deploy-plugin</artifactId>
   1.137 +              <version>2.7</version>
   1.138 +              <configuration>
   1.139 +                  <skip>true</skip>
   1.140 +              </configuration>
   1.141 +          </plugin>      
   1.142 +          <plugin>
   1.143 +              <artifactId>maven-assembly-plugin</artifactId>
   1.144 +              <version>2.4</version>
   1.145 +              <executions>
   1.146 +                  <execution>
   1.147 +                      <id>distro-assembly</id>
   1.148 +                      <phase>package</phase>
   1.149 +                      <goals>
   1.150 +                          <goal>single</goal>
   1.151 +                      </goals>
   1.152 +                      <configuration>
   1.153 +                          <descriptors>
   1.154 +                              <descriptor>bck2brwsr-assembly.xml</descriptor>
   1.155 +                          </descriptors>
   1.156 +                      </configuration>
   1.157 +                  </execution>
   1.158 +              </executions>                
   1.159 +          </plugin>      
   1.160        </plugins>
   1.161    </build>
   1.162  
   1.163    <dependencies>
   1.164      <dependency>
   1.165 -      <groupId>org.apidesign.bck2brwsr</groupId>
   1.166 -      <artifactId>emul</artifactId>
   1.167 -      <version>${project.version}</version>
   1.168 -      <classifier>rt</classifier>
   1.169 -    </dependency>
   1.170 -    <dependency>
   1.171 -      <groupId>org.apidesign.bck2brwsr</groupId>
   1.172 -      <artifactId>javaquery.api</artifactId>
   1.173 -      <version>${project.version}</version>
   1.174 -      <scope>runtime</scope>
   1.175 -    </dependency>
   1.176 -    <dependency>
   1.177        <groupId>org.testng</groupId>
   1.178        <artifactId>testng</artifactId>
   1.179        <version>6.5.2</version>
   1.180 @@ -143,16 +139,91 @@
   1.181        <scope>test</scope>
   1.182      </dependency>
   1.183      <dependency>
   1.184 -      <groupId>${project.groupId}</groupId>
   1.185 -      <artifactId>launcher.http</artifactId>
   1.186 -      <version>${project.version}</version>
   1.187 -      <scope>test</scope>
   1.188 -    </dependency>
   1.189 -    <dependency>
   1.190        <groupId>org.apidesign.html</groupId>
   1.191        <artifactId>net.java.html.json</artifactId>
   1.192        <version>0.1-SNAPSHOT</version>
   1.193        <type>jar</type>
   1.194      </dependency>
   1.195    </dependencies>
   1.196 +  <profiles>
   1.197 +      <profile>
   1.198 +          <id>fxbrwsr</id>
   1.199 +          <activation>
   1.200 +              <activeByDefault>true</activeByDefault>
   1.201 +          </activation>
   1.202 +          <properties>
   1.203 +              <brwsr>fxbrwsr</brwsr>
   1.204 +          </properties>
   1.205 +          <dependencies>
   1.206 +              <dependency>
   1.207 +                  <groupId>org.apidesign.html</groupId>
   1.208 +                  <artifactId>ko-fx</artifactId>
   1.209 +                  <version>0.1-SNAPSHOT</version>
   1.210 +              </dependency>
   1.211 +              <dependency>
   1.212 +                  <groupId>${project.groupId}</groupId>
   1.213 +                  <artifactId>launcher.fx</artifactId>
   1.214 +                  <version>${project.version}</version>
   1.215 +                  <scope>test</scope>
   1.216 +              </dependency>
   1.217 +          </dependencies>
   1.218 +      </profile>
   1.219 +      <profile>
   1.220 +          <id>bck2brwsr</id>
   1.221 +          <activation>
   1.222 +              <property>
   1.223 +                  <name>brwsr</name>
   1.224 +                  <value>bck2brwsr</value>
   1.225 +              </property>
   1.226 +          </activation>
   1.227 +          <build>
   1.228 +              <plugins>
   1.229 +                  <plugin>
   1.230 +                      <groupId>org.apidesign.bck2brwsr</groupId>
   1.231 +                      <artifactId>bck2brwsr-maven-plugin</artifactId>
   1.232 +                      <executions>
   1.233 +                          <execution>
   1.234 +                              <goals>
   1.235 +                                  <goal>j2js</goal>
   1.236 +                              </goals>
   1.237 +                          </execution>
   1.238 +                      </executions>
   1.239 +                      <configuration>
   1.240 +                          <javascript>${project.build.directory}/bck2brwsr.js</javascript>
   1.241 +                          <obfuscation>${bck2brwsr.obfuscationlevel}</obfuscation>
   1.242 +                      </configuration>
   1.243 +                  </plugin>
   1.244 +                  <plugin>
   1.245 +                      <groupId>org.apache.maven.plugins</groupId>
   1.246 +                      <artifactId>maven-compiler-plugin</artifactId>
   1.247 +                      <configuration>
   1.248 +                          <compilerArguments>
   1.249 +                              <bootclasspath>netbeans.ignore.jdk.bootclasspath</bootclasspath>
   1.250 +                          </compilerArguments>
   1.251 +                      </configuration>
   1.252 +                  </plugin>
   1.253 +              </plugins>
   1.254 +          </build>
   1.255 +          <dependencies>
   1.256 +              <dependency>
   1.257 +                  <groupId>org.apidesign.bck2brwsr</groupId>
   1.258 +                  <artifactId>emul</artifactId>
   1.259 +                  <version>${project.version}</version>
   1.260 +                  <classifier>rt</classifier>
   1.261 +              </dependency>
   1.262 +              <dependency>
   1.263 +                  <groupId>org.apidesign.bck2brwsr</groupId>
   1.264 +                  <artifactId>javaquery.api</artifactId>
   1.265 +                  <version>${project.version}</version>
   1.266 +                  <scope>runtime</scope>
   1.267 +              </dependency>
   1.268 +              <dependency>
   1.269 +                  <groupId>${project.groupId}</groupId>
   1.270 +                  <artifactId>launcher.http</artifactId>
   1.271 +                  <version>${project.version}</version>
   1.272 +                  <scope>test</scope>
   1.273 +              </dependency>
   1.274 +          </dependencies>
   1.275 +      </profile>
   1.276 +  </profiles>
   1.277  </project>
     2.1 --- a/launcher/api/src/main/java/org/apidesign/bck2brwsr/launcher/Launcher.java	Sun Apr 28 20:31:31 2013 +0200
     2.2 +++ b/launcher/api/src/main/java/org/apidesign/bck2brwsr/launcher/Launcher.java	Sun Apr 28 21:17:04 2013 +0200
     2.3 @@ -82,12 +82,16 @@
     2.4          String msg = "Trying to create browser '" + cmd + "'";
     2.5          try {
     2.6              Class<?> c;
     2.7 -            if ("fx".equals(cmd)) { // NOI18N
     2.8 +            if ("fxbrwsr".equals(cmd)) { // NOI18N
     2.9                  msg = "Please include org.apidesign.bck2brwsr:launcher.fx dependency!";
    2.10                  c = loadClass("org.apidesign.bck2brwsr.launcher.FXBrwsrLauncher"); // NOI18N
    2.11              } else {
    2.12                  msg = "Please include org.apidesign.bck2brwsr:launcher.html dependency!";
    2.13                  c = loadClass("org.apidesign.bck2brwsr.launcher.Bck2BrwsrLauncher"); // NOI18N
    2.14 +                if ("bck2brwsr".equals(cmd)) { // NOI18N
    2.15 +                    // use default executable
    2.16 +                    cmd = null;
    2.17 +                }
    2.18              }
    2.19              Constructor<?> cnstr = c.getConstructor(String.class);
    2.20              return (Launcher) cnstr.newInstance(cmd);
    2.21 @@ -107,7 +111,22 @@
    2.22       * @throws IOException if something goes wrong
    2.23       */
    2.24      public static Closeable showURL(ClassLoader classes, String startpage) throws IOException {
    2.25 -        Launcher l = createBrowser(null);
    2.26 +        return showURL(null, classes, startpage);
    2.27 +    }
    2.28 +    /** Starts an HTTP server which provides access to classes and resources
    2.29 +     * available in the <code>classes</code> URL and shows a start page
    2.30 +     * available as {@link ClassLoader#getResource(java.lang.String)} from the
    2.31 +     * provide classloader. Opens a browser with URL showing the start page.
    2.32 +     * 
    2.33 +     * @param brwsr name of browser to use or <code>null</code>
    2.34 +     * @param classes classloader offering access to classes and resources
    2.35 +     * @param startpage page to show in the browser
    2.36 +     * @return interface that allows one to stop the server
    2.37 +     * @throws IOException if something goes wrong
    2.38 +     * @since 0.7
    2.39 +     */
    2.40 +    public static Closeable showURL(String brwsr, ClassLoader classes, String startpage) throws IOException {
    2.41 +        Launcher l = createBrowser(brwsr);
    2.42          l.addClassLoader(classes);
    2.43          l.showURL(startpage);
    2.44          return (Closeable) l;
     3.1 --- a/launcher/fx/pom.xml	Sun Apr 28 20:31:31 2013 +0200
     3.2 +++ b/launcher/fx/pom.xml	Sun Apr 28 21:17:04 2013 +0200
     3.3 @@ -45,10 +45,5 @@
     3.4        <scope>system</scope>
     3.5        <systemPath>${java.home}/lib/jfxrt.jar</systemPath>
     3.6      </dependency>
     3.7 -    <dependency>
     3.8 -        <groupId>${project.groupId}</groupId>
     3.9 -        <artifactId>vm4brwsr</artifactId>
    3.10 -        <version>${project.version}</version>
    3.11 -    </dependency>
    3.12    </dependencies>
    3.13  </project>
     4.1 --- a/launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/BaseHTTPLauncher.java	Sun Apr 28 20:31:31 2013 +0200
     4.2 +++ b/launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/BaseHTTPLauncher.java	Sun Apr 28 21:17:04 2013 +0200
     4.3 @@ -41,7 +41,6 @@
     4.4  import java.util.logging.Level;
     4.5  import java.util.logging.Logger;
     4.6  import org.apidesign.bck2brwsr.launcher.InvocationContext.Resource;
     4.7 -import org.apidesign.vm4brwsr.Bck2Brwsr;
     4.8  import org.glassfish.grizzly.PortRange;
     4.9  import org.glassfish.grizzly.http.server.HttpHandler;
    4.10  import org.glassfish.grizzly.http.server.HttpServer;
    4.11 @@ -56,7 +55,7 @@
    4.12   * Supports execution in native browser as well as Java's internal 
    4.13   * execution engine.
    4.14   */
    4.15 -class BaseHTTPLauncher extends Launcher implements Closeable {
    4.16 +abstract class BaseHTTPLauncher extends Launcher implements Closeable {
    4.17      private static final Logger LOG = Logger.getLogger(BaseHTTPLauncher.class.getName());
    4.18      private static final InvocationContext END = new InvocationContext(null, null, null);
    4.19      private final Set<ClassLoader> loaders = new LinkedHashSet<>();
    4.20 @@ -70,7 +69,7 @@
    4.21      
    4.22      public BaseHTTPLauncher(String cmd) {
    4.23          this.cmd = cmd;
    4.24 -        addClassLoader(Bck2Brwsr.class.getClassLoader());
    4.25 +        addClassLoader(BaseHTTPLauncher.class.getClassLoader());
    4.26          setTimeout(180000);
    4.27      }
    4.28      
    4.29 @@ -455,29 +454,9 @@
    4.30          }
    4.31      }
    4.32  
    4.33 -    void generateBck2BrwsrJS(StringBuilder sb, Bck2Brwsr.Resources loader) throws IOException {
    4.34 -        Bck2Brwsr.generate(sb, loader);
    4.35 -        sb.append(
    4.36 -            "(function WrapperVM(global) {"
    4.37 -            + "  function ldCls(res) {\n"
    4.38 -            + "    var request = new XMLHttpRequest();\n"
    4.39 -            + "    request.open('GET', '/classes/' + res, false);\n"
    4.40 -            + "    request.send();\n"
    4.41 -            + "    if (request.status !== 200) return null;\n"
    4.42 -            + "    var arr = eval('(' + request.responseText + ')');\n"
    4.43 -            + "    return arr;\n"
    4.44 -            + "  }\n"
    4.45 -            + "  var prevvm = global.bck2brwsr;\n"
    4.46 -            + "  global.bck2brwsr = function() {\n"
    4.47 -            + "    var args = Array.prototype.slice.apply(arguments);\n"
    4.48 -            + "    args.unshift(ldCls);\n"
    4.49 -            + "    return prevvm.apply(null, args);\n"
    4.50 -            + "  };\n"
    4.51 -            + "})(this);\n");
    4.52 -    }
    4.53 +    abstract void generateBck2BrwsrJS(StringBuilder sb, Object loader) throws IOException;
    4.54  
    4.55 -    private class Res implements Bck2Brwsr.Resources {
    4.56 -        @Override
    4.57 +    private class Res {
    4.58          public InputStream get(String resource) throws IOException {
    4.59              for (ClassLoader l : loaders) {
    4.60                  URL u = null;
     5.1 --- a/launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/FXBrwsrLauncher.java	Sun Apr 28 20:31:31 2013 +0200
     5.2 +++ b/launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/FXBrwsrLauncher.java	Sun Apr 28 21:17:04 2013 +0200
     5.3 @@ -29,7 +29,6 @@
     5.4  import java.util.logging.Logger;
     5.5  import javafx.application.Platform;
     5.6  import org.apidesign.bck2brwsr.launcher.fximpl.JVMBridge;
     5.7 -import org.apidesign.vm4brwsr.Bck2Brwsr;
     5.8  
     5.9  /**
    5.10   *
    5.11 @@ -79,7 +78,7 @@
    5.12      }
    5.13      
    5.14      @Override
    5.15 -    void generateBck2BrwsrJS(StringBuilder sb, Bck2Brwsr.Resources loader) throws IOException {
    5.16 +    void generateBck2BrwsrJS(StringBuilder sb, Object loader) throws IOException {
    5.17          sb.append("(function() {\n"
    5.18              + "  var impl = this.bck2brwsr;\n"
    5.19              + "  this.bck2brwsr = function() { return impl; };\n"
     6.1 --- a/launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/fximpl/Console.java	Sun Apr 28 20:31:31 2013 +0200
     6.2 +++ b/launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/fximpl/Console.java	Sun Apr 28 21:17:04 2013 +0200
     6.3 @@ -27,7 +27,6 @@
     6.4  import java.util.Enumeration;
     6.5  import javafx.scene.web.WebEngine;
     6.6  import netscape.javascript.JSObject;
     6.7 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
     6.8  
     6.9  /**
    6.10   *
    6.11 @@ -37,24 +36,17 @@
    6.12      public Console() {
    6.13      }
    6.14      
    6.15 -    @JavaScriptBody(args = {"elem", "attr"}, body = 
    6.16 -        "return elem[attr].toString();")
    6.17      private static Object getAttr(Object elem, String attr) {
    6.18          return InvokeJS.CObject.call("getAttr", elem, attr);
    6.19      }
    6.20  
    6.21 -    @JavaScriptBody(args = {"id", "attr", "value"}, body = 
    6.22 -        "window.document.getElementById(id)[attr] = value;")
    6.23      private static void setAttr(String id, String attr, Object value) {
    6.24          InvokeJS.CObject.call("setAttrId", id, attr, value);
    6.25      }
    6.26 -    @JavaScriptBody(args = {"elem", "attr", "value"}, body = 
    6.27 -        "elem[attr] = value;")
    6.28      private static void setAttr(Object id, String attr, Object value) {
    6.29          InvokeJS.CObject.call("setAttr", id, attr, value);
    6.30      }
    6.31      
    6.32 -    @JavaScriptBody(args = {}, body = "return; window.close();")
    6.33      private static void closeWindow() {}
    6.34  
    6.35      private static Object textArea;
    6.36 @@ -113,7 +105,6 @@
    6.37          + "arr[0] = pre;\n"
    6.38          + "arr[1] = status;\n";
    6.39          
    6.40 -    @JavaScriptBody(args = { "test", "c", "arr" }, body = BEGIN_TEST)
    6.41      private static void beginTest(String test, Case c, Object[] arr) {
    6.42          InvokeJS.CObject.call("beginTest", test, c, arr);
    6.43      }
    6.44 @@ -130,7 +121,6 @@
    6.45          + " } catch (e) { alert(e); }"
    6.46          + "};"
    6.47          + "request.send();";
    6.48 -    @JavaScriptBody(args = { "url", "callback", "arr" }, body = LOAD_TEXT)
    6.49      private static void loadText(String url, Runnable callback, String[] arr) throws IOException {
    6.50          InvokeJS.CObject.call("loadText", url, new Run(callback), arr);
    6.51      }
    6.52 @@ -257,12 +247,9 @@
    6.53          }
    6.54      }
    6.55     
    6.56 -    @JavaScriptBody(args = {}, body = "vm.desiredAssertionStatus = true;")
    6.57      private static void turnAssetionStatusOn() {
    6.58      }
    6.59  
    6.60 -    @JavaScriptBody(args = {"r", "time"}, body =
    6.61 -        "return window.setTimeout(function() { r.run__V(); }, time);")
    6.62      private static Object schedule(Runnable r, int time) {
    6.63          return InvokeJS.CObject.call("schedule", new Run(r), time);
    6.64      }
    6.65 @@ -362,16 +349,10 @@
    6.66              return res;
    6.67          }
    6.68          
    6.69 -        @JavaScriptBody(args = "s", body = "return eval('(' + s + ')');")
    6.70          private static Object toJSON(String s) {
    6.71              return InvokeJS.CObject.call("toJSON", s);
    6.72          }
    6.73          
    6.74 -        @JavaScriptBody(args = {"p", "d"}, body = 
    6.75 -              "var v = d[p];\n"
    6.76 -            + "if (typeof v === 'undefined') return null;\n"
    6.77 -            + "return v.toString();"
    6.78 -        )
    6.79          private static Object value(String p, Object d) {
    6.80              return ((JSObject)d).getMember(p);
    6.81          }
    6.82 @@ -388,7 +369,6 @@
    6.83      private static final class InvokeJS {
    6.84          static final JSObject CObject = initJS();
    6.85  
    6.86 -        @JavaScriptBody(args = {  }, body = "return null;")
    6.87          private static JSObject initJS() {
    6.88              WebEngine web = (WebEngine) System.getProperties().get("webEngine");
    6.89              return (JSObject) web.executeScript("(function() {"
     7.1 --- a/rt/mojo/pom.xml	Sun Apr 28 20:31:31 2013 +0200
     7.2 +++ b/rt/mojo/pom.xml	Sun Apr 28 21:17:04 2013 +0200
     7.3 @@ -86,5 +86,10 @@
     7.4          <artifactId>launcher.http</artifactId>
     7.5        <version>${project.version}</version>
     7.6      </dependency>
     7.7 +    <dependency>
     7.8 +        <groupId>${project.groupId}</groupId>
     7.9 +        <artifactId>launcher.fx</artifactId>
    7.10 +      <version>${project.version}</version>
    7.11 +    </dependency>
    7.12  </dependencies>
    7.13  </project>
     8.1 --- a/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/BrswrMojo.java	Sun Apr 28 20:31:31 2013 +0200
     8.2 +++ b/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/BrswrMojo.java	Sun Apr 28 21:17:04 2013 +0200
     8.3 @@ -41,6 +41,15 @@
     8.4  public class BrswrMojo extends AbstractMojo {
     8.5      public BrswrMojo() {
     8.6      }
     8.7 +    
     8.8 +    /** The identification of a launcher to use. Known values <code>fxbrwsr</code>, 
     8.9 +     * <code>bck2brwsr</code>, or 
    8.10 +     * name of an external process to execute.
    8.11 +     */
    8.12 +    @Parameter
    8.13 +    private String launcher;
    8.14 +    
    8.15 +    
    8.16      /** Resource to show as initial page */
    8.17      @Parameter
    8.18      private String startpage;
    8.19 @@ -69,7 +78,7 @@
    8.20              } else {
    8.21                  URLClassLoader url = buildClassLoader(classes, prj.getDependencyArtifacts());
    8.22                  try {
    8.23 -                    httpServer = Launcher.showURL(url, startpage());
    8.24 +                    httpServer = Launcher.showURL(launcher, url, startpage());
    8.25                  } catch (Exception ex) {
    8.26                      throw new MojoExecutionException("Can't open " + startpage(), ex);
    8.27                  }