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 f632d3aaae
commit 34ca11c803
2 changed files with 42 additions and 8 deletions

View File

@@ -52,6 +52,13 @@ import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils; import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.jsf.FacesContextUtils; import org.springframework.web.jsf.FacesContextUtils;
import org.alfresco.repo.tenant.TenantService;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.namespace.NamespaceService;
/** /**
* Base servlet class containing useful constant values and common methods for Alfresco servlets. * Base servlet class containing useful constant values and common methods for Alfresco servlets.
* *
@@ -89,6 +96,8 @@ public abstract class BaseServlet extends HttpServlet
private static Log logger = LogFactory.getLog(BaseServlet.class); private static Log logger = LogFactory.getLog(BaseServlet.class);
// Tenant service
private static TenantService m_tenantService;
/** /**
* Return the ServiceRegistry helper instance * Return the ServiceRegistry helper instance
@@ -291,6 +300,26 @@ public abstract class BaseServlet extends HttpServlet
// get the company home node to start the search from // get the company home node to start the search from
nodeRef = new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId()); nodeRef = new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId());
m_tenantService = (TenantService) wc.getBean("tenantService");
if (m_tenantService !=null && m_tenantService.isEnabled())
{
if (logger.isDebugEnabled())
{
logger.debug("MT is enabled.");
}
NodeService nodeService = (NodeService) wc.getBean("NodeService");
SearchService searchService = (SearchService) wc.getBean("SearchService");
NamespaceService namespaceService = (NamespaceService) wc.getBean("NamespaceService");
// TODO: since these constants are used more widely than just the WebDAVServlet,
// they should be defined somewhere other than in that servlet
String m_rootPath = wc.getServletContext().getInitParameter(org.alfresco.repo.webdav.WebDAVServlet.KEY_ROOT_PATH);
// note: rootNodeRef is required (for storeRef part)
nodeRef = m_tenantService.getRootNode(nodeService, searchService, namespaceService, m_rootPath, nodeRef);
}
if (paths.size() != 0) if (paths.size() != 0)
{ {
FileFolderService ffs = (FileFolderService)wc.getBean("FileFolderService"); FileFolderService ffs = (FileFolderService)wc.getBean("FileFolderService");

View File

@@ -85,6 +85,19 @@
<description>Spring config file locations</description> <description>Spring config file locations</description>
</context-param> </context-param>
<!-- These were previously init params for the WebDAV servlet,
but since they are also needed to MT-enable the
ExternalAccess servlet, I have made them context wide. -->
<context-param>
<param-name>store</param-name>
<param-value>workspace://SpacesStore</param-value>
</context-param>
<context-param>
<param-name>rootPath</param-name>
<param-value>/app:company_home</param-value>
</context-param>
<filter> <filter>
<filter-name>Authentication Filter</filter-name> <filter-name>Authentication Filter</filter-name>
<filter-class>org.alfresco.web.app.servlet.AuthenticationFilter</filter-class> <filter-class>org.alfresco.web.app.servlet.AuthenticationFilter</filter-class>
@@ -312,14 +325,6 @@
<servlet> <servlet>
<servlet-name>WebDAV</servlet-name> <servlet-name>WebDAV</servlet-name>
<servlet-class>org.alfresco.repo.webdav.WebDAVServlet</servlet-class> <servlet-class>org.alfresco.repo.webdav.WebDAVServlet</servlet-class>
<init-param>
<param-name>store</param-name>
<param-value>workspace://SpacesStore</param-value>
</init-param>
<init-param>
<param-name>rootPath</param-name>
<param-value>/app:company_home</param-value>
</init-param>
<load-on-startup>5</load-on-startup> <load-on-startup>5</load-on-startup>
</servlet> </servlet>