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