MOB-651: Decouple File Servers from Config Service and Authenticators

- Minor JLAN changes (backward compatible)
   - CIFSAuthenticator implements an interface (to allow dynamic proxying to authentication subsystem)
   - CIFSAuthenticator accesses ServerConfiguration via ServerConfigurationAccessor interface and doesn't retain references to config sections (again to allow dynamic proxying and hot swapping)
   - ConfigSections have way of directly setting container initialised authenticators, sharemappers, etc.
   - Authenticators, etc. still support initialisation from config service in backward compatible manner.
- Most of ServerConfigurationBean moved to AbstractServerConfigurationBean superclass.
- New org.alfresco.filesys.config package with ServerConfigurationBean implementation and supporting classes that can be initialised by a Spring container.
- File server authenticators moved into authentication subsystem. TODO: Kerberos and NTLM

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13795 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2009-04-01 13:22:06 +00:00
parent e7d9ce8fc6
commit 972dd9a4ba
49 changed files with 9469 additions and 3276 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
* Copyright (C) 2005-2009 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -18,20 +18,24 @@
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* FLOSS exception. You should have received a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.filesys.repo;
import java.util.List;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.filesys.alfresco.AlfrescoContext;
import org.alfresco.filesys.alfresco.IOControlHandler;
import org.alfresco.jlan.server.auth.acl.AccessControl;
import org.alfresco.jlan.server.core.DeviceContextException;
import org.alfresco.jlan.server.filesys.DiskInterface;
import org.alfresco.jlan.server.filesys.DiskSharedDevice;
import org.alfresco.jlan.server.filesys.FileName;
import org.alfresco.jlan.server.filesys.FileSystem;
import org.alfresco.jlan.smb.server.notify.NotifyChangeHandler;
import org.alfresco.service.cmr.repository.*;
import org.alfresco.service.cmr.repository.NodeRef;
/**
* Content Filesystem Context Class
@@ -51,32 +55,114 @@ public class ContentContext extends AlfrescoContext
private NodeRef m_rootNodeRef;
private String m_relativePath;
private boolean m_offlineFiles;
private boolean m_disableNodeMonitor;
private String m_defaultAccessLevel;
private List<AccessControl> m_accessControl;
// Node monitor
private NodeMonitor m_nodeMonitor;
/**
* Class constructor
*
*@param filesysName String
* @param storeName String
* @param rootPath String
* @param rootNodeRef NodeRef
* Default constructor allowing initialization by container.
*/
public ContentContext(String filesysName, String storeName, String rootPath, NodeRef rootNodeRef)
public ContentContext()
{
super(filesysName, rootNodeRef.toString());
m_storeName = storeName;
m_rootPath = rootPath;
m_rootNodeRef = rootNodeRef;
// Create the I/O control handler
setIOHandler( createIOHandler( null));
}
/**
* Class constructor
*
*@param filesysName
* String
* @param storeName
* String
* @param rootPath
* String
* @param rootNodeRef
* NodeRef
*/
public ContentContext(String filesysName, String storeName, String rootPath, NodeRef rootNodeRef)
{
this();
setDeviceName(filesysName);
setStoreName(storeName);
setRootPath(rootPath);
setRootNodeRef(rootNodeRef);
afterPropertiesSet();
}
public void setStoreName(String name)
{
m_storeName = name;
}
public void setRootPath(String path)
{
m_rootPath = path;
}
public void setRelativePath(String path)
{
// Make sure the path is in CIFS format
m_relativePath = path.replace( '/', FileName.DOS_SEPERATOR);;
}
public void setOfflineFiles(boolean offlineFiles)
{
m_offlineFiles = offlineFiles;
}
public void setDisableNodeMonitor(boolean disableNodeMonitor)
{
m_disableNodeMonitor = disableNodeMonitor;
}
public void setDefaultAccessLevel(String defaultAccessLevel)
{
m_defaultAccessLevel = defaultAccessLevel;
}
public void setAccessControl(List<AccessControl> accessControl)
{
m_accessControl = accessControl;
}
public void setRootNodeRef(NodeRef nodeRef)
{
m_rootNodeRef = nodeRef;
setShareName(nodeRef.toString());
}
@Override
public void afterPropertiesSet()
{
super.afterPropertiesSet();
if (m_storeName == null || m_storeName.length() == 0)
{
throw new AlfrescoRuntimeException("Device missing storeName");
}
if (m_rootPath == null || m_rootPath.length() == 0)
{
throw new AlfrescoRuntimeException("Device missing rootPath");
}
}
/**
* Return the filesystem type, either FileSystem.TypeFAT or FileSystem.TypeNTFS.
*
@@ -107,6 +193,57 @@ public class ContentContext extends AlfrescoContext
return m_rootPath;
}
/**
* Return the relative path
*
* @return String
*/
public String getRelativePath()
{
return m_relativePath;
}
/**
* Determines whether locked files should be marked as offline.
*
* @return <code>true</code> if locked files should be marked as offline
*/
public boolean getOfflineFiles()
{
return m_offlineFiles;
}
/**
* Determines whether a node monitor is required.
*
* @return <code>true</code> if a node monitor is required
*/
public boolean getDisableNodeMonitor()
{
return m_disableNodeMonitor;
}
/**
* Return the default access level
*
* @return String
*/
public String getDefaultAccessLevel()
{
return m_defaultAccessLevel;
}
/**
* Return the access control list
*
* @return List<AccessControl>
*/
public List<AccessControl> getAccessControl()
{
return m_accessControl;
}
/**
* Return the root node
*
@@ -120,17 +257,17 @@ public class ContentContext extends AlfrescoContext
/**
* Close the filesystem context
*/
public void CloseContext() {
public void CloseContext() {
// Stop the node monitor, if enabled
if ( m_nodeMonitor != null)
m_nodeMonitor.shutdownRequest();
// Call the base class
super.CloseContext();
}
// Stop the node monitor, if enabled
if ( m_nodeMonitor != null)
m_nodeMonitor.shutdownRequest();
// Call the base class
super.CloseContext();
}
/**
* Create the I/O control handler for this filesystem type
@@ -140,7 +277,7 @@ public class ContentContext extends AlfrescoContext
*/
protected IOControlHandler createIOHandler( DiskInterface filesysDriver)
{
return new ContentIOControlHandler();
return new ContentIOControlHandler();
}
/**
@@ -149,25 +286,25 @@ public class ContentContext extends AlfrescoContext
* @param filesysDriver ContentDiskDriver
*/
protected void setNodeMonitor( NodeMonitor nodeMonitor) {
m_nodeMonitor = nodeMonitor;
m_nodeMonitor = nodeMonitor;
}
/**
* Start the filesystem
*
* @param share DiskSharedDevice
* @exception DeviceContextException
*/
public void startFilesystem(DiskSharedDevice share)
throws DeviceContextException {
/**
* Start the filesystem
*
* @param share DiskSharedDevice
* @exception DeviceContextException
*/
public void startFilesystem(DiskSharedDevice share)
throws DeviceContextException {
// Call the base class
super.startFilesystem(share);
// Start the node monitor, if enabled
if ( m_nodeMonitor != null)
m_nodeMonitor.startMonitor();
}
// Call the base class
super.startFilesystem(share);
// Start the node monitor, if enabled
if ( m_nodeMonitor != null)
m_nodeMonitor.startMonitor();
}
}