Example usage for com.google.gwt.logging.client LogConfiguration loggingIsEnabled

List of usage examples for com.google.gwt.logging.client LogConfiguration loggingIsEnabled

Introduction

In this page you can find the example usage for com.google.gwt.logging.client LogConfiguration loggingIsEnabled.

Prototype

public static boolean loggingIsEnabled() 

Source Link

Usage

From source file:cc.alcina.framework.extras.history.client.HistoryConverterHash.java

License:Apache License

@Override
public void convertHistoryToken() {
    String path = Window.Location.getPath();
    if (path.isEmpty() || path.equals("/")) {
        if (LogConfiguration.loggingIsEnabled()) {
            LOG.fine("Path is '" + path + "'. Nothing to do.");
        }//from w  ww .  j  a  v  a2  s.  c  o  m
        return;
    }
    String newUrl = Window.Location.getProtocol() + "//" + Window.Location.getHost() + "/";
    newUrl = CodeServerParameterHelper.append(newUrl);
    newUrl = newUrl + "#" + path.substring(1);
    if (LogConfiguration.loggingIsEnabled()) {
        LOG.fine("Path is '" + path + "'. Redirecting to '" + newUrl + "'...");
    }
    Window.Location.assign(newUrl); // This will cause a complete reload :(
}

From source file:cc.alcina.framework.extras.history.client.HistoryConverterPushState.java

License:Apache License

@Override
public void convertHistoryToken() {
    String hash = Window.Location.getHash();
    if (hash == null || hash.isEmpty()) {
        if (LogConfiguration.loggingIsEnabled()) {
            LOG.fine("Hash is '" + hash + "'. Nothing to do.");
        }//from w  w  w .  ja  va  2 s . c  om
        return;
    }
    // remove the '#' character
    if (hash.startsWith("#")) {
        hash = hash.substring(1);
    }
    // navigate to the token using pushState
    if (LogConfiguration.loggingIsEnabled()) {
        LOG.fine("Hash is '" + hash + "'. Navigating to '" + hash + "'.");
    }
    History.newItem(hash, false);
}

From source file:client.net.sf.saxon.ce.Controller.java

License:Mozilla Public License

/**
 * Perform a transformation from a Source document to a Result document.
 *
 * @exception XPathException if the transformation fails. As a
 *     special case, the method throws a TerminationException (a subclass
 *     of XPathException) if the transformation was terminated using
 *      xsl:message terminate="yes"./*from  w w w . j a v  a  2s.c  o m*/
 * @param source The input for the source tree. May be null if and only if an
 * initial template has been supplied.
 * @return The root of the result tree.
 */

