Examples of IBackingRepositoryLifecycleManager


Examples of org.pentaho.platform.api.repository2.unified.IBackingRepositoryLifecycleManager

  // =========================================================================================================

  @Override
  public boolean startup( IPentahoSession session ) {
    try {
      IBackingRepositoryLifecycleManager lcm = PentahoSystem.get( IBackingRepositoryLifecycleManager.class );
      if ( lcm != null ) {
        lcm.startup();
      }

      return true;
    } catch ( Exception e ) {
      logger.error( "", e ); //$NON-NLS-1$
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.IBackingRepositoryLifecycleManager

  public void onApplicationEvent( final ApplicationEvent event ) {
    if ( event instanceof AuthenticationSuccessEvent || event instanceof InteractiveAuthenticationSuccessEvent ) {
      logger.debug( "received AbstractAuthenticationEvent" ); //$NON-NLS-1$

      // Get the lifecycle manager for this event
      final IBackingRepositoryLifecycleManager lifecycleManager = getLifecycleManager();
      // Execute new tenant with the tenant id from the logged in user
      final AbstractAuthenticationEvent aEvent = (AbstractAuthenticationEvent) event;
      final String principalName = aEvent.getAuthentication().getName();

      try {
        getSecurityHelper().runAsSystem( new Callable<Void>() {
          @Override
          public Void call() throws Exception {
            // Execute new tenant with the tenant id from the logged in user
            lifecycleManager.newTenant( JcrTenantUtils.getTenant( principalName, true ) );
            return null;
          }
        } );
      } catch ( Exception e ) {
        logger.error( e.getLocalizedMessage(), e );
      }

      try {
        getSecurityHelper().runAsSystem( new Callable<Void>() {
          @Override
          public Void call() throws Exception {
            // Execute new tenant with the tenant id from the logged in user
            lifecycleManager.newUser( JcrTenantUtils.getTenant( principalName, true ), JcrTenantUtils.getPrincipalName(
                principalName, true ) );
            return null;
          }
        } );
      } catch ( Exception e ) {
        logger.error( e.getLocalizedMessage(), e );
      }

      try {
        // The newTenant() call should be executed as the system (or more correctly the tenantAdmin)
        getSecurityHelper().runAsSystem( new Callable<Void>() {
          @Override
          public Void call() throws Exception {
            lifecycleManager.newTenant();
            return null;
          }
        } );
      } catch ( Exception e ) {
        logger.error( e.getLocalizedMessage(), e );
      }

      try {
        // run as user to populate SecurityContextHolder and PentahoSessionHolder since Spring Security events are
        // fired
        // before SecurityContextHolder is set
        getSecurityHelper().runAsUser( principalName, new Callable<Void>() {
          @Override
          public Void call() throws Exception {
            lifecycleManager.newUser();
            return null;
          }
        } );

      } catch ( Exception e ) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.