本文整理汇总了Java中org.alfresco.jlan.server.filesys.FileInfo类的典型用法代码示例。如果您正苦于以下问题:Java FileInfo类的具体用法?Java FileInfo怎么用?Java FileInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FileInfo类属于org.alfresco.jlan.server.filesys包,在下文中一共展示了FileInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFileInformation
import org.alfresco.jlan.server.filesys.FileInfo; //导入依赖的package包/类
@Override
public FileInfo getFileInformation(SrvSession sess, TreeConnection tree,
String path) throws IOException
{
if(logger.isDebugEnabled())
{
logger.debug("getFileInformation:" + path);
}
FileFilterMode.setClient(ClientHelper.getClient(sess));
try
{
FileInfo info = diskInterface.getFileInformation(sess, tree, path);
return info;
}
finally
{
FileFilterMode.clearClient();
}
}
示例2: AlfrescoFolder
import org.alfresco.jlan.server.filesys.FileInfo; //导入依赖的package包/类
public AlfrescoFolder(String path, FileInfo fileInfo, boolean readOnly)
{
super(path);
setFullName(path);
// Set the file timestamps
if ( fileInfo.hasCreationDateTime())
setCreationDate( fileInfo.getCreationDateTime());
if ( fileInfo.hasModifyDateTime())
setModifyDate(fileInfo.getModifyDateTime());
if ( fileInfo.hasAccessDateTime())
setAccessDate(fileInfo.getAccessDateTime());
// Set the file attributes
setAttributes(fileInfo.getFileAttributes());
}
示例3: equals
import org.alfresco.jlan.server.filesys.FileInfo; //导入依赖的package包/类
@Override
public boolean equals(Object other)
{
if (this == other)
{
return true;
}
if (other == null || !(other instanceof FileInfo))
{
return false;
}
ContentFileInfo o = (ContentFileInfo)other;
return m_nodeRef.equals(o.getNodeRef());
}
示例4: createUser
import org.alfresco.jlan.server.filesys.FileInfo; //导入依赖的package包/类
/**
* Creates correct user entity with correct user home space, person and authentication with password equal to '<code>password</code>' options if these options are not exist.
* Method searches for space with name equal to '<code>name</code>' to make it user home space or creates new folder with name equal to '<code>name</code>'. All required
* permissions and roles will be applied to user home space
*
* @param name - {@link String} value which contains new user name
* @param password - {@link String} value of text password for new user
* @param parentNodeRef - {@link NodeRef} instance of parent folder where user home space should be found or created
*/
private void createUser(String name, String password, NodeRef parentNodeRef)
{
Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
properties.put(ContentModel.PROP_USERNAME, name);
Pair<org.alfresco.service.cmr.model.FileInfo, Boolean> userHome = getOrCreateNode(parentNodeRef, name, ContentModel.TYPE_FOLDER);
if (userHome.getSecond())
{
NodeRef nodeRef = userHome.getFirst().getNodeRef();
permissionService.setPermission(nodeRef, name, permissionService.getAllPermission(), true);
permissionService.setPermission(nodeRef, permissionService.getAllAuthorities(), PermissionService.CONSUMER, true);
permissionService.setPermission(nodeRef, permissionService.getOwnerAuthority(), permissionService.getAllPermission(), true);
ownableService.setOwner(nodeRef, name);
permissionService.setInheritParentPermissions(nodeRef, false);
properties.put(ContentModel.PROP_HOMEFOLDER, nodeRef);
if (!personService.personExists(name))
{
personService.createPerson(properties);
}
if (!authenticationService.authenticationExists(name))
{
authenticationService.createAuthentication(name, password.toCharArray());
}
}
}
示例5: getFileInfo
import org.alfresco.jlan.server.filesys.FileInfo; //导入依赖的package包/类
@Override
public FileInfo getFileInfo() {
final FileInfo existingFileInfo = getInfo();
if (existingFileInfo != null) {
return existingFileInfo;
}
final IScsiLogicalUnitCapacity capacity = _removeDeviceInfo.getCapacity();
final long blockCount = capacity.getLogicalBlockAddress() + 1;
final long sizeInBytes = (blockCount * capacity.getBlockSize());
final FileInfo newFileInfo = new PseudoFileInfo(getFileName(), sizeInBytes, getAttributes());
newFileInfo.setCreationDateTime(_creationDateTime);
newFileInfo.setModifyDateTime(_creationDateTime);
newFileInfo.setChangeDateTime(_creationDateTime);
newFileInfo.setAllocationSize(blockCount * capacity.getBlockSize());
setFileInfo(newFileInfo);
return newFileInfo;
}
示例6: RemoteNetworkFile
import org.alfresco.jlan.server.filesys.FileInfo; //导入依赖的package包/类
RemoteNetworkFile(final String name, final FileInfo fileInfo, final RemoteDeviceManager remoteDeviceManager, final RemoteDeviceInfo remoteDeviceInfo) {
super(name);
_remoteDeviceManager = remoteDeviceManager;
_remoteDeviceInfo = remoteDeviceInfo;
setFileSize(fileInfo.getSize());
setModifyDate(fileInfo.getModifyDateTime());
setCreationDate(fileInfo.getCreationDateTime());
final String path = fileInfo.getPath();
if (path != null) {
setFileId(path.hashCode());
setFullName(path);
}
}
示例7: setFileInformation
import org.alfresco.jlan.server.filesys.FileInfo; //导入依赖的package包/类
@Override
public void setFileInformation(SrvSession sess, TreeConnection tree,
String name, FileInfo info) throws IOException
{
diskInterface.setFileInformation(sess, tree, name, info);
}
示例8: setFileInformation
import org.alfresco.jlan.server.filesys.FileInfo; //导入依赖的package包/类
@Override
public void setFileInformation(SrvSession sess, TreeConnection tree,
String name, FileInfo info) throws IOException
{
diskInterface.setFileInformation(sess, tree, name, info);
ContentContext tctx = (ContentContext) tree.getContext();
if(tctx.hasStateCache())
{
FileStateCache cache = tctx.getStateCache();
FileState fstate = cache.findFileState( name, true);
// if ( info.hasSetFlag(FileInfo.SetCreationDate))
// {
// if ( logger.isDebugEnabled())
// {
// logger.debug("Set creation date in file state cache" + name + ", " + info.getCreationDateTime());
// }
// Date createDate = new Date( info.getCreationDateTime());
// fstate.u(createDate.getTime());
// }
if ( info.hasSetFlag(FileInfo.SetModifyDate))
{
if ( logger.isDebugEnabled())
{
logger.debug("Set modification date in file state cache" + name + ", " + info.getModifyDateTime());
}
Date modifyDate = new Date( info.getModifyDateTime());
fstate.updateModifyDateTime(modifyDate.getTime());
}
}
}
示例9: LinkMemoryNetworkFile
import org.alfresco.jlan.server.filesys.FileInfo; //导入依赖的package包/类
/**
* Class constructor.
*
* @param name String
* @param data byte[]
* @param finfo FileInfo
* @param nodeRef NodeRef
*/
public LinkMemoryNetworkFile(String name, byte[] data, FileInfo finfo, NodeRef nodeRef)
{
super( name, nodeRef);
// Set the file data
m_data = data;
if ( m_data == null)
m_data = new byte[0];
// Set the file size
setFileSize( m_data.length);
// Set the creation and modification date/times
setModifyDate( finfo.getModifyDateTime());
setCreationDate( finfo.getCreationDateTime());
// Set the file id and relative path
if ( finfo.getPath() != null)
{
setFileId( finfo.getPath().hashCode());
setFullName( finfo.getPath());
}
}
示例10: getPathForNode
import org.alfresco.jlan.server.filesys.FileInfo; //导入依赖的package包/类
/**
* Convert a node into a share relative path
*/
public String getPathForNode( TreeConnection tree, NodeRef nodeRef)
throws FileNotFoundException
{
// Convert the target node to a path
ContentContext ctx = (ContentContext) tree.getContext();
List<org.alfresco.service.cmr.model.FileInfo> linkPaths = null;
try {
linkPaths = fileFolderService.getNamePath( ctx.getRootNode(), nodeRef);
}
catch ( org.alfresco.service.cmr.model.FileNotFoundException ex)
{
throw new FileNotFoundException();
}
// Build the share relative path to the node
StringBuilder pathStr = new StringBuilder();
for ( org.alfresco.service.cmr.model.FileInfo fInfo : linkPaths) {
pathStr.append( FileName.DOS_SEPERATOR);
pathStr.append( fInfo.getName());
}
// Return the share relative path
return pathStr.toString();
}
示例11: getPathForNode
import org.alfresco.jlan.server.filesys.FileInfo; //导入依赖的package包/类
/**
* Convert a node into a share relative path
*
* @param rootNode rootNode
* @param nodeRef NodeRef
* @return String
* @exception FileNotFoundException
*/
private String getPathForNode( NodeRef rootNode, NodeRef nodeRef)
throws FileNotFoundException
{
if(logger.isDebugEnabled())
{
logger.debug("getPathForNode:" + nodeRef);
}
List<org.alfresco.service.cmr.model.FileInfo> linkPaths = null;
try
{
linkPaths = fileFolderService.getNamePath( rootNode, nodeRef);
}
catch ( org.alfresco.service.cmr.model.FileNotFoundException ex)
{
throw new FileNotFoundException();
}
// Build the share relative path to the node
StringBuilder pathStr = new StringBuilder();
for ( org.alfresco.service.cmr.model.FileInfo fInfo : linkPaths)
{
pathStr.append( FileName.DOS_SEPERATOR);
pathStr.append( fInfo.getName());
}
// Return the share relative path
return pathStr.toString();
}
示例12: getDotInfo
import org.alfresco.jlan.server.filesys.FileInfo; //导入依赖的package包/类
/**
* Return the '.' pseudo file entry details
*
* @param finfo FileInfo
* @return boolean
*/
public boolean getDotInfo(FileInfo finfo) {
// Check if the '.' file information is valid
if ( m_dotInfo != null) {
finfo.copyFrom( m_dotInfo);
return true;
}
// File information not valid
return false;
}
示例13: getDotDotInfo
import org.alfresco.jlan.server.filesys.FileInfo; //导入依赖的package包/类
/**
* Return the '..' pseudo file entry details
*
* @param finfo FileInfo
* @return boolean
*/
public boolean getDotDotInfo(FileInfo finfo) {
// Check if the '..' file information is valid
if ( m_dotDotInfo != null) {
finfo.copyFrom( m_dotDotInfo);
return true;
}
// File information not valid
return false;
}
示例14: testGetFileInformation
import org.alfresco.jlan.server.filesys.FileInfo; //导入依赖的package包/类
/**
* Test Get File Information
*/
public void testGetFileInformation() throws Exception
{
logger.debug("testGetFileInformation");
ServerConfiguration scfg = new ServerConfiguration("testServer");
TestServer testServer = new TestServer("testServer", scfg);
final SrvSession testSession = new TestSrvSession(666, testServer, "test", "remoteName");
DiskSharedDevice share = getDiskSharedDevice();
final TreeConnection testConnection = testServer.getTreeConnection(share);
final RetryingTransactionHelper tran = transactionService.getRetryingTransactionHelper();
class TestContext
{
NodeRef testNodeRef;
};
final TestContext testContext = new TestContext();
/**
* Test 1 : Get the root info
*/
FileInfo finfo = driver.getFileInformation(testSession, testConnection, "");
assertNotNull("root info is null", finfo);
assertEquals("root has a unexpected file name", "", finfo.getFileName());
}
示例15: getOrCreateNode
import org.alfresco.jlan.server.filesys.FileInfo; //导入依赖的package包/类
/**
* Searching for file object with specified name or creating new one if such object is not exist
*
* @param parentRef - {@link NodeRef} of desired parent object
* @param name - {@link String} value for name of desired file object
* @param type - {@link QName} instance which determines type of the object. It may be cm:content, cm:folder etc (see {@link ContentModel})
* @return {@link Pair}<{@link org.alfresco.service.cmr.model.FileInfo}, {@link Boolean}> instance which contains {@link NodeRef} of newly created object and
* <code>true</code> value if file object with specified name was not found or {@link NodeRef} of existent file object and <code>false</code> in other case
*/
private Pair<org.alfresco.service.cmr.model.FileInfo, Boolean> getOrCreateNode(NodeRef parentRef, String name, QName type)
{
NodeRef result = nodeService.getChildByName(parentRef, ContentModel.ASSOC_CONTAINS, name);
Boolean created = false;
if (null == result)
{
result = nodeService.getChildByName(parentRef, ContentModel.ASSOC_CHILDREN, name);
}
if (created = (null == result))
{
result = fileFolderService.create(parentRef, name, type).getNodeRef();
}
return new Pair<org.alfresco.service.cmr.model.FileInfo, Boolean>(fileFolderService.getFileInfo(result), created);
}