Package org.pentaho.platform.api.engine

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


      if ( contentHandlerPattern == null ) {
        final Configuration globalConfig = ClassicEngineBoot.getInstance().getGlobalConfig();
        contentHandlerPattern = globalConfig.getConfigProperty( "org.pentaho.web.ContentHandler" ); //$NON-NLS-1$
      }

      final IApplicationContext ctx = PentahoSystem.getApplicationContext();

      final URLRewriter rewriter;
      final ContentLocation dataLocation;
      final NameGenerator dataNameGenerator;
      if ( ctx != null ) {
        File dataDirectory = new File( ctx.getFileOutputPath( "system/tmp/" ) ); //$NON-NLS-1$
        if ( dataDirectory.exists() && ( dataDirectory.isDirectory() == false ) ) {
          dataDirectory = dataDirectory.getParentFile();
          if ( dataDirectory.isDirectory() == false ) {
            throw new ReportProcessingException( Messages.getInstance().getErrorString(
                "JFreeReportDirectoryComponent.ERROR_0001_INVALID_DIR", dataDirectory.getPath() ) ); //$NON-NLS-1$
View Full Code Here


        final Configuration globalConfig = ClassicEngineBoot.getInstance().getGlobalConfig();
        htmlContentHandlerUrlPattern = PentahoRequestContextHolder.getRequestContext().getContextPath();
        htmlContentHandlerUrlPattern += globalConfig.getConfigProperty( "org.pentaho.web.ContentHandler" ); //$NON-NLS-1$
      }

      final IApplicationContext ctx = PentahoSystem.getApplicationContext();

      final URLRewriter rewriter;
      final ContentLocation dataLocation;
      final NameGenerator dataNameGenerator;
      if ( ctx != null ) {
        File dataDirectory = new File( ctx.getFileOutputPath( "system/tmp/" ) ); //$NON-NLS-1$
        if ( dataDirectory.exists() && ( dataDirectory.isDirectory() == false ) ) {
          dataDirectory = dataDirectory.getParentFile();
          if ( dataDirectory.isDirectory() == false ) {
            throw new ReportProcessingException( Messages.getInstance().getErrorString(
                "JFreeReportDirectoryComponent.ERROR_0001_INVALID_DIR", dataDirectory.getPath() ) ); //$NON-NLS-1$
View Full Code Here

            } else if ( outputName.equals( ChartComponent.CONTEXT_PATH_OUTPUT ) ) {
              IPentahoRequestContext requestContext = PentahoRequestContextHolder.getRequestContext();
              outputValue = requestContext.getContextPath();
            } else if ( outputName.equals( ChartComponent.FULLY_QUALIFIED_SERVER_URL_OUTPUT ) ) {

              IApplicationContext applicationContext = PentahoSystem.getApplicationContext();
              if ( applicationContext != null ) {
                outputValue = applicationContext.getFullyQualifiedServerURL();
              } else {
                IPentahoRequestContext requestContext = PentahoRequestContextHolder.getRequestContext();
                outputValue = requestContext.getContextPath();
              }
            } else if ( outputName.equals( ChartComponent.HTML_IMG_TAG ) ) {
View Full Code Here

      // assume this is a demo installation
      // TODO: Create a servlet that's loaded on startup to set this value
      fullyQualifiedServerUrl = "http://localhost:8080/pentaho/"; //$NON-NLS-1$
    }

    IApplicationContext applicationContext =
      new WebApplicationContext( SolutionContextListener.solutionPath, fullyQualifiedServerUrl, context
        .getRealPath( "" ), context ); //$NON-NLS-1$

    /*
     * Copy out all the initParameter values from the servlet context and put them in the application context.
View Full Code Here

  //
  private HibernateUtil() {
  }

  protected static boolean initialize() {
    IApplicationContext applicationContext = PentahoSystem.getApplicationContext();
    // Add to entry/exit points list
    HibernateUtil hUtil = new HibernateUtil();
    applicationContext.addEntryPointHandler( hUtil );
    applicationContext.addExitPointHandler( hUtil );

    // Look for some hibernate-specific properties...

    String hibernateConfigurationFile = lookupSetting( applicationContext, "hibernateConfigPath", //$NON-NLS-1$
        "settings/config-file", //$NON-NLS-1$
        "hibernate/hibernateConfigPath" ); //$NON-NLS-1$

    String hibernateManagedString = lookupSetting( applicationContext, "hibernateManaged", //$NON-NLS-1$
        "settings/managed", //$NON-NLS-1$
        "hibernate/hibernateManaged" ); //$NON-NLS-1$

    if ( hibernateManagedString != null ) {
      hibernateManaged = Boolean.parseBoolean( hibernateManagedString );
    }

    try {
      HibernateUtil.configuration = new Configuration();
      HibernateUtil.configuration.setEntityResolver( new PentahoEntityResolver() );
      HibernateUtil.configuration.setListener( "load", new HibernateLoadEventListener() ); //$NON-NLS-1$

      if ( hibernateConfigurationFile != null ) {
        String configPath = applicationContext.getSolutionPath( hibernateConfigurationFile );
        File cfgFile = new File( configPath );
        if ( cfgFile.exists() ) {
          HibernateUtil.configuration.configure( cfgFile );
        } else {
          HibernateUtil.log.error( Messages.getInstance().getErrorString(
View Full Code Here

  public void shutdown() {
  }

  public boolean startup( IPentahoSession session ) {
    IApplicationContext applicationContext = PentahoSystem.getApplicationContext();
    applicationContext.addEntryPointHandler( this );
    applicationContext.addExitPointHandler( this );
    return true;
  }
View Full Code Here

  private ReportUtils() {
  }

  public static synchronized File getTempDirectory( final IPentahoSession session ) {
    IApplicationContext ctx = PentahoSystem.getApplicationContext();
    if ( ctx != null ) {
      final String fileOutputPath = ctx.getFileOutputPath( "system/tmp/" ); //$NON-NLS-1$
      final File tempDir = new File( fileOutputPath );
      final String id = session.getId();

      final File userTempDir;
      if ( id == null ) {
View Full Code Here

  }

  protected OutputStream getOutputStream( String solnPath, String testName, String extension ) {
    OutputStream outputStream = null;
    try {
      IApplicationContext appContext = PentahoSystem.getApplicationContext();
      String outputPath = solnPath + "/test/tmp"; //$NON-NLS-1$
      String tmpDir = appContext.getFileOutputPath( outputPath );
      //String tmpDir = PentahoSystem.getApplicationContext().getFileOutputPath(SOLUTION_PATH +"test/tmp"); //$NON-NLS-1$
      File file = new File( tmpDir );
      file.mkdirs();
      String path =
          PentahoSystem.getApplicationContext().getFileOutputPath( solnPath + "/test/tmp/" + testName + extension ); //$NON-NLS-1$
View Full Code Here

    return config.getConfigProperty( key, defaultvalue );
  }

  @Override
  protected String lookupVariable( final String property ) {
    final IApplicationContext context = PentahoSystem.getApplicationContext();
    if ( context != null ) {
      final String contextParam = context.getProperty( property );
      if ( contextParam != null ) {
        return contextParam;
      }
    }

    final IParameterProvider globalParameters = PentahoSystem.getGlobalParameters();
    if ( globalParameters != null ) {
      final String globalParam = globalParameters.getStringParameter( property, null );
      if ( globalParam != null ) {
        return globalParam;
      }
    }

    final String systemSetting = PentahoSystem.getSystemSetting( property, null );
    if ( systemSetting != null ) {
      return systemSetting;
    }

    if ( context != null ) {
      if ( "base-url".equals( property ) ) { //$NON-NLS-1$
        return context.getFullyQualifiedServerURL();
      }
    }
    return null;
  }
View Full Code Here

TOP

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

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.