Package org.pentaho.platform.api.engine

Examples of org.pentaho.platform.api.engine.IParameterProvider


    }

    long start = System.currentTimeMillis();
    long end;
    ILogger iLogger = getAuditLogger();
    IParameterProvider requestParams = getParameterProvider( request.getParameterMap() );

    UUID uuid = CpfAuditHelper.startAudit( getPluginName(), filePath, getObjectName(), this.getPentahoSession(),
      iLogger, requestParams );

    try {
View Full Code Here


    @Override
    public void createContent() throws Exception {
        final OutputStream out;
        final IContentItem contentItem;
        final IParameterProvider pathParams;
        final String method;
        final String payload;
        logger.info("CDF content generator took over: " + Long.toString((new Date()).getTime()));
        try {
            if (parameterProviders.get("path") != null
                    && parameterProviders.get("path").getParameter("httprequest") != null
                    && ((HttpServletRequest) parameterProviders.get("path").getParameter("httprequest")).getContextPath() != null) {
                RELATIVE_URL = ((HttpServletRequest) parameterProviders.get("path").getParameter("httprequest")).getContextPath();
            } else {
                RELATIVE_URL = getBaseUrl();
                /* If we detect an empty string, things will break.
                 * If we detect an absolute url, things will *probably* break.
                 * In either of these cases, we'll resort to Catalina's context,
                 * and its getContextPath() method for better results.
                 */
                if ("".equals(RELATIVE_URL) || RELATIVE_URL.matches("^http://.*")) {
                    Object context = PentahoSystem.getApplicationContext().getContext();
                    Method getContextPath = context.getClass().getMethod("getContextPath", null);
                    if (getContextPath != null) {
                        RELATIVE_URL = getContextPath.invoke(context, null).toString();
                    }
                }
            }

            if (RELATIVE_URL.endsWith("/")) {
                RELATIVE_URL = RELATIVE_URL.substring(0, RELATIVE_URL.length() - 1);
            }

            // If callbacks is properly setup, we assume we're being called from another plugin
            if (this.callbacks != null && callbacks.size() > 0 && HashMap.class.isInstance(callbacks.get(0))) {
                HashMap<String, Object> iface = (HashMap<String, Object>) callbacks.get(0);
                pathParams = parameterProviders.get("path");
                contentItem = outputHandler.getOutputContentItem("response", "content", "", instanceId, MIME_HTML);
                out = (OutputStream) iface.get("output");
                method = "/" + (String) iface.get("method");
                payload = (String) iface.get("payload");
                this.userSession = this.userSession != null ? this.userSession : (IPentahoSession) iface.get("usersession");
            } else { // if not, we handle the request normally
                pathParams = parameterProviders.get("path");
                contentItem = outputHandler.getOutputContentItem("response", "content", "", instanceId, MIME_HTML);
                out = contentItem.getOutputStream(null);
                method = pathParams.getStringParameter("path", null);
                payload = "";
            }

            // make sure we have a workable state
            if (outputHandler == null) {
View Full Code Here

    private void findMethod(final String urlPath, final IContentItem contentItem, final OutputStream out, String payload) throws Exception {

        // Each block will call a different method. If in the future this extends a lot we can think
        // about using reflection for class loading, but I don't expect that to happen.

        final IParameterProvider requestParams = parameterProviders.get(IParameterProvider.SCOPE_REQUEST);

        if (urlPath.equals(RENDER_XCDF)) {

            renderXcdf(out, requestParams);
View Full Code Here

        String messageBaseFilename = requestParams.getStringParameter("messages", null);
        renderHtmlDashboard(requestParams, out, solution, path, templateName == null ? "template.html" : templateName, template, messageBaseFilename);
    }

    private void returnResource(final String urlPath, final IContentItem contentItem, final OutputStream out) throws Exception {
        final IParameterProvider pathParams = parameterProviders.get("path"); //$NON-NLS-1$
        contentItem.setMimeType(MimeHelper.getMimeTypeFromFileName(urlPath));

        final IPluginResourceLoader resLoader = PentahoSystem.get(IPluginResourceLoader.class, null);
        final String maxAge = resLoader.getPluginSetting(CdfContentGenerator.class, "settings/max-age");
        final HttpServletResponse response = (HttpServletResponse) pathParams.getParameter("httpresponse");
        if (maxAge != null && response != null) {
            response.setHeader("Cache-Control", "max-age=" + maxAge);
        }

        getContent(urlPath, out, this);
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.engine.IParameterProvider

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.