Package java.io

Examples of java.io.File$LazyInitialization


        //Further investigation never confirmed the problem again but since we have access to
        //server home directory anyway, why not stay on the safe side... ;)
        OutputStream os = null;

        try {
            File tempDir = createTempDirectory("teiid-deploy-content", null, getServerTempDirectory());

            //The userSpecifiedName is used in case we renamed the file to add version.
            File contentCopy = new File(tempDir, userSpecifedName);

            os = new BufferedOutputStream(new FileOutputStream(contentCopy));
            ContentContext contentContext = resourceContext.getContentContext();
            ContentServices contentServices = contentContext.getContentServices();
            contentServices.downloadPackageBitsForChildResource(contentContext, resourceType.getName(), key, os);
View Full Code Here


        ManagedComponent serverConfigComponent = ManagedComponentUtils.getSingletonManagedComponent(managementView,
            new ComponentType("MCBean", "ServerConfig"));
        String serverTempDir = (String) ManagedComponentUtils.getSimplePropertyValue(serverConfigComponent,
            "serverTempDir");

        return new File(serverTempDir);
    }
View Full Code Here

        // Let's reuse the algorithm the JDK uses to determine a unique name:
        // 1) create a temp file to get a unique name using JDK createTempFile
        // 2) then quickly delete the file and...
        // 3) convert it to a directory

        File tmpDir = File.createTempFile(prefix, suffix, parentDirectory); // create file with unique name
        boolean deleteOk = tmpDir.delete(); // delete the tmp file and...
        boolean mkdirsOk = tmpDir.mkdirs(); // ...convert it to a directory

        if (!deleteOk || !mkdirsOk) {
            throw new IOException("Failed to create temp directory named [" + tmpDir + "]");
        }
View Full Code Here

  protected AbstractDeployer(ProfileServiceConnection profileService) {
    this.profileServiceConnection = profileService;
  }

  public void deploy(CreateResourceReport createResourceReport, ResourceType resourceType) {
        File archiveFile = null;
        try {
            ResourcePackageDetails details = createResourceReport.getPackageDetails();
            PackageDetailsKey key = details.getKey();

            archiveFile = prepareArchive(createResourceReport.getUserSpecifiedResourceName(), key, resourceType);

            String archiveName = archiveFile.getName();

            if (!DeploymentUtils.hasCorrectExtension(archiveName, resourceType)) {
                createResourceReport.setStatus(CreateResourceStatus.FAILURE);
                createResourceReport.setErrorMessage("Incorrect extension specified on filename [" + archiveName + "]");
                return;
View Full Code Here

      // add resources
      Vector beans = Resources.getResourceXmlBeans(this);
      for (int i = 0; i < beans.size(); i++) {
        ResourceXmlBean bean = (ResourceXmlBean) beans.get(i);
        File root =
          new File(
            getServletContext().getRealPath("/"),
            resourcesPath);
        File dir = new File(root, bean.getDirectory());
        File[] files = dir.listFiles();
        for (int k = 0; k < files.length; k++) {
          File file = files[k];
          if (file.isFile()) {
            InputStream in = new FileInputStream(file);
            ZipEntry ze =
              new ZipEntry(
                "resources/"
                  + bean.getId()
                  + "/"
                  + file.getName());
            zip.putNextEntry(ze);

            // Transfer bytes from the file to the ZIP file
            int len;
            while ((len = in.read(buf)) > 0) {
              zip.write(buf, 0, len);
            }

            zip.closeEntry();
            in.close();
          }
        }
      }

      // add images
      File root =
        new File(getServletContext().getRealPath("/"), imagesPath);
      File[] files = root.listFiles();
      for (int k = 0; k < files.length; k++) {
        File file = files[k];
        if (file.isFile()) {
          InputStream in = new FileInputStream(file);
          ZipEntry ze = new ZipEntry("images/" + file.getName());
          zip.putNextEntry(ze);

          // Transfer bytes from the file to the ZIP file
          int len;
          while ((len = in.read(buf)) > 0) {
View Full Code Here

   */
  public void run() {
    while (true) {       
      String[] indexs = Config.getInstance().getIndexNames();
      for( int i=0; i<indexs.length; i++ ) {
        File rep = new File( Config.getInstance().getIndexRoot(), indexs[i] );
        if( !rep.exists() ) {
          rep.mkdir();
        }
      }
      try {
        System.out.println("["+Thread.currentThread().getName()+"] ReIndexation");   
        Mapping.begin();
View Full Code Here

  private static ResourceXmlBean bean;
 
  public static ResourceXmlBean getResourceXmlBean(HttpServlet servlet, String id) throws Exception {
    if( bean == null ) {
      FileInputStream fis = new FileInputStream( new File(servlet.getServletContext().getRealPath("../../../conf/resources.xml")) );
      bean = ResourceXmlBean.parse(fis);
      fis.close();
    }
    return bean.getResource(id);
  }
View Full Code Here

    return bean.getResource(id);
  }
 
  public static Vector getResourceXmlBeans(HttpServlet servlet) throws Exception {
    if( bean == null ) {
      FileInputStream fis = new FileInputStream( new File(servlet.getServletContext().getRealPath("../../../conf/resources.xml")) );
      bean = ResourceXmlBean.parse(fis);
      fis.close();
    }
    return bean.getItems();
  }
View Full Code Here

  private static TypeBean bean;
 
  public static TypeBean getSectionBean(HttpServlet servlet, String template) throws Exception {
    if( bean == null ) {
      FileInputStream fis = new FileInputStream( new File(servlet.getServletContext().getRealPath("../../../conf/templates.xml")) );
      bean = TypeBean.parse(fis);
      fis.close();
    }
    return bean.getBean(template);
  }
View Full Code Here

    return bean.getBean(template);
  }
 
  public static Vector getSectionsBeans(HttpServlet servlet) throws Exception {
    if( bean == null ) {
      FileInputStream fis = new FileInputStream( new File(servlet.getServletContext().getRealPath("../../../conf/templates.xml")) );
      bean = TypeBean.parse(fis);
      fis.close();
    }
    return bean.getItems();
  }
View Full Code Here

TOP

Related Classes of java.io.File$LazyInitialization

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.