Merged V3.2 to HEAD

19507: ALF-955: deletion of dynamic custom model
   19553: Follow-on to r19507 (ALF-955) - fix testAutoRemovalOfVersionHistory


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19569 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2010-03-25 09:30:11 +00:00
parent fcffbe3af8
commit f3b8452415
10 changed files with 563 additions and 169 deletions

View File

@@ -162,8 +162,8 @@ public class DictionaryDAOImpl implements DictionaryDAO
}
destroy();
init();
init();
if (logger.isDebugEnabled())
{
logger.debug("... resetting dictionary completed");
@@ -175,17 +175,19 @@ public class DictionaryDAOImpl implements DictionaryDAO
{
long startTime = System.currentTimeMillis();
if (logger.isDebugEnabled())
{
logger.debug("Init Dictionary: ["+Thread.currentThread()+"] "+(tenantDomain.equals(TenantService.DEFAULT_DOMAIN) ? "" : " (Tenant: "+tenantDomain+")"));
}
try
{
return AuthenticationUtil.runAs(new RunAsWork<DictionaryRegistry>()
{
public DictionaryRegistry doWork()
{
{
try
{
// create threadlocal, if needed
createDataDictionaryLocal(tenantDomain);
DictionaryRegistry dictionaryRegistry = initDictionaryRegistry(tenantDomain);
if (dictionaryRegistry == null)
@@ -221,24 +223,32 @@ public class DictionaryDAOImpl implements DictionaryDAO
readLock.unlock();
}
}
}
}
}, tenantService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenantDomain));
}
finally
{
if (logger.isInfoEnabled())
{
logger.info("Init Dictionary: model count = "+(getModels() != null ? getModels().size() : 0) +" in "+(System.currentTimeMillis()-startTime)+" msecs "+(tenantDomain.equals(TenantService.DEFAULT_DOMAIN) ? "" : " (Tenant: "+tenantDomain+")"));
logger.info("Init Dictionary: model count = "+(getModels() != null ? getModels().size() : 0) +" in "+(System.currentTimeMillis()-startTime)+" msecs ["+Thread.currentThread()+"] "+(tenantDomain.equals(TenantService.DEFAULT_DOMAIN) ? "" : " (Tenant: "+tenantDomain+")"));
}
}
}
private DictionaryRegistry initDictionaryRegistry(String tenantDomain)
{
getDictionaryRegistry(tenantDomain).setCompiledModels(new HashMap<QName,CompiledModel>());
getDictionaryRegistry(tenantDomain).setUriToModels(new HashMap<String, List<CompiledModel>>());
// create threadlocal, if needed
DictionaryRegistry dictionaryRegistry = createDataDictionaryLocal(tenantDomain);
// initialise empty dictionary & namespaces
dictionaryRegistry.setCompiledModels(new HashMap<QName,CompiledModel>());
dictionaryRegistry.setUriToModels(new HashMap<String, List<CompiledModel>>());
if (logger.isTraceEnabled())
{
logger.trace("Empty dictionary initialised: "+dictionaryRegistry+" - "+defaultDictionaryRegistryThreadLocal+" ["+Thread.currentThread()+"]");
}
// initialise empty namespaces
namespaceDAO.init();
// populate the dictionary based on registered sources
@@ -253,7 +263,7 @@ public class DictionaryDAOImpl implements DictionaryDAO
dictionaryListener.afterDictionaryInit();
}
return getDictionaryRegistryLocal(tenantDomain);
return dictionaryRegistry;
}
/* (non-Javadoc)
@@ -1018,7 +1028,7 @@ public class DictionaryDAOImpl implements DictionaryDAO
}
// create threadlocal
private void createDataDictionaryLocal(String tenantDomain)
private DictionaryRegistry createDataDictionaryLocal(String tenantDomain)
{
// create threadlocal, if needed
DictionaryRegistry dictionaryRegistry = getDictionaryRegistryLocal(tenantDomain);
@@ -1035,6 +1045,8 @@ public class DictionaryDAOImpl implements DictionaryDAO
dictionaryRegistryThreadLocal.set(dictionaryRegistry);
}
}
return dictionaryRegistry;
}
// get threadlocal