Package org.jboss.dashboard.profiler

Examples of org.jboss.dashboard.profiler.CodeBlockTrace


    public DataSet buildXYDataSet() {
        DataProperty domainProperty = getDomainProperty();
        DataProperty rangeProperty = getRangeProperty();
        ScalarFunction scalarFunction = getRangeScalarFunction();
        DataSet sourceDataSet = domainProperty.getDataSet();
        CodeBlockTrace trace = new BuildXYDataSetTrace(domainProperty, rangeProperty, scalarFunction).begin();
        try {
            if (domainProperty == null || domainProperty.getDomain() == null) return null;
            if (rangeProperty == null || scalarFunction == null) return null;

            // Group the original data set by the domain property.
            int pivot = sourceDataSet.getPropertyColumn(domainProperty);
            int range = sourceDataSet.getPropertyColumn(rangeProperty);
            int[] columns = new int[] {pivot, range};
            String[] functionCodes = new String[] {CountFunction.CODE, scalarFunction.getCode()};
            return sourceDataSet.groupBy(domainProperty, columns, functionCodes, intervalsSortCriteria, intervalsSortOrder);
        } finally {
            trace.end();
        }
    }
View Full Code Here


        }

        public Object invoke(Object proxy, final Method m, final Object[] args) throws Throwable {
            // Capture commit.
            if (m.getName().equals("commit")) {
                CodeBlockTrace trace = new SQLStatementTrace("commit").begin();
                try {
                    return m.invoke(conn, args);
                } catch (Throwable e) {
                    ErrorManager.lookup().notifyError(e, true);
                    throw e;
                } finally {
                    trace.end();
                }
            }
            // Capture rollback.
            if (m.getName().equals("rollback")) {
                CodeBlockTrace trace = new SQLStatementTrace("rollback").begin();
                try {
                    return m.invoke(conn, args);
                } catch (Throwable e) {
                    ErrorManager.lookup().notifyError(e, true);
                    throw e;
                } finally {
                    trace.end();
                }
            }
            // Capture Statement creation.
            Object result = m.invoke(conn, args);
            if (m.getReturnType() != null) {
View Full Code Here

        }

        public Object invoke(Object proxy, final Method m, final Object[] args) throws Throwable {
            if (m.getName().startsWith("execute") && args != null && args.length > 0) {
                String sqlToExec = (String) args[0];
                CodeBlockTrace trace = new SQLStatementTrace(sqlToExec).begin();
                try {
                    if (log.isDebugEnabled()) log.debug(sqlToExec);
                    return m.invoke(stmt, args);
                } catch (Throwable e) {
                    ErrorManager.lookup().notifyError(e, true);
                    throw e;
                } finally {
                    trace.end();
                }
            } else {
                return m.invoke(stmt, args);
            }
        }
View Full Code Here

        }

        public Object invoke(Object proxy, final Method m, final Object[] args) throws Throwable {
            if (m.getName().startsWith("execute")) {
                String sqlToExec = args != null && args.length > 0 ? (String) args[0] : sql;
                CodeBlockTrace trace = new SQLStatementTrace(sqlToExec).begin();
                try {
                    if (log.isDebugEnabled()) log.debug(sqlToExec);
                    return m.invoke(stmt, args);
                } catch (Throwable e) {
                    ErrorManager.lookup().notifyError(e, true);
                    throw e;
                } finally {
                    trace.end();
                }
            } else {
                return m.invoke(stmt, args);
            }
        }
View Full Code Here

    public void setErrorPage(String errorPage) {
        this.errorPage = errorPage;
    }

    public void jspInclude(String page) {
        CodeBlockTrace trace = new JSPIncludeTrace(page).begin();
        try {
            pageContext.include(page);
        } catch (Throwable t) {
            handleError(t);
        } finally {
            trace.end();
        }
    }
