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.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.repo.content.EmptyContentReader;
|
||||||
import org.alfresco.repo.i18n.MessageDeployer;
|
import org.alfresco.repo.i18n.MessageDeployer;
|
||||||
import org.alfresco.repo.i18n.MessageService;
|
import org.alfresco.repo.i18n.MessageService;
|
||||||
import org.alfresco.repo.tenant.TenantAdminService;
|
import org.alfresco.repo.tenant.TenantAdminService;
|
||||||
@@ -212,10 +213,11 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
|
|||||||
|
|
||||||
if (logger.isTraceEnabled())
|
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);
|
int modelsBeforeCnt = (modelsBefore != null ? modelsBefore.size() : 0);
|
||||||
|
|
||||||
List<String> loadedModels = new ArrayList<String>();
|
List<String> loadedModels = new ArrayList<String>();
|
||||||
@@ -295,18 +297,10 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
|
|||||||
Collection<QName> modelsAfter = dictionaryDAO.getModels();
|
Collection<QName> modelsAfter = dictionaryDAO.getModels();
|
||||||
int modelsAfterCnt = (modelsAfter != null ? modelsAfter.size() : 0);
|
int modelsAfterCnt = (modelsAfter != null ? modelsAfter.size() : 0);
|
||||||
|
|
||||||
if (modelsAfterCnt != (modelsBeforeCnt + loadedModels.size()))
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
String tenantDomain = tenantAdminService.getCurrentUserDomain();
|
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+")"));
|
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+")"));
|
||||||
}
|
|
||||||
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+")"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,7 +453,15 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
|
|||||||
ContentReader contentReader = this.contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);
|
ContentReader contentReader = this.contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);
|
||||||
if (contentReader != null)
|
if (contentReader != null)
|
||||||
{
|
{
|
||||||
model = M2Model.createModel(contentReader.getContentInputStream());
|
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??
|
// TODO should we inactivate the model node and put the error somewhere??
|
||||||
return model;
|
return model;
|
||||||
|
@@ -271,23 +271,24 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
register(dictionaryComponent);
|
register(dictionaryComponent);
|
||||||
|
|
||||||
// register file store - to allow enable/disable tenant callbacks
|
// 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();
|
UserTransaction userTransaction = transactionService.getUserTransaction();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
authenticationContext.setSystemUserAsCurrentUser();
|
authenticationContext.setSystemUserAsCurrentUser();
|
||||||
userTransaction.begin();
|
userTransaction.begin();
|
||||||
|
|
||||||
// bootstrap Tenant Service internal cache
|
// bootstrap Tenant Service internal cache
|
||||||
List<Tenant> tenants = getAllTenants();
|
List<Tenant> tenants = getAllTenants();
|
||||||
|
|
||||||
int enabledCount = 0;
|
int enabledCount = 0;
|
||||||
int disabledCount = 0;
|
int disabledCount = 0;
|
||||||
|
|
||||||
for (Tenant tenant : tenants)
|
for (Tenant tenant : tenants)
|
||||||
{
|
{
|
||||||
if (tenant.isEnabled())
|
if (tenant.isEnabled())
|
||||||
{
|
{
|
||||||
// this will also call tenant deployers registered so far ...
|
// this will also call tenant deployers registered so far ...
|
||||||
@@ -1075,15 +1076,27 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void register(TenantDeployer deployer)
|
public void register(TenantDeployer deployer)
|
||||||
|
{
|
||||||
|
register(deployer, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void register(TenantDeployer deployer, int position)
|
||||||
{
|
{
|
||||||
if (deployer == null)
|
if (deployer == null)
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("TenantDeployer must be provided");
|
throw new AlfrescoRuntimeException("Deployer must be provided");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! tenantDeployers.contains(deployer))
|
if (! tenantDeployers.contains(deployer))
|
||||||
{
|
{
|
||||||
tenantDeployers.add(deployer);
|
if (position == -1)
|
||||||
|
{
|
||||||
|
tenantDeployers.add(deployer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tenantDeployers.add(position, deployer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1092,8 +1105,8 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
if (deployer == null)
|
if (deployer == null)
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("TenantDeployer must be provided");
|
throw new AlfrescoRuntimeException("TenantDeployer must be provided");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tenantDeployers != null)
|
if (tenantDeployers != null)
|
||||||
{
|
{
|
||||||
tenantDeployers.remove(deployer);
|
tenantDeployers.remove(deployer);
|
||||||
|
Reference in New Issue
Block a user