Package org.pentaho.platform.api.engine

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


      pathParams.setParameter( "remoteaddr", request.getRemoteAddr() ); //$NON-NLS-1$
      if ( PentahoSystem.debug ) {
        debug( "GenericServlet contentGeneratorId=" + contentGeneratorId ); //$NON-NLS-1$
        debug( "GenericServlet urlPath=" + urlPath ); //$NON-NLS-1$
      }
      IPentahoSession session = getPentahoSession( request );
      IPluginManager pluginManager = PentahoSystem.get( IPluginManager.class, session );
      if ( pluginManager == null ) {
        OutputStream out = response.getOutputStream();
        String message =
          Messages.getInstance().getErrorString(
View Full Code Here


    }
  }

  @Override
  public String getTenantId() {
    IPentahoSession session = PentahoSessionHolder.getSession(); // get the session
    Object tenantId = session.getAttribute( getTenantSessionVariableName() ); // get the variable
    if ( tenantId != null ) {
      return tenantId.toString(); // Convert to string
    } else {
      return null; // Return null if not in the session.
    }
View Full Code Here

  private boolean tenantOnLeft; // Whether the tenant ID can be found on the left or the right of the string.

  @Override
  public String getTenantId() {
    // Retrieve the session and get the user id.
    IPentahoSession session = PentahoSessionHolder.getSession();
    String id = session.getName();
    String rtn = null;
    if ( id != null ) { // No ID - bail out here
      if ( id.indexOf( getTenantSeparator() ) >= 0 ) {
        // Only gets here if the userid is non-null and has the tenantSeparator
        String[] bits = id.split( getTenantSeparator() ); // split the field
View Full Code Here

      String action = pathParts[pathParts.length - 1];
     
      System.out.println("file: " + file + " solution:"+solution+" path:"+path + " action:" + action);

      String fullPath = ActionInfo.buildSolutionPath(solution, path, action);
      IPentahoSession userSession = PentahoSessionHolder.getSession();
      ISolutionRepository repository = PentahoSystem.get(ISolutionRepository.class, userSession);

      if( repository == null ) {
        log.error("Access to Repository has failed");
        throw new NullPointerException("Access to Repository has failed");
View Full Code Here

  {
    try {
      if (StringUtils.isBlank(directory))
        return Response.ok().build();

      IPentahoSession userSession = PentahoSessionHolder.getSession();
      ISolutionRepository repository = PentahoSystem.get(ISolutionRepository.class, userSession);
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
      ZipOutputStream zos = new ZipOutputStream(bos);

      String[] fileArray = null;
View Full Code Here

    // write out the style sheet and the HTML document

    out.write( "<html>\n<head>".getBytes() ); //$NON-NLS-1$

    final IPentahoSession session = PentahoSessionHolder.getSession();
    IUserSettingService settingsService = PentahoSystem.get( IUserSettingService.class, session );
    String activeThemeName;
    if ( session == null || settingsService == null ) {
      activeThemeName = PentahoSystem.getSystemSetting( "default-activeThemeName", "onyx" );
    } else {
      activeThemeName = StringUtils.defaultIfEmpty( (String) session.getAttribute( "pentaho-user-activeThemeName" ), settingsService
        .getUserSetting( "pentaho-user-activeThemeName", PentahoSystem.getSystemSetting( "default-activeThemeName", "onyx" ) )
          .getSettingValue() );
    }

    IThemeManager themeManager = PentahoSystem.get( IThemeManager.class, null );
View Full Code Here

  protected String expandFunctions( String formula, String user, List<String> roles ) {
    formula = super.expandFunctions( formula, user, roles );

    // "expand" any SESSION('var')

    IPentahoSession session = PentahoSessionHolder.getSession();

    Pattern p = Pattern.compile( "SESSION\\(\"(.*?)\"\\)" ); //$NON-NLS-1$
    Matcher m = p.matcher( formula );
    StringBuffer sb = new StringBuffer( formula.length() );
    while ( m.find() ) {
      String text = m.group( 1 );
      String value = null;
      if ( session.getAttribute( text ) != null ) {
        value = session.getAttribute( text ).toString();
      } else {
        logger.warn( Messages.getInstance().getString(
          "SessionAwareRowLevelSecurityHelper.WARN_0001_NULL_ATTRIBUTE", text, user ) ); //$NON-NLS-1$
        return "FALSE()"; //$NON-NLS-1$
      }
View Full Code Here

   * Returns the IPentahoSession for the current thread
   *
   * @return thread session
   */
  public IPentahoSession getSession() {
    IPentahoSession sess = perThreadSession.get();
    if ( sess == null ) {
      // In a perfect world, the platform should never be in a state where session is null, but we are not there
      // yet.
      // Not all places
      // that instance sessions use the PentahoSessionHolder yet, so we will not make a fuss here if session is
View Full Code Here

  /**
   * Removes the IPentahoSession for the current thread. It is important that the framework calls this to prevent
   * session bleed- through between requests as threads are re-used by the server.
   */
  public void removeSession() {
    IPentahoSession sess = perThreadSession.get();

    if ( sess != null ) {
      if ( logger.isDebugEnabled() ) {
        logger.debug( Messages.getInstance().getString( "PentahoSessionHolder.DEBUG_REMOVING_SESSION", //$NON-NLS-1$
            Thread.currentThread().getName(), String.valueOf( Thread.currentThread().getId() ) ) );
      }
      if ( logger.isTraceEnabled() ) {
        StackTraceElement[] elements = Thread.currentThread().getStackTrace();
        logger.trace( Messages.getInstance().getString( "PentahoSessionHolder.DEBUG_THREAD_STACK_TRACE" ) ); //$NON-NLS-1$
        for ( int i = 0; i < elements.length; i++ ) {
          logger.trace( elements[i] );
        }
      }

      // If the session is a custom/stand-alone session, we need to remove references
      // to it from other objects which may be holding on to it. We do this to prevent
      // memory leaks. In the future, this should not be necessary since objects
      // should not need to have setSesssion methods, but instead use PentahoSessionHolder.getSession()
      if ( sess instanceof StandaloneSession ) {
        if ( logger.isDebugEnabled() ) {
          logger.debug( Messages.getInstance().getString( "PentahoSessionHolder.DEBUG_DESTROY_STANDALONE_SESSION", //$NON-NLS-1$
              String.valueOf( sess.getId() ), sess.getName(), String.valueOf( Thread.currentThread().getId() ) ) );
        }
        ( (StandaloneSession) sess ).destroy();
      }

      perThreadSession.remove();
View Full Code Here

    repo.storeDomain( getTestDomain( ID2 ), false );

    PentahoSessionHolder.setSession( new StandaloneSession( "Standalone Session", "1" ) ); //$NON-NLS-1$ //$NON-NLS-2$
    repo.getDomain( ID1 );

    IPentahoSession session2 = new StandaloneSession( "Standalone Session", "2" ); //$NON-NLS-1$ //$NON-NLS-2$
    PentahoSessionHolder.setSession( session2 );
    repo.getDomain( ID2 );

    assertEquals( 2, PentahoSystem.getCacheManager( null ).getAllKeysFromRegionCache( CACHE_NAME ).size() );
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.