public Node transform(NodeInfo source, com.google.gwt.dom.client.Node target) throws Exception {
    if (inUse) {
        throw new IllegalStateException(
                "The Transformer is being used recursively or concurrently. This is not permitted.");
    }
    clearPerTransformationData();
    if (preparedStylesheet == null) {
        throw new XPathException("Stylesheet has not been prepared");
    }

    if (!dateTimePreset) {
        currentDateTime = null; // reset at start of each transformation
    }

    // no longer used for expiry check - just XSLT context
    getCurrentDateTime();

    if (LogConfiguration.loggingIsEnabled()) {
        LogController.openTraceListener();
    }
    boolean success = false;

    try {
        if (source == null) {
            if (initialTemplate == null) {
                throw new XPathException("Either a source document or an initial template must be specified");
            }

        } else {

            Mode mode = preparedStylesheet.getRuleManager().getMode(initialMode, false);
            if (mode == null || (initialMode != null && mode.isEmpty())) {
                throw new XPathException("Requested initial mode "
                        + (initialMode == null ? "" : initialMode.getDisplayName()) + " does not exist",
                        "XTDE0045");
            }

            if (source.getSystemId() != null) {
                registerDocument(source.getDocumentRoot(), new DocumentURI(source.getSystemId()));
            }
        }
        // System.err.println("*** TransformDocument");
        if (executable == null) {
            throw new XPathException("Stylesheet has not been compiled");
        }

        openMessageEmitter();

        XPathContextMajor initialContext = newXPathContext();

        if (source != null) {

            initialContextItem = source;
            contextForGlobalVariables = source.getRoot();

            SequenceIterator currentIter = SingletonIterator.makeIterator(source);
            if (initialTemplate != null) {
                currentIter.next();
            }
            initialContext.setCurrentIterator(currentIter);
        }

        initializeController();

        PipelineConfiguration pipe = makePipelineConfiguration();
        Receiver result = openResult(pipe, initialContext, target, ResultDocument.APPEND_CONTENT);

        // Process the source document by applying template rules to the initial context node

        if (initialTemplate == null) {
            initialContextItem = source;
            Mode mode = getRuleManager().getMode(initialMode, false);
            if (mode == null || (initialMode != null && mode.isEmpty())) {
                throw new XPathException("Requested initial mode "
                        + (initialMode == null ? "" : initialMode.getDisplayName()) + " does not exist",
                        "XTDE0045");
            }
            TailCall tc = ApplyTemplates.applyTemplates(initialContext.getCurrentIterator(), mode, null, null,
                    initialContext, null);
            while (tc != null) {
                tc = tc.processLeavingTail();
            }
        } else {
            Template t = initialTemplate;
            XPathContextMajor c2 = initialContext.newContext();
            c2.openStackFrame(t.getStackFrameMap());
            c2.setLocalParameters(new ParameterSet());
            c2.setTunnelParameters(new ParameterSet());

            TailCall tc = t.expand(c2);
            while (tc != null) {
                tc = tc.processLeavingTail();
            }
        }

        closeMessageEmitter();
        // the principalURI doesn't have significance because the output is a
        // standalone DOM object - unlike result-documents that are included in the
        // resultdocument pool, therefore don't check the URI:
        //checkPrincipalURI(result, initialContext);

        closeResult(result, initialContext);
        pendingUpdateList.apply(initialContext);
        success = true;
        principalOutputNode = openHTMLWriter.getNode();
        return principalOutputNode;
        // let caller handle exception

    } finally {
        inUse = false;
        principalResultURI = null;

        if (LogConfiguration.loggingIsEnabled()) {
            LogController.closeTraceListener(success);
        }
    }
}

From source file:client.net.sf.saxon.ce.expr.Expression.java

License:Mozilla Public License

/**
 * Method used in subclasses to signal a dynamic error
 * @param message the error message//from w ww.j a  v  a  2 s. com
 * @param code the error code
 * @param context the XPath dynamic context
 */

protected void dynamicError(String message, String code, XPathContext context) throws XPathException {
    //        XPathException err = new XPathException(message, getSourceLocator());
    //        err.setXPathContext(context);
    //        err.setErrorCode(code);
    //        throw err;
    XPathException err;
    if (LogConfiguration.loggingIsEnabled()) {
        err = new XPathException(message, getSourceLocator());
    } else {
        err = new XPathException("", getSourceLocator());
    }
    err = new XPathException(message, getSourceLocator());
    err.setXPathContext(context);
    err.setErrorCode(code);
    throw err;
}

From source file:client.net.sf.saxon.ce.expr.instruct.Choose.java

License:Mozilla Public License

private void enterConditionTrace(int i) {
    if (LogConfiguration.loggingIsEnabled() && LogController.traceIsEnabled()) {
        if (conditionTests != null) {
            XSLTTraceListener xlt = (XSLTTraceListener) LogController.getTraceListener();
            xlt.enterChooseItem(conditionTests[i]);
        }//from w  w w  . jav  a  2s.  c  om
    }
}

From source file:client.net.sf.saxon.ce.expr.instruct.Choose.java

License:Mozilla Public License

private void leaveConditionTrace(int i) {
    if (LogConfiguration.loggingIsEnabled() && LogController.traceIsEnabled()) {
        if (conditionTests != null) {
            XSLTTraceListener xlt = (XSLTTraceListener) LogController.getTraceListener();
            xlt.leaveChooseItem(conditionTests[i]);
        }/* ww  w. j  ava  2 s. c  o m*/
    }
}

From source file:client.net.sf.saxon.ce.expr.instruct.ComputedElement.java

License:Mozilla Public License

