Merged V2.0 to HEAD

5893: AR-1492 AVM and Solaris/NFS


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6164 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-07-04 15:39:42 +00:00
parent 530d129634
commit d87f03ceb4
7 changed files with 372 additions and 284 deletions

View File

@@ -240,7 +240,7 @@ public class AVMContext extends AlfrescoContext
{
// Add a pseudo folder for the new store
rootState.addPseudoFile( new StorePseudoFile( storeName));
rootState.addPseudoFile( new StorePseudoFile( storeName, FileName.DOS_SEPERATOR_STR + storeName));
// DEBUG
@@ -357,7 +357,10 @@ public class AVMContext extends AlfrescoContext
// Add a pseudo folder for the new version
verState.addPseudoFile( new VersionPseudoFile( verName));
pathStr.append( FileName.DOS_SEPERATOR);
pathStr.append( verName);
verState.addPseudoFile( new VersionPseudoFile( verName, pathStr.toString()));
// DEBUG

View File

@@ -721,6 +721,11 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
if ( logger.isDebugEnabled())
logger.debug("Close file " + file.getFullName());
// Start a transaction if the file has been updated
if ( file.getWriteCount() > 0)
sess.beginWriteTransaction( m_transactionService);
// Close the file
file.closeFile();
@@ -1230,6 +1235,7 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
info.setAccessDateTime( nodeDesc.getAccessDate());
info.setCreationDateTime( nodeDesc.getCreateDate());
info.setModifyDateTime( nodeDesc.getModDate());
info.setChangeDateTime( nodeDesc.getModDate());
// Build the file attributes
@@ -1238,9 +1244,9 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
if ( nodeDesc.isDirectory())
attr += FileAttribute.Directory;
if (nodeDesc.getName().startsWith(".")
|| nodeDesc.getName().equalsIgnoreCase("Desktop.ini")
|| nodeDesc.getName().equalsIgnoreCase("Thumbs.db"))
if ( nodeDesc.getName().startsWith( ".") ||
nodeDesc.getName().equalsIgnoreCase( "Desktop.ini") ||
nodeDesc.getName().equalsIgnoreCase( "Thumbs.db"))
attr += FileAttribute.Hidden;
// Mark the file/folder as read-only if not the head version
@@ -2070,6 +2076,7 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
FileState fstate = null;
StringBuilder str = null;
String relPath = null;
switch ( avmPath.isLevel())
{
@@ -2106,8 +2113,7 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
Map<QName, PropertyValue> props = m_avmService.getStoreProperties( storeDesc.getName());
if (props.containsKey(AVMContext.PROP_WORKFLOWPREVIEW)
|| props.containsKey(AVMContext.PROP_AUTHORPREVIEW))
if ( props.containsKey( AVMContext.PROP_WORKFLOWPREVIEW) || props.containsKey( AVMContext.PROP_AUTHORPREVIEW))
sandbox = true;
else
sandbox = false;
@@ -2120,7 +2126,7 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
// Add a pseudo file for the current store
if ( sandbox == false || avmCtx.showSandboxes() == true)
fstate.addPseudoFile(new StorePseudoFile(storeDesc));
fstate.addPseudoFile( new StorePseudoFile( storeDesc, FileName.DOS_SEPERATOR_STR + storeDesc.getName()));
}
}
}
@@ -2139,7 +2145,8 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
// Search for the file state for the store pseudo folder
fstate = avmCtx.getStateTable().findFileState(str.toString());
relPath = str.toString();
fstate = avmCtx.getStateTable().findFileState( relPath);
if ( fstate == null)
{
@@ -2149,11 +2156,17 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
// Add a pseudo file for the head version
fstate.addPseudoFile(new VersionPseudoFile(AVMPath.VersionNameHead));
str.append( FileName.DOS_SEPERATOR);
str.append( AVMPath.VersionNameHead);
fstate.addPseudoFile( new VersionPseudoFile( AVMPath.VersionNameHead, str.toString()));
// Add a pseudo file for the version root folder
fstate.addPseudoFile(new DummyFolderPseudoFile(AVMPath.VersionsFolder));
str.setLength( relPath.length() + 1);
str.append( AVMPath.VersionsFolder);
fstate.addPseudoFile( new DummyFolderPseudoFile( AVMPath.VersionsFolder, str.toString()));
}
break;
@@ -2172,7 +2185,9 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
// Search for the file state for the store head version pseudo folder
fstate = avmCtx.getStateTable().findFileState(str.toString());
relPath = str.toString();
fstate = avmCtx.getStateTable().findFileState( relPath);
if ( fstate == null)
{
@@ -2182,11 +2197,17 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
// Add a pseudo file for the data pseudo folder
fstate.addPseudoFile(new DummyFolderPseudoFile(AVMPath.DataFolder));
str.append( FileName.DOS_SEPERATOR);
str.append( AVMPath.DataFolder);
fstate.addPseudoFile( new DummyFolderPseudoFile( AVMPath.DataFolder, str.toString()));
// Add a pseudo file for the metadata pseudo folder
fstate.addPseudoFile(new DummyFolderPseudoFile(AVMPath.MetaDataFolder));
str.setLength( relPath.length() + 1);
str.append( AVMPath.MetaDataFolder);
fstate.addPseudoFile( new DummyFolderPseudoFile( AVMPath.MetaDataFolder, str.toString()));
}
break;
@@ -2209,7 +2230,8 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
// Create a file state for the store path
fstate = avmCtx.getStateTable().findFileState(str.toString(), true, true);
relPath = str.toString();
fstate = avmCtx.getStateTable().findFileState( relPath, true, true);
// Add pseudo folders if the list is empty
@@ -2222,7 +2244,10 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
// Add a pseudo file for the head version
fstate.addPseudoFile(new VersionPseudoFile(verStr.toString()));
str.append( FileName.DOS_SEPERATOR);
str.append( verStr.toString());
fstate.addPseudoFile( new VersionPseudoFile( verStr.toString(), str.toString()));
// Get the list of versions for the store
@@ -2243,9 +2268,12 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
verName = verStr.toString();
str.setLength( relPath.length() + 1);
str.append( verName);
// Add the version pseudo folder
fstate.addPseudoFile(new VersionPseudoFile(verName, verDesc));
fstate.addPseudoFile( new VersionPseudoFile ( verName, verDesc, str.toString()));
}
}
}
@@ -2272,7 +2300,8 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
// Search for the file state for the version pseudo folder
fstate = avmCtx.getStateTable().findFileState(str.toString());
relPath = str.toString();
fstate = avmCtx.getStateTable().findFileState( relPath);
if ( fstate == null)
{
@@ -2282,11 +2311,17 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
// Add a pseudo file for the data pseudo folder
fstate.addPseudoFile(new DummyFolderPseudoFile(AVMPath.DataFolder));
str.append( FileName.DOS_SEPERATOR);
str.append( AVMPath.DataFolder);
fstate.addPseudoFile( new DummyFolderPseudoFile( AVMPath.DataFolder, str.toString()));
// Add a pseudo file for the metadata pseudo folder
fstate.addPseudoFile(new DummyFolderPseudoFile(AVMPath.MetaDataFolder));
str.setLength( relPath.length() + 1);
str.append( AVMPath.MetaDataFolder);
fstate.addPseudoFile( new DummyFolderPseudoFile( AVMPath.MetaDataFolder, str.toString()));
}
break;
}

