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


Java DiskSharedDevice类代码示例

本文整理汇总了Java中org.alfresco.jlan.server.filesys.DiskSharedDevice的典型用法代码示例。如果您正苦于以下问题:Java DiskSharedDevice类的具体用法?Java DiskSharedDevice怎么用?Java DiskSharedDevice使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DiskSharedDevice类属于org.alfresco.jlan.server.filesys包,在下文中一共展示了DiskSharedDevice类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createHomeDiskShare

import org.alfresco.jlan.server.filesys.DiskSharedDevice; //导入依赖的package包/类
/**
 * Create a disk share for the home folder
 * 
 * @param homeFolderRef nodeRef
 * @param userName user name
 * @return DiskSharedDevice
 */
private final DiskSharedDevice createHomeDiskShare(NodeRef homeFolderRef, String userName)
{
    //  Create the disk driver and context
    logger.debug("create home share for user " + userName);
    
    DiskInterface diskDrv = getRepoDiskInterface();
   
    ContentContext diskCtx = new ContentContext( getHomeFolderName(), "", "", homeFolderRef);
    
    if ( getQuotaManager() != null)
    {
        diskCtx.setQuotaManager( getQuotaManager());
    }
    
    ServerConfigurationBean config = (ServerConfigurationBean)m_config;            
    config.initialiseRuntimeContext("cifs.home." + userName, diskCtx);

    //  Create a temporary shared device for the users home directory
    return new DiskSharedDevice(getHomeFolderName(), diskDrv, diskCtx, SharedDevice.Temporary);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:28,代码来源:HomeShareMapper.java

示例2: SmbServerConfiguration

import org.alfresco.jlan.server.filesys.DiskSharedDevice; //导入依赖的package包/类
public SmbServerConfiguration(final String hostname, final String domainName, final String localPath, final String shareName, final DiskInterface diskDriver) throws InvalidConfigurationException, DeviceContextException {
    super(hostname);

    setServerName(hostname);

    createDebugConfigSection(this);
    createCoreServerConfigSection(this);
    createGlobalConfigSection(this);
    createCifsConfigSection(this, hostname, domainName);

    final SecurityConfigSection securityConfigSection = createSecurityConfigSection(this);
    final FilesystemsConfigSection filesystemsConfigSection = createFilesystemsConfigSection(this);

    // Create and start disk share
    final DiskSharedDevice diskShare = createDiskShare(localPath, shareName, diskDriver, securityConfigSection);
    diskShare.setConfiguration(this);
    diskShare.setAccessControlList(securityConfigSection.getGlobalAccessControls());

    ((DiskDeviceContext) diskShare.getContext()).startFilesystem(diskShare);

    filesystemsConfigSection.addShare(diskShare);
}
 
开发者ID:raqet,项目名称:acquisition-server,代码行数:23,代码来源:SmbServerConfiguration.java

示例3: initializeAction

import org.alfresco.jlan.server.filesys.DiskSharedDevice; //导入依赖的package包/类
/**
 * Initialize the desktop action
 * 
 * @param global ConfigElement
 * @param config ConfigElement
 * @param fileSys DiskSharedDevice
 * @exception DesktopActionException
 */
public void initializeAction(ConfigElement global, ConfigElement config, DiskSharedDevice fileSys)
	throws DesktopActionException
{
       if ( !(fileSys.getContext() instanceof AlfrescoContext))
           throw new DesktopActionException("Desktop action requires an Alfresco filesystem driver");
	// Perform standard initialization
	
	standardInitialize(global, config, fileSys);
	
	AlfrescoDiskDriver driver = (AlfrescoDiskDriver)fileSys.getDiskInterface();
	
       // Complete initialization
       initializeAction(driver.getServiceRegistry(), (AlfrescoContext) fileSys.getDiskContext());       		
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:DesktopAction.java

示例4: getDiskSharedDevice

import org.alfresco.jlan.server.filesys.DiskSharedDevice; //导入依赖的package包/类
private DiskSharedDevice getDiskSharedDevice() throws DeviceContextException
{
    
    ContentContext ctx = new ContentContext( "testContext", STORE_NAME, ROOT_PATH, repositoryHelper.getCompanyHome());
  
    DiskSharedDevice share = new DiskSharedDevice("test", driver, ctx);        
    return share;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:9,代码来源:ContentDiskDriverTest.java

示例5: testGetFileInformation

import org.alfresco.jlan.server.filesys.DiskSharedDevice; //导入依赖的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

示例6: createDiskShare

import org.alfresco.jlan.server.filesys.DiskSharedDevice; //导入依赖的package包/类
private static DiskSharedDevice createDiskShare(final String localPath, final String shareName, final DiskInterface diskDriver, final SecurityConfigSection securityConfigSection) throws DeviceContextException {
    final GenericConfigElement args = new GenericConfigElement("args");
    final GenericConfigElement localPathConfig = new GenericConfigElement("LocalPath");
    localPathConfig.setValue(localPath);
    args.addChild(localPathConfig);

    final DiskDeviceContext diskDeviceContext = (DiskDeviceContext) diskDriver.createContext(shareName, args);
    diskDeviceContext.setShareName(shareName);
    diskDeviceContext.setConfigurationParameters(args);
    diskDeviceContext.enableChangeHandler(false);
    diskDeviceContext.setDiskInformation(new SrvDiskInfo(2560000, 64, 512, 2304000)); // Default to a 80Gb sized disk with 90% free space

    return new DiskSharedDevice(shareName, diskDriver, diskDeviceContext);
}
 
开发者ID:raqet,项目名称:acquisition-server,代码行数:15,代码来源:SmbServerConfiguration.java

示例7: getCIFSServerPath

import org.alfresco.jlan.server.filesys.DiskSharedDevice; //导入依赖的package包/类
/**
 * @param diskShare Filesystem shared device
 * @return CIFS server path as network style string label
 */
public String getCIFSServerPath(DiskSharedDevice diskShare)
{
   if (this.cifsServerPath == null)
   {
      StringBuilder buf = new StringBuilder(32);
      
      String serverName = this.getServerConfiguration().getServerName();
      if (serverName != null && serverName.length() != 0)
      {
         buf.append("\\\\");
         buf.append(serverName);
         
         // Check if there is a suffix to apply to the host name
         if (clientConfig != null && clientConfig.getCifsURLSuffix() != null)
         {
         	buf.append(clientConfig.getCifsURLSuffix());
         }
         
         buf.append("\\");
         buf.append(diskShare.getName());
      }
      
      this.cifsServerPath = buf.toString();
   }
   
   return this.cifsServerPath;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:32,代码来源:NavigationBean.java

示例8: getShareList

import org.alfresco.jlan.server.filesys.DiskSharedDevice; //导入依赖的package包/类
/**
 * Return the list of available shares.
 * 
 * @param host String
 * @param sess SrvSession
 * @param allShares boolean
 * @return SharedDeviceList
 */
public SharedDeviceList getShareList(String host, SrvSession sess, boolean allShares)
{
    // Check if the user has a home folder, and the session does not currently have any
    // dynamic shares defined
    
    if ( sess != null && 
            sess.hasClientInformation() && 
            sess.hasDynamicShares() == false &&
    		sess.getClientInformation() instanceof AlfrescoClientInfo)
    {
        AlfrescoClientInfo client = (AlfrescoClientInfo) sess.getClientInformation();
        
        NodeRef personNode = getPersonService().getPerson(client.getUserName());
        
        if(personNode != null)
        {
            NodeRef homeSpaceRef = (NodeRef)getNodeService().getProperty(personNode, ContentModel.PROP_HOMEFOLDER);
        
            if (homeSpaceRef != null)
            {
                // Create the home folder share                
                DiskSharedDevice homeShare = createHomeDiskShare(homeSpaceRef, client.getUserName());
                sess.addDynamicShare(homeShare);
            
            
                if ( logger.isDebugEnabled())
                {
                    logger.debug("Added " + getHomeFolderName() + " share to list of shares for " + client.getUserName());
                }
            }
        }
    }
    
    // Make a copy of the global share list and add the per session dynamic shares
    
    SharedDeviceList shrList = new SharedDeviceList(getFilesystemsConfigSection().getShares());
    
    if ( sess != null && sess.hasDynamicShares()) {
        
        // Add the per session dynamic shares
        
        shrList.addShares(sess.getDynamicShareList());
    }
      
    // Remove unavailable shares from the list and return the list

    if ( allShares == false)
    {
        shrList.removeUnavailableShares();
    }
    return shrList;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:61,代码来源:HomeShareMapper.java

示例9: createTenantShare

import org.alfresco.jlan.server.filesys.DiskSharedDevice; //导入依赖的package包/类
/**
 * Create a tenant domain specific share
 */
private final DiskSharedDevice createTenantShare(String tenantDomain)
{
    logger.debug("create tenant share for domain " + tenantDomain);
       StoreRef storeRef = new StoreRef(getStoreName());
       NodeRef rootNodeRef = new NodeRef(storeRef.getProtocol(), storeRef.getIdentifier(), "dummy"); 
       
       // Root nodeRef is required for storeRef part
       
       rootNodeRef = m_alfrescoConfig.getTenantService().getRootNode(
               m_alfrescoConfig.getNodeService(), 
               m_alfrescoConfig.getSearchService(),
       		m_alfrescoConfig.getNamespaceService(), 
       		getRootPath(), 
       		rootNodeRef);

       //  Create the disk driver and context

       DiskInterface diskDrv = getRepoDiskInterface();
       ContentContext diskCtx = new ContentContext(m_tenantShareName, getStoreName(), getRootPath(), rootNodeRef);
       
       // Set a quota manager for the share, if enabled
       
       if ( m_quotaManager != null)
       {
       	diskCtx.setQuotaManager( m_quotaManager);
       }
       
       if(m_config instanceof ServerConfigurationBean)
       {
           ServerConfigurationBean config = (ServerConfigurationBean)m_config;
           
           config.initialiseRuntimeContext("cifs.tenant." + tenantDomain, diskCtx);
       }
       else
       {
           throw new AlfrescoRuntimeException("configuration error, unknown configuration bean");
       }
       
       //  Default the filesystem to look like an 80Gb sized disk with 90% free space

       diskCtx.setDiskInformation(new SrvDiskInfo(2560, 64, 512, 2304));

       //  Create a temporary shared device for the user to access the tenant company home directory

       return new DiskSharedDevice(m_tenantShareName, diskDrv, diskCtx);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:50,代码来源:MultiTenantShareMapper.java

示例10: standardInitialize

import org.alfresco.jlan.server.filesys.DiskSharedDevice; //导入依赖的package包/类
/**
 * Perform standard desktop action initialization
 * 
 * @param global ConfigElement
 * @param config ConfigElement
 * @param fileSys DiskSharedDevice
 * @exception DesktopActionException
 */
public void standardInitialize(ConfigElement global, ConfigElement config, DiskSharedDevice fileSys)
	throws DesktopActionException
{
	// Check for standard config values
	ConfigElement elem = config.getChild("name");
	if ( elem != null && elem.getValue().length() > 0)
	{
		// Set the action name
		
		setName(elem.getValue());
	}
	else
		throw new DesktopActionException("Desktop action name not specified");
	
	// Get the pseudo file name
	
	ConfigElement name = config.getChild("filename");
	if ( name == null || name.getValue() == null || name.getValue().length() == 0)
		throw new DesktopActionException("Desktop action pseudo name not specified");
	setFilename(name.getValue());
	
	// Get the local path to the executable
	
	ConfigElement path = findConfigElement("path", global, config);
	if ( path == null || path.getValue() == null || path.getValue().length() == 0)
		throw new DesktopActionException("Desktop action executable path not specified");
	setPath(path.getValue());
	
	// Check if confirmations should be switched off for the action
	
	if ( findConfigElement("noConfirm", global, config) != null && hasPreProcessAction(PreConfirmAction))
		setPreProcessActions(getPreProcessActions() - PreConfirmAction);
	
	// Check if the webapp URL has been specified
	
	ConfigElement webURL = findConfigElement("webpath", global, config);
	if ( webURL != null && webURL.getValue() != null && webURL.getValue().length() > 0)
	{
	    setWebappURL(webURL.getValue());
	}
	
	// Check if debug output is enabled for the action
	
	ConfigElement debug = findConfigElement("debug", global, config);
	if ( debug != null)
		setDebug(true);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:56,代码来源:DesktopAction.java

示例11: standardInitialize

import org.alfresco.jlan.server.filesys.DiskSharedDevice; //导入依赖的package包/类
/**
    * Perform standard desktop action initialization
    * 
    * @param global ConfigElement
    * @param config ConfigElement
    * @param fileSys DiskSharedDevice
    * @exception DesktopActionException
    */
   @Override
   public void standardInitialize(ConfigElement global, ConfigElement config, DiskSharedDevice fileSys)
       throws DesktopActionException
   {
	// Perform standard initialization
	super.standardInitialize(global, config, fileSys);
	
	// Get the script file name and check that it exists
	
	ConfigElement elem = config.getChild("script");
	if ( elem != null && elem.getValue().length() > 0)
	{
		// Set the script name
		setScriptName(elem.getValue());
	}
	else
		throw new DesktopActionException("Script name not specified");
	
	// check if the desktop action attributes have been specified
	
	elem = config.getChild("attributes");
	if ( elem != null)
	{
		// Check if the attribute string is empty
		
		if ( elem.getValue().length() == 0)
			throw new DesktopActionException("Empty desktop action attributes");
		
		// Parse the attribute string
		setAttributeList(elem.getValue());
	}
	
	// Check if the desktop action pre-processing options have been specified
	
	elem = config.getChild("preprocess");
	if ( elem != null)
	{
	    setPreprocess(elem.getValue());
	}
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:49,代码来源:JavaScriptDesktopAction.java

示例12: testDeleteFile

import org.alfresco.jlan.server.filesys.DiskSharedDevice; //导入依赖的package包/类
/**
 * Unit test of delete file
 */
public void testDeleteFile() throws Exception
{
    logger.debug("testDeleteFile");
    
    ServerConfiguration scfg = new ServerConfiguration("testServer");
    TestServer testServer = new TestServer("testServer", scfg);
    SrvSession testSession = new TestSrvSession(666, testServer, "test", "remoteName");
    DiskSharedDevice share = getDiskSharedDevice();

    TreeConnection testConnection = testServer.getTreeConnection(share);
    
    final RetryingTransactionHelper tran = transactionService.getRetryingTransactionHelper();

    /**
     * Step 1 : Create a new file in read/write mode and add some content.
     */
    int openAction = FileAction.CreateNotExist;
    String FILE_PATH="\\testDeleteFile.new";
      
    FileOpenParams params = new FileOpenParams(FILE_PATH, openAction, AccessMode.ReadWrite, FileAttribute.NTNormal, 0);
            
    final NetworkFile file = driver.createFile(testSession, testConnection, params);
    assertNotNull("file is null", file);
    assertFalse("file is read only, should be read-write", file.isReadOnly());
        
    RetryingTransactionCallback<Void> writeStuffCB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable
        {
            byte[] stuff = "Hello World".getBytes();
            file.writeFile(stuff, stuff.length, 0, 0);
            file.close();  // needed to actually flush content to node
            return null;
        }
    };
    tran.doInTransaction(writeStuffCB);
             
    /**
      * Step 1: Delete file by path
      */
    driver.deleteFile(testSession, testConnection, FILE_PATH);
    
    /**
     * Step 2: Negative test - Delete file again
     */
    try
    {
        driver.deleteFile(testSession, testConnection, FILE_PATH);
        fail("delete a non existent file");
    }
    catch (IOException fe)
    {
            // expect to go here
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:60,代码来源:ContentDiskDriverTest.java

示例13: testFileExists

import org.alfresco.jlan.server.filesys.DiskSharedDevice; //导入依赖的package包/类
/**
 * Unit test of file exists
 */
public void testFileExists() throws Exception
{
    logger.debug("testFileExists");
    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();
    
    final String FILE_PATH= TEST_ROOT_DOS_PATH + "\\testFileExists.new";
    
    class TestContext
    {
    };
    
    final TestContext testContext = new TestContext();
   
    /**
     * Step 1 : Call FileExists for a directory which does not exist
     */
    logger.debug("Step 1, negative test dir does not exist");
    int status = driver.fileExists(testSession, testConnection, TEST_ROOT_DOS_PATH);
    assertEquals(status, 0);
  
    /**
     * Step 2 : Call FileExists for a file which does not exist
     */
    logger.debug("Step 2, negative test file does not exist");
    status = driver.fileExists(testSession, testConnection, FILE_PATH);
    assertEquals(status, 0);
    
    /**
     * Step 3: Create a new file in read/write mode and add some content.
     */
    int openAction = FileAction.CreateNotExist;

    FileOpenParams params = new FileOpenParams(FILE_PATH, openAction, AccessMode.ReadWrite, FileAttribute.NTNormal, 0);
    FileOpenParams dirParams = new FileOpenParams(TEST_ROOT_DOS_PATH, 0, AccessMode.ReadOnly, FileAttribute.NTDirectory, 0);
 
    driver.createDirectory(testSession, testConnection, dirParams);        
    final NetworkFile file = driver.createFile(testSession, testConnection, params);
    assertNotNull("file is null", file);
    assertFalse("file is read only, should be read-write", file.isReadOnly());
    
    RetryingTransactionCallback<Void> createFileCB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable
        {
            byte[] stuff = "Hello World".getBytes();
            file.writeFile(stuff, stuff.length, 0, 0);
            driver.closeFile(testSession, testConnection, file);
        
            return null;
        }
    };
    tran.doInTransaction(createFileCB, false, true);
     
    status = driver.fileExists(testSession, testConnection, FILE_PATH);
    assertEquals(status, 1);
     
    /**
      * Step 4 : Delete the node - check status goes back to 0
      */
    logger.debug("Step 4, successfully delete node");
    driver.deleteFile(testSession, testConnection, FILE_PATH);
    
    status = driver.fileExists(testSession, testConnection, FILE_PATH);
    assertEquals(status, 0);  
   
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:76,代码来源:ContentDiskDriverTest.java

示例14: testScenarioRenameVersionableFile

import org.alfresco.jlan.server.filesys.DiskSharedDevice; //导入依赖的package包/类
/**
 * Unit test of rename versionable file
 */
public void testScenarioRenameVersionableFile() throws Exception
{  
    logger.debug("testScenarioRenameVersionableFile");
    
    ServerConfiguration scfg = new ServerConfiguration("testServer");
    TestServer testServer = new TestServer("testServer", scfg);
    SrvSession testSession = new TestSrvSession(666, testServer, "test", "remoteName");
    DiskSharedDevice share = getDiskSharedDevice();
    final TreeConnection testConnection = testServer.getTreeConnection(share);
    
    final RetryingTransactionHelper tran = transactionService.getRetryingTransactionHelper();

    final String FILE_PATH1=TEST_ROOT_DOS_PATH + "\\SourceFile1.new";
    final String FILE_PATH2=TEST_ROOT_DOS_PATH + "\\SourceFile2.new";
    
    class TestContext
    {
    };
    
    final TestContext testContext = new TestContext();
   
    FileOpenParams dirParams = new FileOpenParams(TEST_ROOT_DOS_PATH, 0, AccessMode.ReadOnly, FileAttribute.NTDirectory, 0);
    driver.createDirectory(testSession, testConnection, dirParams);

    FileOpenParams params1 = new FileOpenParams(FILE_PATH1, 0, AccessMode.ReadWrite, FileAttribute.NTNormal, 0);
    NetworkFile file1 = driver.createFile(testSession, testConnection, params1);
    
    /**
     * Make Node 1 versionable
     */
    final String LAST_NAME= "Bloggs";
     
    RetryingTransactionCallback<Void> makeVersionableCB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable
        {
            NodeRef file1NodeRef = getNodeForPath(testConnection, FILE_PATH1);
            nodeService.addAspect(file1NodeRef, ContentModel.ASPECT_VERSIONABLE, null);
            
            ContentWriter contentWriter2 = contentService.getWriter(file1NodeRef, ContentModel.PROP_CONTENT, true);
            contentWriter2.putContent("test rename versionable");
            
            nodeService.setProperty(file1NodeRef, ContentModel.PROP_LASTNAME, LAST_NAME);
            nodeService.setProperty(file1NodeRef, TransferModel.PROP_ENDPOINT_PROTOCOL, "http");

            return null;
        }
    };
    tran.doInTransaction(makeVersionableCB, false, true);
  
    /**
     * Step 1: Successfully rename a versionable file - check the name, props and content.
     * TODO Check primary assoc, peer assocs, child assocs, modified date, created date, nodeid, permissions.
     */
    driver.renameFile(testSession, testConnection, FILE_PATH1, FILE_PATH2);
    
    RetryingTransactionCallback<Void> validateVersionableCB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable
        {
            NodeRef file2NodeRef = getNodeForPath(testConnection, FILE_PATH2);
            assertNotNull("file2 node ref is null", file2NodeRef);
            //assertEquals(nodeService.getProperty(file2NodeRef, ContentModel.PROP_LASTNAME), LAST_NAME);
            assertTrue("does not have versionable aspect", nodeService.hasAspect(file2NodeRef, ContentModel.ASPECT_VERSIONABLE));   
            assertTrue("sample property is null", nodeService.getProperty(file2NodeRef, TransferModel.PROP_ENDPOINT_PROTOCOL) != null);     
            
            return null;
        }
    };
    tran.doInTransaction(validateVersionableCB, false, true);

}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:78,代码来源:ContentDiskDriverTest.java

示例15: testDirListing

import org.alfresco.jlan.server.filesys.DiskSharedDevice; //导入依赖的package包/类
public void testDirListing()throws Exception
{
    logger.debug("testDirListing");
    ServerConfiguration scfg = new ServerConfiguration("testServer");
    TestServer testServer = new TestServer("testServer", scfg);
    SrvSession testSession = new TestSrvSession(666, testServer, "test", "remoteName");
    DiskSharedDevice share = getDiskSharedDevice();
    TreeConnection testConnection = testServer.getTreeConnection(share);
    final RetryingTransactionHelper tran = transactionService.getRetryingTransactionHelper();
    
    final String FOLDER_NAME = "parentFolder" + System.currentTimeMillis();
    final String HIDDEN_FOLDER_NAME = "hiddenFolder" + System.currentTimeMillis();
    RetryingTransactionCallback<NodeRef> createNodesCB = new RetryingTransactionCallback<NodeRef>() {

        @Override
        public NodeRef execute() throws Throwable
        {
            NodeRef companyHome = repositoryHelper.getCompanyHome();
            NodeRef parentNode = nodeService.createNode(companyHome, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, FOLDER_NAME), ContentModel.TYPE_FOLDER).getChildRef();
            nodeService.setProperty(parentNode, ContentModel.PROP_NAME, FOLDER_NAME);
            
            NodeRef hiddenNode = nodeService.createNode(parentNode, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, HIDDEN_FOLDER_NAME), ForumModel.TYPE_FORUM).getChildRef();
            nodeService.setProperty(hiddenNode, ContentModel.PROP_NAME, HIDDEN_FOLDER_NAME);
            return parentNode;
        }
    };
    final NodeRef parentFolder = tran.doInTransaction(createNodesCB);
    
    List<String> excludedTypes = new ArrayList<String>();
    excludedTypes.add(ForumModel.TYPE_FORUM.toString());
    cifsHelper.setExcludedTypes(excludedTypes);
    SearchContext result = driver.startSearch(testSession, testConnection, "\\"+FOLDER_NAME + "\\*", 0);
    while(result.hasMoreFiles())
    {
        if (result.nextFileName().equals(HIDDEN_FOLDER_NAME))
        {
            fail("Exluded types mustn't be shown in cifs");    
        } 
    }

    RetryingTransactionCallback<Void> deleteNodeCB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable
        {
            nodeService.deleteNode(parentFolder);
            return null;
        }
    };
    tran.doInTransaction(deleteNodeCB, false, true);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:52,代码来源:ContentDiskDriverTest.java


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