mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-11236 : Webdav changes breaks upgrade
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31609 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -802,6 +802,12 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="webDavBootstrapBean" class="org.alfresco.repo.webdav.WebDavBootstrap" >
|
||||||
|
<property name="rootNode">
|
||||||
|
<ref bean="webdavRootNode"/>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
<!-- Startup Message -->
|
<!-- Startup Message -->
|
||||||
|
|
||||||
<bean id="startupLog" class="org.alfresco.repo.descriptor.DescriptorStartupLog">
|
<bean id="startupLog" class="org.alfresco.repo.descriptor.DescriptorStartupLog">
|
||||||
|
@@ -64,44 +64,8 @@ public class MTNodesCache2
|
|||||||
PropertyCheck.mandatory(this, "searchService", getSearchService());
|
PropertyCheck.mandatory(this, "searchService", getSearchService());
|
||||||
PropertyCheck.mandatory(this, "namespaceService", getNamespaceService());
|
PropertyCheck.mandatory(this, "namespaceService", getNamespaceService());
|
||||||
PropertyCheck.mandatory(this, "tenantService", getTenantService());
|
PropertyCheck.mandatory(this, "tenantService", getTenantService());
|
||||||
|
|
||||||
if(!enabled)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
PropertyCheck.mandatory(this, "storeName", storeName);
|
PropertyCheck.mandatory(this, "storeName", storeName);
|
||||||
PropertyCheck.mandatory(this, "rootPath", rootPath);
|
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<NodeRef> 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)
|
public void setNodeService(NodeService nodeService)
|
||||||
@@ -142,6 +106,48 @@ public class MTNodesCache2
|
|||||||
return result;
|
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<NodeRef> 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
|
* @return Returns the name of the store
|
||||||
* @throws ServletException if the store name was not set
|
* @throws ServletException if the store name was not set
|
||||||
|
47
source/java/org/alfresco/repo/webdav/WebDavBootstrap.java
Normal file
47
source/java/org/alfresco/repo/webdav/WebDavBootstrap.java
Normal file
@@ -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
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user