Merged V4.1-BUG-FIX to HEAD

42804: Merged BRANCHES/DEV/BELARUS/V4.1-BUG-FIX-2012_10_17 to BRANCHES/DEV/V4.1-BUG-FIX:
      42748: ALF-14200: Adding Invalid Aspects Via CMIS ATOM API Results in NullPointerException
   42810: Fix for ALF-15276 - sys:locale Attribute No Longer Available From jsnode
   42814: ALF-15276 - small improvement to remove duplicated data from response
   42824: ALF-15048: Merged PATCHES/V4.0.2 to V4.1-BUG-FIX
        42724: ALF-16048: CLONE - Version history doesn't go beyond two versions (0.1 and 0.2) when dragged and dropped via CIFS from Mac Lion OSx
        42739: ALF-16048: New files missing from previous check in
        42742: ALF-16048: Another missing file.
   42839: ALF-16417: Fix "Hybrid Sync - can retain invalid cloud tickets in a local cache"
      - retry once for invalid auth 
      - also externalise the implicit/default cache config
   42849: NodeDAO: Added new method to retrieve specific store ID
    - public Pair<Long, StoreRef> getStore(StoreRef storeRef);
   42857: Merged DEV to V4.1-BUG-FIX
      42821: ALF-13506 : WCMQS Example Application Caching Causes Changes to Inconsistently Appear on the Editorial Web Site
             Concurrency was improved for AssetImpl class.
             The returned values of the collections were made unmodifiable in the classes which implement Resource interface.
   42872: ALF-15601: "Performance issue using CMIS method getChildren() - gets version history"
   - avoids getting the version history (an expensive operation) if possible i.e. in the case of current version (live) nodes like for getChildren
   42900: Merged DEV to V4.1-BUG-FIX
      42734: ALF-15335 : 'external' authentication subsystem debug information too scarce
         Extended debug information in the authentication subsystem.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@42904 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2012-10-21 18:09:03 +00:00
parent 78a151522e
commit b58125d078
25 changed files with 1191 additions and 176 deletions

View File

