protected void writeWebApps() throws IOException { // write to a subdirectory of the default temp directory File deployDir = new File(RunUtil.getRunDir(), getWebappDir()); deployDir.mkdirs(); // figure out the set of files to add or remove List<String> addFiles = new ArrayList<String>(); List<String> removeFiles = new ArrayList<String>(); FileListUtil.compareDirs("META-INF/" + getWebappDir(), deployDir, addFiles, removeFiles); // remove the files to remove for (String removeFile : removeFiles) { File remove = new File(deployDir, removeFile); // files have been extracted into directories if (remove.isDirectory()) { RunUtil.deleteDir(remove); } } for (String addFile : addFiles) { String fullPath = "/" + getWebappDir() + "/" + addFile; // make sure to clear the directory before we write to it File existingDir = new File(deployDir, addFile); if (existingDir.exists() && existingDir.isDirectory()) { RunUtil.deleteDir(existingDir); } RunUtil.extractJar(getClass(), fullPath, deployDir); } // write the updated checksum list RunUtil.extract(getClass(), "/META-INF/" + getWebappDir() + "/files.list", deployDir); }
protected void writeSchemas() throws IOException { // issue #1191: for offline instances of Wonderland, make sure // we have a copy of all the dtd files locally, otherwise // glassfish will fail File install_dir = new File(RunUtil.getRunDir(), "web_install"); File lib_dir = new File(install_dir, "lib"); File dtds_dir = new File(lib_dir, "dtds"); File schemas_dir = new File(lib_dir, "schemas"); // clear the directory & recreate it if (dtds_dir.exists()) { RunUtil.deleteDir(dtds_dir); } if (schemas_dir.exists()) { RunUtil.deleteDir(schemas_dir); } // extract the dtds ZipInputStream zis = new ZipInputStream(getClass().getResourceAsStream("/webserver/schemas/schemas.zip")); RunUtil.extractZip(zis, lib_dir); }