();
@@ -107,7 +161,8 @@ public class DictionaryDAOTest extends TestCase
bootstrap.setModels(bootstrapModels);
bootstrap.setDictionaryDAO(dictionaryDAO);
- bootstrap.bootstrap();
+ bootstrap.setTenantService(tenantService);
+ bootstrap.bootstrap();
}
diff --git a/source/java/org/alfresco/repo/dictionary/DictionaryDeployer.java b/source/java/org/alfresco/repo/dictionary/DictionaryDeployer.java
new file mode 100755
index 0000000000..7502876e8e
--- /dev/null
+++ b/source/java/org/alfresco/repo/dictionary/DictionaryDeployer.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2005-2007 Alfresco Software Limited.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ * As a special exception to the terms and conditions of version 2.0 of
+ * the GPL, you may redistribute this Program in connection with Free/Libre
+ * and Open Source Software ("FLOSS") applications as described in Alfresco's
+ * FLOSS exception. You should have recieved a copy of the text describing
+ * the FLOSS exception, and it is also available here:
+ * http://www.alfresco.com/legal/licensing"
+ */
+package org.alfresco.repo.dictionary;
+
+
+/**
+ * Dictionary Deployer interface.
+ *
+ * This interface allows DictionaryDAO to be (re-)initialised.
+ * Dictionary Deployer components must register with the DictionaryService.
+ *
+ */
+
+public interface DictionaryDeployer
+{
+ // callback for (re-)initialising the Dictionary caches
+ public void initDictionary();
+
+ // register prior to bootstrap
+ public void register();
+}
+
+
diff --git a/source/java/org/alfresco/repo/dictionary/DictionaryRepositoryBootstrap.java b/source/java/org/alfresco/repo/dictionary/DictionaryRepositoryBootstrap.java
index 2e28135644..1a138045e9 100644
--- a/source/java/org/alfresco/repo/dictionary/DictionaryRepositoryBootstrap.java
+++ b/source/java/org/alfresco/repo/dictionary/DictionaryRepositoryBootstrap.java
@@ -30,26 +30,43 @@ import java.util.List;
import java.util.Map;
import org.alfresco.model.ContentModel;
-import org.alfresco.repo.security.authentication.AuthenticationComponent;
+import org.alfresco.repo.i18n.MessageDeployer;
+import org.alfresco.repo.i18n.MessageService;
+import org.alfresco.repo.security.authentication.AuthenticationUtil;
+import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
+import org.alfresco.repo.tenant.TenantDeployer;
+import org.alfresco.repo.tenant.TenantDeployerService;
+import org.alfresco.repo.tenant.TenantService;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
-import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.SearchService;
+import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.transaction.TransactionService;
-
+import org.alfresco.util.AbstractLifecycleBean;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.context.ApplicationEvent;
/**
* Bootstrap the dictionary from specified locations within the repository
*
- * @author Roy Wetherall
+ * @author Roy Wetherall, JanV
*/
-public class DictionaryRepositoryBootstrap
-{
- /** Loactions in the respository fro which models should be loaded */
- private List repositoryLocations = new ArrayList();
+public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean implements TenantDeployer, DictionaryDeployer, MessageDeployer
+{
+ // Logging support
+ private static Log logger = LogFactory
+ .getLog("org.alfresco.repo.dictionary.DictionaryRepositoryBootstrap");
+
+ /** Locations in the repository from which models should be loaded */
+ private List repositoryModelsLocations = new ArrayList();
+
+ /** Locations in the repository from which messages should be loaded */
+ private List repositoryMessagesLocations = new ArrayList();
/** Dictionary DAO */
private DictionaryDAO dictionaryDAO = null;
@@ -59,12 +76,24 @@ public class DictionaryRepositoryBootstrap
/** The content service */
private ContentService contentService;
+
+ /** The node service */
+ private NodeService nodeService;
+
+ /** The tenant service */
+ private TenantService tenantService;
+ /** The tenant deployer service */
+ private TenantDeployerService tenantDeployerService;
+
+ /** The namespace service */
+ private NamespaceService namespaceService;
+
+ /** The message service */
+ private MessageService messageService;
+
/** The transaction service */
private TransactionService transactionService;
-
- /** The authentication component */
- private AuthenticationComponent authenticationComponent;
/**
* Sets the Dictionary DAO
@@ -95,7 +124,57 @@ public class DictionaryRepositoryBootstrap
{
this.contentService = contentService;
}
+
+ /**
+ * Set the node service
+ *
+ * @param nodeService the node service
+ */
+ public void setNodeService(NodeService nodeService)
+ {
+ this.nodeService = nodeService;
+ }
+
+ /**
+ * Set the tenant service
+ *
+ * @param tenantService the tenant service
+ */
+ public void setTenantService(TenantService tenantService)
+ {
+ this.tenantService = tenantService;
+ }
+ /**
+ * Set the tenant admin service
+ *
+ * @param tenantAdminService the tenant admin service
+ */
+ public void setTenantDeployerService(TenantDeployerService tenantDeployerService)
+ {
+ this.tenantDeployerService = tenantDeployerService;
+ }
+
+ /**
+ * Set the namespace service
+ *
+ * @param namespaceService the namespace service
+ */
+ public void setNamespaceService(NamespaceService namespaceService)
+ {
+ this.namespaceService = namespaceService;
+ }
+
+ /**
+ * Set the message service
+ *
+ * @param messageService the message service
+ */
+ public void setMessageService(MessageService messageService)
+ {
+ this.messageService = messageService;
+ }
+
/**
* Set the transaction service
*
@@ -107,95 +186,175 @@ public class DictionaryRepositoryBootstrap
}
/**
- * Set the authentication service
+ * Set the repository models locations
*
- * @param authenticationComponent the authentication component
- */
- public void setAuthenticationComponent(
- AuthenticationComponent authenticationComponent)
+ * @param repositoryModelsLocations list of the repository models locations
+ */ public void setRepositoryModelsLocations(
+ List repositoryLocations)
{
- this.authenticationComponent = authenticationComponent;
+ this.repositoryModelsLocations = repositoryLocations;
}
/**
- * Set the respository locations
+ * Set the repository messages (resource bundle) locations
*
- * @param repositoryLocations list of the repository locaitons
+ * @param repositoryLocations
+ * list of the repository messages locations
*/
- public void setRepositoryLocations(
+ public void setRepositoryMessagesLocations(
List repositoryLocations)
{
- this.repositoryLocations = repositoryLocations;
+ this.repositoryMessagesLocations = repositoryLocations;
}
-
- @SuppressWarnings("unchecked")
- public void bootstrap()
+
+
+ /**
+ * Initialise - after bootstrap of schema and tenant admin service
+ */
+ public void init()
{
- transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback()
+ transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback