Package org.pentaho.platform.api.engine

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


                "SetGlobalOutputTest.xaction", "empty action sequence test", false, true, instanceId, false,
                parameterProviderMap, null, null, urlFactory, messages ); //$NON-NLS-1$ //$NON-NLS-2$
      assertNotNull( "RuntimeContext is null", runtimeContext );
      assertEquals( "Action sequence execution failed", runtimeContext.getStatus(),
          IRuntimeContext.RUNTIME_STATUS_SUCCESS );
      IParameterProvider provider = PentahoSystem.getGlobalParameters();
      String parameter = provider.getStringParameter( "GLOBAL_TEST", null ); //$NON-NLS-1$
      assertNotNull( parameter );
      assertEquals( "This is a test", parameter ); //$NON-NLS-1$

    } catch ( Exception e ) {
      // we should not get here
View Full Code Here


    super( userName, session.getId(), locale );

    this.session = session;

    // run any session initialization actions
    IParameterProvider sessionParameters = new PentahoSessionParameterProvider( userSession );
    PentahoSystem.sessionStartup( this, sessionParameters );
  }
View Full Code Here

  private static final long serialVersionUID = -2788935372334892908L;
  private static final Log logger = LogFactory.getLog( FileResourceContentGenerator.class );

  @Override
  public void createContent( OutputStream out ) throws Exception {
    IParameterProvider pathParams = parameterProviders.get( "path" ); //$NON-NLS-1$
    IParameterProvider requestParams = parameterProviders.get( IParameterProvider.SCOPE_REQUEST );

    RepositoryFile file = (RepositoryFile) pathParams.getParameter( "file" ); //$NON-NLS-1$

    ActionHarness harness = new ActionHarness( this );

    Iterator<?> iter = requestParams.getParameterNames();

    while ( iter.hasNext() ) {
      String paramName = (String) iter.next();
      harness.setValue( paramName, requestParams.getParameter( paramName ) );
    }

    this.setOutputStream( out );
    this.setRepositoryFile( file );
    this.execute();
View Full Code Here

  }

  public void setRequest( final HttpServletRequest request ) {
    this.request = request;
    IParameterProvider requestParameters = new HttpRequestParameterProvider( request );
    setParameterProvider( HttpRequestParameterProvider.SCOPE_REQUEST, requestParameters );

  }
View Full Code Here

  public IParameterProvider getPathParameters() {
    if ( this.pathParameters != null ) {
      return this.pathParameters;
    }

    IParameterProvider pathParams = this.parameterProviders.get( "path" ); //$NON-NLS-1$
    SimpleParameterSetter parameters = new SimpleParameterSetter();
    Iterator pathParamIterator = pathParams.getParameterNames();
    while ( pathParamIterator.hasNext() ) {
      String param = (String) pathParamIterator.next();
      parameters.setParameter( param, pathParams.getParameter( param ) );
    }

    this.pathParameters = parameters;
    return parameters;
  }