@@ -76,6 +76,8 @@ import org.alfresco.model.ContentModel;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.content.encoding.ContentCharsetFinder;
import org.alfresco.repo.content.filestore.FileContentReader;
import org.alfresco.repo.node.archive.NodeArchiveService;
import org.alfresco.repo.node.archive.RestoreNodeReport;
import org.alfresco.repo.policy.BehaviourFilter;
import org.alfresco.repo.security.authentication.AuthenticationContext;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
@@ -143,6 +145,7 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
private BehaviourFilter policyBehaviourFilter;
private NodeMonitorFactory m_nodeMonitorFactory;
private ContentComparator contentComparator;
private NodeArchiveService nodeArchiveService;
// TODO Should not be here - should be specific to a context.
private boolean isLockedFilesAsOffline;
@@ -168,6 +171,7 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
PropertyCheck.mandatory(this, "m_nodeMonitorFactory", m_nodeMonitorFactory);
PropertyCheck.mandatory(this, "ioControlHandler", ioControlHandler);
PropertyCheck.mandatory(this, "contentComparator", getContentComparator());
PropertyCheck.mandatory(this, "nodeArchiveService", nodeArchiveService);
}
/**
@@ -1170,6 +1174,11 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
throw new AlfrescoRuntimeException("obsolete method called");
}
public void deleteFile(final SrvSession session, final TreeConnection tree, final String name) throws IOException
{
throw new AlfrescoRuntimeException("obsolete method called");
}
/**
* Delete the specified file.
*
@@ -1177,8 +1186,9 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
* @param tree Tree connection
* @param file NetworkFile
* @exception java.io.IOException The exception description.
* @return NodeRef of deletedFile
*/
public void deleteFile(final SrvSession session, final TreeConnection tree, final String name) throws IOException
public NodeRef deleteFile2(final SrvSession session, final TreeConnection tree, NodeRef rootNode, String path) throws IOException
{
// Get the device context
@@ -1186,21 +1196,21 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
if(logger.isDebugEnabled())
{
logger.debug("deleteFile:" + name + ", session:" + session.getUniqueId());
logger.debug("deleteFile:" + path + ", session:" + session.getUniqueId());
}
try
{
if(session.isPseudoFilesEnabled() && ctx.isPseudoFilesEnabled())
{
String[] paths = FileName.splitPath(name);
String[] paths = FileName.splitPath(path);
// lookup parent directory
NodeRef dirNodeRef = getNodeForPath(tree, paths[0]);
// Check whether we are opening a pseudo file
if(ctx.getPseudoFileOverlay().isPseudoFile(dirNodeRef, paths[1]))
{
return;
return null;
}
}
@@ -1209,34 +1219,34 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
final QuotaManager quotaMgr = ctx.getQuotaManager();
// Get the node and delete it
final NodeRef nodeRef = getNodeForPath(tree, name);
final NodeRef nodeRef = getNodeForPath(tree, path);
if (fileFolderService.exists(nodeRef))
{
// Get the size of the file being deleted
final FileInfo fInfo = quotaMgr == null ? null : getFileInformation(session, tree, name);
final FileInfo fInfo = quotaMgr == null ? null : getFileInformation(session, tree, path);
if(logger.isDebugEnabled())
{
logger.debug("deleted file" + name);
logger.debug("deleted file" + path);
}
fileFolderService.delete(nodeRef);
//TODO Needs to be post-commit
if (quotaMgr != null)
{
quotaMgr.releaseSpace(session, tree, fInfo.getFileId(), name, fInfo.getSize());
quotaMgr.releaseSpace(session, tree, fInfo.getFileId(), path, fInfo.getSize());
}
// Debug
if (logger.isDebugEnabled())
{
logger.debug("Deleted file: " + name + ", nodeRef=" + nodeRef);
logger.debug("Deleted file: " + path + ", nodeRef=" + nodeRef);
}
// void return
return;
return nodeRef;
}
}
catch (NodeLockedException ex)
@@ -1247,7 +1257,7 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
}
// Convert to a filesystem access denied status
throw new AccessDeniedException("Unable to delete " + name);
throw new AccessDeniedException("Unable to delete " + path);
}
catch (org.alfresco.repo.security.permissions.AccessDeniedException ex)
{
@@ -1259,7 +1269,7 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
}
// Convert to a filesystem access denied status
throw new AccessDeniedException("Unable to delete " + name);
throw new AccessDeniedException("Unable to delete " + path);
}
catch (IOException ex)
{
@@ -1280,10 +1290,11 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
}
// Convert to a general I/O exception
IOException ioe = new IOException("Delete file " + name);
IOException ioe = new IOException("Delete file " + path);
ioe.initCause(ex);
throw ioe;
}
return null;
}
/**
@@ -2997,4 +3008,49 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
{
return contentComparator;
}
@Override
public NetworkFile restoreFile(
SrvSession sess,
TreeConnection tree,
NodeRef rootNode,
String path,
long allocationSize,
NodeRef originalNodeRef) throws IOException
{
// First attempt to restore the node
if(logger.isDebugEnabled())
{
logger.debug("restore node:" + originalNodeRef + ", path:" + path);
}
NodeRef archivedNodeRef = getNodeArchiveService().getArchivedNode(originalNodeRef);
RestoreNodeReport report = getNodeArchiveService().restoreArchivedNode(archivedNodeRef);
if(report.getStatus().isSuccess())
{
NodeRef newNodeRef = report.getRestoredNodeRef();
if (logger.isDebugEnabled())
{
logger.debug("node has been restored");
}
return openFile(sess, tree, rootNode, path, OpenFileMode.READ_WRITE, true);
}
else
{
return createFile(rootNode, path, allocationSize);
}
}
public void setNodeArchiveService(NodeArchiveService nodeArchiveService)
{
this.nodeArchiveService = nodeArchiveService;
}
public NodeArchiveService getNodeArchiveService()
{
return nodeArchiveService;
}
}