Dynamic model activation / deactivation - via WebClient UI or RepoAdmin console - also verified in MT env

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6712 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2007-09-10 11:37:01 +00:00
parent c730f41aba
commit 3b58addf08
9 changed files with 546 additions and 400 deletions

View File

@@ -29,6 +29,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.i18n.MessageDeployer;
import org.alfresco.repo.i18n.MessageService;
@@ -260,15 +261,18 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
false);
for (NodeRef dictionaryModel : nodeRefs)
{
// TODO - should validate in case of re-deploy - e.g. update or delete
M2Model model = createM2Model(dictionaryModel);
if (model != null)
{
for (M2Namespace namespace : model.getNamespaces())
{
modelMap.put(namespace.getUri(), model);
}
{
boolean isActive = ((Boolean)nodeService.getProperty(dictionaryModel, ContentModel.PROP_MODEL_ACTIVE)).booleanValue();
if (isActive)
{
M2Model model = createM2Model(dictionaryModel);
if (model != null)
{
for (M2Namespace namespace : model.getNamespaces())
{
modelMap.put(namespace.getUri(), model);
}
}
}
}
}
@@ -377,8 +381,16 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
// an error will be raised during compilation
}
dictionaryDAO.putModel(model);
loadedModels.add(modelName);
try
{
dictionaryDAO.putModel(model);
loadedModels.add(modelName);
}
catch (AlfrescoRuntimeException e)
{
// note: skip with warning - to allow server to start, and hence allow the possibility of fixing the broken model(s)
logger.warn("Failed to load model '" + modelName + "' : " + e);
}
}
}