当前位置: 首页>>代码示例>>Java>>正文


Java FileInfo.isDirectory方法代码示例

本文整理汇总了Java中org.alfresco.jlan.server.filesys.FileInfo.isDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java FileInfo.isDirectory方法的具体用法?Java FileInfo.isDirectory怎么用?Java FileInfo.isDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.alfresco.jlan.server.filesys.FileInfo的用法示例。


在下文中一共展示了FileInfo.isDirectory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFileInformationInternal

import org.alfresco.jlan.server.filesys.FileInfo; //导入方法依赖的package包/类
private FileInfo getFileInformationInternal(SrvSession sess, TreeConnection tree,
        String path) throws IOException
{
           
    //String userName = AuthenticationUtil.getFullyAuthenticatedUser();
    SharedDevice device = tree.getSharedDevice();
    String deviceName = device.getName();
   
    if(logger.isDebugEnabled())
    {
        logger.debug("getFileInformation session:" + sess.getUniqueId() + ", deviceName:" + deviceName + ", path:" + path);
    }
    
    if(path == null)
    {
        throw new IllegalArgumentException("Path is null");
    }
    
    FileInfoKey key = new FileInfoKey(sess, path, tree);
    
    FileInfo fromCache = fileInfoCache.get(key);
    
    if(fromCache != null)
    {
        if(logger.isDebugEnabled())
        {
            logger.debug("returning FileInfo from cache");
        }
        return fromCache;
    }
    
    FileInfo info = diskInterface.getFileInformation(sess, tree, path);
    
    if(info != null)
    {
        /**
         * Don't cache directories since the modification date is important.
         */
        if(!info.isDirectory())
        {
            fileInfoCache.put(key, info);
        }
    }
     
    /*
     * Dual Key the cache so it can be looked up by NodeRef or Path
     */
    if(info instanceof ContentFileInfo)
    {
        ContentFileInfo cinfo = (ContentFileInfo)info;
        fileInfoCache.put(cinfo.getNodeRef(), info);    
    }
    
    return info;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:56,代码来源:BufferedContentDiskDriver.java

示例2: fileExists

import org.alfresco.jlan.server.filesys.FileInfo; //导入方法依赖的package包/类
@Override
public int fileExists(SrvSession sess, TreeConnection tree, String path)
{
    String deviceName = tree.getSharedDevice().getName();
    
    if(logger.isDebugEnabled())
    {
        logger.debug("fileExists session:" + sess.getUniqueId() + ", deviceName" + deviceName + ", path:" + path);
    }
    
    FileInfoKey key = new FileInfoKey(sess, path, tree);
    
    FileInfo fromCache = fileInfoCache.get(key);
    
    if(fromCache != null)
    {
        if(logger.isDebugEnabled())
        {
            logger.debug("fileExists found FileInfo in cache");
        }
        if (fromCache.isDirectory())
        {
            return FileStatus.DirectoryExists;
        }
        else
        {
            return FileStatus.FileExists;
        }
    }
    else
    {
        try 
        {
            FileInfo lookup = getFileInformationInternal(sess, tree, path);
            
            if(logger.isDebugEnabled())
            {
                logger.debug("fileExists obtained file information");
            }
            if (lookup.isDirectory())
            {
                return FileStatus.DirectoryExists;
            }
            else
            {
                return FileStatus.FileExists;
            }
        }
        catch (IOException ie)
        {
            return FileStatus.NotExist;
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:55,代码来源:BufferedContentDiskDriver.java


注:本文中的org.alfresco.jlan.server.filesys.FileInfo.isDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。