mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.2 to HEAD
19659: ALF-589 - MT: Could not startup Alfresco with tenant after adding a custom model (and using tenant routing file content store) 19666: ALF-589 - remove unnecessary warn git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19669 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -28,6 +28,7 @@ import java.util.Set;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.EmptyContentReader;
|
||||
import org.alfresco.repo.i18n.MessageDeployer;
|
||||
import org.alfresco.repo.i18n.MessageService;
|
||||
import org.alfresco.repo.tenant.TenantAdminService;
|
||||
@@ -212,10 +213,11 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
|
||||
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace("onDictionaryInit: ["+Thread.currentThread()+"]");
|
||||
String tenantDomain = tenantAdminService.getCurrentUserDomain();
|
||||
logger.trace("onDictionaryInit: ["+Thread.currentThread()+"]"+(tenantDomain.equals(TenantService.DEFAULT_DOMAIN) ? "" : " (Tenant: "+tenantDomain+")"));
|
||||
}
|
||||
|
||||
Collection<QName> modelsBefore = dictionaryDAO.getModels();
|
||||
Collection<QName> modelsBefore = dictionaryDAO.getModels(); // note: re-entrant
|
||||
int modelsBeforeCnt = (modelsBefore != null ? modelsBefore.size() : 0);
|
||||
|
||||
List<String> loadedModels = new ArrayList<String>();
|
||||
@@ -295,18 +297,10 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
|
||||
Collection<QName> modelsAfter = dictionaryDAO.getModels();
|
||||
int modelsAfterCnt = (modelsAfter != null ? modelsAfter.size() : 0);
|
||||
|
||||
if (modelsAfterCnt != (modelsBeforeCnt + loadedModels.size()))
|
||||
{
|
||||
String tenantDomain = tenantAdminService.getCurrentUserDomain();
|
||||
logger.warn("Model count: before="+modelsBeforeCnt+", load="+loadedModels.size()+", after="+modelsAfterCnt+" in "+(System.currentTimeMillis()-startTime)+" msecs ["+Thread.currentThread()+"] "+(tenantDomain.equals(TenantService.DEFAULT_DOMAIN) ? "" : " (Tenant: "+tenantDomain+")"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
String tenantDomain = tenantAdminService.getCurrentUserDomain();
|
||||
logger.debug("Model count: before="+modelsBeforeCnt+", load="+loadedModels.size()+", after="+modelsAfterCnt+" in "+(System.currentTimeMillis()-startTime)+" msecs ["+Thread.currentThread()+"] "+(tenantDomain.equals(TenantService.DEFAULT_DOMAIN) ? "" : " (Tenant: "+tenantDomain+")"));
|
||||
}
|
||||
logger.debug("Model count: before="+modelsBeforeCnt+", load/update="+loadedModels.size()+", after="+modelsAfterCnt+" in "+(System.currentTimeMillis()-startTime)+" msecs ["+Thread.currentThread()+"] "+(tenantDomain.equals(TenantService.DEFAULT_DOMAIN) ? "" : " (Tenant: "+tenantDomain+")"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -458,9 +452,17 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
|
||||
M2Model model = null;
|
||||
ContentReader contentReader = this.contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);
|
||||
if (contentReader != null)
|
||||
{
|
||||
if (contentReader instanceof EmptyContentReader)
|
||||
{
|
||||
// belts-and-braces
|
||||
logger.error("Failed to create model (due to EmptyContentReader): "+nodeRef);
|
||||
}
|
||||
else
|
||||
{
|
||||
model = M2Model.createModel(contentReader.getContentInputStream());
|
||||
}
|
||||
}
|
||||
// TODO should we inactivate the model node and put the error somewhere??
|
||||
return model;
|
||||
}
|
||||
|
@@ -271,7 +271,8 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
||||
register(dictionaryComponent);
|
||||
|
||||
// register file store - to allow enable/disable tenant callbacks
|
||||
register(tenantFileContentStore);
|
||||
// note: tenantFileContentStore must be registed before dictionaryRepositoryBootstrap
|
||||
register(tenantFileContentStore, 0);
|
||||
|
||||
UserTransaction userTransaction = transactionService.getUserTransaction();
|
||||
|
||||
@@ -1075,16 +1076,28 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
||||
}
|
||||
|
||||
public void register(TenantDeployer deployer)
|
||||
{
|
||||
register(deployer, -1);
|
||||
}
|
||||
|
||||
protected void register(TenantDeployer deployer, int position)
|
||||
{
|
||||
if (deployer == null)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("TenantDeployer must be provided");
|
||||
throw new AlfrescoRuntimeException("Deployer must be provided");
|
||||
}
|
||||
|
||||
if (! tenantDeployers.contains(deployer))
|
||||
{
|
||||
if (position == -1)
|
||||
{
|
||||
tenantDeployers.add(deployer);
|
||||
}
|
||||
else
|
||||
{
|
||||
tenantDeployers.add(position, deployer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void unregister(TenantDeployer deployer)
|
||||
|
Reference in New Issue
Block a user