Merged missing changes to file-servers.xml and file-servers.properties from 13521 in V3.1

Synchronized new file-servers-context.xml with these changes
Debugged NFS and Desktop Action Initialization via Spring

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13831 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2009-04-03 17:31:00 +00:00
parent 0ee6c8038a
commit 7ed214059f
16 changed files with 750 additions and 576 deletions

View File

@@ -37,7 +37,6 @@ import org.alfresco.jlan.server.filesys.DiskInterface;
import org.alfresco.jlan.server.filesys.FileSystem;
import org.alfresco.jlan.server.filesys.SrvDiskInfo;
import org.alfresco.jlan.server.filesys.pseudo.PseudoFileInterface;
import org.springframework.beans.factory.InitializingBean;
/**
@@ -47,7 +46,7 @@ import org.springframework.beans.factory.InitializingBean;
*
* @author GKSpencer
*/
public abstract class AlfrescoContext extends DiskDeviceContext implements InitializingBean
public abstract class AlfrescoContext extends DiskDeviceContext
{
// Token name to substitute current servers DNS name or TCP/IP address into the webapp URL
@@ -71,6 +70,7 @@ public abstract class AlfrescoContext extends DiskDeviceContext implements Initi
private GlobalDesktopActionConfigBean m_globalDesktopActionConfig = new GlobalDesktopActionConfigBean();
private DesktopActionTable m_desktopActions;
private List<DesktopAction> m_desktopActionsToInitialize;
// I/O control handler
@@ -94,10 +94,29 @@ public abstract class AlfrescoContext extends DiskDeviceContext implements Initi
enableChangeHandler(!disableChangeNotification);
}
public void afterPropertiesSet()
{
/**
* Complete initialization by registering with a disk driver
*/
public void initialize(AlfrescoDiskDriver filesysDriver)
{
if (m_desktopActionsToInitialize != null)
{
for (DesktopAction desktopAction : m_desktopActionsToInitialize)
{
// Initialize the desktop action
try
{
desktopAction.initializeAction(filesysDriver, this);
}
catch (DesktopActionException ex)
{
throw new AlfrescoRuntimeException("Failed to initialize desktop action", ex);
}
addDesktopAction(desktopAction);
}
}
}
/**
* Return the filesystem type, either FileSystem.TypeFAT or FileSystem.TypeNTFS.
*
@@ -400,19 +419,12 @@ public abstract class AlfrescoContext extends DiskDeviceContext implements Initi
*
* @param desktopActions DesktopAction List
*/
public final void setDesktopActions(List<DesktopAction> desktopActions)
public final void setDesktopActionList(List<DesktopAction> desktopActions)
{
// Enumerate the desktop actions and add to this filesystem
for (DesktopAction desktopAction : desktopActions)
{
addDesktopAction(desktopAction);
}
// Note it is assumed that a AlfrescoDiskDriver.register() call will initialise the I/O control handler
m_desktopActionsToInitialize = desktopActions;
}
protected void setGlobalDesktopActionConfig(GlobalDesktopActionConfigBean desktopActionConfig)
public void setGlobalDesktopActionConfig(GlobalDesktopActionConfigBean desktopActionConfig)
{
m_globalDesktopActionConfig = desktopActionConfig;
}
@@ -422,6 +434,8 @@ public abstract class AlfrescoContext extends DiskDeviceContext implements Initi
{
return m_globalDesktopActionConfig;
}
/**

View File

@@ -29,6 +29,8 @@ import javax.transaction.UserTransaction;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.filesys.state.FileStateReaper;
import org.alfresco.jlan.server.SrvSession;
import org.alfresco.jlan.server.core.DeviceContext;
import org.alfresco.jlan.server.core.DeviceContextException;
import org.alfresco.jlan.server.filesys.IOControlNotImplementedException;
import org.alfresco.jlan.server.filesys.IOCtlInterface;
import org.alfresco.jlan.server.filesys.NetworkFile;
@@ -346,4 +348,20 @@ public abstract class AlfrescoDiskDriver implements IOCtlInterface, Transactiona
sess.setTransaction( this);
}
/**
* Registers a device context object for this instance
* of the shared device. The same DeviceInterface implementation may be used for multiple
* shares. In this base class, we initialize all desktop actions.
*
* @param ctx the context
* @exception DeviceContextException
*/
public void registerContext(DeviceContext ctx) throws DeviceContextException
{
if (ctx instanceof AlfrescoContext)
{
((AlfrescoContext) ctx).initialize(this);
}
}
}

