Package org.pentaho.platform.api.engine

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


    }

    // We know what plugin is supposed to have the serialization policy file, now go find it
    // in the plugin's filesystem
    //
    IPluginResourceLoader resLoader =
        PentahoSystem.get( IPluginResourceLoader.class, PentahoSessionHolder.getSession() );
    List<URL> urls = resLoader.findResources( serviceClassloader, serializationPolicyFilename );
    if ( urls.size() < 1 ) {
      logger.error( Messages.getInstance().getErrorString(
          "GwtRpcPluginProxyServlet.ERROR_0006_FAILED_TO_FIND_FILE", serializationPolicyFilename ) ); //$NON-NLS-1$
      return null;
    }
View Full Code Here


        return new ByteArrayInputStream( bytes );
      }
    }

    ClassLoader loader = pluginManager.getClassLoader( pluginId );
    IPluginResourceLoader resLoader = PentahoSystem.get( IPluginResourceLoader.class );
    inputStream = resLoader.getResourceAsStream( loader, path );

    if ( inputStream == null ) {
      throw new FileNotFoundException( Messages.getInstance()
          .getString( "PluginFileResource.COULD_NOT_READ_FILE", path ) ); //$NON-NLS-1$
    }
View Full Code Here

    return getPluginSetting( plugin.getId(), key, defaultValue );
  }

  @Override
  public Object getPluginSetting( String pluginId, String key, String defaultValue ) {
    IPluginResourceLoader resLoader = PentahoSystem.get( IPluginResourceLoader.class, null );
    ClassLoader classLoader = classLoaderMap.get( pluginId );
    return resLoader.getPluginSetting( classLoader, key, defaultValue );
  }
View Full Code Here

  public InputStream getStaticResource( String path ) {
    for ( IPlatformPlugin plugin : registeredPlugins.values() ) {
      Map<String, String> resourceMap = plugin.getStaticResourceMap();
      for ( String url : resourceMap.keySet() ) {
        if ( isRequested( url, path ) ) {
          IPluginResourceLoader resLoader = PentahoSystem.get( IPluginResourceLoader.class, null );
          ClassLoader classLoader = classLoaderMap.get( plugin.getId() );
          String resourcePath = path.replace( url, resourceMap.get( url ) );
          return resLoader.getResourceAsStream( classLoader, resourcePath );
        }
      }
    }
    return null;
  }
View Full Code Here

  public ResourceManager() {

    CACHEABLE_EXTENSIONS.add("html");

    final IPluginResourceLoader resLoader = PentahoSystem.get(IPluginResourceLoader.class, null);
    this.isCacheEnabled = Boolean.parseBoolean(resLoader.getPluginSetting(this.getClass(), "saiku/enable-cache"));

  }
View Full Code Here

    return null; // To change body of implemented methods use File | Settings | File Templates.
  }

  @Override
  public void createContent( OutputStream outputStream ) throws Exception {
    IPluginResourceLoader pluginResourceLoader = PentahoSystem.get( IPluginResourceLoader.class );
    IPluginManager pluginManager = PentahoSystem.get( IPluginManager.class );
    ClassLoader classLoader = pluginManager.getClassLoader( pluginId );
    String filePath = !relativeFilePath.startsWith( "/" ) ? "/" + relativeFilePath : relativeFilePath;
    InputStream inputStream = pluginResourceLoader.getResourceAsStream( classLoader, filePath );
    int val;
    while ( ( val = inputStream.read() ) != -1 ) {
      outputStream.write( val );
    }
    outputStream.flush();
View Full Code Here

      path = path != null && path.endsWith( "/content" ) ? path.substring( 0, path.indexOf( "/content" ) ) : path;

      response.setHeader( "Content-Type", MimeHelper.getMimeTypeFromFileName( path ) );

      final IPluginResourceLoader resLoader = PentahoSystem.get( IPluginResourceLoader.class, null );
      final String formats =
          resLoader.getPluginSetting( this.getClass(), CdfConstants.PLUGIN_SETTINGS_DOWNLOADABLE_FORMATS );

      List<String> allowedFormats = Arrays.asList( StringUtils.split( formats, ',' ) );
      String extension = path.replaceAll( ".*\\.(.*)", "$1" );
      if ( allowedFormats.indexOf( extension ) < 0 ) {
        // We can't provide this type of file
View Full Code Here

    return path.replaceAll( "//+", "/" );
  }

  private void setCacheControl() {
    final IPluginResourceLoader resLoader = PentahoSystem.get( IPluginResourceLoader.class, null );
    final String maxAge = resLoader.getPluginSetting( this.getClass(), "max-age" );
    final HttpServletResponse response = getResponse();
    if ( maxAge != null && response != null ) {
      response.setHeader( "Cache-Control", "max-age=" + maxAge );
    }
  }
View Full Code Here

        logger.error( "resource not found:" + resource );
        response.sendError( HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
        return;
      }

      IPluginResourceLoader resLoader = PentahoSystem.get( IPluginResourceLoader.class, null );
      String maxAge = resLoader.getPluginSetting( this.getClass(), "max-age" );

      String mimeType;
      try {
        mimeType = MimeTypeHandler.getMimeTypeFromExtension( file.getExtension() );
      } catch ( java.lang.IllegalArgumentException ex ) {
View Full Code Here

    CACHEABLE_EXTENSIONS.add("html");
    CACHEABLE_EXTENSIONS.add("json");
    CACHEABLE_EXTENSIONS.add("cdfde");

    final IPluginResourceLoader resLoader = PentahoSystem.get(IPluginResourceLoader.class, null);
    this.isCacheEnabled = Boolean.parseBoolean(resLoader.getPluginSetting(this.getClass(), "pentaho-cdf-dd/enable-cache"));

    //

  }
View Full Code Here

TOP

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

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.