/**
 * Create an instruction that creates a new element node
 *
 * @param elementName      Expression that evaluates to produce the name of the
 *                         element node as a lexical QName
 * @param namespace        Expression that evaluates to produce the namespace URI of
 *                         the element node. Set to null if the namespace is to be deduced from the prefix
 *                         of the elementName.
 * @param nsContext        Saved copy of the static namespace context for the instruction.
 *                         Can be set to null if namespace is supplied. This namespace context
 *                         must resolve the null prefix correctly, based on the different rules for
 *                         XSLT and XQuery.
 * @param inheritNamespaces true if child elements automatically inherit the namespaces of their parent
        //  ww w  .  ja va2  s  . c om
 */
public ComputedElement(Expression elementName, Expression namespace, NamespaceResolver nsContext,
        boolean inheritNamespaces) {
    this.elementName = elementName;
    this.namespace = namespace;
    this.nsContext = nsContext;
    this.inheritNamespaces = inheritNamespaces;
    adoptChildExpression(elementName);
    adoptChildExpression(namespace);
    if (LogConfiguration.loggingIsEnabled() && LogController.traceIsEnabled()) {
        this.AddTraceProperty("name", elementName);
    }
}

From source file:client.net.sf.saxon.ce.expr.instruct.ForEach.java

License:Mozilla Public License

public TailCall processLeavingTail(XPathContext context) throws XPathException {
    SequenceIterator iter = select.iterate(context);

    XPathContextMajor c2 = context.newContext();
    c2.setCurrentIterator(iter);//w w  w.  j a  v a 2s . c om
    c2.setCurrentTemplateRule(null);

    if (containsTailCall) {
        if (LogConfiguration.loggingIsEnabled() && LogController.traceIsEnabled()) {
            TraceListener listener = LogController.getTraceListener();
            Item item = iter.next();
            if (item == null) {
                return null;
            }
            listener.startCurrentItem(item);
            TailCall tc = ((TailCallReturner) action).processLeavingTail(c2);
            listener.endCurrentItem(item);
            return tc;

        } else {
            Item item = iter.next();
            if (item == null) {
                return null;
            }
        }
        return ((TailCallReturner) action).processLeavingTail(c2);
    } else {
        if (LogConfiguration.loggingIsEnabled() && LogController.traceIsEnabled()) {
            TraceListener listener = LogController.getTraceListener();
            while (true) {
                Item item = iter.next();
                if (item == null) {
                    break;
                }
                listener.startCurrentItem(item);
                action.process(c2);
                listener.endCurrentItem(item);
            }
        } else {
            while (true) {
                Item item = iter.next();
                if (item == null) {
                    break;
                }
                action.process(c2);
            }
        }
    }
    return null;
}

From source file:client.net.sf.saxon.ce.expr.instruct.ForEachGroup.java

License:Mozilla Public License

public TailCall processLeavingTail(XPathContext context) throws XPathException {
    GroupIterator groupIterator = getGroupIterator(context);

    XPathContextMajor c2 = context.newContext();
    c2.setCurrentIterator(groupIterator);
    c2.setCurrentGroupIterator(groupIterator);
    c2.setCurrentTemplateRule(null);/*  ww  w .jav a 2 s.c  o m*/

    if (LogConfiguration.loggingIsEnabled() && LogController.traceIsEnabled()) {
        TraceListener listener = LogController.getTraceListener();
        while (true) {
            Item item = groupIterator.next();
            if (item == null) {
                break;
            }
            listener.startCurrentItem(item);
            action.process(c2);
            listener.endCurrentItem(item);
        }
    } else {
        while (true) {
            Item item = groupIterator.next();
            if (item == null) {
                break;
            }
            action.process(c2);
        }
    }

    return null;
}

From source file:client.net.sf.saxon.ce.expr.instruct.ResultDocument.java

License:Mozilla Public License

/**
 * Create a result-document instruction/*from w  w  w.  j a v a 2  s. co m*/
 * @param href                    href attribute of instruction
 * @param methodExpression        format attribute of instruction
 * @param baseURI                 base URI of the instruction
 * @param nsResolver              namespace resolver
 */

public ResultDocument(Expression href, Expression methodExpression, // AVT defining the output format
        String baseURI, NamespaceResolver nsResolver) {
    this.href = href;
    this.methodExpression = methodExpression;
    this.nsResolver = nsResolver;
    adoptChildExpression(href);
    if (LogConfiguration.loggingIsEnabled() && LogController.traceIsEnabled()) {
        this.AddTraceProperty("href", href);
    }
}