View File

@@ -30,21 +30,20 @@ import java.net.InetAddress;
import java.net.URL;
import java.net.URLDecoder;
import org.alfresco.config.ConfigElement;
import org.alfresco.jlan.server.filesys.DiskSharedDevice;
import org.alfresco.jlan.server.filesys.pseudo.LocalPseudoFile;
import org.alfresco.jlan.server.filesys.pseudo.PseudoFile;
import org.alfresco.config.ConfigElement;
import org.alfresco.service.ServiceRegistry;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
/**
* Desktop Action Class
*
* @author gkspencer
*/
public abstract class DesktopAction implements InitializingBean{
public abstract class DesktopAction {
// Logging
@@ -118,7 +117,6 @@ public abstract class DesktopAction implements InitializingBean{
// Filesystem driver and context
private DiskSharedDevice m_diskSharedDevice;
private AlfrescoDiskDriver m_filesysDriver;
private AlfrescoContext m_filesysContext;
@@ -312,13 +310,14 @@ public abstract class DesktopAction implements InitializingBean{
public void initializeAction(ConfigElement global, ConfigElement config, DiskSharedDevice fileSys)
throws DesktopActionException
{
if ( !(fileSys.getContext() instanceof AlfrescoContext))
throw new DesktopActionException("Desktop action requires an Alfresco filesystem driver");
// Perform standard initialization
standardInitialize(global, config, fileSys);
// Complete initialization
afterPropertiesSet();
initializeAction((AlfrescoDiskDriver) fileSys.getDiskInterface(), (AlfrescoContext) fileSys.getDiskContext());
}
/**
@@ -332,8 +331,6 @@ public abstract class DesktopAction implements InitializingBean{
public void standardInitialize(ConfigElement global, ConfigElement config, DiskSharedDevice fileSys)
throws DesktopActionException
{
setDiskSharedDevice(fileSys);
// Check for standard config values
ConfigElement elem = config.getChild("name");
if ( elem != null && elem.getValue().length() > 0)
@@ -380,20 +377,17 @@ public abstract class DesktopAction implements InitializingBean{
}
public void afterPropertiesSet() throws DesktopActionException
/**
* Initialize the desktop action
*
* @exception DesktopActionException
*/
public void initializeAction(AlfrescoDiskDriver filesysDriver, AlfrescoContext filesysContext) throws DesktopActionException
{
if (m_diskSharedDevice == null)
throw new DesktopActionException("Desktop action requires an Alfresco filesystem driver");
// Save the filesystem device and I/O handler
if ( m_diskSharedDevice.getContext() instanceof AlfrescoContext)
{
m_filesysDriver = (AlfrescoDiskDriver) m_diskSharedDevice.getDiskInterface();
m_filesysContext = (AlfrescoContext) m_diskSharedDevice.getDiskContext();
}
else
throw new DesktopActionException("Desktop action requires an Alfresco filesystem driver");
m_filesysDriver = filesysDriver;
m_filesysContext = filesysContext;
// Check for standard config values
@@ -602,15 +596,6 @@ public abstract class DesktopAction implements InitializingBean{
m_debug = ena;
}
/**
* Sets the disk shared device.
* @param diskSharedDevice
*/
public void setDiskSharedDevice(DiskSharedDevice diskSharedDevice)
{
m_diskSharedDevice = diskSharedDevice;
}
/**
* Set the webapp URL
*
@@ -663,4 +648,5 @@ public abstract class DesktopAction implements InitializingBean{
return str.toString();
}
}

View File

@@ -68,6 +68,8 @@ public class PassthruServerFactory implements FactoryBean, InitializingBean, Dis
private Integer offlineCheckInterval;
private PassthruServers passthruServers;
private boolean nullDomainUseAnyServer;
/**
* Sets the timeout for opening a session to an authentication server
@@ -123,6 +125,17 @@ public class PassthruServerFactory implements FactoryBean, InitializingBean, Dis
{
this.offlineCheckInterval = offlineCheckInterval;
}
/**
* Set the null domain to use any available server option
*
* @param nullDomain boolean
*/
public final void setNullDomainUseAnyServer( boolean nullDomain)
{
this.nullDomainUseAnyServer = nullDomain;
}
/**
* Set the protocol order for passthru connections
@@ -233,6 +246,8 @@ public class PassthruServerFactory implements FactoryBean, InitializingBean, Dis
passthruServers.setConnectionTimeout(this.timeout);
}
passthruServers.setNullDomainUseAnyServer(this.nullDomainUseAnyServer);
// Check if a server name has been specified

View File

@@ -479,40 +479,33 @@ public class AlfrescoRpcAuthenticator implements RpcAuthenticator, InitializingB
for ( UserMapping userElem : this.userMappings)
{
// Validate the element type
// Get the user name, user id and group id
if ( userElem.getName().equalsIgnoreCase( "user"))
String userName = userElem.getName();
if ( userName == null || userName.length() == 0)
throw new InvalidConfigurationException("Empty user name, or name not specified");
// Check if the mapping already exists
Integer idKey = new Integer(( userElem.getGid() << 16) + userElem.getUid());
if ( m_idMap.containsKey( idKey) == false)
{
// Get the user name, user id and group id
// Add the username uid/gid mapping
String userName = userElem.getName();
m_idMap.put( idKey, userName);
if ( userName == null || userName.length() == 0)
throw new InvalidConfigurationException("Empty user name, or name not specified");
// DEBUG
// Check if the mapping already exists
Integer idKey = new Integer(( userElem.getGid() << 16) + userElem.getUid());
if ( m_idMap.containsKey( idKey) == false)
{
// Add the username uid/gid mapping
m_idMap.put( idKey, userName);
// DEBUG
if ( logger.isDebugEnabled())
logger.debug("Added RPC user mapping for user " + userName + " uid=" + userElem.getUid() + ", gid=" + userElem.getGid());
}
else if ( logger.isDebugEnabled())
{
// DEBUG
logger.debug("Ignored duplicate mapping for uid=" + userElem.getUid() + ", gid=" + userElem.getGid());
}
if ( logger.isDebugEnabled())
logger.debug("Added RPC user mapping for user " + userName + " uid=" + userElem.getUid() + ", gid=" + userElem.getGid());
}
else if ( logger.isDebugEnabled())
{
// DEBUG
logger.debug("Ignored duplicate mapping for uid=" + userElem.getUid() + ", gid=" + userElem.getGid());
}
else
throw new InvalidConfigurationException( "Invalid user mapping, " + userElem.getName());
}
}

View File

@@ -29,6 +29,7 @@ import java.util.StringTokenizer;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.filesys.alfresco.AlfrescoContext;
import org.alfresco.filesys.alfresco.AlfrescoDiskDriver;
import org.alfresco.filesys.alfresco.IOControlHandler;
import org.alfresco.filesys.state.FileState;
import org.alfresco.filesys.state.FileStateTable;
@@ -126,8 +127,6 @@ public class AVMContext extends AlfrescoContext
// Set the store version to use
setVersion(version);
afterPropertiesSet();
}
/**
@@ -146,8 +145,6 @@ public class AVMContext extends AlfrescoContext
// Enable the virtualization view
setVirtualView(true);
setShowOptions(showOptions);
afterPropertiesSet();
}
public void setStorePath(String path)
@@ -213,10 +210,10 @@ public class AVMContext extends AlfrescoContext
m_createStore = createStore;
}
@Override
public void afterPropertiesSet()
public void initialize(AlfrescoDiskDriver filesysDriver)
{
if (m_virtualView)
{
// A context for a view onto all stores/versions within AVM.
@@ -241,7 +238,7 @@ public class AVMContext extends AlfrescoContext
setShareName(m_storePath + "(" + m_version + ")");
}
super.afterPropertiesSet();
super.initialize(filesysDriver);
}
/**

View File

@@ -426,9 +426,12 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
* @param context the device context
* @exception DeviceContextException
*/
@Override
public void registerContext(DeviceContext ctx)
throws DeviceContextException
{
super.registerContext(ctx);
AVMContext context = (AVMContext)ctx;
// Use the system user as the authenticated context for the filesystem initialization
@@ -625,7 +628,6 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
{
AuthenticationUtil.popAuthentication();
}
}
/**

View File

@@ -499,7 +499,7 @@ public class CIFSConfigBean
*
* @return the session timeout
*/
protected Integer getSessionTimeout()
public Integer getSessionTimeout()
{
return sessionTimeout;
}
@@ -510,7 +510,7 @@ public class CIFSConfigBean
* @param sessionTimeout
* the new session timeout
*/
protected void setSessionTimeout(Integer sessionTimeout)
public void setSessionTimeout(Integer sessionTimeout)
{
this.sessionTimeout = sessionTimeout;
}

View File

@@ -28,6 +28,7 @@ import java.util.List;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.filesys.alfresco.AlfrescoContext;
import org.alfresco.filesys.alfresco.AlfrescoDiskDriver;
import org.alfresco.filesys.alfresco.IOControlHandler;
import org.alfresco.jlan.server.auth.acl.AccessControl;
import org.alfresco.jlan.server.core.DeviceContextException;
@@ -100,8 +101,6 @@ public class ContentContext extends AlfrescoContext
setStoreName(storeName);
setRootPath(rootPath);
setRootNodeRef(rootNodeRef);
afterPropertiesSet();
}
public void setStoreName(String name)
@@ -148,9 +147,9 @@ public class ContentContext extends AlfrescoContext
@Override
public void afterPropertiesSet()
public void initialize(AlfrescoDiskDriver filesysDriver)
{
super.afterPropertiesSet();
super.initialize(filesysDriver);
if (m_storeName == null || m_storeName.length() == 0)
{

View File

@@ -426,8 +426,6 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
context.setDisableNodeMonitor(true);
}
context.afterPropertiesSet();
registerContext(context);
// Return the context for this shared filesystem
@@ -444,8 +442,11 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
* @param ctx the context
* @exception DeviceContextException
*/
@Override
public void registerContext(DeviceContext ctx) throws DeviceContextException
{
super.registerContext(ctx);
ContentContext context = (ContentContext)ctx;
// Wrap the initialization in a transaction

View File

@@ -35,6 +35,8 @@ import java.util.Map;
import java.util.StringTokenizer;
import org.alfresco.config.ConfigElement;
import org.alfresco.filesys.alfresco.AlfrescoContext;
import org.alfresco.filesys.alfresco.AlfrescoDiskDriver;
import org.alfresco.filesys.alfresco.DesktopAction;
import org.alfresco.filesys.alfresco.DesktopActionException;
import org.alfresco.filesys.alfresco.DesktopParams;
@@ -42,7 +44,6 @@ import org.alfresco.filesys.alfresco.DesktopResponse;
import org.alfresco.jlan.server.filesys.DiskSharedDevice;
import org.alfresco.scripts.ScriptException;
import org.alfresco.service.cmr.repository.ScriptService;
import org.alfresco.service.transaction.TransactionService;
/**
* Javascript Desktop Action Class
@@ -126,7 +127,7 @@ public class JavaScriptDesktopAction extends DesktopAction {
throw new DesktopActionException("Empty desktop action attributes");
// Parse the attribute string
setAttributes(elem.getValue());
setAttributeList(elem.getValue());
}
// Check if the desktop action pre-processing options have been specified
@@ -134,16 +135,17 @@ public class JavaScriptDesktopAction extends DesktopAction {
elem = config.getChild("preprocess");
if ( elem != null)
{
setPreProcessActions(elem.getValue());
setPreprocess(elem.getValue());
}
}
@Override
public void afterPropertiesSet() throws DesktopActionException
public void initializeAction(AlfrescoDiskDriver filesysDriver, AlfrescoContext filesysContext)
throws DesktopActionException
{
// Perform standard initialization
super.afterPropertiesSet();
super.initializeAction(filesysDriver, filesysContext);
// Get the script file name and check that it exists
@@ -368,7 +370,7 @@ public class JavaScriptDesktopAction extends DesktopAction {
*
* @param name String
*/
protected final void setScriptName(String name)
public final void setScriptName(String name)
{
m_scriptName = name;
}
@@ -379,7 +381,7 @@ public class JavaScriptDesktopAction extends DesktopAction {
* @param attributes String
* @throws DesktopActionException
*/
protected void setAttributes(String attributes) throws DesktopActionException
public void setAttributeList(String attributes) throws DesktopActionException
{
// Check if the attribute string is empty
if ( attributes == null || attributes.length() == 0)
@@ -431,7 +433,7 @@ public class JavaScriptDesktopAction extends DesktopAction {
* @param preProcessActions String
* @throws DesktopActionException
*/
protected void setPreProcessActions(String preProcessActions) throws DesktopActionException
public void setPreprocess(String preProcessActions) throws DesktopActionException
{
// Check if the pre-process string is empty