本文整理汇总了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;
}
示例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;
}
}
}