Search in sources :

Example 1 with SharedDevice

use of org.alfresco.jlan.server.core.SharedDevice in project alfresco-repository by Alfresco.

the class BufferedContentDiskDriver method getFileInformationInternal.

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;
}
Also used : FileInfo(org.alfresco.jlan.server.filesys.FileInfo) SharedDevice(org.alfresco.jlan.server.core.SharedDevice)

Example 2 with SharedDevice

use of org.alfresco.jlan.server.core.SharedDevice in project alfresco-repository by Alfresco.

the class MultiTenantShareMapper method deleteShares.

/**
 * Delete temporary shares for the specified session
 *
 * @param sess SrvSession
 */
public void deleteShares(SrvSession sess) {
    if (sess.hasDynamicShares() == false)
        return;
    // Delete the dynamic shares
    SharedDeviceList shares = sess.getDynamicShareList();
    Enumeration<SharedDevice> enm = shares.enumerateShares();
    while (enm.hasMoreElements()) {
        // Get the current share from the list
        SharedDevice shr = enm.nextElement();
        // Close the shared device
        shr.getContext().CloseContext();
    }
}
Also used : SharedDeviceList(org.alfresco.jlan.server.core.SharedDeviceList) DiskSharedDevice(org.alfresco.jlan.server.filesys.DiskSharedDevice) SharedDevice(org.alfresco.jlan.server.core.SharedDevice)

Aggregations

SharedDevice (org.alfresco.jlan.server.core.SharedDevice)2 SharedDeviceList (org.alfresco.jlan.server.core.SharedDeviceList)1 DiskSharedDevice (org.alfresco.jlan.server.filesys.DiskSharedDevice)1 FileInfo (org.alfresco.jlan.server.filesys.FileInfo)1