Examples of ERXStringHolder


Examples of er.extensions.components.ERXStringHolder

     * Note: this action must be invoked against a specific instance (the instance number must be in the request URL).
     * @return a page showing what action was taken (with regard to EOAdaptorDebugging), if any.
     */
    public WOActionResults eoAdaptorDebuggingAction() {
        if (canPerformActionWithPasswordKey("er.extensions.ERXEOAdaptorDebuggingPassword")) {
          ERXStringHolder result = pageWithName(ERXStringHolder.class);
          result.setEscapeHTML(false);
            String message;
            boolean currentState = ERXExtensions.adaptorLogging();
            int instance = request().applicationNumber();
            if (instance == -1) {
                log.info("EOAdaptorDebuggingAction requested without a specific instance.");
                message = "<p>You must invoke this action on a <em>specific</em> instance.</p>" +
                        "<p>Your url should look like: <code>.../WebObjects/1/wa/...</code>, where '1' would be the first instance of the target application.</p>";
            } else {
                String debugParam = request().stringFormValueForKey("debug");
                log.debug("EOAdaptorDebuggingAction requested with 'debug' param:" + debugParam);
                if (debugParam == null || debugParam.trim().length() == 0) {
                    message = "<p>EOAdaptorDebugging is currently <strong>" + (currentState ? "ON" : "OFF") + "</strong> for instance <strong>" + instance + "</strong>.</p>";
                    message += "<p>To change the setting, provide the 'debug' parameter to this action, e.g.: <code>...eoAdaptorDebugging?debug=on&pw=secret</code></p>";
                } else {
                    if (debugParam.trim().equalsIgnoreCase("on")) {
                        debugParam = "true";
                    } else if (debugParam.trim().equalsIgnoreCase("off")) {
                        debugParam = "false";
                    }

                    boolean desiredState = ERXValueUtilities.booleanValueWithDefault(debugParam, false);
                    log.debug("EOAdaptorDebuggingAction requested 'debug' state change to: '" + desiredState + "' for instance: " + instance + ".");
                    if (currentState != desiredState) {
                        ERXExtensions.setAdaptorLogging(desiredState);
                        message = "<p>Turned EOAdaptorDebugging <strong>" + (desiredState ? "ON" : "OFF") + "</strong> for instance <strong>" + instance + "</strong>.</p>";
                    } else {
                        message = "<p>EOAdaptorDebugging setting <strong>not changed</strong>.</p>";
                    }
                }
            }

            message += "<p><em>Please be mindful of using EOAdaptorDebugging as it may have a large impact on application performance.</em></p>";
            result.setValue(message);
            return result;
        }

        return forbiddenResponse();
    }
View Full Code Here

Examples of er.extensions.components.ERXStringHolder

     * <br/>
     * @return short info about free and used memory before and after GC.
     */
    public WOActionResults forceGCAction() {
        if (canPerformActionWithPasswordKey("er.extensions.ERXGCPassword")) {
          ERXStringHolder result = pageWithName(ERXStringHolder.class);
            Runtime runtime = Runtime.getRuntime();
            ERXUnitAwareDecimalFormat decimalFormatter = new ERXUnitAwareDecimalFormat(ERXUnitAwareDecimalFormat.BYTE);
            decimalFormatter.setMaximumFractionDigits(2);
          
            String info = "Before: ";
            info += decimalFormatter.format(runtime.maxMemory()) + " max, ";
            info += decimalFormatter.format(runtime.totalMemory()) + " total, ";
            info += decimalFormatter.format(runtime.totalMemory()-runtime.freeMemory()) + " used, ";
            info += decimalFormatter.format(runtime.freeMemory()) + " free\n";
           
            int count = 5;
            if(request().stringFormValueForKey("count") != null) {
              count = Integer.parseInt(request().stringFormValueForKey("count"));
            }
            ERXExtensions.forceGC(count);
 
            info += "After: ";
            info += decimalFormatter.format(runtime.maxMemory()) + " max, ";
            info += decimalFormatter.format(runtime.totalMemory()) + " total, ";
            info += decimalFormatter.format(runtime.totalMemory()-runtime.freeMemory()) + " used, ";
            info += decimalFormatter.format(runtime.freeMemory()) + " free\n";

            result.setValue(info);
            log.info("GC forced\n"+info);
            return result;
        }
        return forbiddenResponse();
    }
View Full Code Here

Examples of er.extensions.components.ERXStringHolder

     *
     * @return list of lock traces
     */
    public WOActionResults showOpenEditingContextLockTracesAction() {
      if (canPerformActionWithPasswordKey("er.extensions.ERXOpenEditingContextLockTracesPassword")) {
        ERXStringHolder result = pageWithName(ERXStringHolder.class);
        result.setEscapeHTML(false);
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        pw.println("<pre>");
        pw.println(ERXEC.outstandingLockDescription());
        pw.println("</pre>");
        pw.println("<hr>");
        pw.println("<pre>");
        pw.println(ERXObjectStoreCoordinator.outstandingLockDescription());
        pw.println("</pre>");
        pw.close();
        result.setValue(sw.toString());
        return result;
      }
      return forbiddenResponse();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.