Package org.saiku.plugin.util.packager

Examples of org.saiku.plugin.util.packager.Packager


    @Produces({"text/plain" })
    @Path("/plugins")
    public String getPlugins(@QueryParam("debug") @DefaultValue("false") Boolean debug)
    {
        try {
            Packager packager = Packager.getInstance();
            List<File> files = new ArrayList<File>();
            String searchRootDir = PentahoSystem.getApplicationContext().getSolutionPath("saiku/plugins");
            File searchRootFile = new File(searchRootDir);
            if (searchRootFile.exists()) {
                List<File> solutionFiles = getJsFiles(searchRootFile);
                files.addAll(solutionFiles);
            }
            final IPluginManager pluginManager = (IPluginManager) PentahoSystem.get(IPluginManager.class, PentahoSessionHolder.getSession());
            Long start = (new Date()).getTime();
            for (String plugin : pluginManager.getRegisteredPlugins()) {
                final PluginClassLoader pluginClassloader = (PluginClassLoader) pluginManager.getClassLoader(plugin);
                File pluginDir = pluginClassloader.getPluginDir();
                File saikuDir = new File(pluginDir, "saiku");
                if (saikuDir.exists()) {
                    File saikuPluginDir = new File(saikuDir, "plugins");
                    if (saikuPluginDir.exists()) {
                        List<File> jsFiles = getJsFiles(saikuPluginDir);
                        files.addAll(jsFiles);
                    }
                }
            }
            Long end = (new Date()).getTime();
            log.debug("Looking for all plugin files time: " + (end - start) + "ms - Files: " + files.size());
            if (files.size() > 0) {
                String pluginRootDir = PentahoSystem.getApplicationContext().getSolutionPath("system/saiku");
                File[] fileArray = files.toArray(new File[files.size()]);
                packager.registerPackage("scripts", Packager.Filetype.JS, searchRootDir, pluginRootDir + "/../../system/saiku/ui/js/scripts.js", fileArray);
                packager.minifyPackage("scripts", ( debug ? Packager.Mode.CONCATENATE : Packager.Mode.MINIFY));
                return ResourceManager.getInstance().getResourceAsString( "ui/js/scripts.js");
            }
        } catch (IOException ioe) {
            log.error("Error fetching plugins", ioe);
        }
View Full Code Here


  @Path("/plugins")
  public String getPlugins(@QueryParam("debug") @DefaultValue("false") Boolean debug)
  {

    try {
      Packager packager = Packager.getInstance();
      List<File> files = new ArrayList<File>();


      String searchRootDir = PentahoSystem.getApplicationContext().getSolutionPath("saiku/plugins")
      File searchRootFile = new File(searchRootDir);
      if (searchRootFile.exists()) {
        List<File> solutionFiles = getJsFiles(searchRootFile);
        files.addAll(solutionFiles);
      }


      final IPluginManager pluginManager = (IPluginManager) PentahoSystem.get(IPluginManager.class, PentahoSessionHolder.getSession());

      Long start = (new Date()).getTime();
      for (String plugin : pluginManager.getRegisteredPlugins()) {
        final PluginClassLoader pluginClassloader = (PluginClassLoader) pluginManager.getClassLoader(plugin);
        File pluginDir = pluginClassloader.getPluginDir();
        File saikuDir = new File(pluginDir, "saiku");
        if (saikuDir.exists()) {
          File saikuPluginDir = new File(saikuDir, "plugins");
          if (saikuPluginDir.exists()) {
            List<File> jsFiles = getJsFiles(saikuPluginDir);
            files.addAll(jsFiles);
          }
        }
      }

      Long end = (new Date()).getTime();
      log.debug("Looking for all plugin files time: " + (end - start) + "ms - Files: " + files.size());

      if (files.size() > 0) {
        String pluginRootDir = PentahoSystem.getApplicationContext().getSolutionPath("system/saiku");
        File[] fileArray = files.toArray(new File[files.size()]);
        packager.registerPackage("scripts", Packager.Filetype.JS, searchRootDir, pluginRootDir + "/../../system/saiku/ui/js/scripts.js", fileArray);         
        packager.minifyPackage("scripts", ( debug ? Packager.Mode.CONCATENATE : Packager.Mode.MINIFY));
        return ResourceManager.getInstance().getResourceAsString( "ui/js/scripts.js");

      }
    } catch (IOException ioe) {
      log.error("Error fetching plugins", ioe);
View Full Code Here

TOP

Related Classes of org.saiku.plugin.util.packager.Packager

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.