本文整理汇总了Java中org.alfresco.util.Deleter类的典型用法代码示例。如果您正苦于以下问题:Java Deleter类的具体用法?Java Deleter怎么用?Java Deleter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Deleter类属于org.alfresco.util包,在下文中一共展示了Deleter类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteFilesNow
import org.alfresco.util.Deleter; //导入依赖的package包/类
/**
* Deletes both the cached content file and its peer properties file that contains the
* original content URL and deletion marker information.
*
* @param cacheFile Location of cached content file.
* @return true if the content file was deleted, false otherwise.
*/
private boolean deleteFilesNow(File cacheFile)
{
CacheFileProps props = new CacheFileProps(cacheFile);
props.delete();
long fileSize = cacheFile.length();
boolean deleted = cacheFile.delete();
if (deleted)
{
if (log.isTraceEnabled())
{
log.trace("Deleted cache file: " + cacheFile);
}
numFilesDeleted++;
sizeFilesDeleted += fileSize;
Deleter.deleteEmptyParents(cacheFile, cache.getCacheRoot());
}
else
{
if (log.isWarnEnabled())
{
log.warn("Failed to delete cache file: " + cacheFile);
}
}
return deleted;
}
示例2: delete
import org.alfresco.util.Deleter; //导入依赖的package包/类
/**
* Attempts to delete the content. The actual deletion is optional on the interface
* so it just returns the success or failure of the underlying delete.
*
* @throws UnsupportedOperationException if the store is read-only
*
* @see #setReadOnly(boolean)
*/
public boolean delete(String contentUrl)
{
if (readOnly)
{
throw new UnsupportedOperationException("This store is currently read-only: " + this);
}
if (contentUrl.startsWith(SPOOF_PROTOCOL))
{
// This is not a failure but the content can never actually be deleted
return false;
}
// Handle regular files based on the real files
File file = makeFile(contentUrl);
boolean deleted = false;
if (!file.exists())
{
// File does not exist
deleted = true;
}
else
{
deleted = file.delete();
}
// Delete empty parents regardless of whether the file was ignore above.
if (deleteEmptyDirs && deleted)
{
Deleter.deleteEmptyParents(file, getRootLocation());
}
// done
if (logger.isDebugEnabled())
{
logger.debug("Delete content directly: \n" +
" store: " + this + "\n" +
" url: " + contentUrl);
}
return deleted;
}