mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
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:
@@ -240,7 +240,7 @@ public class AVMContext extends AlfrescoContext
|
|||||||
{
|
{
|
||||||
// Add a pseudo folder for the new store
|
// Add a pseudo folder for the new store
|
||||||
|
|
||||||
rootState.addPseudoFile( new StorePseudoFile( storeName));
|
rootState.addPseudoFile( new StorePseudoFile( storeName, FileName.DOS_SEPERATOR_STR + storeName));
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
|
|
||||||
@@ -357,7 +357,10 @@ public class AVMContext extends AlfrescoContext
|
|||||||
|
|
||||||
// Add a pseudo folder for the new version
|
// 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
|
// DEBUG
|
||||||
|
|
||||||
|
@@ -718,10 +718,15 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
|||||||
{
|
{
|
||||||
// DEBUG
|
// DEBUG
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if ( logger.isDebugEnabled())
|
||||||
logger.debug("Close file " + file.getFullName());
|
logger.debug("Close file " + file.getFullName());
|
||||||
|
|
||||||
// Close the file
|
// Start a transaction if the file has been updated
|
||||||
|
|
||||||
|
if ( file.getWriteCount() > 0)
|
||||||
|
sess.beginWriteTransaction( m_transactionService);
|
||||||
|
|
||||||
|
// Close the file
|
||||||
|
|
||||||
file.closeFile();
|
file.closeFile();
|
||||||
|
|
||||||
@@ -1159,114 +1164,115 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
|||||||
// Convert the relative path to a store path
|
// Convert the relative path to a store path
|
||||||
|
|
||||||
AVMContext ctx = (AVMContext) tree.getContext();
|
AVMContext ctx = (AVMContext) tree.getContext();
|
||||||
AVMPath storePath = buildStorePath(ctx, name);
|
AVMPath storePath = buildStorePath( ctx, name);
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if ( logger.isDebugEnabled())
|
||||||
logger.debug("Get file information, path=" + name + ", storePath=" + storePath);
|
logger.debug("Get file information, path=" + name + ", storePath=" + storePath);
|
||||||
|
|
||||||
// Check if hte path is valid
|
// Check if hte path is valid
|
||||||
|
|
||||||
if (storePath.isValid() == false)
|
if ( storePath.isValid() == false)
|
||||||
throw new FileNotFoundException(name);
|
throw new FileNotFoundException( name);
|
||||||
|
|
||||||
// Check if the filesystem is the virtualization view
|
// Check if the filesystem is the virtualization view
|
||||||
|
|
||||||
if (ctx.isVirtualizationView() && storePath.isReadOnlyPseudoPath())
|
if ( ctx.isVirtualizationView() && storePath.isReadOnlyPseudoPath())
|
||||||
{
|
{
|
||||||
// Check if the search path is for the root, a store or version folder
|
// Check if the search path is for the root, a store or version folder
|
||||||
|
|
||||||
if (storePath.isRootPath())
|
if ( storePath.isRootPath())
|
||||||
{
|
{
|
||||||
// Return dummy file informatiom for the root folder
|
// Return dummy file informatiom for the root folder
|
||||||
|
|
||||||
return new FileInfo(name, 0L, FileAttribute.Directory);
|
return new FileInfo( name, 0L, FileAttribute.Directory);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Find the pseudo file for the store/version folder
|
// Find the pseudo file for the store/version folder
|
||||||
|
|
||||||
PseudoFile psFile = findPseudoFolder(storePath, ctx);
|
PseudoFile psFile = findPseudoFolder( storePath, ctx);
|
||||||
if (psFile != null)
|
if ( psFile != null)
|
||||||
{
|
{
|
||||||
// DEBUG
|
// DEBUG
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if ( logger.isDebugEnabled())
|
||||||
logger.debug(" Found pseudo file " + psFile);
|
logger.debug( " Found pseudo file " + psFile);
|
||||||
return psFile.getFileInfo();
|
return psFile.getFileInfo();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw new FileNotFoundException(name);
|
throw new FileNotFoundException( name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search for the file/folder
|
// Search for the file/folder
|
||||||
|
|
||||||
sess.beginReadTransaction(m_transactionService);
|
sess.beginReadTransaction( m_transactionService);
|
||||||
|
|
||||||
FileInfo info = null;
|
FileInfo info = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
AVMNodeDescriptor nodeDesc = m_avmService.lookup(storePath.getVersion(), storePath.getAVMPath());
|
AVMNodeDescriptor nodeDesc = m_avmService.lookup( storePath.getVersion(), storePath.getAVMPath());
|
||||||
|
|
||||||
if (nodeDesc != null)
|
if ( nodeDesc != null)
|
||||||
{
|
{
|
||||||
// Create, and fill in, the file information
|
// Create, and fill in, the file information
|
||||||
|
|
||||||
info = new FileInfo();
|
info = new FileInfo();
|
||||||
|
|
||||||
info.setFileName(nodeDesc.getName());
|
info.setFileName( nodeDesc.getName());
|
||||||
|
|
||||||
if (nodeDesc.isFile())
|
if ( nodeDesc.isFile())
|
||||||
{
|
{
|
||||||
info.setFileSize(nodeDesc.getLength());
|
info.setFileSize( nodeDesc.getLength());
|
||||||
info.setAllocationSize((nodeDesc.getLength() + 512L) & 0xFFFFFFFFFFFFFE00L);
|
info.setAllocationSize((nodeDesc.getLength() + 512L) & 0xFFFFFFFFFFFFFE00L);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
info.setFileSize(0L);
|
info.setFileSize( 0L);
|
||||||
|
|
||||||
info.setAccessDateTime(nodeDesc.getAccessDate());
|
info.setAccessDateTime( nodeDesc.getAccessDate());
|
||||||
info.setCreationDateTime(nodeDesc.getCreateDate());
|
info.setCreationDateTime( nodeDesc.getCreateDate());
|
||||||
info.setModifyDateTime(nodeDesc.getModDate());
|
info.setModifyDateTime( nodeDesc.getModDate());
|
||||||
|
info.setChangeDateTime( nodeDesc.getModDate());
|
||||||
|
|
||||||
// Build the file attributes
|
// Build the file attributes
|
||||||
|
|
||||||
int attr = 0;
|
int attr = 0;
|
||||||
|
|
||||||
if (nodeDesc.isDirectory())
|
if ( nodeDesc.isDirectory())
|
||||||
attr += FileAttribute.Directory;
|
attr += FileAttribute.Directory;
|
||||||
|
|
||||||
if (nodeDesc.getName().startsWith(".")
|
if ( nodeDesc.getName().startsWith( ".") ||
|
||||||
|| nodeDesc.getName().equalsIgnoreCase("Desktop.ini")
|
nodeDesc.getName().equalsIgnoreCase( "Desktop.ini") ||
|
||||||
|| nodeDesc.getName().equalsIgnoreCase("Thumbs.db"))
|
nodeDesc.getName().equalsIgnoreCase( "Thumbs.db"))
|
||||||
attr += FileAttribute.Hidden;
|
attr += FileAttribute.Hidden;
|
||||||
|
|
||||||
// Mark the file/folder as read-only if not the head version
|
// Mark the file/folder as read-only if not the head version
|
||||||
|
|
||||||
if (ctx.isVersion() != AVMContext.VERSION_HEAD)
|
if ( ctx.isVersion() != AVMContext.VERSION_HEAD)
|
||||||
attr += FileAttribute.ReadOnly;
|
attr += FileAttribute.ReadOnly;
|
||||||
|
|
||||||
info.setFileAttributes(attr);
|
info.setFileAttributes( attr);
|
||||||
|
|
||||||
// Set the file id
|
// Set the file id
|
||||||
|
|
||||||
info.setFileId(storePath.generateFileId());
|
info.setFileId( storePath.generateFileId());
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if ( logger.isDebugEnabled())
|
||||||
logger.debug(" File info=" + info);
|
logger.debug(" File info=" + info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (AVMNotFoundException ex)
|
catch ( AVMNotFoundException ex)
|
||||||
{
|
{
|
||||||
throw new FileNotFoundException(name);
|
throw new FileNotFoundException( name);
|
||||||
}
|
}
|
||||||
catch (AVMWrongTypeException ex)
|
catch ( AVMWrongTypeException ex)
|
||||||
{
|
{
|
||||||
throw new PathNotFoundException(name);
|
throw new PathNotFoundException( name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the file information
|
// Return the file information
|
||||||
@@ -2063,232 +2069,261 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
|||||||
{
|
{
|
||||||
// Make sure the is to a pseudo file/folder
|
// Make sure the is to a pseudo file/folder
|
||||||
|
|
||||||
if (avmPath.isPseudoPath() == false)
|
if ( avmPath.isPseudoPath() == false)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// Check if the path is to a store pseudo folder
|
// Check if the path is to a store pseudo folder
|
||||||
|
|
||||||
FileState fstate = null;
|
FileState fstate = null;
|
||||||
StringBuilder str = null;
|
StringBuilder str = null;
|
||||||
|
String relPath = null;
|
||||||
|
|
||||||
switch (avmPath.isLevel())
|
switch ( avmPath.isLevel())
|
||||||
{
|
{
|
||||||
// Root of the hieararchy
|
// Root of the hieararchy
|
||||||
|
|
||||||
case Root:
|
case Root:
|
||||||
|
|
||||||
// Get the root path file state
|
// Get the root path file state
|
||||||
|
|
||||||
fstate = avmCtx.getStateTable().findFileState(FileName.DOS_SEPERATOR_STR);
|
fstate = avmCtx.getStateTable().findFileState( FileName.DOS_SEPERATOR_STR);
|
||||||
|
|
||||||
// Check if the root file state is valid
|
// Check if the root file state is valid
|
||||||
|
|
||||||
if (fstate == null)
|
if ( fstate == null)
|
||||||
{
|
|
||||||
// Create a file state for the root folder
|
|
||||||
|
|
||||||
fstate = avmCtx.getStateTable().findFileState(FileName.DOS_SEPERATOR_STR, true, true);
|
|
||||||
fstate.setExpiryTime(FileState.NoTimeout);
|
|
||||||
|
|
||||||
// Get a list of the available AVM stores
|
|
||||||
|
|
||||||
List<AVMStoreDescriptor> storeList = m_avmService.getStores();
|
|
||||||
|
|
||||||
if (storeList != null && storeList.size() > 0)
|
|
||||||
{
|
{
|
||||||
// Add pseudo files for the stores
|
// Create a file state for the root folder
|
||||||
|
|
||||||
boolean sandbox = false;
|
fstate = avmCtx.getStateTable().findFileState( FileName.DOS_SEPERATOR_STR, true, true);
|
||||||
|
fstate.setExpiryTime( FileState.NoTimeout);
|
||||||
|
|
||||||
for (AVMStoreDescriptor storeDesc : storeList)
|
// Get a list of the available AVM stores
|
||||||
|
|
||||||
|
List<AVMStoreDescriptor> storeList = m_avmService.getStores();
|
||||||
|
|
||||||
|
if ( storeList != null && storeList.size() > 0)
|
||||||
{
|
{
|
||||||
// Get the properties for the current store
|
// Add pseudo files for the stores
|
||||||
|
|
||||||
Map<QName, PropertyValue> props = m_avmService.getStoreProperties(storeDesc.getName());
|
boolean sandbox = false;
|
||||||
|
|
||||||
if (props.containsKey(AVMContext.PROP_WORKFLOWPREVIEW)
|
for ( AVMStoreDescriptor storeDesc : storeList)
|
||||||
|| props.containsKey(AVMContext.PROP_AUTHORPREVIEW))
|
{
|
||||||
sandbox = true;
|
// Get the properties for the current store
|
||||||
else
|
|
||||||
sandbox = false;
|
|
||||||
|
|
||||||
// DEBUG
|
Map<QName, PropertyValue> props = m_avmService.getStoreProperties( storeDesc.getName());
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if ( props.containsKey( AVMContext.PROP_WORKFLOWPREVIEW) || props.containsKey( AVMContext.PROP_AUTHORPREVIEW))
|
||||||
logger.debug("Store " + storeDesc.getName() + ", sandbox=" + sandbox);
|
sandbox = true;
|
||||||
|
else
|
||||||
|
sandbox = false;
|
||||||
|
|
||||||
// Add a pseudo file for the current store
|
// DEBUG
|
||||||
|
|
||||||
if (sandbox == false || avmCtx.showSandboxes() == true)
|
if ( logger.isDebugEnabled())
|
||||||
fstate.addPseudoFile(new StorePseudoFile(storeDesc));
|
logger.debug( "Store " + storeDesc.getName() + ", sandbox=" + sandbox);
|
||||||
|
|
||||||
|
// Add a pseudo file for the current store
|
||||||
|
|
||||||
|
if ( sandbox == false || avmCtx.showSandboxes() == true)
|
||||||
|
fstate.addPseudoFile( new StorePseudoFile( storeDesc, FileName.DOS_SEPERATOR_STR + storeDesc.getName()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
// Store folder
|
// Store folder
|
||||||
|
|
||||||
case StoreRoot:
|
case StoreRoot:
|
||||||
|
|
||||||
// Build the path to the parent store folder
|
|
||||||
|
|
||||||
str = new StringBuilder();
|
|
||||||
|
|
||||||
str.append(FileName.DOS_SEPERATOR);
|
|
||||||
str.append(avmPath.getStoreName());
|
|
||||||
|
|
||||||
// Search for the file state for the store pseudo folder
|
|
||||||
|
|
||||||
fstate = avmCtx.getStateTable().findFileState(str.toString());
|
|
||||||
|
|
||||||
if (fstate == null)
|
|
||||||
{
|
|
||||||
// Create a file state for the store path
|
|
||||||
|
|
||||||
fstate = avmCtx.getStateTable().findFileState(str.toString(), true, true);
|
|
||||||
|
|
||||||
// Add a pseudo file for the head version
|
|
||||||
|
|
||||||
fstate.addPseudoFile(new VersionPseudoFile(AVMPath.VersionNameHead));
|
|
||||||
|
|
||||||
// Add a pseudo file for the version root folder
|
|
||||||
|
|
||||||
fstate.addPseudoFile(new DummyFolderPseudoFile(AVMPath.VersionsFolder));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Head folder
|
|
||||||
|
|
||||||
case Head:
|
|
||||||
|
|
||||||
// Build the path to the store head version folder
|
|
||||||
|
|
||||||
str = new StringBuilder();
|
|
||||||
|
|
||||||
str.append(FileName.DOS_SEPERATOR);
|
|
||||||
str.append(avmPath.getStoreName());
|
|
||||||
str.append(FileName.DOS_SEPERATOR);
|
|
||||||
str.append(AVMPath.VersionNameHead);
|
|
||||||
|
|
||||||
// Search for the file state for the store head version pseudo folder
|
|
||||||
|
|
||||||
fstate = avmCtx.getStateTable().findFileState(str.toString());
|
|
||||||
|
|
||||||
if (fstate == null)
|
|
||||||
{
|
|
||||||
// Create a file state for the store head folder path
|
|
||||||
|
|
||||||
fstate = avmCtx.getStateTable().findFileState(str.toString(), true, true);
|
|
||||||
|
|
||||||
// Add a pseudo file for the data pseudo folder
|
|
||||||
|
|
||||||
fstate.addPseudoFile(new DummyFolderPseudoFile(AVMPath.DataFolder));
|
|
||||||
|
|
||||||
// Add a pseudo file for the metadata pseudo folder
|
|
||||||
|
|
||||||
fstate.addPseudoFile(new DummyFolderPseudoFile(AVMPath.MetaDataFolder));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Version root folder
|
|
||||||
|
|
||||||
case VersionRoot:
|
|
||||||
|
|
||||||
// Get the list of AVM store versions
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Build the path to the parent store folder
|
// Build the path to the parent store folder
|
||||||
|
|
||||||
str = new StringBuilder();
|
str = new StringBuilder();
|
||||||
|
|
||||||
str.append(FileName.DOS_SEPERATOR);
|
str.append( FileName.DOS_SEPERATOR);
|
||||||
str.append(avmPath.getStoreName());
|
str.append( avmPath.getStoreName());
|
||||||
str.append(FileName.DOS_SEPERATOR);
|
|
||||||
str.append(AVMPath.VersionsFolder);
|
|
||||||
|
|
||||||
// Create a file state for the store path
|
// Search for the file state for the store pseudo folder
|
||||||
|
|
||||||
fstate = avmCtx.getStateTable().findFileState(str.toString(), true, true);
|
relPath = str.toString();
|
||||||
|
fstate = avmCtx.getStateTable().findFileState( relPath);
|
||||||
|
|
||||||
// Add pseudo folders if the list is empty
|
if ( fstate == null)
|
||||||
|
|
||||||
if (fstate.hasPseudoFiles() == false)
|
|
||||||
{
|
{
|
||||||
// Build the version folder name for the head version
|
// Create a file state for the store path
|
||||||
|
|
||||||
StringBuilder verStr = new StringBuilder(AVMPath.VersionFolderPrefix);
|
fstate = avmCtx.getStateTable().findFileState( str.toString(), true, true);
|
||||||
verStr.append("-1");
|
|
||||||
|
|
||||||
// Add a pseudo file for the head version
|
// Add a pseudo file for the head version
|
||||||
|
|
||||||
fstate.addPseudoFile(new VersionPseudoFile(verStr.toString()));
|
str.append( FileName.DOS_SEPERATOR);
|
||||||
|
str.append( AVMPath.VersionNameHead);
|
||||||
|
|
||||||
// Get the list of versions for the store
|
fstate.addPseudoFile( new VersionPseudoFile( AVMPath.VersionNameHead, str.toString()));
|
||||||
|
|
||||||
List<VersionDescriptor> verList = m_avmService.getStoreVersions(avmPath.getStoreName());
|
// Add a pseudo file for the version root folder
|
||||||
|
|
||||||
// Add pseudo files for the versions to the store state
|
str.setLength( relPath.length() + 1);
|
||||||
|
str.append( AVMPath.VersionsFolder);
|
||||||
|
|
||||||
if (verList.size() > 0)
|
fstate.addPseudoFile( new DummyFolderPseudoFile( AVMPath.VersionsFolder, str.toString()));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Head folder
|
||||||
|
|
||||||
|
case Head:
|
||||||
|
|
||||||
|
// Build the path to the store head version folder
|
||||||
|
|
||||||
|
str = new StringBuilder();
|
||||||
|
|
||||||
|
str.append( FileName.DOS_SEPERATOR);
|
||||||
|
str.append( avmPath.getStoreName());
|
||||||
|
str.append( FileName.DOS_SEPERATOR);
|
||||||
|
str.append( AVMPath.VersionNameHead);
|
||||||
|
|
||||||
|
// Search for the file state for the store head version pseudo folder
|
||||||
|
|
||||||
|
relPath = str.toString();
|
||||||
|
|
||||||
|
fstate = avmCtx.getStateTable().findFileState( relPath);
|
||||||
|
|
||||||
|
if ( fstate == null)
|
||||||
|
{
|
||||||
|
// Create a file state for the store head folder path
|
||||||
|
|
||||||
|
fstate = avmCtx.getStateTable().findFileState( str.toString(), true, true);
|
||||||
|
|
||||||
|
// Add a pseudo file for the data pseudo folder
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
str.setLength( relPath.length() + 1);
|
||||||
|
str.append( AVMPath.MetaDataFolder);
|
||||||
|
|
||||||
|
fstate.addPseudoFile( new DummyFolderPseudoFile( AVMPath.MetaDataFolder, str.toString()));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Version root folder
|
||||||
|
|
||||||
|
case VersionRoot:
|
||||||
|
|
||||||
|
// Get the list of AVM store versions
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Build the path to the parent store folder
|
||||||
|
|
||||||
|
str = new StringBuilder();
|
||||||
|
|
||||||
|
str.append( FileName.DOS_SEPERATOR);
|
||||||
|
str.append( avmPath.getStoreName());
|
||||||
|
str.append( FileName.DOS_SEPERATOR);
|
||||||
|
str.append( AVMPath.VersionsFolder);
|
||||||
|
|
||||||
|
// Create a file state for the store path
|
||||||
|
|
||||||
|
relPath = str.toString();
|
||||||
|
fstate = avmCtx.getStateTable().findFileState( relPath, true, true);
|
||||||
|
|
||||||
|
// Add pseudo folders if the list is empty
|
||||||
|
|
||||||
|
if ( fstate.hasPseudoFiles() == false)
|
||||||
{
|
{
|
||||||
for (VersionDescriptor verDesc : verList)
|
// Build the version folder name for the head version
|
||||||
|
|
||||||
|
StringBuilder verStr = new StringBuilder( AVMPath.VersionFolderPrefix);
|
||||||
|
verStr.append( "-1");
|
||||||
|
|
||||||
|
// Add a pseudo file for the head version
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
List<VersionDescriptor> verList = m_avmService.getStoreVersions( avmPath.getStoreName());
|
||||||
|
|
||||||
|
// Add pseudo files for the versions to the store state
|
||||||
|
|
||||||
|
if ( verList.size() > 0)
|
||||||
{
|
{
|
||||||
// Generate the version string
|
for ( VersionDescriptor verDesc : verList)
|
||||||
|
{
|
||||||
|
// Generate the version string
|
||||||
|
|
||||||
String verName = null;
|
String verName = null;
|
||||||
|
|
||||||
verStr.setLength(AVMPath.VersionFolderPrefix.length());
|
verStr.setLength( AVMPath.VersionFolderPrefix.length());
|
||||||
verStr.append(verDesc.getVersionID());
|
verStr.append( verDesc.getVersionID());
|
||||||
|
|
||||||
verName = verStr.toString();
|
verName = verStr.toString();
|
||||||
|
|
||||||
// Add the version pseudo folder
|
str.setLength( relPath.length() + 1);
|
||||||
|
str.append( verName);
|
||||||
|
|
||||||
fstate.addPseudoFile(new VersionPseudoFile(verName, verDesc));
|
// Add the version pseudo folder
|
||||||
|
|
||||||
|
fstate.addPseudoFile( new VersionPseudoFile ( verName, verDesc, str.toString()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
catch ( AVMNotFoundException ex)
|
||||||
catch (AVMNotFoundException ex)
|
{
|
||||||
{
|
// Invalid store name
|
||||||
// Invalid store name
|
}
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
// Version folder
|
// Version folder
|
||||||
|
|
||||||
case Version:
|
case Version:
|
||||||
|
|
||||||
// Build the path to the store version folder
|
// Build the path to the store version folder
|
||||||
|
|
||||||
str = new StringBuilder();
|
str = new StringBuilder();
|
||||||
|
|
||||||
str.append(FileName.DOS_SEPERATOR);
|
str.append( FileName.DOS_SEPERATOR);
|
||||||
str.append(avmPath.getStoreName());
|
str.append( avmPath.getStoreName());
|
||||||
str.append(FileName.DOS_SEPERATOR);
|
str.append( FileName.DOS_SEPERATOR);
|
||||||
str.append(AVMPath.VersionFolderPrefix);
|
str.append( AVMPath.VersionFolderPrefix);
|
||||||
str.append(avmPath.getVersion());
|
str.append( avmPath.getVersion());
|
||||||
|
|
||||||
// Search for the file state for the version pseudo folder
|
// 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)
|
if ( fstate == null)
|
||||||
{
|
{
|
||||||
// Create a file state for the version folder path
|
// Create a file state for the version folder path
|
||||||
|
|
||||||
fstate = avmCtx.getStateTable().findFileState(str.toString(), true, true);
|
fstate = avmCtx.getStateTable().findFileState( str.toString(), true, true);
|
||||||
|
|
||||||
// Add a pseudo file for the data pseudo folder
|
// Add a pseudo file for the data pseudo folder
|
||||||
|
|
||||||
fstate.addPseudoFile(new DummyFolderPseudoFile(AVMPath.DataFolder));
|
str.append( FileName.DOS_SEPERATOR);
|
||||||
|
str.append( AVMPath.DataFolder);
|
||||||
|
|
||||||
// Add a pseudo file for the metadata pseudo folder
|
fstate.addPseudoFile( new DummyFolderPseudoFile( AVMPath.DataFolder, str.toString()));
|
||||||
|
|
||||||
fstate.addPseudoFile(new DummyFolderPseudoFile(AVMPath.MetaDataFolder));
|
// Add a pseudo file for the metadata pseudo folder
|
||||||
}
|
|
||||||
break;
|
str.setLength( relPath.length() + 1);
|
||||||
|
str.append( AVMPath.MetaDataFolder);
|
||||||
|
|
||||||
|
fstate.addPseudoFile( new DummyFolderPseudoFile( AVMPath.MetaDataFolder, str.toString()));
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the file state
|
// Return the file state
|
||||||
|
@@ -223,6 +223,7 @@ public class AVMNetworkFile extends NetworkFile {
|
|||||||
// Set modification flag
|
// Set modification flag
|
||||||
|
|
||||||
m_modified = true;
|
m_modified = true;
|
||||||
|
incrementWriteCount();
|
||||||
|
|
||||||
// Update the current file size
|
// Update the current file size
|
||||||
|
|
||||||
@@ -329,6 +330,7 @@ public class AVMNetworkFile extends NetworkFile {
|
|||||||
// Set modification flag
|
// Set modification flag
|
||||||
|
|
||||||
m_modified = true;
|
m_modified = true;
|
||||||
|
incrementWriteCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -42,8 +42,9 @@ public class DummyFolderPseudoFile extends PseudoFile {
|
|||||||
* Class constructor
|
* Class constructor
|
||||||
*
|
*
|
||||||
* @param fname String
|
* @param fname String
|
||||||
|
* @param relPath String
|
||||||
*/
|
*/
|
||||||
public DummyFolderPseudoFile( String fname)
|
public DummyFolderPseudoFile( String fname, String relPath)
|
||||||
{
|
{
|
||||||
super( fname, FileAttribute.Directory + FileAttribute.ReadOnly);
|
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);
|
FileInfo fInfo = new FileInfo( fname, 0L, FileAttribute.Directory + FileAttribute.ReadOnly);
|
||||||
fInfo.setCreationDateTime( System.currentTimeMillis());
|
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);
|
setFileInfo( fInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -178,6 +178,7 @@ public class PseudoFileListSearchContext extends SearchContext {
|
|||||||
attr += FileAttribute.Hidden;
|
attr += FileAttribute.Hidden;
|
||||||
|
|
||||||
info.setFileAttributes( attr);
|
info.setFileAttributes( attr);
|
||||||
|
info.setFileId( pfInfo.getFileId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Indicate if the file information is valid
|
// Indicate if the file information is valid
|
||||||
|
@@ -44,15 +44,23 @@ public class StorePseudoFile extends PseudoFile {
|
|||||||
* Class constructor
|
* Class constructor
|
||||||
*
|
*
|
||||||
* @param storeDesc AVMStoreDescriptor
|
* @param storeDesc AVMStoreDescriptor
|
||||||
|
* @param relPath String
|
||||||
*/
|
*/
|
||||||
public StorePseudoFile( AVMStoreDescriptor storeDesc)
|
public StorePseudoFile( AVMStoreDescriptor storeDesc, String relPath)
|
||||||
{
|
{
|
||||||
super( storeDesc.getName(), FileAttribute.Directory + FileAttribute.ReadOnly);
|
super( storeDesc.getName(), FileAttribute.Directory + FileAttribute.ReadOnly);
|
||||||
|
|
||||||
// Create static file information from the store details
|
// Create static file information from the store details
|
||||||
|
|
||||||
FileInfo fInfo = new FileInfo( storeDesc.getName(), 0L, FileAttribute.Directory + FileAttribute.ReadOnly);
|
FileInfo fInfo = new FileInfo( storeDesc.getName(), 0L, FileAttribute.Directory + FileAttribute.ReadOnly);
|
||||||
|
|
||||||
fInfo.setCreationDateTime( storeDesc.getCreateDate());
|
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);
|
setFileInfo( fInfo);
|
||||||
}
|
}
|
||||||
@@ -61,15 +69,24 @@ public class StorePseudoFile extends PseudoFile {
|
|||||||
* Class constructor
|
* Class constructor
|
||||||
*
|
*
|
||||||
* @param storeName String
|
* @param storeName String
|
||||||
|
* @param relPath String
|
||||||
*/
|
*/
|
||||||
public StorePseudoFile( String storeName)
|
public StorePseudoFile( String storeName, String relPath)
|
||||||
{
|
{
|
||||||
super( storeName, FileAttribute.Directory + FileAttribute.ReadOnly);
|
super( storeName, FileAttribute.Directory + FileAttribute.ReadOnly);
|
||||||
|
|
||||||
// Create static file information from the store details
|
// Create static file information from the store details
|
||||||
|
|
||||||
FileInfo fInfo = new FileInfo( storeName, 0L, FileAttribute.Directory + FileAttribute.ReadOnly);
|
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);
|
setFileInfo( fInfo);
|
||||||
}
|
}
|
||||||
|
@@ -44,8 +44,9 @@ public class VersionPseudoFile extends PseudoFile {
|
|||||||
* Class constructor
|
* Class constructor
|
||||||
*
|
*
|
||||||
* @param name String
|
* @param name String
|
||||||
|
* @param relPath String
|
||||||
*/
|
*/
|
||||||
public VersionPseudoFile( String name)
|
public VersionPseudoFile( String name, String relPath)
|
||||||
{
|
{
|
||||||
super( name, FileAttribute.Directory + FileAttribute.ReadOnly);
|
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);
|
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);
|
setFileInfo( fInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,8 +71,9 @@ public class VersionPseudoFile extends PseudoFile {
|
|||||||
*
|
*
|
||||||
* @param name String
|
* @param name String
|
||||||
* @param verDesc VersionDescriptor
|
* @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);
|
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);
|
FileInfo fInfo = new FileInfo( name, 0L, FileAttribute.Directory + FileAttribute.ReadOnly);
|
||||||
fInfo.setCreationDateTime( verDesc.getCreateDate());
|
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);
|
setFileInfo( fInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user