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:
Jan Vonka
2010-03-30 13:23:54 +00:00
parent 7b979fa11e
commit 3ada598751
2 changed files with 37 additions and 22 deletions

View File

@@ -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;
}

View File

@@ -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)