View Full Code Here

        }
    }

    protected void handleError(Throwable t) {
        ErrorReport errorReport = ErrorManager.lookup().notifyError(t, true);
        CodeBlockTrace trace = new JSPIncludeTrace(errorPage).begin();
        try {
            // Display the error page.
            ErrorReportHandler errorHandler = JSPIncludeErrorHandler.lookup();
            errorHandler.setErrorReport(errorReport);
            errorHandler.setCloseEnabled(false);
            pageContext.getRequest().setAttribute("errorHandlerName", errorHandler.getBeanName());
            pageContext.include(errorPage);
        } catch (Throwable t1) {
            log.error("JSP error processing failed.", t1);
            try {
                // If the error JSP rendering fails then print a simple error message.
                String errorStr = errorReport.printErrorMessage() + "\n\n" + errorReport.printContext(0);
                pageContext.getOut().println("<span class=\"skn-error\"><pre>" + errorStr + "</pre></span>");
            } catch (Throwable t2) {
                log.error("Cannot print a JSP error message.", t2);
            }
        } finally {
            trace.end();
        }
    }
View Full Code Here

    public int doEndTag() throws JspTagException {
        UIBeanHandler uiBean = getBeanInstance();
        String page = uiBean.getBeanJSP();
        if (StringUtils.isBlank(page)) throw new RuntimeException("Page for bean " + getBeanName() + " is null.");

        CodeBlockTrace trace = new BeanHandler.HandlerTrace(uiBean, null).begin();
        Object previousComponent = pageContext.getRequest().getAttribute(CURRENT_BEAN);
        try {
            uiBean.beforeRenderBean();
            pageContext.getRequest().setAttribute(CURRENT_BEAN, uiBean);
            jspInclude(page);
            pageContext.getRequest().setAttribute(CURRENT_BEAN, previousComponent);
            uiBean.afterRenderBean();
        } catch (Exception e) {
            handleError(e);
        } finally {
            pageContext.getRequest().setAttribute(CURRENT_BEAN, previousComponent);
            trace.end();
        }
        return EVAL_PAGE;
    }
View Full Code Here

        removeDataSetHolder(dataProvider);
        return getDataSet(dataProvider);
    }

    public DataSet filterDataSet(DataProvider dataProvider, DataFilter dataFilter) throws Exception {
        CodeBlockTrace trace = CodeBlockHelper.newCodeBlockTrace(CoreCodeBlockTypes.DATASET_FILTER,
                "dataset-filter-" + dataProvider.getCode(),
                "Data set filter - " + dataProvider.getDescription(LocaleManager.currentLocale()),
                createDataProviderContext(dataProvider)).begin();
        try {
            DataSetHolder dataSetHolder = getDataSetHolder(dataProvider);
            dataSetHolder.filteredDataSet = dataSetHolder.originalDataSet.filter(dataFilter);
            if (dataSetHolder.filteredDataSet != null) {
                ((DataProviderImpl)dataProvider).deserializeDataProperties(dataSetHolder.filteredDataSet);
            }
            return dataSetHolder.getDataSet();
        } finally {
            trace.end();
        }
    }
View Full Code Here

        String providerCode = dataProvider.getCode();
        return dataSetMap.remove(providerCode);
    }

    protected DataSet loadDataSet(DataProvider dataProvider) throws Exception {
        CodeBlockTrace trace = CodeBlockHelper.newCodeBlockTrace(CoreCodeBlockTypes.DATASET_LOAD,
                                "dataset-load-" + dataProvider.getCode(),
                                "Data set load - " + dataProvider.getDescription(LocaleManager.currentLocale()),
                                createDataProviderContext(dataProvider)).begin();
        try {
            DataSet dataSet = dataProvider.getDataLoader().load(dataProvider);
            dataSet.setDataProvider(dataProvider);
            ((DataProviderImpl)dataProvider).deserializeDataProperties(dataSet);
            return dataSet;
        } finally {
            trace.end();
        }
    }
View Full Code Here

        return CODE;
    }

    public double scalar(Collection values) {
        double ret;
        CodeBlockTrace trace = new ScalarFunctionTrace(CODE, values).begin();
        try {
            if (values == null || values.isEmpty()) return 0;
            double average = super.scalar(values) / values.size();
            ret = round(average, precission);
        } finally {
            trace.end();
        }
        // Adjust to the specified precission.
        return ret;
    }
View Full Code Here

TOP

Related Classes of org.jboss.dashboard.profiler.CodeBlockTrace

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.