[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

nuxeo ECM, and where is Context.compressReader() in openJDK?



  let me see how succinct i can make this.  i'm writing a doc on how
to install and build the open source nuxeo ECM software on fedora
using openJDK-1.6.0:

http://www.crashcourse.ca/wiki/index.php/Nuxeo_on_Fedora

nothing deep about simply downloading and installing the zip file,
that works fine.

  however, trying to build the mercurial checkout fails, as you can
read further down that page.  as i read it (and i could be wrong), the
failure is the result of trying to call the java method
Context.compressReader(), which i don't see exists anymore -- it's
entirely missing from this page:

http://www.mozilla.org/rhino/apidocs/org/mozilla/javascript/Context.html

and that certainly seems to be the problem based on the build error
message, no?

  someone from nuxeo just pointed out that they don't guarantee a
successful build under openJDK, only under *sun's* java.  so does that
mean sun's java *would* have that class method?  or am i
misinterpreting this?  just for the entertainment value, it would be
nice to finish that build with openJDK.  does anyone here know what
the story is for Context.compressReader()?  am i reading correctly
that it simply doesn't exist in openJDK?

  just for fun, i attached the offending .java file, it's only 69
lines long so java gurus can see clearly what's being imported.

  thoughts?

rday
--

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

            Linux Consulting, Training and Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
========================================================================
/*
 * (C) Copyright 2006-2007 Nuxeo SAS <http://nuxeo.com> and others
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Jean-Marc Orliaguet, Chalmers
 *
 * $Id$
 */

package org.nuxeo.theme.html;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.ContextAction;
import org.mozilla.javascript.Script;
import org.mozilla.javascript.tools.ToolErrorReporter;
import org.mozilla.javascript.tools.shell.Global;
import org.mozilla.javascript.tools.shell.Main;

public final class JSUtils {

    static final Log log = LogFactory.getLog(JSUtils.class);

    private static final Global global = Main.getGlobal();

    static {
        ToolErrorReporter errorReporter = new ToolErrorReporter(false,
                global.getErr());
        Main.shellContextFactory.setErrorReporter(errorReporter);
        global.init(Main.shellContextFactory);
    }

    public static String compressSource(final String source) {
        IProxy iproxy = new IProxy(source);
        return (String) Main.shellContextFactory.call(iproxy);
    }

    private static class IProxy implements ContextAction {
        private final String source;

        IProxy(String source) {
            this.source = source;
        }

        public Object run(final Context cx) {
            try {
                final Script script = Main.loadScriptFromSource(cx, source,
                        "compress", 1, null);
                return cx.compressReader(global, script, source, "compress", 1,
                        null);
            } catch (IllegalArgumentException e) {
                // Can happen on very large files (> 500K) with JDK 5
                log.error("Could not compress javascript source.");
                return source;
            } catch (NoSuchMethodError e) {
                // custom_rhino.jar is not installed.
                log.info("Could not compress javascript source. custom_rhino.jar is probably not installed.");
                return source;
            }
        }
    }

}

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]