Package org.apache.cocoon.util.location

Examples of org.apache.cocoon.util.location.Location


        handler.startPrefixMapping("ex", EXCEPTION_NS);
        attr.addCDATAAttribute("class", root.getClass().getName());
        handler.startElement(EXCEPTION_NS, "exception-report", "ex:exception-report", attr);
       
        // Root exception location
        Location loc = LocationUtils.getLocation(root);       
        if (LocationUtils.isKnown(loc)) {
            attr.clear();
            dumpLocation(loc, attr, handler);
        }
View Full Code Here


    public void addWidgetDefinition(WidgetDefinition widgetDefinition) throws DuplicateIdException {
        String id = widgetDefinition.getId();
        // Do not add NewDefinition id's hash.
        if (!(widgetDefinition instanceof NewDefinition)) {
            if (widgetDefinitionsById.containsKey(id)) {
                Location duplicateLocation = widgetDefinition.getLocation();
                Location containerLocation = containerDefinition.getLocation();
                Location firstLocation = getWidgetDefinition(id).getLocation();
                throw new DuplicateIdException(
                    "Duplicate widget id \"" + id + "\" detected at " + duplicateLocation + ".\n" +
                    "Container widget \"" + containerDefinition.getId() + "\" at " + containerLocation + "\n" +
                    "already contains a widget with id \"" + id + "\" at " + firstLocation + ".");
            }
View Full Code Here

            while(parentsIt.hasPrevious()) {
                WidgetDefinition widgetDefinition = (WidgetDefinition)parentsIt.previous();
                if (widgetDefinition instanceof UnionDefinition) break;
                if (widgetDefinition instanceof RepeaterDefinition) break;
                if (widgetDefinition == containerDefinition) {
                    Location location = containerDefinition.getLocation();
                    if (parent instanceof FormDefinition) {
                        throw new Exception("Container: Non-terminating recursion detected in form definition (" + location + ")");
                    }
                    throw new Exception("Container: Non-terminating recursion detected in widget definition: "
                        + parent.getId() + " (" + location + ")");
View Full Code Here

        return expires;
    }

    protected Location getLocation(Parameters param) {
        Location location = null;
        if (param instanceof Locatable) {
            location = ((Locatable)param).getLocation();
        }
        if (location == null) {
            location = Location.UNKNOWN;
View Full Code Here

    public Throwable getThrowable() {
        if (exception == null) {
            return null;
        }
       
        Location loc = LocationUtils.getLocation(exception);
        if (LocationUtils.isKnown(loc)) {
            // Has a location: don't loose this precious information!
            return exception;
        }
       
View Full Code Here

        // "DEBUG:A debug message" or "INFO:Transforming <foo> in mode 'bar'" to use the different
        // log levels. This can include also deprecation logs for system-defined stylesheets
        // using "DEPRECATED:WARN:Styling 'foo' is replaced by 'bar'".   

        if (logger.isWarnEnabled()) {
            Location loc = LocationUtils.getLocation(ex);
            logger.warn(ex.getMessage() + " at "+ loc == null ? uri : loc.toString());
        }
        // Keep the warning (see below)
        warningEx = ex;
    }
View Full Code Here

     * As a convenience, the node is returned by this method to allow constructs
     * like <code>return treeBuilder.setupNode(new MyNode(), config)</code>.
     */
    public ProcessingNode setupNode(ProcessingNode node, Configuration config)
      throws Exception {
        Location location = getLocation(config);
        if (node instanceof AbstractProcessingNode) {
            ((AbstractProcessingNode)node).setLocation(location);
        }

        this.lifecycle.setupComponent(node, false);
View Full Code Here

        if (type != null) {
            desc.append(" type=\"").append(type).append('"');
        }
        desc.append('>');
       
        Location rawLoc = LocationUtils.getLocation(config, null);
        return new LocationImpl(desc.toString(), rawLoc.getURI(), rawLoc.getLineNumber(), rawLoc.getColumnNumber());
    }
View Full Code Here

            stack.push(lastEvent);
        }

        public void startElement(String namespaceURI, String localName, String qname, Attributes attrs) throws SAXException {
            Event newEvent = null;
            Location locator = LocationUtils.getLocation(this.locator, "<"+qname+">");
            AttributesImpl elementAttributes = new AttributesImpl(attrs);
            int attributeCount = elementAttributes.getLength();
            for (int i = 0; i < attributeCount; i++) {
                String attributeURI = elementAttributes.getURI(i);
                if (StringUtils.equals(attributeURI, NS)) {
View Full Code Here

    public void addWidgetDefinition(WidgetDefinition widgetDefinition) throws DuplicateIdException {
        String id = widgetDefinition.getId();
        // Do not add NewDefinition id's hash.
        if (!(widgetDefinition instanceof NewDefinition)) {
            if (widgetDefinitionsById.containsKey(id)) {
                Location containerLocation = containerDefinition.getLocation();
                Location firstLocation = getWidgetDefinition(id).getLocation();
                throw new DuplicateIdException(
                    "Detected duplicate widget id '" + id + "'.\n" +
                    "Container widget '" + containerDefinition.getId() + "' at " + containerLocation + "\n" +
                    "already contains a widget with the same id at " + firstLocation + ".",
                        widgetDefinition);
View Full Code Here

TOP

Related Classes of org.apache.cocoon.util.location.Location

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.