Package org.apache.isis.core.commons.debug

Examples of org.apache.isis.core.commons.debug.DebugBuilder


    /**
     * @see #specification(ObjectAdapter, DebugBuilder)
     * @see #specification(ObjectSpecification, DebugBuilder)
     */
    public static String specification(final ObjectAdapter adapter) {
        final DebugBuilder debugBuilder = new DebugString();
        specification(adapter, debugBuilder);
        return debugBuilder.toString();
    }
View Full Code Here


    /**
     * @see #adapter(ObjectAdapter, DebugBuilder)
     */
    public static String adapter(final ObjectAdapter adapter) {
        final DebugBuilder debugBuilder = new DebugString();
        adapter(adapter, debugBuilder);
        return debugBuilder.toString();
    }
View Full Code Here

    /**
     * @see #specification(ObjectAdapter, DebugBuilder)
     * @see #specification(ObjectSpecification, DebugBuilder)
     */
    public static String specification(final ObjectAdapter adapter) {
        final DebugBuilder debugBuilder = new DebugString();
        specification(adapter, debugBuilder);
        return debugBuilder.toString();
    }
View Full Code Here

    /**
     * @see #adapter(ObjectAdapter, DebugBuilder)
     */
    public static String adapter(final ObjectAdapter adapter) {
        final DebugBuilder debugBuilder = new DebugString();
        adapter(adapter, debugBuilder);
        return debugBuilder.toString();
    }
View Full Code Here

            Defaults.initialise(BASE_NAME, IsisContext.getConfiguration());
            Defaults.setPkIdLabel(Sql.identifier(Defaults.getPkIdLabel()));
            Defaults.setIdColumn(Sql.identifier(Defaults.getIdColumn()));
        }

        final DebugBuilder debug = new DebugString();
        connectionPool.debug(debug);
        LOG.info("Database: " + debug);

        objectMappingLookup.init();
View Full Code Here

    protected void objectGraph(final Request request) {
        final String id = request.getOptionalProperty(VALUE);
        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
        request.appendHtml("<h1>Object Graph - " + object + "</h1>");
        request.appendHtml("<pre>");
        final DebugBuilder debug = new DebugString();
        Dump.graph(object, null, debug);
        request.appendHtml(debug.toString());
        request.appendHtml("</pre>");
    }
View Full Code Here

    }

    private void specification(final Request request, final ObjectSpecification spec) {
        request.appendHtml("<h1>Specification - " + spec.getFullIdentifier() + "</h1>");
        request.appendHtml("<p><a href=\"./debug.shtml?type=specification-graph&value=" + spec.getFullIdentifier() + "\">Specification Graph</a></p>");
        final DebugBuilder debug = new DebugHtmlString();
        specification(spec, debug);
        request.appendHtml(debug.toString());
    }
View Full Code Here

        final String name = request.getOptionalProperty(VALUE);
        final ObjectSpecification spec = getSpecificationLoader().loadSpecification(name);
        request.appendHtml("<h1>Specification Graph - " + spec.getFullIdentifier() + "</h1>");
        request.appendHtml("<p><a href=\"./debug.shtml?type=specification&value=" + spec.getFullIdentifier() + "\">Full Specification</a></p>");
        request.appendHtml("<pre>");
        final DebugBuilder debug = new DebugString();
        debug.appendln(spec.getFullIdentifier());
        debug.indent();
        specificationGraph(spec, debug, new ArrayList<ObjectSpecification>());
        debug.unindent();
        request.appendHtml(debug.toString());
        request.appendHtml("</pre>");
    }
