Package org.pentaho.platform.api.engine

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


    finishTest();
  }

  public void testCustomParameter() {
    startTest();
    IPentahoSession session = new StandaloneSession( "admin" );
    CustomSettingsParameterProvider provider = new CustomSettingsParameterProvider();
    provider.setSession( session );

    assertEquals( "Output is not correct", "value1", provider.getStringParameter(
        "settings-{$user}.xml{personal-settings/setting1}", null ) );
View Full Code Here


    }
    return xactionStr;
  }

  public static ISolutionEngine getSolutionEngine() {
    IPentahoSession session = new StandaloneSession( "system" );
    return getSolutionEngine( session );

  }
View Full Code Here

    }
  }

  protected IPentahoSession generatePentahoSession( final HttpServletRequest httpRequest ) {
    HttpSession httpSession = httpRequest.getSession( false );
    IPentahoSession pentahoSession = null;
    if ( httpSession != null ) {
      pentahoSession = new PentahoHttpSession( null, httpSession, httpRequest.getLocale(), null );
    } else {
      pentahoSession = new NoDestroyStandaloneSession( null );
    }
    if ( callSetAuthenticatedForAnonymousUsers ) {
      pentahoSession.setAuthenticated( getAnonymousUser() );
    }
    ITempFileDeleter deleter = PentahoSystem.get( ITempFileDeleter.class, pentahoSession );
    if ( deleter != null ) {
      pentahoSession.setAttribute( ITempFileDeleter.DELETER_SESSION_VARIABLE, deleter );
    }
    return pentahoSession;
  }
View Full Code Here

      return;
    }

    HttpSession httpSession = safeGetSession( httpRequest, forceEagerSessionCreation );
    boolean httpSessionExistedAtStartOfRequest = httpSession != null;
    IPentahoSession pentahoSessionBeforeChainExecution = readPentahoSessionFromHttpSession( httpSession );

    // Make the HttpSession null, as we don't want to keep a reference to it lying
    // around in case chain.doFilter() invalidates it.
    httpSession = null;

    localeLeftovers( httpRequest );

    if ( pentahoSessionBeforeChainExecution == null ) {
      pentahoSessionBeforeChainExecution = generatePentahoSession( httpRequest );

      if ( logger.isDebugEnabled() ) {
        logger.debug( "Found no IPentahoSession in HTTP session; created new IPentahoSession" );
      }
    } else {
      if ( logger.isDebugEnabled() ) {
        logger.debug( "Obtained a valid IPentahoSession from HTTP session to "
            + "associate with PentahoSessionHolder: '" + pentahoSessionBeforeChainExecution + "'" );
      }
    }

    httpRequest.setAttribute( FILTER_APPLIED, Boolean.TRUE );

    // Create a wrapper that will eagerly update the session with the Pentaho session
    // if anything in the chain does a sendError() or sendRedirect().

    OnRedirectUpdateSessionResponseWrapper responseWrapper =
        new OnRedirectUpdateSessionResponseWrapper( httpResponse, httpRequest, httpSessionExistedAtStartOfRequest );

    // Proceed with chain

    try {
      // This is the only place in this class where PentahoSessionHolder.setSession() is called
      PentahoSessionHolder.setSession( pentahoSessionBeforeChainExecution );

      chain.doFilter( httpRequest, responseWrapper );
    } finally {
      // This is the only place in this class where PentahoSessionHolder.getSession() is called
      IPentahoSession pentahoSessionAfterChainExecution = PentahoSessionHolder.getSession();

      // Crucial removal of PentahoSessionHolder contents - do this before anything else.
      PentahoSessionHolder.removeSession();

      httpRequest.removeAttribute( FILTER_APPLIED );
View Full Code Here

      return null;
    }

    // HTTP session exists, so try to obtain a Pentaho session from it.

    IPentahoSession pentahoSessionFromHttpSession =
        (IPentahoSession) httpSession.getAttribute( PentahoSystem.PENTAHO_SESSION_KEY );

    if ( pentahoSessionFromHttpSession == null ) {
      if ( logger.isDebugEnabled() ) {
        logger.debug( "HttpSession returned null object for " + PentahoSystem.PENTAHO_SESSION_KEY );
View Full Code Here

     */
    private void doSessionUpdate() {
      if ( sessionUpdateDone ) {
        return;
      }
      IPentahoSession pentahoSession = PentahoSessionHolder.getSession();
      storePentahoSessionInHttpSession( pentahoSession, request, httpSessionExistedAtStartOfRequest );
      sessionUpdateDone = true;
    }
View Full Code Here

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    SimpleOutputHandler outputHandler = new SimpleOutputHandler( out, false );
    outputHandler.setOutputPreference( IOutputHandler.OUTPUT_TYPE_DEFAULT );

    startTest();
    IPentahoSession session = new StandaloneSession( "system" );
    ISolutionEngine solutionEngine = ServiceTestHelper.getSolutionEngine();
    if ( outputHandler != null ) {
      outputHandler.setSession( session );
    }
    try {
View Full Code Here

  }

  @Test
  public void testGetObjectReference() throws Exception {
    IPentahoSession session = new StandaloneSession( "joe" );
    RuntimeObjectFactory factory = new RuntimeObjectFactory();
    final SingletonPentahoObjectReference<String>
      something = new SingletonPentahoObjectReference<String>( String.class, "Something" );
    factory.registerReference( something );
    assertSame( something, factory.getObjectReference( String.class, session ) );
View Full Code Here

  }

  @Test
  public void testGetObjectReferences() throws Exception {

    IPentahoSession session = new StandaloneSession( "joe" );
    RuntimeObjectFactory factory = new RuntimeObjectFactory();
    final SingletonPentahoObjectReference<String> something1 =
      new SingletonPentahoObjectReference<String>( String.class, "Something1", Collections.<String, Object>emptyMap(),
        0 );
    final SingletonPentahoObjectReference<String> something2 =
View Full Code Here

          String roleName,
          Properties props )
        throws SQLException {
        // What we do here is to filter the role names with the mapper.
        // First, get a user role mapper, if one is configured.
        final IPentahoSession session =
            PentahoSessionHolder.getSession();

        final IConnectionUserRoleMapper mondrianUserRoleMapper =
            PentahoSystem.get(
                IConnectionUserRoleMapper.class,
View Full Code Here

TOP

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

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.