Package net.sf.jasperreports.engine.fill

Examples of net.sf.jasperreports.engine.fill.JRSwapFileVirtualizer


    return isVirtualizationActive;
  }
 
  public JRVirtualizer getVirtualizer() {
   
    JRSwapFileVirtualizer virtualizer;
    int maxSize = 2;
   
    String maxSizeStr = (String)getConfigSourceBean().getAttribute("VIRTUALIZER.maxSize");
    if(maxSizeStr != null) {
      maxSize = Integer.parseInt(maxSizeStr);
    }
   
    File virtualizationDir;
    String virtualizationDirPath = (String)getConfigSourceBean().getAttribute("VIRTUALIZER.dir");
    virtualizationDir = null;
   
    if(virtualizationDirPath == null){
      virtualizationDir = new File(getTempDir(), "virtualization");
    } else {
      if(!virtualizationDirPath.startsWith("/")) {
        virtualizationDir = new File(getTempDir(), virtualizationDirPath);
      } else {
        virtualizationDir = new File(virtualizationDirPath);
      }
    }
   
    virtualizationDir = new File(virtualizationDir, "jrcache");
    virtualizationDir.mkdirs();
   
    logger.debug("Max page cached during virtualization process: " + maxSize);
    logger.debug("Dir used as storing area during virtualization: " + virtualizationDir);
   
    JRSwapFile swapFile = new JRSwapFile(virtualizationDir.getAbsolutePath(), maxSize, maxSize);
    virtualizer = new JRSwapFileVirtualizer(maxSize, swapFile);
    virtualizer.setReadOnly(false);
   
    return virtualizer;
  }
View Full Code Here


   *
   * @return the virtualizer
   */
  public JRSwapFileVirtualizer getSwapVirtualizer(String tmpDirectory, ServletContext servletContext) {
    logger.debug("IN");
    JRSwapFileVirtualizer virtualizer = null;

    SourceBean config = EnginConf.getInstance().getConfig();
    String maxSizeStr = (String)config.getAttribute("VIRTUALIZER.maxSize");
    int maxSize = 2;
    if(maxSizeStr!=null) maxSize = Integer.parseInt(maxSizeStr);
    String dir = (String)config.getAttribute("VIRTUALIZER.dir");
    if(dir == null){
      dir = tmpDirectory;
    } else {
      if(!dir.startsWith("/")) {
        String contRealPath = servletContext.getRealPath("/");
        if(contRealPath.endsWith("\\")||contRealPath.endsWith("/")) {
          contRealPath = contRealPath.substring(0, contRealPath.length()-1);
        }
        dir = contRealPath + "/" + dir;
      }
    }
   

    dir = dir + System.getProperty("file.separator") + "jrcache";
    File file = new File(dir);
    file.mkdirs();
    logger.debug("Max page cached during virtualization process: " + maxSize);
    logger.debug("Dir used as storing area during virtualization: " + dir);
    JRSwapFile swapFile = new JRSwapFile(dir,maxSize,maxSize);
    virtualizer = new JRSwapFileVirtualizer(maxSize, swapFile);
    virtualizer.setReadOnly(false);
    logger.debug("OUT");
    return virtualizer;
  }
View Full Code Here

TOP

Related Classes of net.sf.jasperreports.engine.fill.JRSwapFileVirtualizer

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.