Merged DEV/JASONH to HEAD

12201: MT-enable (implementing ALFCOM-1892), also add ALFCOM-1809 workaround
  12242: Refactor creating getRootNode method
  12662: improve ALFCOM-1892, also remove ALFCOM-1809 workaround (should not be required)


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12664 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2009-01-09 14:57:21 +00:00
parent 9553dd6e7c
commit 01bf05db58

View File

@@ -272,9 +272,59 @@ public class WebDAVServlet extends HttpServlet
NamespaceService namespaceService = (NamespaceService) context.getBean("NamespaceService");
// Create the WebDAV helper
m_davHelper = new WebDAVHelper(m_serviceRegistry, authService);
String storeValue = context.getServletContext().getInitParameter(org.alfresco.repo.webdav.WebDAVServlet.KEY_STORE);
if (storeValue == null)
{
throw new ServletException("Device missing init value: " + KEY_STORE);
}
m_rootPath = context.getServletContext().getInitParameter(org.alfresco.repo.webdav.WebDAVServlet.KEY_ROOT_PATH);
if (m_rootPath == null)
{
throw new ServletException("Device missing init value: " + KEY_ROOT_PATH);
}
// Initialize the root node
m_rootNodeRef = getRootNode(storeValue, m_rootPath, context, nodeService, searchService,
namespaceService, m_transactionService);
// Create the WebDAV methods table
m_davMethods = new Hashtable<String,Class>();
m_davMethods.put(WebDAV.METHOD_PROPFIND, PropFindMethod.class);
m_davMethods.put(WebDAV.METHOD_COPY, CopyMethod.class);
m_davMethods.put(WebDAV.METHOD_DELETE, DeleteMethod.class);
m_davMethods.put(WebDAV.METHOD_GET, GetMethod.class);
m_davMethods.put(WebDAV.METHOD_HEAD, HeadMethod.class);
m_davMethods.put(WebDAV.METHOD_LOCK, LockMethod.class);
m_davMethods.put(WebDAV.METHOD_MKCOL, MkcolMethod.class);
m_davMethods.put(WebDAV.METHOD_MOVE, MoveMethod.class);
m_davMethods.put(WebDAV.METHOD_OPTIONS, OptionsMethod.class);
m_davMethods.put(WebDAV.METHOD_POST, PostMethod.class);
m_davMethods.put(WebDAV.METHOD_PUT, PutMethod.class);
m_davMethods.put(WebDAV.METHOD_UNLOCK, UnlockMethod.class);
}
/**
* @param config
* @param context
* @param nodeService
* @param searchService
* @param namespaceService
*/
public static NodeRef getRootNode(String storeValue, String m_rootPath,
WebApplicationContext context, NodeService nodeService,
SearchService searchService, NamespaceService namespaceService,
TransactionService m_transactionService)
throws ServletException {
NodeRef m_rootNodeRef = null;
// Initialize the root node
ServerConfigurationBean fileSrvConfig = (ServerConfigurationBean) context.getBean(ServerConfigurationBean.SERVER_CONFIGURATION);
@@ -286,6 +336,7 @@ public class WebDAVServlet extends HttpServlet
AuthenticationComponent authComponent = (AuthenticationComponent) context.getBean("authenticationComponent");
authComponent.setCurrentUser( authComponent.getSystemUserName());
// Wrap the initialization in a transaction
UserTransaction tx = m_transactionService.getUserTransaction(true);
@@ -298,8 +349,6 @@ public class WebDAVServlet extends HttpServlet
tx.begin();
// Get the store
String storeValue = config.getInitParameter(KEY_STORE);
if (storeValue == null)
{
throw new ServletException("Device missing init value: " + KEY_STORE);
@@ -314,9 +363,7 @@ public class WebDAVServlet extends HttpServlet
}
NodeRef storeRootNodeRef = nodeService.getRootNode(storeRef);
// Get the root path
m_rootPath = config.getInitParameter(KEY_ROOT_PATH);
// Check the root path
if (m_rootPath == null)
{
throw new ServletException("Device missing init value: " + KEY_ROOT_PATH);
@@ -342,6 +389,7 @@ public class WebDAVServlet extends HttpServlet
{
// we found a node
m_rootNodeRef = nodeRefs.get(0);
}
// Commit the transaction
@@ -359,21 +407,8 @@ public class WebDAVServlet extends HttpServlet
authComponent.clearCurrentSecurityContext();
}
// Create the WebDAV methods table
return m_rootNodeRef;
m_davMethods = new Hashtable<String,Class>();
m_davMethods.put(WebDAV.METHOD_PROPFIND, PropFindMethod.class);
m_davMethods.put(WebDAV.METHOD_COPY, CopyMethod.class);
m_davMethods.put(WebDAV.METHOD_DELETE, DeleteMethod.class);
m_davMethods.put(WebDAV.METHOD_GET, GetMethod.class);
m_davMethods.put(WebDAV.METHOD_HEAD, HeadMethod.class);
m_davMethods.put(WebDAV.METHOD_LOCK, LockMethod.class);
m_davMethods.put(WebDAV.METHOD_MKCOL, MkcolMethod.class);
m_davMethods.put(WebDAV.METHOD_MOVE, MoveMethod.class);
m_davMethods.put(WebDAV.METHOD_OPTIONS, OptionsMethod.class);
m_davMethods.put(WebDAV.METHOD_POST, PostMethod.class);
m_davMethods.put(WebDAV.METHOD_PUT, PutMethod.class);
m_davMethods.put(WebDAV.METHOD_UNLOCK, UnlockMethod.class);
}
}