mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merged PATCHES/V3.2.r to HEAD
19546: (RECORD ONLY) Merged V3.2 to PATCHES/V3.2.r 19432: Merged V3.1 to V3.2 19427: Merged V3.0 to V3.1 19423: Merged V2.2 to V3.0 19391: Fix for ALF-2076: AUTO does not work if a document has been added and deleted since the index backup 19419: V2.2 Build Fix 19421: Fix for ALF-2076: AUTO does not work if a document has been added and deleted since the index backup 19463: Merged V3.1 to V3.2 19459: Merged V3.0 to V3.1 19457: Merged V2.2 to V3.0 19449: Addition Fix for ALF-2076: AUTO does not work if a document has been added and deleted since the index backup 19493 Merged V3.1 to V3.2 19471: Build fix after changes for ALF-2076 were merged forward. Index checker correctly understands INDETERMINATE state of indexed transactions 19547: (RECORD ONLY) Incremented version label 19555: (RECORD ONLY) Merged V3.2 to PATCHES/V3.2.r 19552: Merged V3.1 to V3.2 19551: Further fix after changes for ALF-2076 were merged forward. Final fix to check for InIndex.No 19566: (RECORD ONLY) Merged V3.2 to PATCHES/V3.2.r 19539: Merged HEAD to V3.2 19538: ALF-2076: Build fix - fix build speed 19802: (RECORD ONLY) ALF-2382, ALF-2383: Merged V3.2 to PATCHES/V3.2.r 19647: ALF-2231: Merged DEV/BELARUS/V2.2-2009_12_01 to V3.2 17704: ENH-681: alfresco webdav does not respect webdav locks 19624: ALF-2231: Merged DEV/BELARUS/V2.2-2009_12_01 to V3.2 17704: ENH-681: alfresco webdav does not respect webdav locks 19623: ALF-1890: Correction to previous checkin to allow defaulting of request body charset 19617: ALF-1890: Improvements to make ALL WebDAV methods retryable - Solution from PutMethod promoted to request wrapper that will handle ALL calls to getInputStream and getReader 19614: ALF-1890: Merged V2.2 to V3.2 17709: Merged DEV_TEMPORARY to V2.2 17700: ETWOTWO-1393: concurrent writes to webdav lead to data loss (0kb resulting file) 19613: Merged DEV/BELARUS/V2.2-2010_02_03 to V2.2 19157: ALF-1890: concurrent writes to webdav lead to data loss (0kb resulting file) 19803: ALF-558: File servers (CIFS / FTP / NFS) can now handle concurrent write operations on Alfresco repository - ContentDiskDriver / AVMDiskDriver now use retrying transactions for write operations - Disable EagerContentStoreCleaner on ContentDiskDriver / AVMDiskDriver closeFile() operations so that they may be retried after rollback (Sony zero byte problem) - Allow manual association of AVM ContentData with nodes so that closeFile() may be retried - Propagation of new argument through AVM interfaces 19804: (RECORD ONLY) Merged PATCHES/V3.2.0 to PATCHES/V3.2.r Merged HEAD to V3.2.0 19786: Refactor of previous test fix. I have pushed down the OOo-specific parts of the change from AbstractContentTransformerTest to OpenOfficeContentTransformerTest leaving an extension point in the base class should other transformations need to be excluded in the future. 19785: Fix for failing test OpenOfficeContentTransformerTest.testAllConversions. Various OOo-related transformations are returned as available but fail on our test server with OOo on it. Pending further work on these failings, I am disabling those transformations in test code whilst leaving them available in the product code. This is because in the wild a different OOo version may succeed with these transformations. I had previously explicitly disabled 3 transformations in the product and I am moving that restriction from product to test code for the same reason. 19707: Return value from isTransformationBlocked was inverted. Fixed now. 19705: Refinement of previous check-in re OOo transformations. I have pulled up the code that handles blocked transformations into a superclass so that the JodConverter-based transformer worker can inherit the same list of blocked transformations. To reiterate, blocked transformations are those that the OOo integration code believes should work but which are broken in practice. These are blocked by the transformers and will always be unavailable regardless of the OOo connection state. 19702: Fix for HEAD builds running on panda build server. OOo was recently installed on panda which has activated various OOo-related transformations/extractions in the test code. It appears that OOo does not support some transformations from Office 97 to Office 2007. Specifically doc to docx and xls to xlsx. These transformations have now been marked as unavailable. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@20004 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,6 +24,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
@@ -817,34 +818,35 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
* @exception java.io.IOException
|
||||
* If an error occurs.
|
||||
*/
|
||||
public void closeFile(SrvSession sess, TreeConnection tree, NetworkFile file) throws java.io.IOException
|
||||
public void closeFile(final SrvSession sess, final TreeConnection tree, final NetworkFile file) throws java.io.IOException
|
||||
{
|
||||
// DEBUG
|
||||
|
||||
if ( logger.isDebugEnabled())
|
||||
logger.debug("Close file " + file.getFullName());
|
||||
|
||||
// Start a transaction if the file has been updated
|
||||
|
||||
if ( file.getWriteCount() > 0)
|
||||
beginWriteTransaction( sess);
|
||||
|
||||
// Close the file
|
||||
|
||||
file.closeFile();
|
||||
doInWriteTransaction(sess, new Callable<Void>(){
|
||||
|
||||
// Check if the file/directory is marked for delete
|
||||
public Void call() throws Exception
|
||||
{
|
||||
// Close the file
|
||||
|
||||
file.closeFile();
|
||||
|
||||
if (file.hasDeleteOnClose())
|
||||
{
|
||||
// Check if the file/directory is marked for delete
|
||||
|
||||
// Check for a file or directory
|
||||
if (file.hasDeleteOnClose())
|
||||
{
|
||||
|
||||
if (file.isDirectory())
|
||||
deleteDirectory(sess, tree, file.getFullName());
|
||||
else
|
||||
deleteFile(sess, tree, file.getFullName());
|
||||
}
|
||||
// Check for a file or directory
|
||||
|
||||
if (file.isDirectory())
|
||||
deleteDirectory(sess, tree, file.getFullName());
|
||||
else
|
||||
deleteFile(sess, tree, file.getFullName());
|
||||
}
|
||||
return null;
|
||||
}});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -869,11 +871,11 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
|
||||
// Split the path to get the new folder name and relative path
|
||||
|
||||
String[] paths = FileName.splitPath(params.getPath());
|
||||
final String[] paths = FileName.splitPath(params.getPath());
|
||||
|
||||
// Convert the relative path to a store path
|
||||
|
||||
AVMPath storePath = buildStorePath(ctx, paths[0], sess);
|
||||
final AVMPath storePath = buildStorePath(ctx, paths[0], sess);
|
||||
|
||||
// DEBUG
|
||||
|
||||
@@ -892,13 +894,18 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
|
||||
// Create a new file
|
||||
|
||||
beginWriteTransaction( sess);
|
||||
|
||||
try
|
||||
{
|
||||
// Create the new file entry
|
||||
doInWriteTransaction(sess, new Callable<Void>(){
|
||||
|
||||
m_avmService.createDirectory(storePath.getAVMPath(), paths[1]);
|
||||
public Void call() throws Exception
|
||||
{
|
||||
// Create the new file entry
|
||||
|
||||
m_avmService.createDirectory(storePath.getAVMPath(), paths[1]);
|
||||
|
||||
return null;
|
||||
}});
|
||||
}
|
||||
catch (AVMExistsException ex)
|
||||
{
|
||||
@@ -939,20 +946,20 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
* @exception java.io.IOException
|
||||
* If an error occurs.
|
||||
*/
|
||||
public NetworkFile createFile(SrvSession sess, TreeConnection tree, FileOpenParams params)
|
||||
public NetworkFile createFile(final SrvSession sess, TreeConnection tree, final FileOpenParams params)
|
||||
throws java.io.IOException
|
||||
{
|
||||
// Check if the filesystem is writable
|
||||
|
||||
AVMContext ctx = (AVMContext) tree.getContext();
|
||||
final AVMContext ctx = (AVMContext) tree.getContext();
|
||||
|
||||
// Split the path to get the file name and relative path
|
||||
|
||||
String[] paths = FileName.splitPath(params.getPath());
|
||||
final String[] paths = FileName.splitPath(params.getPath());
|
||||
|
||||
// Convert the relative path to a store path
|
||||
|
||||
AVMPath storePath = buildStorePath(ctx, paths[0], sess);
|
||||
final AVMPath storePath = buildStorePath(ctx, paths[0], sess);
|
||||
|
||||
// DEBUG
|
||||
|
||||
@@ -973,38 +980,41 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
throw new AccessDeniedException("Cannot create " + params.getPath() + ", filesys not writable");
|
||||
}
|
||||
|
||||
// Create a new file
|
||||
|
||||
beginWriteTransaction( sess);
|
||||
|
||||
AVMNetworkFile netFile = null;
|
||||
|
||||
try
|
||||
{
|
||||
// Create the new file entry
|
||||
// Create a new file
|
||||
return doInWriteTransaction(sess, new Callable<NetworkFile>(){
|
||||
|
||||
m_avmService.createFile(storePath.getAVMPath(), paths[1]).close();
|
||||
public NetworkFile call() throws Exception
|
||||
{
|
||||
// Create the new file entry
|
||||
|
||||
// Get the new file details
|
||||
m_avmService.createFile(storePath.getAVMPath(), paths[1]).close();
|
||||
|
||||
AVMPath fileStorePath = buildStorePath(ctx, params.getPath(), sess);
|
||||
AVMNodeDescriptor nodeDesc = m_avmService.lookup(fileStorePath.getVersion(), fileStorePath.getAVMPath());
|
||||
// Get the new file details
|
||||
|
||||
if (nodeDesc != null)
|
||||
{
|
||||
// Create the network file object for the new file
|
||||
AVMPath fileStorePath = buildStorePath(ctx, params.getPath(), sess);
|
||||
AVMNodeDescriptor nodeDesc = m_avmService.lookup(fileStorePath.getVersion(), fileStorePath.getAVMPath());
|
||||
|
||||
netFile = new AVMNetworkFile(nodeDesc, fileStorePath.getAVMPath(), fileStorePath.getVersion(),
|
||||
m_avmService);
|
||||
netFile.setGrantedAccess(NetworkFile.READWRITE);
|
||||
netFile.setFullName(params.getPath());
|
||||
if (nodeDesc != null)
|
||||
{
|
||||
// Create the network file object for the new file
|
||||
|
||||
netFile.setFileId(fileStorePath.generateFileId());
|
||||
AVMNetworkFile netFile = new AVMNetworkFile(nodeDesc, fileStorePath.getAVMPath(), fileStorePath.getVersion(),
|
||||
m_nodeService, m_avmService);
|
||||
netFile.setGrantedAccess(NetworkFile.READWRITE);
|
||||
netFile.setFullName(params.getPath());
|
||||
|
||||
// Set the mime-type for the new file
|
||||
netFile.setFileId(fileStorePath.generateFileId());
|
||||
|
||||
netFile.setMimeType(m_mimetypeService.guessMimetype(paths[1]));
|
||||
}
|
||||
// Set the mime-type for the new file
|
||||
|
||||
netFile.setMimeType(m_mimetypeService.guessMimetype(paths[1]));
|
||||
return netFile;
|
||||
}
|
||||
return null;
|
||||
}});
|
||||
}
|
||||
catch (AVMExistsException ex)
|
||||
{
|
||||
@@ -1030,10 +1040,6 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
{
|
||||
throw new AccessDeniedException(params.getPath());
|
||||
}
|
||||
|
||||
// Return the file
|
||||
|
||||
return netFile;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1048,12 +1054,12 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
* @exception java.io.IOException
|
||||
* The exception description.
|
||||
*/
|
||||
public void deleteDirectory(SrvSession sess, TreeConnection tree, String dir) throws java.io.IOException
|
||||
public void deleteDirectory(SrvSession sess, TreeConnection tree, final String dir) throws java.io.IOException
|
||||
{
|
||||
// Convert the relative path to a store path
|
||||
|
||||
AVMContext ctx = (AVMContext) tree.getContext();
|
||||
AVMPath storePath = buildStorePath(ctx, dir, sess);
|
||||
final AVMPath storePath = buildStorePath(ctx, dir, sess);
|
||||
|
||||
// DEBUG
|
||||
|
||||
@@ -1072,30 +1078,34 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
|
||||
// Make sure the path is to a folder before deleting it
|
||||
|
||||
beginWriteTransaction( sess);
|
||||
|
||||
try
|
||||
{
|
||||
AVMNodeDescriptor nodeDesc = m_avmService.lookup(storePath.getVersion(), storePath.getAVMPath());
|
||||
if (nodeDesc != null)
|
||||
{
|
||||
// Check that we are deleting a folder
|
||||
doInWriteTransaction(sess, new Callable<Void>(){
|
||||
|
||||
if (nodeDesc.isDirectory())
|
||||
public Void call() throws Exception
|
||||
{
|
||||
// Make sure the directory is empty
|
||||
AVMNodeDescriptor nodeDesc = m_avmService.lookup(storePath.getVersion(), storePath.getAVMPath());
|
||||
if (nodeDesc != null)
|
||||
{
|
||||
// Check that we are deleting a folder
|
||||
|
||||
SortedMap<String, AVMNodeDescriptor> fileList = m_avmService.getDirectoryListing(nodeDesc);
|
||||
if (fileList != null && fileList.size() > 0)
|
||||
throw new DirectoryNotEmptyException(dir);
|
||||
if (nodeDesc.isDirectory())
|
||||
{
|
||||
// Make sure the directory is empty
|
||||
|
||||
// Delete the folder
|
||||
SortedMap<String, AVMNodeDescriptor> fileList = m_avmService.getDirectoryListing(nodeDesc);
|
||||
if (fileList != null && fileList.size() > 0)
|
||||
throw new DirectoryNotEmptyException(dir);
|
||||
|
||||
m_avmService.removeNode(storePath.getAVMPath());
|
||||
}
|
||||
else
|
||||
throw new IOException("Delete directory path is not a directory, " + dir);
|
||||
}
|
||||
// Delete the folder
|
||||
|
||||
m_avmService.removeNode(storePath.getAVMPath());
|
||||
}
|
||||
else
|
||||
throw new IOException("Delete directory path is not a directory, " + dir);
|
||||
}
|
||||
return null;
|
||||
}});
|
||||
}
|
||||
catch (AVMNotFoundException ex)
|
||||
{
|
||||
@@ -1123,12 +1133,12 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
* @exception java.io.IOException
|
||||
* The exception description.
|
||||
*/
|
||||
public void deleteFile(SrvSession sess, TreeConnection tree, String name) throws java.io.IOException
|
||||
public void deleteFile(SrvSession sess, TreeConnection tree, final String name) throws java.io.IOException
|
||||
{
|
||||
// Convert the relative path to a store path
|
||||
|
||||
AVMContext ctx = (AVMContext) tree.getContext();
|
||||
AVMPath storePath = buildStorePath(ctx, name, sess);
|
||||
final AVMPath storePath = buildStorePath(ctx, name, sess);
|
||||
|
||||
// DEBUG
|
||||
|
||||
@@ -1147,24 +1157,28 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
|
||||
// Make sure the path is to a file before deleting it
|
||||
|
||||
beginWriteTransaction( sess);
|
||||
|
||||
try
|
||||
{
|
||||
AVMNodeDescriptor nodeDesc = m_avmService.lookup(storePath.getVersion(), storePath.getAVMPath());
|
||||
if (nodeDesc != null)
|
||||
{
|
||||
// Check that we are deleting a file
|
||||
doInWriteTransaction(sess, new Callable<Void>(){
|
||||
|
||||
if (nodeDesc.isFile())
|
||||
public Void call() throws Exception
|
||||
{
|
||||
// Delete the file
|
||||
AVMNodeDescriptor nodeDesc = m_avmService.lookup(storePath.getVersion(), storePath.getAVMPath());
|
||||
if (nodeDesc != null)
|
||||
{
|
||||
// Check that we are deleting a file
|
||||
|
||||
m_avmService.removeNode(storePath.getAVMPath());
|
||||
}
|
||||
else
|
||||
throw new IOException("Delete file path is not a file, " + name);
|
||||
}
|
||||
if (nodeDesc.isFile())
|
||||
{
|
||||
// Delete the file
|
||||
|
||||
m_avmService.removeNode(storePath.getAVMPath());
|
||||
}
|
||||
else
|
||||
throw new IOException("Delete file path is not a file, " + name);
|
||||
}
|
||||
return null;
|
||||
}});
|
||||
}
|
||||
catch (AVMNotFoundException ex)
|
||||
{
|
||||
@@ -1545,7 +1559,7 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
|
||||
// Create the network file object for the opened file/folder
|
||||
|
||||
netFile = new AVMNetworkFile(nodeDesc, storePath.getAVMPath(), storePath.getVersion(), m_avmService);
|
||||
netFile = new AVMNetworkFile(nodeDesc, storePath.getAVMPath(), storePath.getVersion(), m_nodeService, m_avmService);
|
||||
|
||||
if (params.isReadOnlyAccess() || storePath.getVersion() != AVMContext.VERSION_HEAD)
|
||||
netFile.setGrantedAccess(NetworkFile.READONLY);
|
||||
@@ -1651,13 +1665,13 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
|
||||
AVMContext ctx = (AVMContext) tree.getContext();
|
||||
|
||||
String[] oldPaths = FileName.splitPath(oldName);
|
||||
String[] newPaths = FileName.splitPath(newName);
|
||||
final String[] oldPaths = FileName.splitPath(oldName);
|
||||
final String[] newPaths = FileName.splitPath(newName);
|
||||
|
||||
// Convert the parent paths to store paths
|
||||
|
||||
AVMPath oldAVMPath = buildStorePath(ctx, oldPaths[0], sess);
|
||||
AVMPath newAVMPath = buildStorePath(ctx, newPaths[0], sess);
|
||||
final AVMPath oldAVMPath = buildStorePath(ctx, oldPaths[0], sess);
|
||||
final AVMPath newAVMPath = buildStorePath(ctx, newPaths[0], sess);
|
||||
|
||||
// DEBUG
|
||||
|
||||
@@ -1679,15 +1693,17 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
throw new AccessDeniedException("Cannot rename folder to read-only folder, " + newName);
|
||||
}
|
||||
|
||||
// Start a transaction for the rename
|
||||
|
||||
beginWriteTransaction( sess);
|
||||
|
||||
try
|
||||
{
|
||||
// Rename the file/folder
|
||||
doInWriteTransaction(sess, new Callable<Void>(){
|
||||
|
||||
m_avmService.rename(oldAVMPath.getAVMPath(), oldPaths[1], newAVMPath.getAVMPath(), newPaths[1]);
|
||||
public Void call() throws Exception
|
||||
{
|
||||
// Rename the file/folder
|
||||
|
||||
m_avmService.rename(oldAVMPath.getAVMPath(), oldPaths[1], newAVMPath.getAVMPath(), newPaths[1]);
|
||||
return null;
|
||||
}});
|
||||
}
|
||||
catch (AVMNotFoundException ex)
|
||||
{
|
||||
@@ -1973,7 +1989,7 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
* @exception java.io.IOException
|
||||
* The exception description.
|
||||
*/
|
||||
public void truncateFile(SrvSession sess, TreeConnection tree, NetworkFile file, long siz)
|
||||
public void truncateFile(SrvSession sess, TreeConnection tree, final NetworkFile file, final long siz)
|
||||
throws java.io.IOException
|
||||
{
|
||||
// Check if the file is a directory, or only has read access
|
||||
@@ -1985,13 +2001,25 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
|
||||
AVMNetworkFile avmFile = (AVMNetworkFile) file;
|
||||
|
||||
if (avmFile.hasContentChannel() == false || avmFile.isWritable() == false)
|
||||
beginWriteTransaction( sess);
|
||||
|
||||
// Truncate or extend the file
|
||||
if (avmFile.hasContentChannel() == false || avmFile.isWritable() == false)
|
||||
{
|
||||
doInWriteTransaction(sess, new Callable<Void>(){
|
||||
|
||||
public Void call() throws Exception
|
||||
{
|
||||
file.truncateFile(siz);
|
||||
file.flushFile();
|
||||
return null;
|
||||
}});
|
||||
}
|
||||
else
|
||||
{
|
||||
file.truncateFile(siz);
|
||||
file.flushFile();
|
||||
}
|
||||
|
||||
|
||||
file.truncateFile(siz);
|
||||
file.flushFile();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2015,8 +2043,8 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
* @exception java.io.IOException
|
||||
* The exception description.
|
||||
*/
|
||||
public int writeFile(SrvSession sess, TreeConnection tree, NetworkFile file, byte[] buf, int bufoff, int siz,
|
||||
long fileoff) throws java.io.IOException
|
||||
public int writeFile(SrvSession sess, TreeConnection tree, final NetworkFile file, final byte[] buf, final int bufoff, final int siz,
|
||||
final long fileoff) throws java.io.IOException
|
||||
{
|
||||
// Check if the file is a directory, or only has read access
|
||||
|
||||
@@ -2027,12 +2055,22 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
|
||||
AVMNetworkFile avmFile = (AVMNetworkFile) file;
|
||||
|
||||
if (avmFile.hasContentChannel() == false || avmFile.isWritable() == false)
|
||||
beginWriteTransaction( sess);
|
||||
|
||||
// Write the data to the file
|
||||
if (avmFile.hasContentChannel() == false || avmFile.isWritable() == false)
|
||||
{
|
||||
doInWriteTransaction(sess, new Callable<Void>(){
|
||||
|
||||
public Void call() throws Exception
|
||||
{
|
||||
file.writeFile(buf, siz, bufoff, fileoff);
|
||||
return null;
|
||||
}});
|
||||
}
|
||||
else
|
||||
{
|
||||
file.writeFile(buf, siz, bufoff, fileoff);
|
||||
}
|
||||
|
||||
file.writeFile(buf, siz, bufoff, fileoff);
|
||||
|
||||
// Return the actual write length
|
||||
|
||||
|
Reference in New Issue
Block a user