diff --git a/config/alfresco/bootstrap-context.xml b/config/alfresco/bootstrap-context.xml
index ddaee27dc7..a247ec35ea 100644
--- a/config/alfresco/bootstrap-context.xml
+++ b/config/alfresco/bootstrap-context.xml
@@ -801,6 +801,12 @@
+
+
+
+
+
+
diff --git a/source/java/org/alfresco/repo/webdav/MTNodesCache2.java b/source/java/org/alfresco/repo/webdav/MTNodesCache2.java
index 80c04fb4bd..8ff7d6df46 100644
--- a/source/java/org/alfresco/repo/webdav/MTNodesCache2.java
+++ b/source/java/org/alfresco/repo/webdav/MTNodesCache2.java
@@ -63,45 +63,9 @@ public class MTNodesCache2
PropertyCheck.mandatory(this, "nodeService", getNodeService());
PropertyCheck.mandatory(this, "searchService", getSearchService());
PropertyCheck.mandatory(this, "namespaceService", getNamespaceService());
- PropertyCheck.mandatory(this, "tenantService", getTenantService());
-
- if(!enabled)
- {
- return;
- }
-
+ PropertyCheck.mandatory(this, "tenantService", getTenantService());
PropertyCheck.mandatory(this, "storeName", storeName);
PropertyCheck.mandatory(this, "rootPath", rootPath);
-
- AuthenticationUtil.setRunAsUserSystem();
- try
- {
- StoreRef storeRef = new StoreRef(storeName);
-
- if (nodeService.exists(storeRef) == false)
- {
- throw new RuntimeException("No store for path: " + storeName);
- }
-
- NodeRef storeRootNodeRef = nodeService.getRootNode(storeRef);
-
- List nodeRefs = getSearchService().selectNodes(storeRootNodeRef, rootPath, null, getNamespaceService(), false);
-
- if (nodeRefs.size() > 1)
- {
- throw new RuntimeException("Multiple possible children for : \n" + " path: " + rootPath + "\n" + " results: " + nodeRefs);
- }
- else if (nodeRefs.size() == 0)
- {
- throw new RuntimeException("Node is not found for : \n" + " root path: " + rootPath);
- }
-
- defaultNode = nodeRefs.get(0);
- }
- finally
- {
- AuthenticationUtil.clearCurrentSecurityContext();
- }
}
public void setNodeService(NodeService nodeService)
@@ -141,6 +105,48 @@ public class MTNodesCache2
}
return result;
}
+
+
+ public void onBootstrap()
+ {
+ if(!enabled)
+ {
+ return;
+ }
+
+ nodesCache.clear();
+
+ AuthenticationUtil.setRunAsUserSystem();
+ try
+ {
+ StoreRef storeRef = new StoreRef(storeName);
+
+ if (nodeService.exists(storeRef) == false)
+ {
+ throw new RuntimeException("No store for path: " + storeName);
+ }
+
+ NodeRef storeRootNodeRef = nodeService.getRootNode(storeRef);
+
+ List nodeRefs = getSearchService().selectNodes(storeRootNodeRef, rootPath, null, getNamespaceService(), false);
+
+ if (nodeRefs.size() > 1)
+ {
+ throw new RuntimeException("Multiple possible children for : \n" + " path: " + rootPath + "\n" + " results: " + nodeRefs);
+ }
+ else if (nodeRefs.size() == 0)
+ {
+ throw new RuntimeException("Node is not found for : \n" + " root path: " + rootPath);
+ }
+
+ defaultNode = nodeRefs.get(0);
+ }
+ finally
+ {
+ AuthenticationUtil.clearCurrentSecurityContext();
+ }
+ }
+
/**
* @return Returns the name of the store
diff --git a/source/java/org/alfresco/repo/webdav/WebDavBootstrap.java b/source/java/org/alfresco/repo/webdav/WebDavBootstrap.java
new file mode 100644
index 0000000000..c793d8c972
--- /dev/null
+++ b/source/java/org/alfresco/repo/webdav/WebDavBootstrap.java
@@ -0,0 +1,47 @@
+package org.alfresco.repo.webdav;
+
+import org.alfresco.util.PropertyCheck;
+import org.springframework.context.ApplicationEvent;
+import org.springframework.extensions.surf.util.AbstractLifecycleBean;
+
+/**
+ * Bootstrap WebDav
+ *
+ * Not much to do (yet) but simply looks up root node
+ *
+ * @author mrogers
+ */
+public class WebDavBootstrap extends AbstractLifecycleBean
+{
+ private MTNodesCache2 rootNode;
+
+ public void init()
+ {
+ PropertyCheck.mandatory(this, "rootNode", getRootNode());
+ }
+
+ public void setRootNode(MTNodesCache2 rootNode)
+ {
+ this.rootNode = rootNode;
+ }
+ public MTNodesCache2 getRootNode()
+ {
+ return rootNode;
+ }
+
+ @Override
+ protected void onBootstrap(ApplicationEvent event)
+ {
+ // Bootstrap the rootNode
+ rootNode.onBootstrap();
+ }
+
+ @Override
+ protected void onShutdown(ApplicationEvent event)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}