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


Java FileInfo類代碼示例

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

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

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

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

示例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;
}
 
開發者ID:raqet,項目名稱:acquisition-server,代碼行數:23,代碼來源:RemotePseudoFile.java

示例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);
    }
}
 
開發者ID:raqet,項目名稱:acquisition-server,代碼行數:17,代碼來源:RemoteNetworkFile.java

示例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);

}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:8,代碼來源:NonTransactionalRuleContentDiskDriver.java

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

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

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

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

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

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

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

示例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}&lt;{@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);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:24,代碼來源:ContentDiskDriverTest.java


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