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


Java SrvSession类代码示例

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


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

示例1: getPseudoFile

import org.alfresco.jlan.server.SrvSession; //导入依赖的package包/类
/**
 * Return the pseudo file for the specified path, or null if the path is not a pseudo file
 * 
 * @param sess SrvSession
 * @param tree TreeConnection
 * @param path String
 * @return PseudoFile
 */
public PseudoFile getPseudoFile(SrvSession sess, TreeConnection tree, String path)
{
    // Check if the path is for a pseudo file
    
    ContentContext ctx = (ContentContext) tree.getContext();
    
    String[] paths = FileName.splitPath( path);
    FileState fstate = getStateForPath( ctx, paths[0]);
    
    if ( fstate != null && fstate.hasPseudoFiles())
    {
        // Check if there is a matching pseudo file
        
        PseudoFile pfile = fstate.getPseudoFileList().findFile( paths[1], false);
        if ( pfile != null)
            return pfile;
    }
    
    // Not a pseudo file
    
    return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:31,代码来源:PseudoFileImpl.java

示例2: procRunActionInTransaction

import org.alfresco.jlan.server.SrvSession; //导入依赖的package包/类
private final DataBuffer procRunActionInTransaction( final SrvSession sess, final TreeConnection tree, final DataBuffer reqBuf, final NodeRef folderNode,
        final NetworkFile netFile, final Object contentDriver, final ContentContext contentContext)
{

    RetryingTransactionHelper helper = transactionService.getRetryingTransactionHelper();
    
    RetryingTransactionCallback<DataBuffer> notifyCB = new RetryingTransactionCallback<DataBuffer>() {

     @Override
     public DataBuffer execute() throws Throwable
     {
     	return procRunAction(sess, tree, reqBuf, folderNode,
                 netFile, contentDriver, contentContext);
     }
 };
    
 // Require a new read/write transaction
    return helper.doInTransaction(notifyCB, false, true);
	
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:ContentIOControlHandler.java

示例3: findTenantShare

import org.alfresco.jlan.server.SrvSession; //导入依赖的package包/类
/**
 * Find a share for a tenant
 * 
 * @param host String
 * @param name String
 * @param typ int
 * @param sess SrvSession
 * @param create boolean
 * @return SharedDevice
 * @exception InvalidUserException
 */
private final SharedDevice findTenantShare(String host, String name, int typ, SrvSession sess, boolean create)
    throws InvalidUserException {

	// Get the share list for the tenant
	
	SharedDeviceList shareList = getTenantShareList(host, sess, true);
	if ( shareList == null)
	{    
		return null;
	}
	
	// Search for the required share in the list of shares for the tennant
	
	return shareList.findShare( name, typ, true);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:MultiTenantShareMapper.java

示例4: createDirectory

import org.alfresco.jlan.server.SrvSession; //导入依赖的package包/类
@Override
public void createDirectory(SrvSession sess, TreeConnection tree,
        FileOpenParams params) throws IOException
{
	try
	{
        FileFilterMode.setClient(ClientHelper.getClient(sess));
        try
        {
            diskInterface.createDirectory(sess, tree, params);
        }
        finally
        {
            FileFilterMode.clearClient();
        }
	}
    catch(org.alfresco.repo.security.permissions.AccessDeniedException ade)
    {
	    throw new AccessDeniedException("Unable to create directory " +  params.getPath(), ade);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:NonTransactionalRuleContentDiskDriver.java

示例5: getDriverState

import org.alfresco.jlan.server.SrvSession; //导入依赖的package包/类
/**
 * Get the driver state from the session.
 * @param sess SrvSession
 * @return the driver state.
 */
private DriverState getDriverState(SrvSession sess)
{
    synchronized (sess)
    {
        // Get the driver state
        Object state = sess.getDriverState();
        if(state == null)
        {
            state = new DriverState();
            sess.setDriverState(state);
            if(logger.isDebugEnabled())
            {
                logger.debug("new driver state created");
            }

        }
        DriverState driverState = (DriverState)state;
        return driverState;
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:NonTransactionalRuleContentDiskDriver.java

示例6: prepareTestConditions

import org.alfresco.jlan.server.SrvSession; //导入依赖的package包/类
private TestContext prepareTestConditions(boolean autoCreatePeopleOnLogin, String userName) throws Exception
{
    UserRegistrySynchronizer userRegistrySynchronizer = makeUserRegistrySynchronizerStub(autoCreatePeopleOnLogin);
    ((AbstractAuthenticationComponent) cifsAuthenticator.getAuthenticationComponent()).setUserRegistrySynchronizer(userRegistrySynchronizer);

    ClientInfo client = mock(AlfrescoClientInfo.class);
    client.setUserName(userName);
    SrvSession sess = mock(SMBSrvSession.class);
    sess.setUniqueId(userName);
    // add getter to the original class, otherwise reflection should be used to add session to private field
    AuthenticateSession as = mock(AuthenticateSession.class);
    // assume successful passthru authentication
    doNothing().when(as).doSessionSetup(anyString(), anyString(), anyString(), any(byte[].class), any(byte[].class), anyInt());
    PassthruDetails pd = new PassthruDetails(sess, as);
    cifsAuthenticator.getSessions().put(userName, pd);

    return new TestContext(client, sess);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:CifsAuthenticatorPassthruTest.java

示例7: deleteFile

import org.alfresco.jlan.server.SrvSession; //导入依赖的package包/类
@Override
public void deleteFile(SrvSession sess, TreeConnection tree, String name)
        throws IOException
{
    ContentContext tctx = (ContentContext) tree.getContext();

    diskInterface.deleteFile(sess, tree, name);
    
    if(tctx.hasStateCache())
    {
        FileStateCache cache = tctx.getStateCache();
        FileState fstate = cache.findFileState( name, false);
        
        if(fstate != null)
        {
            fstate.setFileStatus(FileStatus.NotExist);
            fstate.setOpenCount(0);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:LegacyFileStateDriver.java

示例8: renameFile

import org.alfresco.jlan.server.SrvSession; //导入依赖的package包/类
@Override
public void renameFile(SrvSession sess, TreeConnection tree,
        String oldName, String newName) throws IOException
{
    ContentContext tctx = (ContentContext) tree.getContext();
    
    diskInterface.renameFile(sess, tree, oldName, newName);  
    
    if(tctx.hasStateCache())
    {
        FileStateCache cache = tctx.getStateCache();
        FileState fstate = cache.findFileState( oldName, false);
        
        if(fstate != null)
        {
            if(logger.isDebugEnabled())
            {
                logger.debug("rename file state from:" + oldName + ", to:" + newName);
            }
            cache.renameFileState(newName, fstate, fstate.isDirectory());               
        }
    }
    
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:LegacyFileStateDriver.java

示例9: FileInfoKey

import org.alfresco.jlan.server.SrvSession; //导入依赖的package包/类
public FileInfoKey(SrvSession sess, String path, TreeConnection tree)
        {
            this.path = path;
            this.user = sess.getUniqueId();
            this.deviceName = tree.getSharedDevice().getName();
            
//            if(deviceName == null)
//            {
//                throw new RuntimeException("device name is null");
//            }
//            if(path == null)
//            {
//                throw new RuntimeException("path is null");
//            }
//            if(user == null)
//            {
//                throw new RuntimeException("unique id is null");
//            }
        }
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:BufferedContentDiskDriver.java

示例10: reduceQuota

import org.alfresco.jlan.server.SrvSession; //导入依赖的package包/类
/**
 * 
 * @param session
 * @param tree
 * @param file
 */
public void reduceQuota(SrvSession session, TreeConnection tree, NetworkFile file)
{
    if(file.hasDeleteOnClose())
    {
        final ContentContext ctx = (ContentContext) tree.getContext();
        
        if(logger.isDebugEnabled())
        {
            logger.debug("closeFile has delete on close set");
        }

        if(file instanceof TempNetworkFile)
        {
            TempNetworkFile tnf = (TempNetworkFile)file;
            final QuotaManager quotaMgr = ctx.getQuotaManager();
            if (quotaMgr != null)
            {
                try
                {
                    quotaMgr.releaseSpace(session, tree, file.getFileId(), file.getName(), tnf.getFileSizeInt());
                } 
                catch (IOException e)
                {
                    logger.error(e);
                }
            }
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:36,代码来源:ContentDiskDriver2.java

示例11: testGetFileInformation

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

示例12: getShareList

import org.alfresco.jlan.server.SrvSession; //导入依赖的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 that the filesystems configuration is valid
   
	if ( m_filesysConfig == null)
		return null;
   
	//  Check if this is a tenant user
	
	if ( m_alfrescoConfig.getTenantService().isEnabled() && m_alfrescoConfig.getTenantService().isTenantUser())
	{
		return getTenantShareList(host, sess, allShares);
	}
	
	//	Make a copy of the global share list and add the per session dynamic shares
	
	SharedDeviceList shrList = new SharedDeviceList( m_filesysConfig.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,代码行数:41,代码来源:MultiTenantShareMapper.java

示例13: closeFile

import org.alfresco.jlan.server.SrvSession; //导入依赖的package包/类
@Override
public void closeFile(SrvSession sess, TreeConnection tree,
        NetworkFile param) throws IOException
{
    if(logger.isDebugEnabled())
    {
        logger.debug("closeFile:" + param.getFullName());
    }
    
    ContentContext tctx = (ContentContext) tree.getContext();
    NodeRef rootNode = tctx.getRootNode();
    
    DriverState driverState = getDriverState(sess);
         
    String[] paths = FileName.splitPath(param.getFullName());
    String folder = paths[0];
    String file = paths[1];
    
    try
    {
        EvaluatorContext ctx = getEvaluatorContext(driverState, folder);

        Operation o = new CloseFileOperation(file, param, rootNode, param.getFullName(), param.hasDeleteOnClose(), param.isForce());
        Command c = ruleEvaluator.evaluate(ctx, o);
    
        commandExecutor.execute(sess, tree, c);
    
        releaseEvaluatorContextIfEmpty(driverState, ctx, folder);
    }
    catch(org.alfresco.repo.security.permissions.AccessDeniedException ade)
    {
	    throw new AccessDeniedException("Unable to close file " +  param.getFullName(), ade);
    }

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

示例14: deleteDirectory

import org.alfresco.jlan.server.SrvSession; //导入依赖的package包/类
@Override
public void deleteDirectory(SrvSession sess, TreeConnection tree, String dir)
        throws IOException
{
    try
    {
    	diskInterface.deleteDirectory(sess, tree, dir);
    }
    catch(org.alfresco.repo.security.permissions.AccessDeniedException ade)
    {
	    throw new AccessDeniedException("Unable to delete directory " +  dir, ade);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:14,代码来源:NonTransactionalRuleContentDiskDriver.java

示例15: deleteFile

import org.alfresco.jlan.server.SrvSession; //导入依赖的package包/类
@Override
public void deleteFile(SrvSession sess, TreeConnection tree, String name)
        throws IOException
{
    if(logger.isDebugEnabled())
    {
        logger.debug("deleteFile name:" + name);
    }
    try
    {
        ContentContext tctx = (ContentContext) tree.getContext();
        NodeRef rootNode = tctx.getRootNode();
    
        DriverState driverState = getDriverState(sess);
         
        String[] paths = FileName.splitPath(name);
        String folder = paths[0];
        String file = paths[1];
    
        EvaluatorContext ctx = getEvaluatorContext(driverState, folder);

        Operation o = new DeleteFileOperation(file, rootNode, name);
        Command c = ruleEvaluator.evaluate(ctx, o);
        commandExecutor.execute(sess, tree, c);
    
        releaseEvaluatorContextIfEmpty(driverState, ctx, folder);
    }
    catch(org.alfresco.repo.security.permissions.AccessDeniedException ade)
    {
	    throw new AccessDeniedException("Unable to delete file " +  name, ade);
    }
    

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


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