mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-16 17:55:15 +00:00
Merged V2.2 to HEAD
8265: Added catch blocks for the permissions service access denied exception to various file/folder operations 8286: Merged V2.1 to V2.2 8256: Fix broken WCM workflow. 8257: Partial fix for AWC-1850 8283: Merged V2.1-A to V2.1 8264: Fine-grained debug logging for exceptions causing transaction retries. 8288: Should fix workflow problems. Hard to test since almost nothing works right now. 8291: Added Peter's fixes to improve deployment start scripts 8294: Update deploy script from Peter 8298: Fix for WCM-1058: 8300: Commented out admin dashlet (active_tasks) 8359: Fix AR-1735: Customer-requested POI upgrade 8367: Fix for AWC-1639 8368: Fix for WCM-1102 8389: Revert changes between r8072 and r8251 from Schema2XForms.java 8401: Fix for WCM-1105 8407: Minor typo fix git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8488 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
parent
c5edd151e9
commit
78c695fc0a
@ -220,6 +220,10 @@
|
||||
class="org.alfresco.linkvalidation.LinkValidationServiceImpl"
|
||||
lazy-init="true"
|
||||
init-method="register">
|
||||
|
||||
<property name="authenticationComponent">
|
||||
<ref bean="authenticationComponent"/>
|
||||
</property>
|
||||
<property name="attributeService">
|
||||
<ref bean="AttributeService"/>
|
||||
</property>
|
||||
|
@ -23,8 +23,6 @@
|
||||
|
||||
package org.alfresco.filesys.avm;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.filesys.alfresco.AlfrescoContext;
|
||||
import org.alfresco.filesys.alfresco.IOControlHandler;
|
||||
import org.alfresco.filesys.state.FileState;
|
||||
@ -37,9 +35,6 @@ import org.alfresco.repo.avm.CreateStoreCallback;
|
||||
import org.alfresco.repo.avm.CreateVersionCallback;
|
||||
import org.alfresco.repo.avm.PurgeStoreCallback;
|
||||
import org.alfresco.repo.avm.PurgeVersionCallback;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.sandbox.SandboxConstants;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@ -58,7 +53,7 @@ public class AVMContext extends AlfrescoContext
|
||||
private static final Log logger = LogFactory.getLog(AVMContext.class);
|
||||
|
||||
// Constants
|
||||
//
|
||||
//
|
||||
// Version id that indicates the head version
|
||||
|
||||
public static final int VERSION_HEAD = -1;
|
||||
@ -246,6 +241,7 @@ public class AVMContext extends AlfrescoContext
|
||||
|
||||
return showStore;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the filesystem context
|
||||
*/
|
||||
|
@ -868,6 +868,14 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
{
|
||||
throw new FileNotFoundException(params.getPath());
|
||||
}
|
||||
catch (AVMLockingException ex)
|
||||
{
|
||||
throw new AccessDeniedException(params.getPath());
|
||||
}
|
||||
catch ( org.alfresco.repo.security.permissions.AccessDeniedException ex)
|
||||
{
|
||||
throw new AccessDeniedException(params.getPath());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -967,6 +975,10 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
{
|
||||
throw new AccessDeniedException(params.getPath());
|
||||
}
|
||||
catch ( org.alfresco.repo.security.permissions.AccessDeniedException ex)
|
||||
{
|
||||
throw new AccessDeniedException(params.getPath());
|
||||
}
|
||||
|
||||
// Return the file
|
||||
|
||||
@ -1039,6 +1051,10 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
{
|
||||
throw new IOException("Invalid path, " + dir);
|
||||
}
|
||||
catch ( org.alfresco.repo.security.permissions.AccessDeniedException ex)
|
||||
{
|
||||
throw new AccessDeniedException("Access denied, " + dir);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1105,6 +1121,10 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
{
|
||||
throw new AccessDeniedException("File locked, " + name);
|
||||
}
|
||||
catch ( org.alfresco.repo.security.permissions.AccessDeniedException ex)
|
||||
{
|
||||
throw new AccessDeniedException("Access denied, " + name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1493,6 +1513,10 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
{
|
||||
throw new FileNotFoundException(params.getPath());
|
||||
}
|
||||
catch ( org.alfresco.repo.security.permissions.AccessDeniedException ex)
|
||||
{
|
||||
throw new FileNotFoundException(params.getPath());
|
||||
}
|
||||
|
||||
// Return the file
|
||||
|
||||
@ -1615,6 +1639,10 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
{
|
||||
throw new FileExistsException("Destination exists, " + newName);
|
||||
}
|
||||
catch ( org.alfresco.repo.security.permissions.AccessDeniedException ex)
|
||||
{
|
||||
throw new AccessDeniedException("Access denied, " + oldName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,12 +27,11 @@
|
||||
|
||||
package org.alfresco.linkvalidation;
|
||||
|
||||
import java.net.SocketException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.net.ssl.SSLException;
|
||||
import org.alfresco.service.cmr.avm.AVMNotFoundException;
|
||||
import org.alfresco.util.NameMatcher;
|
||||
import java.net.SocketException;
|
||||
import javax.net.ssl.SSLException;
|
||||
|
||||
public interface LinkValidationService
|
||||
{
|
||||
|
@ -535,7 +535,7 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
{
|
||||
try
|
||||
{
|
||||
// layers are not ye indexed
|
||||
// layers are not yet indexed
|
||||
setupBasicTree();
|
||||
fService.createStore("layer");
|
||||
fService.createDirectory("layer:/", "root");
|
||||
|
@ -258,71 +258,81 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
||||
*/
|
||||
}
|
||||
// Clear out the new nodes.
|
||||
List<Long> allLayeredNodeIDs = AVMDAOs.Instance().fAVMNodeDAO.getNewLayeredInStoreIDs(me);
|
||||
AVMDAOs.Instance().fAVMNodeDAO.clearNewInStore(me);
|
||||
AVMDAOs.Instance().fAVMNodeDAO.clear();
|
||||
List<Long> layeredNodeIDs = new ArrayList<Long>();
|
||||
for (Long layeredID : allLayeredNodeIDs)
|
||||
try
|
||||
{
|
||||
Layered layered = (Layered)AVMDAOs.Instance().fAVMNodeDAO.getByID(layeredID);
|
||||
String indirection = layered.getIndirection();
|
||||
if (indirection == null)
|
||||
// attempt to clear only AVMNodes from cache, to allow direct batch update of them
|
||||
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||
AVMDAOs.Instance().fAVMNodeDAO.noCache();
|
||||
AVMDAOs.Instance().fAVMNodeDAO.clearNewInStore(me);
|
||||
|
||||
List<Long> allLayeredNodeIDs = AVMDAOs.Instance().fAVMNodeDAO.getNewLayeredInStoreIDs(me);
|
||||
List<Long> layeredNodeIDs = new ArrayList<Long>();
|
||||
for (Long layeredID : allLayeredNodeIDs)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
layeredNodeIDs.add(layeredID);
|
||||
String storeName = indirection.substring(0, indirection.indexOf(':'));
|
||||
if (!snapShotMap.containsKey(storeName))
|
||||
{
|
||||
AVMStore store = AVMDAOs.Instance().fAVMStoreDAO.getByName(storeName);
|
||||
if (store == null)
|
||||
Layered layered = (Layered)AVMDAOs.Instance().fAVMNodeDAO.getByID(layeredID);
|
||||
String indirection = layered.getIndirection();
|
||||
if (indirection == null)
|
||||
{
|
||||
layered.setIndirectionVersion(-1);
|
||||
continue;
|
||||
}
|
||||
layeredNodeIDs.add(layeredID);
|
||||
String storeName = indirection.substring(0, indirection.indexOf(':'));
|
||||
if (!snapShotMap.containsKey(storeName))
|
||||
{
|
||||
AVMStore store = AVMDAOs.Instance().fAVMStoreDAO.getByName(storeName);
|
||||
if (store == null)
|
||||
{
|
||||
layered.setIndirectionVersion(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
store.createSnapshot(null, null, snapShotMap);
|
||||
layered = (Layered)AVMDAOs.Instance().fAVMNodeDAO.getByID(layeredID);
|
||||
layered.setIndirectionVersion(snapShotMap.get(storeName));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
store.createSnapshot(null, null, snapShotMap);
|
||||
layered = (Layered)AVMDAOs.Instance().fAVMNodeDAO.getByID(layeredID);
|
||||
layered.setIndirectionVersion(snapShotMap.get(storeName));
|
||||
}
|
||||
}
|
||||
else
|
||||
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||
// Make up a new version record.
|
||||
String user = RawServices.Instance().getAuthenticationComponent().getCurrentUserName();
|
||||
if (user == null)
|
||||
{
|
||||
layered.setIndirectionVersion(snapShotMap.get(storeName));
|
||||
user = RawServices.Instance().getAuthenticationComponent().getSystemUserName();
|
||||
}
|
||||
me = (AVMStoreImpl)AVMDAOs.Instance().fAVMStoreDAO.getByID(fID);
|
||||
VersionRoot versionRoot = new VersionRootImpl(me,
|
||||
me.fRoot,
|
||||
me.fNextVersionID++,
|
||||
System.currentTimeMillis(),
|
||||
user,
|
||||
tag,
|
||||
description);
|
||||
// Another embarassing flush needed.
|
||||
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||
AVMDAOs.Instance().fVersionRootDAO.save(versionRoot);
|
||||
for (Long nodeID : layeredNodeIDs)
|
||||
{
|
||||
AVMNode node = AVMDAOs.Instance().fAVMNodeDAO.getByID(nodeID);
|
||||
List<String> paths = fAVMRepository.getVersionPaths(versionRoot, node);
|
||||
for (String path : paths)
|
||||
{
|
||||
VersionLayeredNodeEntry entry =
|
||||
new VersionLayeredNodeEntryImpl(versionRoot, path);
|
||||
AVMDAOs.Instance().fVersionLayeredNodeEntryDAO.save(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||
// Make up a new version record.
|
||||
String user = RawServices.Instance().getAuthenticationComponent().getCurrentUserName();
|
||||
if (user == null)
|
||||
finally
|
||||
{
|
||||
user = RawServices.Instance().getAuthenticationComponent().getSystemUserName();
|
||||
}
|
||||
me = (AVMStoreImpl)AVMDAOs.Instance().fAVMStoreDAO.getByID(fID);
|
||||
VersionRoot versionRoot = new VersionRootImpl(me,
|
||||
me.fRoot,
|
||||
me.fNextVersionID++,
|
||||
System.currentTimeMillis(),
|
||||
user,
|
||||
tag,
|
||||
description);
|
||||
// Another embarassing flush needed.
|
||||
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||
AVMDAOs.Instance().fVersionRootDAO.save(versionRoot);
|
||||
for (Long nodeID : layeredNodeIDs)
|
||||
{
|
||||
AVMNode node = AVMDAOs.Instance().fAVMNodeDAO.getByID(nodeID);
|
||||
List<String> paths = fAVMRepository.getVersionPaths(versionRoot, node);
|
||||
for (String path : paths)
|
||||
{
|
||||
VersionLayeredNodeEntry entry =
|
||||
new VersionLayeredNodeEntryImpl(versionRoot, path);
|
||||
AVMDAOs.Instance().fVersionLayeredNodeEntryDAO.save(entry);
|
||||
}
|
||||
AVMDAOs.Instance().fAVMNodeDAO.yesCache();
|
||||
}
|
||||
return snapShotMap;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new directory.
|
||||
* @param path The path to the containing directory.
|
||||
|
@ -24,8 +24,11 @@
|
||||
*/
|
||||
package org.alfresco.repo.domain.hibernate;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.repo.avm.hibernate.SessionCacheChecker;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||
@ -33,6 +36,8 @@ import org.alfresco.util.resource.MethodResourceManager;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.engine.CollectionKey;
|
||||
import org.hibernate.engine.EntityKey;
|
||||
import org.hibernate.stat.SessionStatistics;
|
||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||
|
||||
@ -133,7 +138,8 @@ public class SessionSizeResourceManager extends HibernateDaoSupport implements M
|
||||
if ((entityCount + collectionCount) > threshold)
|
||||
{
|
||||
session.flush();
|
||||
session.clear();
|
||||
selectivelyClear(session, stats);
|
||||
// session.clear();
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
String msg = String.format(
|
||||
@ -144,4 +150,28 @@ public class SessionSizeResourceManager extends HibernateDaoSupport implements M
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void selectivelyClear(Session session, SessionStatistics stats)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.error(stats);
|
||||
}
|
||||
Set<EntityKey> keys = new HashSet<EntityKey>((Set<EntityKey>)stats.getEntityKeys());
|
||||
for (EntityKey key : keys)
|
||||
{
|
||||
// This should probably be configurable but frankly the nauseous extrusion of Gavin King's
|
||||
// programmatic alimentary tract (hibernate) will go away before this could make a difference.
|
||||
if (!key.getEntityName().startsWith("org.alfresco"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Object val = session.get(key.getEntityName(), key.getIdentifier());
|
||||
if (val != null)
|
||||
{
|
||||
session.evict(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -254,9 +254,11 @@ public class RetryingTransactionHelper
|
||||
{
|
||||
if (count != 0)
|
||||
{
|
||||
logger.debug(
|
||||
"Transaction succeeded after " + count +
|
||||
" retries on thread " + Thread.currentThread().getName());
|
||||
logger.debug("\n" +
|
||||
"Transaction succeeded: \n" +
|
||||
" Thread: " + Thread.currentThread().getName() + "\n" +
|
||||
" Txn: " + txn + "\n" +
|
||||
" Iteration: " + count);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -277,6 +279,16 @@ public class RetryingTransactionHelper
|
||||
e);
|
||||
}
|
||||
}
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("\n" +
|
||||
"Transaction commit failed: \n" +
|
||||
" Thread: " + Thread.currentThread().getName() + "\n" +
|
||||
" Txn: " + txn + "\n" +
|
||||
" Iteration: " + count + "\n" +
|
||||
" Exception follows:",
|
||||
e);
|
||||
}
|
||||
// Rollback if we can.
|
||||
if (txn != null)
|
||||
{
|
||||
|
@ -24,6 +24,7 @@
|
||||
*/
|
||||
package org.alfresco.repo.workflow.jbpm;
|
||||
|
||||
import org.alfresco.repo.domain.hibernate.SessionSizeResourceManager;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||
import org.alfresco.repo.transaction.TransactionListener;
|
||||
import org.alfresco.util.GUID;
|
||||
@ -115,6 +116,7 @@ public class JBPMTransactionTemplate extends JbpmTemplate
|
||||
if (context == null)
|
||||
{
|
||||
context = super.getContext();
|
||||
SessionSizeResourceManager.setDisableInTransaction();
|
||||
AlfrescoTransactionSupport.bindResource(JBPM_CONTEXT_KEY, context);
|
||||
AlfrescoTransactionSupport.bindListener(this);
|
||||
|
||||
@ -155,24 +157,6 @@ public class JBPMTransactionTemplate extends JbpmTemplate
|
||||
* @see org.alfresco.repo.transaction.TransactionListener#beforeCommit(boolean)
|
||||
*/
|
||||
public void beforeCommit(boolean readOnly)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.transaction.TransactionListener#beforeCompletion()
|
||||
*/
|
||||
public void beforeCompletion()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.transaction.TransactionListener#afterCommit()
|
||||
*/
|
||||
public void afterCommit()
|
||||
{
|
||||
JbpmContext context = (JbpmContext)AlfrescoTransactionSupport.getResource(JBPM_CONTEXT_KEY);
|
||||
if (context != null)
|
||||
@ -185,6 +169,22 @@ public class JBPMTransactionTemplate extends JbpmTemplate
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.transaction.TransactionListener#beforeCompletion()
|
||||
*/
|
||||
public void beforeCompletion()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.transaction.TransactionListener#afterCommit()
|
||||
*/
|
||||
public void afterCommit()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.transaction.TransactionListener#afterRollback()
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user