Coding standards.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@34548 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2012-03-16 10:43:47 +00:00
parent fbc668418e
commit 5ec8d40e1c
2 changed files with 47 additions and 38 deletions

View File

@@ -22,7 +22,8 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.alfresco.repo.security.authentication.AuthenticationContext;
import javax.servlet.ServletException;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.tenant.TenantService;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -42,22 +43,19 @@ import org.alfresco.util.PropertyCheck;
public class MTNodesCache2
{
private boolean enabled = false;
private NodeService nodeService;
private SearchService searchService;
private NamespaceService namespaceService;
private TenantService tenantService;
private Map<String, NodeRef> nodesCache = new ConcurrentHashMap<String, NodeRef>();
private NodeRef defaultNode = null;
private String storeName;
private String rootPath;
/**
* Spring bean init method
*/
public void init()
{
PropertyCheck.mandatory(this, "nodeService", getNodeService());
@@ -72,6 +70,7 @@ public class MTNodesCache2
{
this.nodeService = nodeService;
}
public NodeService getNodeService()
{
return nodeService;
@@ -106,10 +105,9 @@ public class MTNodesCache2
return result;
}
public void onBootstrap()
{
if(!enabled)
if (!enabled)
{
return;
}
@@ -146,29 +144,30 @@ public class MTNodesCache2
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
*/
public String getStoreName()
{
return storeName;
}
public void setStoreName(String storeName)
{
this.storeName = storeName;
}
/**
* @return Returns the WebDAV root path within the store
* @return Returns the WebDAV root path within the store
* @throws ServletException if the root path was not set
*/
public String getRootPath()
{
return rootPath;
}
public void setRootPath(String rootPath)
{
this.rootPath = rootPath;
@@ -203,15 +202,14 @@ public class MTNodesCache2
{
return tenantService;
}
public boolean getEnabled()
{
return enabled;
}
public void setEnabled(boolean enabled)
{
this.enabled = enabled;
}
}

View File

@@ -36,7 +36,7 @@ import org.springframework.extensions.surf.util.URLEncoder;
/**
* The WebDav client is used by the repository to generate webdav URLs
*
* <p>
* This is a bog standard spring bean for the repo side of WebDav.
*
* @See org.alfresco.repo.webdav.WebDavServlet the server side of webdav.
@@ -45,30 +45,23 @@ import org.springframework.extensions.surf.util.URLEncoder;
*/
public class WebDavServiceImpl implements WebDavService
{
public static final String WEBDAV_PREFIX = "webdav";
private static Log logger = LogFactory.getLog(WebDavServiceImpl.class);
private boolean enabled = false;
private NodeService nodeService;
private DictionaryService dictionaryService;
private FileFolderService fileFolderService;
private static Log logger = LogFactory.getLog(WebDavServiceImpl.class);
// Root nodes
private MTNodesCache2 rootNode;
public static final String WEBDAV_PREFIX = "webdav";
public boolean getEnabled()
{
return enabled;
}
public void setEnabled(boolean enabled)
{
this.enabled = enabled;
}
/**
* Spring bean init method
*/
public void init()
{
PropertyCheck.mandatory(this, "nodeService", getNodeService());
@@ -85,11 +78,13 @@ public class WebDavServiceImpl implements WebDavService
*/
public String getWebdavUrl(NodeRef nodeRef)
{
if(!enabled)
String url = "";
if (!enabled)
{
return "";
return url;
}
try
{
QName typeName = nodeService.getType(nodeRef);
@@ -107,15 +102,14 @@ public class WebDavServiceImpl implements WebDavService
path.append("/")
.append(URLEncoder.encode(paths.get(i).getName()));
}
return path.toString();
url = path.toString();
}
}
catch (FileNotFoundException nodeErr)
{
// cannot build path if file no longer exists
return "";
// cannot build path if file no longer exists, return default
}
return "";
return url;
}
/**
@@ -138,34 +132,51 @@ public class WebDavServiceImpl implements WebDavService
return isDocument;
}
public boolean getEnabled()
{
return enabled;
}
public void setEnabled(boolean enabled)
{
this.enabled = enabled;
}
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
public NodeService getNodeService()
{
return nodeService;
}
public void setDictionaryService(DictionaryService dictionaryService)
{
this.dictionaryService = dictionaryService;
}
public DictionaryService getDictionaryService()
{
return dictionaryService;
}
public void setFileFolderService(FileFolderService fileFolderService)
{
this.fileFolderService = fileFolderService;
}
public FileFolderService getFileFolderService()
{
return fileFolderService;
}
public void setRootNode(MTNodesCache2 rootNode)
{
this.rootNode = rootNode;
}
public MTNodesCache2 getRootNode()
{
return rootNode;