View Full Code Here

  public Log getLogger() {
    return LogFactory.getLog( ActionSequenceContentGenerator.class );
  }

  public void createContent( OutputStream outputStream ) throws Exception {
    IParameterProvider requestParams = getRequestParameters();
    IParameterProvider pathParams = getPathParameters();

    if ( ( requestParams != null ) && ( requestParams.getStringParameter( "path", null ) != null ) ) //$NON-NLS-1$
    {
      //So far the decode that used to be here is not necessary and breaks files with special characters.
      // Leaving commented code here in case it shows up later
      //path = URLDecoder.decode( requestParams.getStringParameter( "path", "" ), "UTF-8" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
      path = requestParams.getStringParameter( "path", "" );
    } else if ( ( pathParams != null ) && ( pathParams.getStringParameter( "path", null ) != null ) ) { //$NON-NLS-1$
      path = URLDecoder.decode( pathParams.getStringParameter( "path", "" ), "UTF-8" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }

    if ( ( requestParams != null ) && ( requestParams.getStringParameter( "contentType", null )
      != null ) ) { //$NON-NLS-1$
      contentType = requestParams.getStringParameter( "contentType", TEXT_HTML ); //$NON-NLS-1$
    } else if ( ( pathParams != null ) && ( pathParams.getStringParameter( "contentType", null )
      != null ) ) { //$NON-NLS-1$
      contentType = pathParams.getStringParameter( "contentType", TEXT_HTML ); //$NON-NLS-1$
    }

    if ( path != null && path.length() > 0 ) {
      IUnifiedRepository unifiedRepository = PentahoSystem.get( IUnifiedRepository.class, null );
      RepositoryFile file = unifiedRepository.getFile( path );

      HttpServletRequest httpRequest = (HttpServletRequest) pathParams.getParameter( "httprequest" ); //$NON-NLS-1$

      HttpServletResponse httpResponse = (HttpServletResponse) pathParams.getParameter( "httpresponse" ); //$NON-NLS-1$

      String buffer =
        XactionUtil.execute( contentType, file, httpRequest, httpResponse, PentahoSessionHolder.getSession(),
          outputHandler.getMimeTypeListener() );
View Full Code Here

    if ( this.parameterProviders == null ) {
      return new SimpleParameterProvider();
    }

    IParameterProvider requestParams = this.parameterProviders.get( "request" ); //$NON-NLS-1$
    SimpleParameterSetter parameters = new SimpleParameterSetter();
    Iterator requestParamIterator = requestParams.getParameterNames();
    while ( requestParamIterator.hasNext() ) {
      String param = (String) requestParamIterator.next();
      parameters.setParameter( param, requestParams.getParameter( param ) );
    }
    this.requestParameters = parameters;
    return parameters;
  }
View Full Code Here

  public IParameterProvider getPathParameters() {
    if ( this.pathParameters != null ) {
      return this.pathParameters;
    }

    IParameterProvider pathParams = this.parameterProviders.get( "path" ); //$NON-NLS-1$
    SimpleParameterSetter parameters = new SimpleParameterSetter();
    Iterator pathParamIterator = pathParams.getParameterNames();
    while ( pathParamIterator.hasNext() ) {
      String param = (String) pathParamIterator.next();
      parameters.setParameter( param, pathParams.getParameter( param ) );
    }

    this.pathParameters = parameters;
    return parameters;
  }
View Full Code Here

    this.pathParameters = parameters;
    return parameters;
  }

  public String getMimeType() {
    IParameterProvider requestParams = getRequestParameters();
    IParameterProvider pathParams = getPathParameters();

    if ( ( requestParams != null ) && ( requestParams.getStringParameter( "contentType", null )
      != null ) ) { //$NON-NLS-1$
      contentType = requestParams.getStringParameter( "contentType", TEXT_HTML ); //$NON-NLS-1$
    } else if ( ( pathParams != null ) && ( pathParams.getStringParameter( "contentType", null )
      != null ) ) { //$NON-NLS-1$
      contentType = pathParams.getStringParameter( "contentType", TEXT_HTML ); //$NON-NLS-1$
    }
    return contentType;
  }
View Full Code Here

  private String path = null;

  @Override
  public void createContent( OutputStream outputStream ) throws Exception {
    IParameterProvider requestParams = getRequestParameters();
    IParameterProvider pathParams = getPathParameters();

    if ( ( requestParams != null ) && ( requestParams.getStringParameter( "path", null ) != null ) ) {
      path = URLDecoder
        .decode( requestParams.getStringParameter( "path", "" ), "UTF-8" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    } else if ( ( pathParams != null ) && ( pathParams.getStringParameter( "path", null ) != null ) ) { //$NON-NLS-1$
      path = URLDecoder
        .decode( pathParams.getStringParameter( "path", "" ), "UTF-8" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }

    if ( path != null && path.length() > 0 ) {
      IUnifiedRepository unifiedRepository = PentahoSystem.get( IUnifiedRepository.class, null );
      RepositoryFile file = unifiedRepository.getFile( path );
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.