public void configureTempDirectory (File dir, WebAppContext context) { if (dir == null) throw new IllegalArgumentException("Null temp dir"); //if dir exists and we don't want it persisted, delete it if (dir.exists() && !context.isPersistTempDirectory()) { if (!IO.delete(dir)) throw new IllegalStateException("Failed to delete temp dir "+dir); } //if it doesn't exist make it if (!dir.exists()) dir.mkdirs(); if (!context.isPersistTempDirectory()) dir.deleteOnExit(); //is it useable if (!dir.canWrite() || !dir.isDirectory()) throw new IllegalStateException("Temp dir "+dir+" not useable: writeable="+dir.canWrite()+", dir="+dir.isDirectory()); }
/** * @see org.eclipse.jetty.webapp.AbstractConfiguration#cloneConfigure(org.eclipse.jetty.webapp.WebAppContext, org.eclipse.jetty.webapp.WebAppContext) */ @Override public void cloneConfigure(WebAppContext template, WebAppContext context) throws Exception { File tmpDir=File.createTempFile(WebInfConfiguration.getCanonicalNameForWebAppTmpDir(context),"",template.getTempDirectory().getParentFile()); if (tmpDir.exists()) { IO.delete(tmpDir); } tmpDir.mkdir(); tmpDir.deleteOnExit(); context.setTempDirectory(tmpDir); }
IO.delete(extractedWebAppDir); extractedWebAppDir.mkdir(); LOG.debug("Extract " + web_app + " to " + extractedWebAppDir); IO.delete(extractedWebInfDir); extractedWebInfDir.mkdir(); Resource web_inf_lib = web_inf.addPath("lib/"); IO.delete(webInfLibDir); webInfLibDir.mkdir(); IO.delete(webInfClassesDir); webInfClassesDir.mkdir(); LOG.debug("Copying WEB-INF/classes from "+web_inf_classes+" to "+webInfClassesDir.getAbsolutePath());
@Override public void deconfigure(WebAppContext context) throws Exception { //if we're not persisting the temp dir contents delete it if (!context.isPersistTempDirectory()) { IO.delete(context.getTempDirectory()); } //if it wasn't explicitly configured by the user, then unset it Boolean tmpdirConfigured = (Boolean)context.getAttribute(TEMPDIR_CONFIGURED); if (tmpdirConfigured != null && !tmpdirConfigured) context.setTempDirectory(null); //reset the base resource back to what it was before we did any unpacking of resources if (context.getBaseResource() != null) context.getBaseResource().close(); context.setBaseResource(_preUnpackBaseResource); }
/** Delete File. * This delete will recursively delete directories - BE CAREFUL * @param file The file (or directory) to be deleted. * @return true if anything was deleted. (note: this does not mean that all content in a directory was deleted) */ public static boolean delete(File file) { if (!file.exists()) return false; if (file.isDirectory()) { File[] files = file.listFiles(); for (int i=0;files!=null && i<files.length;i++) delete(files[i]); } return file.delete(); }
@Override public void destroy() { for (File file : _files) { if (file.exists()) { if (LOG.isDebugEnabled()) LOG.debug("Destroy {}",file); IO.delete(file); } } }
public void destroy() { for (File file : _files) { if (file.exists()) { LOG.debug("Destroy {}",file); IO.delete(file); } } }
public void destroy() { for (File file : _files) { if (file.exists()) { LOG.debug("Destroy {}",file); IO.delete(file); } } }
private void shutdown() { if(jettyManager != null) { jettyManager.shutdown(); } if(jettyWorkDirectory != null) { IO.delete(jettyWorkDirectory); } }
public void destroy() { for (File file : _files) { if (file.exists()) { LOG.debug("Destroy {}",file); IO.delete(file); } } }
public void destroy() { for (File file : _files) { if (file.exists()) { LOG.debug("Destroy {}",file); IO.delete(file); } } }
public void destroy() { for (File file : _files) { if (file.exists()) { LOG.debug("Destroy {}",file); IO.delete(file); } } }
public void destroy() { for (File file : _files) { if (file.exists()) { LOG.debug("Destroy {}",file); IO.delete(file); } } }
@Override protected WebAppContext createWebAppContext() throws Exception { WebAppContext warCtx = new WebAppContext(warFile.toURI().toString(), "/" + getContext()); // http://mifosforge.jira.com/browse/MIFOS-4765 File warCtxTmpDir = new File(warFile.getParentFile(), warFile.getName() + "_tmp"); IO.delete(warCtxTmpDir); warCtx.setTempDirectory(warCtxTmpDir); warCtxTmpDir.deleteOnExit(); warCtx.setExtractWAR(true); return warCtx; }
@Override public void destroy() { for (File file : _files) { if (file.exists()) { if (LOG.isDebugEnabled()) LOG.debug("Destroy {}",file); IO.delete(file); } } }
@Override public void destroy() { for (File file : _files) { if (file.exists()) { if (LOG.isDebugEnabled()) LOG.debug("Destroy {}",file); IO.delete(file); } } }
/** * @see org.eclipse.jetty.webapp.AbstractConfiguration#cloneConfigure(org.eclipse.jetty.webapp.WebAppContext, org.eclipse.jetty.webapp.WebAppContext) */ @Override public void cloneConfigure(WebAppContext template, WebAppContext context) throws Exception { File tmpDir=File.createTempFile(WebInfConfiguration.getCanonicalNameForWebAppTmpDir(context),"",template.getTempDirectory().getParentFile()); if (tmpDir.exists()) { IO.delete(tmpDir); } tmpDir.mkdir(); tmpDir.deleteOnExit(); context.setTempDirectory(tmpDir); }
/** * @see org.eclipse.jetty.webapp.AbstractConfiguration#cloneConfigure(org.eclipse.jetty.webapp.WebAppContext, org.eclipse.jetty.webapp.WebAppContext) */ @Override public void cloneConfigure(WebAppContext template, WebAppContext context) throws Exception { File tmpDir=File.createTempFile(WebInfConfiguration.getCanonicalNameForWebAppTmpDir(context),"",template.getTempDirectory().getParentFile()); if (tmpDir.exists()) { IO.delete(tmpDir); } tmpDir.mkdir(); tmpDir.deleteOnExit(); context.setTempDirectory(tmpDir); }
/** * @see org.eclipse.jetty.webapp.AbstractConfiguration#cloneConfigure(org.eclipse.jetty.webapp.WebAppContext, org.eclipse.jetty.webapp.WebAppContext) */ @Override public void cloneConfigure(WebAppContext template, WebAppContext context) throws Exception { File tmpDir=File.createTempFile(WebInfConfiguration.getCanonicalNameForWebAppTmpDir(context),"",template.getTempDirectory().getParentFile()); if (tmpDir.exists()) { IO.delete(tmpDir); } tmpDir.mkdir(); tmpDir.deleteOnExit(); context.setTempDirectory(tmpDir); }
/** * @see org.eclipse.jetty.webapp.AbstractConfiguration#cloneConfigure(org.eclipse.jetty.webapp.WebAppContext, org.eclipse.jetty.webapp.WebAppContext) */ @Override public void cloneConfigure(WebAppContext template, WebAppContext context) throws Exception { File tmpDir=File.createTempFile(WebInfConfiguration.getCanonicalNameForWebAppTmpDir(context),"",template.getTempDirectory().getParentFile()); if (tmpDir.exists()) { IO.delete(tmpDir); } tmpDir.mkdir(); tmpDir.deleteOnExit(); context.setTempDirectory(tmpDir); }