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

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


            }
            // TODO add clause for request
        } else {
            for (final DebuggableWithTitle info : infos) {
                if (info.debugTitle().equals(sectionName)) {
                    final DebugString debug = new DebugString();
                    info.debugData(debug);
                    writer.println(debug.toString());
                }
            }
        }

        writer.print("[Options: ");
View Full Code Here


    private void refresh() {
        final DebuggableWithTitle[] infos = getInfo();
        final DebuggableWithTitle info = infos[panel];
        if (info != null) {
            setTitle(info.debugTitle());
            final DebugString str = new DebugString();
            info.debugData(str);
            field.setText(str.toString());
            field.setCaretPosition(0);
        }
    }
View Full Code Here

    private void runAction(final Context context, final Request request, final Page page) {
        try {
            ACCESS_LOG.info("request " + request.toString());
            Request r = request;
            final DebugString debug = new DebugString();
            debug.startSection("Request");
            debug.appendln("http", request.toString());
            debug.endSection();
            do {
                final Action action = (Action) actions.get(r.getRequestType());
                try {
                    action.execute(r, context, page);
                } catch (final ObjectLookupException e) {
                    final String error =
                        "The object/service you selected has timed out.  Please navigate to the object via the history bar.";
                    displayError(context, page, error);
                } catch (final TaskLookupException e) {
                    final String error =
                        "The task you went back to has already been completed or cancelled.  Please start the task again.";
                    displayError(context, page, error);
                }
                r = r.getForward();
                if (r != null) {
                    LOG.debug("forward to " + r);
                }
            } while (r != null);
            if (LOG.isDebugEnabled()) {
                context.debug(debug);
                debug.appendln();
                if (IsisContext.inSession()) {
                    IsisContext.getSession(getExecutionContextId()).debugAll(debug);
                } else {
                    debug.appendln("No session");
                }
                LOG.debug(debug.toString());
            }
        } catch (final ActionException e) {
            page.setTitle("Error");
            page.getViewPane().setTitle("Error", "Action Exception");
            LOG.error("ActionException, executing action " + request.getRequestType(), e);
View Full Code Here

            page.setTitle("Debug");

            final DebugPane debugPane = context.getComponentFactory().createDebugPane();
            page.setDebug(debugPane);

            final DebugString debug = new DebugString();

            final AuthenticationSession authenticationSession = IsisContext.getAuthenticationSession();
            debug.appendTitle("Session");
            if (authenticationSession != null) {
                debug.appendln("user", authenticationSession.getUserName());
                debug.appendln("roles", authenticationSession.getRoles());
            } else {
                debug.appendln("none");
            }

            final UserProfile userProfile = IsisContext.getUserProfile();
            debug.appendTitle("User profile");
            if (userProfile != null) {
                UserProfilesDebugUtil.asDebuggableWithTitle(userProfile).debugData(debug);
            } else {
                debug.appendln("none");
            }

            debug.appendTitle("Actions");
            final Iterator e = actions.entrySet().iterator();
            debug.indent();
            while (e.hasNext()) {
                final Map.Entry element = (Map.Entry) e.next();
                debug.appendln(element.getKey() + " -> " + element.getValue());
            }
            debug.unindent();

            context.debug(debug);

            ImageLookup.debug(debug);

            debugPane.appendln("<pre>" + debug.toString() + "</pre>");
        }
View Full Code Here

    }

    @Test
    public void testDebug() throws Exception {
        addViewForObject();
        final DebugString debugString = new DebugString();
        notifier.debugData(debugString);
        assertNotNull(debugString.toString());
    }
View Full Code Here

        assertEquals("def", options.getString("unknown", "def"));
    }

    @Test
    public void debug() throws Exception {
        final DebugString debug = new DebugString();
        options.debugData(debug);
        assertNotNull(debug.toString());
    }
View Full Code Here

    }

    public static void saveToFile(final DebuggableWithTitle object) {
        final String dateStamp = FORMAT.format(new Date());
        final String fileName = object.getClass().getName() + "-" + dateStamp + ".txt";
        final DebugString text = new DebugString();
        object.debugData(text);
        final String title = object.debugTitle();

        saveToFile(new File(fileName), title, text.toString());
    }
View Full Code Here

        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

        return oid;
    }

    @Override
    public String debug() {
        final DebugString debug = new DebugString();
        memento.debug(debug);
        return debug.toString();
    }
View Full Code Here

        UserManager.endRequest(context.getSession());
    }

    private void prepareErrorDetails(final Throwable exception, final RequestContext requestContext,
        final String errorRef, final String servletPath) {
        final DebugString debugText = new DebugString();
        final DebugHtmlString debugHtml = new DebugHtmlString();
        final DebugBuilder debug = new DebugTee(debugText, debugHtml);

        try {
            debug.startSection("Exception");
View Full Code Here

TOP

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

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.