當前位置: 首頁>>代碼示例>>Java>>正文


Java Deleter類代碼示例

本文整理匯總了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;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:34,代碼來源:CachedContentCleaner.java

示例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;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:48,代碼來源:FileContentStore.java


注:本文中的org.alfresco.util.Deleter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。