Package java.io

Examples of java.io.File$LazyInitialization


  public void setObjectSerializer(ObjectSerializer serializer) {
    this.serializer = serializer;
  }   
 
  private void saveMetadataStore(VFSDeploymentUnit unit, VDBMetaData vdb, MetadataStoreGroup store) throws IOException {
    File cacheFileName = buildCachedVDBFileName(this.serializer, unit, vdb);
    if (!cacheFileName.exists()) {
      this.serializer.saveAttachment(cacheFileName,store);
      LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+unit.getRoot().getName()+" metadata has been cached to "+ cacheFileName); //$NON-NLS-1$ //$NON-NLS-2$
    }   
  }
View Full Code Here


        if (model.getSourceNames().isEmpty()) {
          throw new DeploymentException(RuntimePlugin.Util.getString("fail_to_deploy", vdb.getName()+"-"+vdb.getVersion(), model.getName())); //$NON-NLS-1$ //$NON-NLS-2$
        }
           
        final boolean cache = "cached".equalsIgnoreCase(vdb.getPropertyValue("UseConnectorMetadata")); //$NON-NLS-1$ //$NON-NLS-2$
        final File cacheFile = buildCachedModelFileName(unit, vdb, model.getName());
        boolean loaded = false;
        if (cache) {
        MetadataStore store = this.serializer.loadSafe(cacheFile, MetadataStore.class);
        if (store != null) {
          vdbStore.addStore(store);
View Full Code Here

    if (imf != null) {
      imf.addEntriesPlusVisibilities(unit.getRoot(), vdb);
      unit.addAttachment(IndexMetadataFactory.class, imf);
             
      // add the cached store.
      File cacheFile = VDBDeployer.buildCachedVDBFileName(this.serializer, unit, vdb);
      // check to see if the vdb has been modified when server is down; if it is then clear the old files
      if (this.serializer.isStale(cacheFile, unit.getRoot().getLastModified())) {
        this.serializer.removeAttachments(unit);
        LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", unit.getRoot().getName(), "old cached metadata has been removed"); //$NON-NLS-1$ //$NON-NLS-2$       
      }
View Full Code Here

        } catch( Exception e ) {
          throw new ServletException(e);
        }
       
        String realPath = servlet.getServletContext().getRealPath("/");
        File resources = new File(realPath,ResourceServlet.relativePath);
        File tresources = new File(resources,path);
       
        File[] files = tresources.listFiles();
        Vector mfiles = new Vector();
        for( int i=0; i<files.length; i++ ) {
          mfiles.add(new org.nextime.ion.backoffice.bean.File(files[i]));
        }
       
View Full Code Here

    return (cacheFile.exists() && timeAfter > cacheFile.lastModified());
  }
 
  public void removeAttachments(VFSDeploymentUnit vf) {
    String dirName = baseDirectory(vf);
    FileUtils.removeDirectoryAndChildren(new File(dirName));
  }
View Full Code Here

  public File getAttachmentPath(VFSDeploymentUnit vf, String baseName) {
   
    String dirName = baseDirectory(vf);

    final String vfsPath = baseName + ATTACHMENT_SUFFIX;
    File f = new File(dirName, vfsPath);
    if (!f.getParentFile().exists()) {
      f.getParentFile().mkdirs();
    }
    return f;
  }
View Full Code Here

    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();
    }
View Full Code Here

  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();
    }
View Full Code Here

          "\n      You will need to manually create one -ds.xml for each JDBC DataSource " +
          "\n      with a JNDI name of <connector binding name>DS, " +
          "\n      where any spaces in the name are replace by _");
      System.exit(-1);
    }
    File file = new File(args[0]);
    if (!file.exists()) {
      System.err.println(args[0] + " does not exist."); //$NON-NLS-1$
      System.exit(-1);
    }
    String fullName = file.getName();
    String fileName = fullName.substring(0, fullName.length() - 4);
    String ext = FileUtils.getExtension(file);
    if (ext == null) {
      System.err.println(fullName + " is not a vdb or xml file."); //$NON-NLS-1$
      System.exit(-1);
    }
    ext = ext.toLowerCase();
    if (ext.endsWith("vdb")) {
      File dir = createTempDirectory();
      try {
        extract(file, dir);
        File metainf = new File(dir, "META-INF");
        File config = new File(dir, "ConfigurationInfo.def");
        File manifest = new File(dir, "MetaMatrix-VdbManifestModel.xmi");
        if (manifest.exists()) {
          String configStr = ObjectConverterUtil.convertFileToString(config);
          String manifestStr = ObjectConverterUtil.convertFileToString(manifest);
          int index = configStr.lastIndexOf("</VDB>");
          int manifestBegin = manifestStr.indexOf("<xmi");
          configStr = configStr.substring(0, index) + manifestStr.substring(manifestBegin) + "</VDB>";
          FileUtils.write(configStr.getBytes(), config);
          manifest.delete();
        }
        transformConfig(config, "/vdb.xsl", new StreamResult(new File(metainf, "vdb.xml")));
        config.delete();
        FileOutputStream out = new FileOutputStream(new File(file.getParent(), fileName + "_70.vdb"));
        ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(out));
        int parentLength = dir.getPath().length();
        addDirectory(dir, zos, parentLength);
        zos.close();
      } finally {
        FileUtils.removeDirectoryAndChildren(dir);
      }
    } else if (ext.endsWith("xml") || ext.endsWith("def")){
      File parent = file.getParentFile();
      transformConfig(file, "/vdb.xsl", new StreamResult(new File(parent, fileName + "-vdb.xml")));
    } else {
      System.err.println(fullName + " is not a vdb or xml file.  Run with no arguments for help."); //$NON-NLS-1$
      System.exit(-1);
    }
  }
View Full Code Here

  private static void addDirectory(File dir, ZipOutputStream zos,
      int parentLength) throws IOException {
    String[] files = dir.list();
    for (String entry : files) {
      File f = new File(dir, entry);
      if (f.isDirectory()) {
        addDirectory(f, zos, parentLength);
      } else {
        ZipEntry e = new ZipEntry(f.getPath().substring(parentLength));
        zos.putNextEntry(e);
        FileUtils.write(f, zos);
        zos.closeEntry();
      }
    }
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.