View Full Code Here

            if (type.equals("system")) {
                displaySystem(request);
            } else if (type.equals("session")) {
                displaySession(request);
            } else if (type.equals("test")) {
                final DebugBuilder debug = new DebugHtmlString();
                debug.appendTitle("Title");
                debug.appendln("boolean", true);
                debug.appendln("number", 213);
                debug.startSection("Section 1");
                debug.appendln("boolean", false);
                debug.appendln("number", 12348);
                debug.endSection();
                debug.startSection("Section 2");
                debug.appendln("boolean", false);
                debug.appendln("number", 12348);
                debug.appendTitle("Another title");
                debug.appendln("boolean", false);
                debug.appendln("number", 12348);
                debug.endSection();

                debug.startSection("Section 3");
                debug.appendln("boolean", false);
                debug.appendln("number", 89878);
                debug.endSection();
                debug.startSection("Subsection 2");
                debug.appendln("boolean", false);
                debug.appendln("number", 12348);
                debug.endSection();

                debug.startSection("Section 4");
                debug.appendln("boolean", false);
                debug.indent();
                debug.appendln("boolean", false);
                debug.appendln("number", 12348);
                debug.unindent();
                debug.appendln("number", 12348);
                debug.appendPreformatted("code", "line 1\nline 2\nline 3");
                debug.appendln("A lot of text etc.");
                debug.endSection();

                request.appendHtml(debug.toString());
                //request.appendHtml("<pre>" + debug.toString() + "</pre>");
               
                debug.close();
               
            } else if (type.equals("variables")) {
                displayVariables(request);
            } else if (type.equals("dispatcher")) {
                displayDispatcher(request);
            } else if (type.equals("context")) {
                displayContext(request);
            } else if (type.equals("specifications")) {
                listSpecifications(request);
            } else if (type.equals("specification-for")) {
                specificationFor(request);
            } else if (type.equals("specification")) {
                specification(request);
            } else if (type.equals("specification-graph")) {
                specificationGraph(request);
            } else if (type.equals("object-graph")) {
                objectGraph(request);

            } else if (type.equals("object")) {
                final String value = request.getOptionalProperty(VALUE);
                final RequestContext context = request.getContext();
                final ObjectAdapter object = context.getMappedObject(value);
                final DebugString str = new DebugString();
                Dump.adapter(object, str);
                Dump.graph(object, IsisContext.getAuthenticationSession(), str);
                request.appendHtml("<h2>" + object.getSpecification().getFullIdentifier() + "</h2>");
                request.appendHtml("<pre class=\"debug\">" + str + "</pre>");
            }

        }

        if (alwaysShow || request.getContext().getDebug() == RequestContext.Debug.ON) {

            final RequestContext context = request.getContext();

            final String id = request.getOptionalProperty("object");
            if (id != null) {
                final ObjectAdapter object = context.getMappedObject(id);
                if (object instanceof DebuggableWithTitle) {
                    final DebugString debug = new DebugString();
                    ((DebuggableWithTitle) object).debugData(debug);
                    request.appendHtml("<pre class=\"debug\">" + debug + "</pre>");
                } else {
                    request.appendHtml(object.toString());
                }
            }

            final String variable = request.getOptionalProperty("variable");
            if (variable != null) {
                final Object object = context.getVariable(variable);
                request.appendHtml(variable + " => " + (object == null ? "null" : object.toString()));
            }

            final String list = request.getOptionalProperty("list");
            if (list != null) {
                final DebugString debug = new DebugString();
                context.append(debug, list);
                request.appendHtml(debug.toString());
            }

            final String uri = request.getOptionalProperty("uri");
            if (uri != null) {
                request.appendHtml("<pre class=\"debug\">");
View Full Code Here

        error.missingFile("Failed to find page " + servletPath + ".");
        context.raiseError(404, error);
    }

    private void show403ErrorPage(final RequestContext context, ErrorCollator error, final Throwable e, final Throwable ex) {
        DebugBuilder debug = error.getDebug();
        error.message(e);
        error.message(ex);
       
        final List<String> roles = ((ForbiddenException) ex).getRoles();
        final StringBuffer roleList = new StringBuffer();
        for (final String role : roles) {
            if (roleList.length() > 0) {
                roleList.append("|");
            }
            roleList.append(role);
        }
        final Identifier identifier =  ((ForbiddenException) ex).getIdentifier();
        if (identifier != null) {
            debug.appendln("Class", identifier.toClassIdentityString() + ":" + roleList);
            debug.appendln("Member",identifier.toClassAndNameIdentityString() + ":" + roleList);
            debug.appendln("Other",identifier.toFullIdentityString() + ":" + roleList);
        }
       
        error.compileError(context);
        context.raiseError(403, error);
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.core.commons.debug.DebugBuilder

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.