本文整理匯總了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;
}