mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Short term fixes to repo/AVM filesystems and a few other bits affected by the Alfresco JLAN cluster changes.
Hard code a standalone state cache into the repo/AVM filesystems. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28775 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,12 +24,21 @@ import java.util.StringTokenizer;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.filesys.config.GlobalDesktopActionConfigBean;
|
||||
import org.alfresco.filesys.config.ServerConfigurationBean;
|
||||
import org.alfresco.jlan.server.config.CoreServerConfigSection;
|
||||
import org.alfresco.jlan.server.config.InvalidConfigurationException;
|
||||
import org.alfresco.jlan.server.core.DeviceContextException;
|
||||
import org.alfresco.jlan.server.filesys.DiskDeviceContext;
|
||||
import org.alfresco.jlan.server.filesys.DiskInterface;
|
||||
import org.alfresco.jlan.server.filesys.DiskSharedDevice;
|
||||
import org.alfresco.jlan.server.filesys.FileSystem;
|
||||
import org.alfresco.jlan.server.filesys.FilesystemsConfigSection;
|
||||
import org.alfresco.jlan.server.filesys.SrvDiskInfo;
|
||||
import org.alfresco.jlan.server.filesys.cache.FileStateCache;
|
||||
import org.alfresco.jlan.server.filesys.cache.StandaloneFileStateCache;
|
||||
import org.alfresco.jlan.server.filesys.pseudo.PseudoFileInterface;
|
||||
import org.alfresco.repo.admin.SysAdminParams;
|
||||
import org.springframework.extensions.config.element.GenericConfigElement;
|
||||
|
||||
/**
|
||||
* Alfresco Filesystem Context Class
|
||||
@@ -74,6 +83,10 @@ public abstract class AlfrescoContext extends DiskDeviceContext
|
||||
|
||||
private IOControlHandler m_ioHandler;
|
||||
|
||||
// Server configuration
|
||||
|
||||
private ServerConfigurationBean m_serverConfig;
|
||||
|
||||
// Debug flags
|
||||
//
|
||||
// Requires the logger to be enabled for debug output
|
||||
@@ -107,6 +120,15 @@ public abstract class AlfrescoContext extends DiskDeviceContext
|
||||
enableChangeHandler(!disableChangeNotification);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the server configuration
|
||||
*
|
||||
* @param srvConfig ServerConfigurationBean
|
||||
*/
|
||||
public void setServerConfigurationBean( ServerConfigurationBean srvConfig) {
|
||||
m_serverConfig = srvConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Complete initialization by registering with a disk driver
|
||||
*/
|
||||
@@ -424,4 +446,57 @@ public abstract class AlfrescoContext extends DiskDeviceContext
|
||||
{
|
||||
return (m_debug & flg) != 0 ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the filesystem
|
||||
*
|
||||
* @param share DiskSharedDevice
|
||||
* @exception DeviceContextException
|
||||
*/
|
||||
public void startFilesystem(DiskSharedDevice share)
|
||||
throws DeviceContextException {
|
||||
|
||||
// Call the base class
|
||||
|
||||
super.startFilesystem(share);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable the state cache
|
||||
*
|
||||
* @param ena boolean
|
||||
*/
|
||||
public void enableStateCache( boolean ena) {
|
||||
|
||||
// Check if the server configuration has been set
|
||||
|
||||
if ( m_serverConfig == null)
|
||||
throw new AlfrescoRuntimeException( "Failed to set standalone file state cache for share " + getShareName());
|
||||
|
||||
// Check if we are enabling the state cache
|
||||
|
||||
if ( ena == true && getStateCache() == null) {
|
||||
|
||||
// Set the state cache, use a hard coded standalone cache for now
|
||||
|
||||
FilesystemsConfigSection filesysConfig = (FilesystemsConfigSection) m_serverConfig.getConfigSection( FilesystemsConfigSection.SectionName);
|
||||
|
||||
if ( filesysConfig != null) {
|
||||
|
||||
try {
|
||||
|
||||
// Create a standalone state cache
|
||||
|
||||
StandaloneFileStateCache standaloneCache = new StandaloneFileStateCache();
|
||||
standaloneCache.initializeCache( new GenericConfigElement( ""), m_serverConfig);
|
||||
|
||||
filesysConfig.addFileStateCache( getDeviceName(), standaloneCache);
|
||||
setStateCache( standaloneCache);
|
||||
}
|
||||
catch ( InvalidConfigurationException ex) {
|
||||
throw new AlfrescoRuntimeException( "Failed to initialize standalone state cache for " + getDeviceName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import javax.transaction.Status;
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.filesys.config.ServerConfigurationBean;
|
||||
import org.alfresco.jlan.server.SrvSession;
|
||||
import org.alfresco.jlan.server.core.DeviceContext;
|
||||
import org.alfresco.jlan.server.core.DeviceContextException;
|
||||
@@ -399,13 +400,25 @@ public abstract class AlfrescoDiskDriver implements IOCtlInterface, Transactiona
|
||||
* shares. In this base class, we initialize all desktop actions.
|
||||
*
|
||||
* @param ctx the context
|
||||
* @param serverConfig ServerConfigurationBean
|
||||
* @exception DeviceContextException
|
||||
*/
|
||||
public void registerContext(DeviceContext ctx) throws DeviceContextException
|
||||
public void registerContext(DeviceContext ctx, ServerConfigurationBean serverConfig) throws DeviceContextException
|
||||
{
|
||||
if (ctx instanceof AlfrescoContext)
|
||||
{
|
||||
((AlfrescoContext) ctx).initialize(this);
|
||||
// Enable a standalone state cache on the filesystem
|
||||
|
||||
AlfrescoContext alfCtx = (AlfrescoContext) ctx;
|
||||
|
||||
if ( serverConfig != null) {
|
||||
alfCtx.setServerConfigurationBean( serverConfig);
|
||||
alfCtx.enableStateCache( true);
|
||||
}
|
||||
|
||||
// Initialize the filesystem
|
||||
|
||||
alfCtx.initialize(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.alfresco.filesys.alfresco;
|
||||
|
||||
import org.alfresco.filesys.config.ServerConfigurationBean;
|
||||
import org.alfresco.jlan.server.core.DeviceContext;
|
||||
import org.alfresco.jlan.server.core.DeviceContextException;
|
||||
import org.alfresco.jlan.server.filesys.DiskInterface;
|
||||
@@ -33,7 +34,8 @@ public interface ExtendedDiskInterface extends DiskInterface
|
||||
*
|
||||
* @param context
|
||||
* the device context
|
||||
* @param serverConfig ServerConfigurationBean
|
||||
* @exception DeviceContextException
|
||||
*/
|
||||
public void registerContext(DeviceContext ctx) throws DeviceContextException;
|
||||
public void registerContext(DeviceContext ctx, ServerConfigurationBean serverConfig) throws DeviceContextException;
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@ import java.util.StringTokenizer;
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import org.alfresco.filesys.alfresco.AlfrescoDiskDriver;
|
||||
import org.alfresco.filesys.config.ServerConfigurationBean;
|
||||
import org.alfresco.jlan.server.SrvSession;
|
||||
import org.alfresco.jlan.server.auth.ClientInfo;
|
||||
import org.alfresco.jlan.server.core.DeviceContext;
|
||||
@@ -417,7 +418,7 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
}
|
||||
|
||||
// Register the context bean
|
||||
registerContext(context);
|
||||
registerContext(context, null);
|
||||
|
||||
// Return the context for this shared filesystem
|
||||
return context;
|
||||
@@ -428,13 +429,14 @@ public class AVMDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||
* device.
|
||||
*
|
||||
* @param context the device context
|
||||
* @param serverConfig ServerConfigurationBean
|
||||
* @exception DeviceContextException
|
||||
*/
|
||||
@Override
|
||||
public void registerContext(DeviceContext ctx)
|
||||
public void registerContext(DeviceContext ctx, ServerConfigurationBean serverConfig)
|
||||
throws DeviceContextException
|
||||
{
|
||||
super.registerContext(ctx);
|
||||
super.registerContext(ctx, serverConfig);
|
||||
|
||||
AVMContext context = (AVMContext)ctx;
|
||||
// Use the system user as the authenticated context for the filesystem initialization
|
||||
|
@@ -1627,7 +1627,7 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean
|
||||
// the new filesystem
|
||||
|
||||
ExtendedDiskInterface filesysDriver = getAvmDiskInterface();
|
||||
filesysDriver.registerContext(filesystem);
|
||||
filesysDriver.registerContext(filesystem, this);
|
||||
|
||||
// Create the shared filesystem
|
||||
|
||||
@@ -1656,7 +1656,7 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean
|
||||
|
||||
ExtendedDiskInterface filesysDriver = getRepoDiskInterface();
|
||||
ContentContext filesysContext = (ContentContext) filesystem;
|
||||
filesysDriver.registerContext(filesystem);
|
||||
filesysDriver.registerContext(filesystem, this);
|
||||
|
||||
// Check if an access control list has been specified
|
||||
|
||||
|
@@ -374,6 +374,9 @@ public class ContentContext extends AlfrescoContext
|
||||
// Call the base class
|
||||
|
||||
super.startFilesystem(share);
|
||||
|
||||
if ( getStateCache() != null)
|
||||
getStateCache().setCaseSensitive( false);
|
||||
|
||||
// Find the thread pool via the configuration
|
||||
|
||||
|
@@ -39,6 +39,7 @@ import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.filesys.alfresco.AlfrescoContext;
|
||||
import org.alfresco.filesys.alfresco.AlfrescoDiskDriver;
|
||||
import org.alfresco.filesys.alfresco.AlfrescoNetworkFile;
|
||||
import org.alfresco.filesys.config.ServerConfigurationBean;
|
||||
import org.alfresco.jlan.server.SrvSession;
|
||||
import org.alfresco.jlan.server.core.DeviceContext;
|
||||
import org.alfresco.jlan.server.core.DeviceContextException;
|
||||
@@ -590,7 +591,7 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
|
||||
|
||||
// Register the device context
|
||||
|
||||
registerContext(context);
|
||||
registerContext(context, null);
|
||||
|
||||
// Return the context for this shared filesystem
|
||||
|
||||
@@ -606,13 +607,14 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
|
||||
* WARNING: side effect, will commit or roll back current user transaction context.
|
||||
*
|
||||
* @param ctx the context
|
||||
* @param serverConfig ServerConfigurationBean
|
||||
* @exception DeviceContextException
|
||||
*/
|
||||
// MER TODO - transaction handling in registerContext needs changing
|
||||
@Override
|
||||
public void registerContext(DeviceContext ctx) throws DeviceContextException
|
||||
public void registerContext(DeviceContext ctx, ServerConfigurationBean serverConfig) throws DeviceContextException
|
||||
{
|
||||
super.registerContext(ctx);
|
||||
super.registerContext(ctx, serverConfig);
|
||||
|
||||
ContentContext context = (ContentContext)ctx;
|
||||
|
||||
@@ -750,7 +752,6 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
|
||||
// Enable file state caching
|
||||
|
||||
context.enableStateCache( true);
|
||||
context.getStateCache().setCaseSensitive( false);
|
||||
|
||||
// Initialize the I/O control handler
|
||||
|
||||
|
@@ -23,6 +23,7 @@ import java.io.IOException;
|
||||
|
||||
import org.alfresco.jlan.server.filesys.FileInfo;
|
||||
import org.alfresco.jlan.server.filesys.cache.FileState;
|
||||
import org.alfresco.jlan.server.filesys.cache.LocalFileState;
|
||||
import org.alfresco.jlan.smb.SeekType;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
@@ -261,7 +262,7 @@ public class LinkMemoryNetworkFile extends NodeRefNetworkFile
|
||||
// Create a dummy file state
|
||||
|
||||
if ( super.getFileState() == null)
|
||||
setFileState(new FileState(getFullName(), false));
|
||||
setFileState(new LocalFileState(getFullName(), false));
|
||||
return super.getFileState();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user