本文整理了Java中com.sun.enterprise.util.io.FileUtils.whack()
方法的一些代码示例,展示了FileUtils.whack()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.whack()
方法的具体详情如下:
包路径:com.sun.enterprise.util.io.FileUtils
类名称:FileUtils
方法名:whack
[英]Deletes a directory and its contents.
If this method encounters a symbolic link in the subtree below "parent" then it deletes the link but not any of the files pointed to by the link. Note that whack will delete files if a symbolic link appears in the path above the specified parent directory in the path.
[中]删除目录及其内容。
如果此方法在“parent”下面的子树中遇到符号链接,则会删除该链接,但不会删除该链接指向的任何文件。请注意,如果在路径中指定的父目录上方的路径中出现符号链接,则whack将删除文件。
代码示例来源:origin: org.glassfish.main.common/common-util
/**
* Deletes the temporary files created by this temp PayloadFilesManager.
*/
public void cleanup() {
if ( ! isCleanedUp) {
FileUtils.whack(super.targetDir);
isCleanedUp = true;
}
}
代码示例来源:origin: eclipse-ee4j/glassfish
/**
* Deletes the temporary files created by this temp PayloadFilesManager.
*/
public void cleanup() {
if ( ! isCleanedUp) {
FileUtils.whack(super.targetDir);
isCleanedUp = true;
}
}
代码示例来源:origin: org.glassfish.common/common-util
/**
* Deletes the temporary files created by this temp PayloadFilesManager.
*/
public void cleanup() {
if ( ! isCleanedUp) {
FileUtils.whack(super.targetDir);
isCleanedUp = true;
}
}
代码示例来源:origin: org.glassfish.common/common-util
public static void liquidate(File parent) {
whack(parent);
}
代码示例来源:origin: org.glassfish.common/common-util
/**
* Deletes a directory and its contents.
* <p/>
* If this method encounters a symbolic link in the subtree below "parent"
* then it deletes the link but not any of the files pointed to by the link.
* Note that whack will delete files if a symbolic link appears in the
* path above the specified parent directory in the path.
*
* @param parent the File at the top of the subtree to delete
* @return success or failure of deleting the directory
*/
public static boolean whack(File parent) {
return whack(parent, null);
}
代码示例来源:origin: org.glassfish.main.common/common-util
public static void liquidate(File parent) {
whack(parent);
}
代码示例来源:origin: org.glassfish.main.common/common-util
/**
* Deletes a directory and its contents.
* <p/>
* If this method encounters a symbolic link in the subtree below "parent"
* then it deletes the link but not any of the files pointed to by the link.
* Note that whack will delete files if a symbolic link appears in the
* path above the specified parent directory in the path.
*
* @param parent the File at the top of the subtree to delete
* @return success or failure of deleting the directory
*/
public static boolean whack(File parent) {
return whack(parent, null);
}
代码示例来源:origin: eclipse-ee4j/glassfish
/**
* Deletes a directory and its contents.
* <p/>
* If this method encounters a symbolic link in the subtree below "parent"
* then it deletes the link but not any of the files pointed to by the link.
* Note that whack will delete files if a symbolic link appears in the
* path above the specified parent directory in the path.
*
* @param parent the File at the top of the subtree to delete
* @return success or failure of deleting the directory
*/
public static boolean whack(File parent) {
return whack(parent, null);
}
代码示例来源:origin: eclipse-ee4j/glassfish
public static void liquidate(File parent) {
whack(parent);
}
代码示例来源:origin: org.glassfish/osgi-javaee-base
private void cleanup(File dir)
{
assert (dir.isDirectory() && dir.exists());
FileUtils.whack(dir);
logger.logp(Level.INFO, "OSGiUndeploymentRequest", "cleanup",
"Deleted {0}", new Object[]{dir});
}
代码示例来源:origin: org.glassfish.fighterfish/osgi-javaee-base
private void cleanup(File dir)
{
assert (dir.isDirectory() && dir.exists());
FileUtils.whack(dir);
logger.logp(Level.INFO, "OSGiUndeploymentRequest", "cleanup",
"Deleted {0}", new Object[]{dir});
}
代码示例来源:origin: org.glassfish.main.cluster/cluster-cli
/**
* Remove the named subdirectory of the instance directory.
*/
private void removeSubdirectory(String name) {
File subdir = new File(instanceDir, name);
if (logger.isLoggable(Level.FINER))
logger.finer("Removing: " + subdir);
FileUtils.whack(subdir);
}
代码示例来源:origin: org.glassfish.main.cluster/cluster-cli
private void deleteBackupDir() {
File backup = getBackupDir();
if (backup != null && backup.isDirectory()) {
FileUtils.whack(backup);
}
}
代码示例来源:origin: org.glassfish.main.virtualization/virt-core
@Override
public boolean delete(String path) throws IOException {
File target = absolutize(new File(path));
if (target.exists()) {
if (target.isDirectory()) {
return FileUtils.whack(target);
} else {
return target.delete();
}
}
return false;
}
代码示例来源:origin: org.glassfish.main.admin/backup
private void sanityCheckExplodedFiles() throws BackupException {
// Is the "magic" properties file where it is supposed to be?
File statusFile = new File(tempRestoreDir, Constants.PROPS_FILENAME);
if(!statusFile.exists()) {
// cleanup -- we are officially failing the restore!
FileUtils.whack(tempRestoreDir);
throw new BackupException(
"backup-res.RestoreError.CorruptBackupFile.NoStatusFile",
request.domainName);
}
}
代码示例来源:origin: org.glassfish.main.core/kernel
public void event(Event event) {
if (event.is(EventTypes.SERVER_SHUTDOWN)) {
if (tmpFile.exists()) {
FileUtils.whack(tmpFile);
}
}
}
});
代码示例来源:origin: org.glassfish.deployment/deployment-common
public void clean() {
// need to remove the generated directories...
// need to remove generated/xml, generated/ejb, generated/jsp,
// remove generated/xml
File generatedXmlRoot = getScratchDir("xml");
FileUtils.whack(generatedXmlRoot);
// remove generated/ejb
File generatedEjbRoot = getScratchDir("ejb");
// recursively delete...
FileUtils.whack(generatedEjbRoot);
// remove generated/jsp
File generatedJspRoot = getScratchDir("jsp");
// recursively delete...
FileUtils.whack(generatedJspRoot);
// remove the internal archive directory which holds the original
// archive (and possibly deployment plan) that cluster sync can use
FileUtils.whack(getAppInternalDir());
}
代码示例来源:origin: org.glassfish.main.cluster/cluster-cli
private void backupInstanceDir() throws CommandException {
File f = getServerDirs().getServerDir();
if (f != null && f.isDirectory()) {
SecureRandom r = new SecureRandom();
setBackupDir(r.nextInt());
File backup = getBackupDir();
if (!f.renameTo(backup)) {
logger.warning(Strings.get("import.sync.bundle.backupInstanceDirFailed", f.getAbsolutePath(), backup.getAbsolutePath()));
if (FileUtils.whack(f)) { //Ask user first before deleting?
logger.warning(Strings.get("import.sync.bundle.deletedInstanceDir", f.getAbsolutePath()));
}
}
}
}
代码示例来源:origin: org.glassfish.main.virtualization/virt-core
@Override
public boolean delete(Template config) {
String templateName = config.getName();
File templateLocation = new File(location, templateName);
for (TemplateInstance ti : templates) {
if (ti.getConfig().getName().equals(config.getName())) {
templates.remove(ti);
break;
}
}
if (templateLocation.exists()) {
return FileUtils.whack(templateLocation);
}
return true;
}
代码示例来源:origin: org.glassfish.ejb/ejb-container
void forceClose() {
state = CLOSING;
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("IN close()");
}
cleanupTransactions();
cleanupConnectorRuntime();
undeploy();
if (res_app != null && res_app.deleteOnExit()) {
try {
FileUtils.whack((File)res_app.getApplication());
} catch (Exception e) {
_logger.log(Level.WARNING, "Error in removing temp file", e);
}
}
stop();
}
内容来源于网络,如有侵权,请联系作者删除!