View File

@@ -223,6 +223,7 @@ public class AVMNetworkFile extends NetworkFile {
// Set modification flag
m_modified = true;
incrementWriteCount();
// Update the current file size
@@ -329,6 +330,7 @@ public class AVMNetworkFile extends NetworkFile {
// Set modification flag
m_modified = true;
incrementWriteCount();
}
/**

View File

@@ -42,8 +42,9 @@ public class DummyFolderPseudoFile extends PseudoFile {
* Class constructor
*
* @param fname String
* @param relPath String
*/
public DummyFolderPseudoFile( String fname)
public DummyFolderPseudoFile( String fname, String relPath)
{
super( fname, FileAttribute.Directory + FileAttribute.ReadOnly);
@@ -52,6 +53,15 @@ public class DummyFolderPseudoFile extends PseudoFile {
FileInfo fInfo = new FileInfo( fname, 0L, FileAttribute.Directory + FileAttribute.ReadOnly);
fInfo.setCreationDateTime( System.currentTimeMillis());
fInfo.setPath( relPath);
fInfo.setFileId( relPath.hashCode());
long timeNow = System.currentTimeMillis();
fInfo.setCreationDateTime( timeNow);
fInfo.setModifyDateTime( timeNow);
fInfo.setAccessDateTime( timeNow);
fInfo.setChangeDateTime( timeNow);
setFileInfo( fInfo);
}

View File

@@ -178,6 +178,7 @@ public class PseudoFileListSearchContext extends SearchContext {
attr += FileAttribute.Hidden;
info.setFileAttributes( attr);
info.setFileId( pfInfo.getFileId());
}
// Indicate if the file information is valid

View File

@@ -44,15 +44,23 @@ public class StorePseudoFile extends PseudoFile {
* Class constructor
*
* @param storeDesc AVMStoreDescriptor
* @param relPath String
*/
public StorePseudoFile( AVMStoreDescriptor storeDesc)
public StorePseudoFile( AVMStoreDescriptor storeDesc, String relPath)
{
super( storeDesc.getName(), FileAttribute.Directory + FileAttribute.ReadOnly);
// Create static file information from the store details
FileInfo fInfo = new FileInfo( storeDesc.getName(), 0L, FileAttribute.Directory + FileAttribute.ReadOnly);
fInfo.setCreationDateTime( storeDesc.getCreateDate());
fInfo.setModifyDateTime( storeDesc.getCreateDate());
fInfo.setAccessDateTime( storeDesc.getCreateDate());
fInfo.setChangeDateTime( storeDesc.getCreateDate());
fInfo.setPath( relPath);
fInfo.setFileId( relPath.hashCode());
setFileInfo( fInfo);
}
@@ -61,15 +69,24 @@ public class StorePseudoFile extends PseudoFile {
* Class constructor
*
* @param storeName String
* @param relPath String
*/
public StorePseudoFile( String storeName)
public StorePseudoFile( String storeName, String relPath)
{
super( storeName, FileAttribute.Directory + FileAttribute.ReadOnly);
// Create static file information from the store details
FileInfo fInfo = new FileInfo( storeName, 0L, FileAttribute.Directory + FileAttribute.ReadOnly);
fInfo.setCreationDateTime( System.currentTimeMillis());
long timeNow = System.currentTimeMillis();
fInfo.setCreationDateTime( timeNow);
fInfo.setModifyDateTime( timeNow);
fInfo.setAccessDateTime( timeNow);
fInfo.setChangeDateTime( timeNow);
fInfo.setPath( relPath);
fInfo.setFileId( relPath.hashCode());
setFileInfo( fInfo);
}

View File

@@ -44,8 +44,9 @@ public class VersionPseudoFile extends PseudoFile {
* Class constructor
*
* @param name String
* @param relPath String
*/
public VersionPseudoFile( String name)
public VersionPseudoFile( String name, String relPath)
{
super( name, FileAttribute.Directory + FileAttribute.ReadOnly);
@@ -53,6 +54,15 @@ public class VersionPseudoFile extends PseudoFile {
FileInfo fInfo = new FileInfo( name, 0L, FileAttribute.Directory + FileAttribute.ReadOnly);
fInfo.setPath( relPath);
fInfo.setFileId( relPath.hashCode());
long timeNow = System.currentTimeMillis();
fInfo.setCreationDateTime( timeNow);
fInfo.setModifyDateTime( timeNow);
fInfo.setAccessDateTime( timeNow);
fInfo.setChangeDateTime( timeNow);
setFileInfo( fInfo);
}
@@ -61,8 +71,9 @@ public class VersionPseudoFile extends PseudoFile {
*
* @param name String
* @param verDesc VersionDescriptor
* @param relPath String
*/
public VersionPseudoFile( String name, VersionDescriptor verDesc)
public VersionPseudoFile( String name, VersionDescriptor verDesc, String relPath)
{
super( name, FileAttribute.Directory + FileAttribute.ReadOnly);
@@ -71,6 +82,15 @@ public class VersionPseudoFile extends PseudoFile {
FileInfo fInfo = new FileInfo( name, 0L, FileAttribute.Directory + FileAttribute.ReadOnly);
fInfo.setCreationDateTime( verDesc.getCreateDate());
fInfo.setPath( relPath);
fInfo.setFileId( relPath.hashCode());
long timeNow = System.currentTimeMillis();
fInfo.setCreationDateTime( timeNow);
fInfo.setModifyDateTime( timeNow);
fInfo.setAccessDateTime( timeNow);
fInfo.setChangeDateTime( timeNow);
setFileInfo( fInfo);
}