Morning merge.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@2959 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-05-23 16:39:21 +00:00
parent 7440ae18a6
commit a5d07e1069
18 changed files with 179 additions and 31 deletions

View File

@@ -214,16 +214,21 @@ public class CifsHelper
// Check the lock status of the file
if ( hasLockedFilesAsOffline())
{
String lockTypeStr = (String) nodeProperties.get(ContentModel.PROP_LOCK_TYPE);
String lockTypeStr = (String) nodeProperties.get(ContentModel.PROP_LOCK_TYPE);
if ( lockTypeStr != null)
{
// File is locked so mark it as offline
fileInfo.setFileAttributes(fileInfo.getFileAttributes() + FileAttribute.NTOffline);
}
if ( lockTypeStr != null)
{
// File is locked so mark it as read-only and offline
int attr = fileInfo.getFileAttributes();
if (( attr & FileAttribute.ReadOnly) == 0)
attr += FileAttribute.ReadOnly;
if ( hasLockedFilesAsOffline())
attr += FileAttribute.NTOffline;
fileInfo.setFileAttributes( attr);
}
}

View File

@@ -226,4 +226,24 @@ public class ContentContext extends DiskDeviceContext
{
m_urlFileName = urlFileName;
}
/**
* Close the filesystem context
*/
public void CloseContext() {
// Check if file states are enabled
if ( hasStateTable())
{
// Shutdown the file state checker thread
getStateTable().shutdownRequest();
}
// Call the base class
super.CloseContext();
}
}

View File

@@ -519,20 +519,24 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
{
// Get the file information for the node
session.beginTransaction(transactionService, true);
finfo = cifsHelper.getFileInformation(nodeRef);
// DEBUG
if ( logger.isDebugEnabled())
if ( logger.isInfoEnabled())
logger.debug("getInfo using cached noderef for path " + path);
}
// If the required node was not in the state cache, the parent folder node might be
session.beginTransaction(transactionService, true);
if ( finfo == null)
{
// Start a transaction
session.beginTransaction(transactionService, true);
String[] paths = FileName.splitPath( path);
if ( paths[0] != null && paths[0].length() > 1)
@@ -548,7 +552,7 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
// DEBUG
if ( logger.isDebugEnabled())
if ( logger.isInfoEnabled())
logger.debug("getInfo using cached noderef for parent " + path);
}
}
@@ -906,6 +910,13 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
if ( params.hasAccessMode(AccessMode.NTDelete) &&
permissionService.hasPermission(nodeRef, PermissionService.DELETE) == AccessStatus.DENIED)
throw new AccessDeniedException("No delete access to " + params.getFullPath());
// Check if the file has a lock
String lockTypeStr = (String) nodeService.getProperty( nodeRef, ContentModel.PROP_LOCK_TYPE);
if ( params.hasAccessMode(AccessMode.NTWrite) && lockTypeStr != null)
throw new AccessDeniedException("File is locked, no write access to " + params.getFullPath());
// Check if there is a file state for the file
@@ -1042,7 +1053,7 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
// DEBUG
if ( logger.isDebugEnabled())
if ( logger.isInfoEnabled())
logger.debug("Create file using cached noderef for path " + paths[0]);
}
}
@@ -1084,6 +1095,7 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
" node: " + nodeRef + "\n" +
" network file: " + netFile);
}
return netFile;
}
catch (org.alfresco.repo.security.permissions.AccessDeniedException ex)
@@ -1860,6 +1872,12 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
// check that the node exists
if (nodeService.exists(fstate.getNodeRef()))
{
// Bump the file states expiry time
fstate.setExpiryTime(System.currentTimeMillis() + FileState.DefTimeout);
// Return the cached noderef
return fstate.getNodeRef();
}
else

View File

@@ -50,6 +50,14 @@ public class FileStateTable implements Runnable
private long m_cacheTimer = 2 * 60000L; // 2 minutes default
// File state checker thread
private Thread m_thread;
// Shutdown request flag
private boolean m_shutdown;
/**
* Class constructor
*/
@@ -59,10 +67,10 @@ public class FileStateTable implements Runnable
// Start the expired file state checker thread
Thread th = new Thread(this);
th.setDaemon(true);
th.setName("FileStateExpire");
th.start();
m_thread = new Thread(this);
m_thread.setDaemon(true);
m_thread.setName("FileStateExpire");
m_thread.start();
}
/**
@@ -366,7 +374,9 @@ public class FileStateTable implements Runnable
// Loop forever
while (true)
m_shutdown = false;
while ( m_shutdown == false)
{
// Sleep for the required interval
@@ -379,6 +389,18 @@ public class FileStateTable implements Runnable
{
}
// Check for shutdown
if ( m_shutdown == true)
{
// Debug
if ( logger.isDebugEnabled())
logger.debug("FileStateExpire thread closing");
return;
}
try
{
@@ -401,6 +423,22 @@ public class FileStateTable implements Runnable
}
}
/**
* Request the file state checker thread to shutdown
*/
public final void shutdownRequest() {
m_shutdown = true;
if ( m_thread != null)
{
try {
m_thread.interrupt();
}
catch (Exception ex) {
}
}
}
/**
* Dump the state cache entries to the specified stream
*/