+ * Acts as an adaptor between JLAN's configuration requirements and the spring configuration of + * the Alfresco filesystem subsystem. + *
+ * Also contains an amount of initialisation logic. * * @author gkspencer * @author dward + * @author mrogers */ public class ServerConfigurationBean extends AbstractServerConfigurationBean { @@ -91,6 +106,7 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean private boolean avmAllStores; private SecurityConfigBean securityConfigBean; private CoreServerConfigBean coreServerConfigBean; + private ClusterConfigBean clusterConfigBean; /** * Default constructor @@ -145,6 +161,11 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean { this.coreServerConfigBean = coreServerConfigBean; } + + public void setClusterConfigBean(ClusterConfigBean clusterConfigBean) + { + this.clusterConfigBean = clusterConfigBean; + } /** * Process the CIFS server configuration @@ -1627,17 +1648,14 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean // the new filesystem ExtendedDiskInterface filesysDriver = getAvmDiskInterface(); - filesysDriver.registerContext(filesystem, this); - - // Create the shared filesystem - - filesys = new DiskSharedDevice(filesystem.getDeviceName(), filesysDriver, (AVMContext)filesystem); - filesys.setConfiguration( this); - - // Check if the filesystem uses the file state cache, if so then add to the file state reaper - DiskDeviceContext diskCtx = (DiskDeviceContext) filesystem; + + // Check if the filesystem uses the file state cache, if so then add to the file state reaper + StandaloneFileStateCache standaloneCache = new StandaloneFileStateCache(); + standaloneCache.initializeCache( new GenericConfigElement( ""), this); + diskCtx.setStateCache(standaloneCache); + if ( diskCtx.hasStateCache()) { // Register the state cache with the reaper thread @@ -1645,6 +1663,12 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean fsysConfig.addFileStateCache( filesystem.getDeviceName(), diskCtx.getStateCache()); } + filesysDriver.registerContext(filesystem); + + // Create the shared filesystem + + filesys = new DiskSharedDevice(filesystem.getDeviceName(), filesysDriver, (AVMContext)filesystem); + filesys.setConfiguration( this); // Start the filesystem ((AVMContext)filesystem).startFilesystem(filesys); @@ -1656,7 +1680,58 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean ExtendedDiskInterface filesysDriver = getRepoDiskInterface(); ContentContext filesysContext = (ContentContext) filesystem; - filesysDriver.registerContext(filesystem, this); + + if(clusterConfigBean != null && clusterConfigBean.getClusterEnabled()) + { + if(logger.isDebugEnabled()) + { + logger.debug("start hazelcast cache : " + clusterConfigBean.getClusterName() + ", shareName: "+ filesysContext.getShareName()); + } + + // initialise the hazelcast cache for this filesystem + HazelCastClusterFileStateCache hazel = new HazelCastClusterFileStateCache(); + GenericConfigElement config = new GenericConfigElement("hazelcastStateCache"); + GenericConfigElement clusterNameCfg = new GenericConfigElement("clusterName"); + clusterNameCfg.setValue(clusterConfigBean.getClusterName()); + config.addChild(clusterNameCfg); + + GenericConfigElement topicNameCfg = new GenericConfigElement("clusterTopic"); + String topicName = filesysContext.getShareName(); + if(topicName == null || topicName.isEmpty()) + { + topicName="default"; + } + topicNameCfg.setValue(topicName); + config.addChild(topicNameCfg); + + GenericConfigElement debugCfg = new GenericConfigElement("cacheDebug"); + debugCfg.addAttribute("flags", "StateCache,Rename"); + config.addChild(debugCfg); + + hazel.initializeCache(config, this); + filesysContext.setStateCache(hazel); + } + else + { + // Create state cache here and inject + StandaloneFileStateCache standaloneCache = new StandaloneFileStateCache(); + standaloneCache.initializeCache( new GenericConfigElement( ""), this); + filesysContext.setStateCache(standaloneCache); + } + + if ( filesysContext.hasStateCache()) { + + // Register the state cache with the reaper thread + + fsysConfig.addFileStateCache( filesystem.getDeviceName(), filesysContext.getStateCache()); + + // Create the lock manager for the context. + FileStateLockManager lockMgr = new FileStateLockManager(filesysContext.getStateCache()); + filesysContext.setLockManager(lockMgr); + filesysContext.setOpLockManager(lockMgr); + } + + filesysDriver.registerContext(filesystem); // Check if an access control list has been specified @@ -1683,14 +1758,7 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean filesys.setAccessControlList(acls); - // Check if the filesystem uses the file state cache, if so then add to the file state reaper - - if ( filesysContext.hasStateCache()) { - - // Register the state cache with the reaper thread - - fsysConfig.addFileStateCache( filesystem.getDeviceName(), filesysContext.getStateCache()); - } + // Check if change notifications should be enabled @@ -1748,7 +1816,7 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean // Create the new share for the store AVMContext avmContext = new AVMContext(storeName, storeName + ":/", AVMContext.VERSION_HEAD); - avmContext.enableStateCache(this, true); +// avmContext.enableStateCache(this, true); // Create the shared filesystem @@ -1822,7 +1890,6 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean else { // Check if the tenant service is enabled - if (m_tenantService != null && m_tenantService.isEnabled()) { // Initialize the multi-tenancy share mapper @@ -1830,14 +1897,7 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean secConfig.setShareMapper("org.alfresco.filesys.alfresco.MultiTenantShareMapper", new GenericConfigElement("shareMapper")); - ShareMapper mapper = secConfig.getShareMapper(); - - if(mapper instanceof MultiTenantShareMapper) - { - MultiTenantShareMapper mtsm = (MultiTenantShareMapper)mapper; - mtsm.setServerConfigurationBean(this); - } - } + } } // Check if any domain mappings have been specified @@ -2100,4 +2160,112 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean coreConfig.setMemoryPool(DefaultMemoryPoolBufSizes, DefaultMemoryPoolInitAlloc, DefaultMemoryPoolMaxAlloc); } } + + /** + * Initialise a runtime context - not configured through spring e.g MT. + * + * TODO - what about desktop actions etc? + * + * @param diskCtx + */ + public void initialiseRuntimeContext(AlfrescoContext diskCtx) + { + if (diskCtx.getStateCache() == null) { + + // Set the state cache, use a hard coded standalone cache for now + FilesystemsConfigSection filesysConfig = (FilesystemsConfigSection) this.getConfigSection( FilesystemsConfigSection.SectionName); + + if ( filesysConfig != null) { + + try { + + // Create a standalone state cache + StandaloneFileStateCache standaloneCache = new StandaloneFileStateCache(); + standaloneCache.initializeCache( new GenericConfigElement( ""), this); + filesysConfig.addFileStateCache( diskCtx.getDeviceName(), standaloneCache); + diskCtx.setStateCache( standaloneCache); + + FileStateLockManager lockMgr = new FileStateLockManager(standaloneCache); + diskCtx.setLockManager(lockMgr); + diskCtx.setOpLockManager(lockMgr); + } + catch ( InvalidConfigurationException ex) + { + throw new AlfrescoRuntimeException( "Failed to initialize standalone state cache for " + diskCtx.getDeviceName()); + } + } + } + } + + /** + * Initialise a runtime context - AVM + * + * TODO - what about desktop actions etc? + * + * @param diskCtx + */ + public void initialiseRuntimeContext(AVMContext diskCtx) + { + if (diskCtx.getStateCache() == null) { + + // Set the state cache, use a hard coded standalone cache for now + FilesystemsConfigSection filesysConfig = (FilesystemsConfigSection) this.getConfigSection( FilesystemsConfigSection.SectionName); + + if ( filesysConfig != null) { + + try { + + // Create a standalone state cache + StandaloneFileStateCache standaloneCache = new StandaloneFileStateCache(); + standaloneCache.initializeCache( new GenericConfigElement( ""), this); + filesysConfig.addFileStateCache( diskCtx.getDeviceName(), standaloneCache); + diskCtx.setStateCache( standaloneCache); + } + catch ( InvalidConfigurationException ex) { + throw new AlfrescoRuntimeException( "Failed to initialize standalone state cache for " + diskCtx.getDeviceName()); + } + } + } + } + + + @Override + protected void processClusterConfig() throws InvalidConfigurationException + { + + // TODO - when should we close the config ? jlanClusterConfig.closeConfig(); + + if (clusterConfigBean == null || !clusterConfigBean.getClusterEnabled()) + { + removeConfigSection(ClusterConfigSection.SectionName); + logger.info("Filesystem cluster cache not enabled"); + return; + } + + String clusterName = clusterConfigBean.getClusterName(); + if (clusterName == null || clusterName.length() == 0) + { + throw new InvalidConfigurationException("Cluster name not specified or invalid"); + } + + String clusterFile = clusterConfigBean.getConfigFile(); + if (clusterFile == null || clusterFile.length() == 0) + { + throw new InvalidConfigurationException("Cluster config file not specified or invalid"); + } + + // New Hazelcast instance created here within the ClusterConfigSection + ClusterConfigSection jlanClusterConfig = new ClusterConfigSection(this); + + try + { + //TODO replace config XML file with Hazelcast config bean backed by spring. + jlanClusterConfig.setConfigFile(clusterFile); + HazelcastInstance hazelcastInstance = jlanClusterConfig.getHazelcastInstance(); + } + catch (FileNotFoundException e) + { + throw new InvalidConfigurationException("Unable to start filsystem cluster", e); + } + } } diff --git a/source/java/org/alfresco/filesys/repo/BufferedContentDiskDriver.java b/source/java/org/alfresco/filesys/repo/BufferedContentDiskDriver.java index 5035c8f32f..1833dfcb10 100644 --- a/source/java/org/alfresco/filesys/repo/BufferedContentDiskDriver.java +++ b/source/java/org/alfresco/filesys/repo/BufferedContentDiskDriver.java @@ -42,6 +42,8 @@ import org.alfresco.jlan.server.filesys.SrvDiskInfo; import org.alfresco.jlan.server.filesys.TreeConnection; import org.alfresco.jlan.server.filesys.cache.FileState; import org.alfresco.jlan.server.filesys.cache.FileStateCache; +import org.alfresco.jlan.server.locking.FileLockingInterface; +import org.alfresco.jlan.server.locking.LockManager; import org.alfresco.jlan.server.locking.OpLockInterface; import org.alfresco.jlan.server.locking.OpLockManager; import org.alfresco.jlan.smb.SMBException; @@ -63,8 +65,18 @@ import org.springframework.extensions.config.ConfigElement; * Decorates ContentDiskDriver with a performance cache of some frequently used * results. In particular for getFileInformation and fileExists */ +/* + * MER - this class is also acting as a proxy to gather together the different interfaces + * and present them to JLAN. This was not the intention and is a short term hack. It + * should be possible to un-spring the buffering, however that's not possible at the moment. + */ public class BufferedContentDiskDriver implements ExtendedDiskInterface, - DiskInterface, DiskSizeInterface, IOCtlInterface, OpLockInterface, NodeServicePolicies.OnDeleteNodePolicy, + DiskInterface, + DiskSizeInterface, + IOCtlInterface, + OpLockInterface, + FileLockingInterface, + NodeServicePolicies.OnDeleteNodePolicy, NodeServicePolicies.OnMoveNodePolicy { // Logging @@ -78,6 +90,8 @@ public class BufferedContentDiskDriver implements ExtendedDiskInterface, private OpLockInterface opLockInterface; + private FileLockingInterface fileLockingInterface; + private PolicyComponent policyComponent; public void init() @@ -86,7 +100,9 @@ public class BufferedContentDiskDriver implements ExtendedDiskInterface, PropertyCheck.mandatory(this, "diskSizeInterface", diskSizeInterface); PropertyCheck.mandatory(this, "ioctltInterface", ioctlInterface); PropertyCheck.mandatory(this, "fileInfoCache", fileInfoCache); + PropertyCheck.mandatory(this, "fileLockingInterface", getFileLockingInterface()); PropertyCheck.mandatory(this, "opLockInterface", getOpLockInterface()); + PropertyCheck.mandatory(this, "fileLockingInterface", fileLockingInterface); PropertyCheck.mandatory(this, "policyComponent", getPolicyComponent()); getPolicyComponent().bindClassBehaviour( NodeServicePolicies.OnDeleteNodePolicy.QNAME, @@ -95,8 +111,6 @@ public class BufferedContentDiskDriver implements ExtendedDiskInterface, this, new JavaBehaviour(this, "onMoveNode")); } - - /** * FileInfo Cache for path to FileInfo */ @@ -477,10 +491,10 @@ public class BufferedContentDiskDriver implements ExtendedDiskInterface, } @Override - public void registerContext(DeviceContext ctx, ServerConfigurationBean scb) + public void registerContext(DeviceContext ctx) throws DeviceContextException { - diskInterface.registerContext(ctx, scb); + diskInterface.registerContext(ctx); } public void setDiskInterface(ExtendedDiskInterface diskInterface) @@ -565,5 +579,23 @@ public class BufferedContentDiskDriver implements ExtendedDiskInterface, { return opLockInterface.isOpLocksEnabled(sess, tree); } + + @Override + public LockManager getLockManager(SrvSession sess, TreeConnection tree) + { + return getFileLockingInterface().getLockManager(sess, tree); + } + + + public void setFileLockingInterface(FileLockingInterface fileLockingInterface) + { + this.fileLockingInterface = fileLockingInterface; + } + + + public FileLockingInterface getFileLockingInterface() + { + return fileLockingInterface; + } } \ No newline at end of file diff --git a/source/java/org/alfresco/filesys/repo/ContentDiskDriver.java b/source/java/org/alfresco/filesys/repo/ContentDiskDriver.java index 4e16acccf8..174e817ae2 100644 --- a/source/java/org/alfresco/filesys/repo/ContentDiskDriver.java +++ b/source/java/org/alfresco/filesys/repo/ContentDiskDriver.java @@ -620,7 +620,7 @@ public class ContentDiskDriver extends AlfrescoTxDiskDriver implements DiskInter // Register the device context - registerContext(context, null); + registerContext(context); // Return the context for this shared filesystem @@ -641,9 +641,9 @@ public class ContentDiskDriver extends AlfrescoTxDiskDriver implements DiskInter */ // MER TODO - transaction handling in registerContext needs changing @Override - public void registerContext(DeviceContext ctx, ServerConfigurationBean serverConfig) throws DeviceContextException + public void registerContext(DeviceContext ctx) throws DeviceContextException { - super.registerContext(ctx, serverConfig); + super.registerContext(ctx); ContentContext context = (ContentContext)ctx; @@ -777,9 +777,9 @@ public class ContentDiskDriver extends AlfrescoTxDiskDriver implements DiskInter logger.info("Locked files will be marked as offline"); } - // Enable file state caching - - context.enableStateCache(serverConfig, true); +// // Enable file state caching +// +// context.enableStateCache(serverConfig, true); // Install the node service monitor diff --git a/source/java/org/alfresco/filesys/repo/ContentDiskDriver2.java b/source/java/org/alfresco/filesys/repo/ContentDiskDriver2.java index f8e7103f56..9e0e022531 100644 --- a/source/java/org/alfresco/filesys/repo/ContentDiskDriver2.java +++ b/source/java/org/alfresco/filesys/repo/ContentDiskDriver2.java @@ -81,6 +81,7 @@ import org.alfresco.jlan.server.filesys.pseudo.PseudoFileList; import org.alfresco.jlan.server.filesys.pseudo.PseudoNetworkFile; import org.alfresco.jlan.server.filesys.quota.QuotaManager; import org.alfresco.jlan.server.filesys.quota.QuotaManagerException; +import org.alfresco.jlan.server.locking.FileLockingInterface; import org.alfresco.jlan.server.locking.LockManager; import org.alfresco.jlan.server.locking.OpLockInterface; import org.alfresco.jlan.server.locking.OpLockManager; @@ -143,7 +144,12 @@ import org.springframework.extensions.config.ConfigElement; * */ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedDiskInterface, - DiskInterface, DiskSizeInterface, IOCtlInterface, RepositoryDiskInterface, OpLockInterface + DiskInterface, + DiskSizeInterface, + IOCtlInterface, + RepositoryDiskInterface, + OpLockInterface, + FileLockingInterface { // Logging private static final Log logger = LogFactory.getLog(ContentDiskDriver2.class); @@ -166,9 +172,6 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD private AuthenticationService authService; private BehaviourFilter policyBehaviourFilter; private NodeMonitorFactory m_nodeMonitorFactory; - //private IOControlHandler ioControlHandler; - - private FileStateLockManager lockManager; private boolean isLockedFilesAsOffline; @@ -439,10 +442,10 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD * There's a load of initialisation that needs to be moved out of this method, like the * instantiation of the lock manager, quota manager and node monitor. */ - public void registerContext(DeviceContext ctx, ServerConfigurationBean serverConfig) throws DeviceContextException + public void registerContext(DeviceContext ctx) throws DeviceContextException { logger.debug("registerContext"); - super.registerContext(ctx, serverConfig); + super.registerContext(ctx); final ContentContext context = (ContentContext)ctx; @@ -558,8 +561,8 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD // Enable file state caching - context.enableStateCache(serverConfig, true); - context.getStateCache().setCaseSensitive( false); +// context.enableStateCache(serverConfig, true); +// context.getStateCache().setCaseSensitive( false); logger.debug("initialise the node monitor"); // Install the node service monitor @@ -571,9 +574,6 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD logger.debug("initialise the file state lock manager"); - // Create the lock manager - - lockManager = new FileStateLockManager(context.getStateCache()); // Check if oplocks are enabled @@ -2440,7 +2440,8 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD */ public LockManager getLockManager(SrvSession sess, TreeConnection tree) { - return lockManager; + AlfrescoContext alfCtx = (AlfrescoContext) tree.getContext(); + return alfCtx.getLockManager(); } /** @@ -2535,18 +2536,35 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD // Validate the file id if(logger.isDebugEnabled()) { - logger.debug("processIOControl ctrlCode:" + ctrlCode + ", fid:" + fid); + logger.debug("processIOControl ctrlCode: 0x" + Integer.toHexString(ctrlCode) + ", fid:" + fid); } NetworkFile netFile = tree.findFile(fid); if ( netFile == null || netFile.isDirectory() == false) { + if(logger.isDebugEnabled()) + { + logger.debug("net file is null or not a directory"); + } throw new SMBException(SMBStatus.NTErr, SMBStatus.NTInvalidParameter); } final ContentContext ctx = (ContentContext) tree.getContext(); - org.alfresco.jlan.util.DataBuffer buff = ioControlHandler.processIOControl(sess, tree, ctrlCode, fid, dataBuf, isFSCtrl, filter, this, ctx); - return buff; + try + { + org.alfresco.jlan.util.DataBuffer buff = ioControlHandler.processIOControl(sess, tree, ctrlCode, fid, dataBuf, isFSCtrl, filter, this, ctx); + + return buff; + } + catch(SMBException smbException) + { + if(logger.isDebugEnabled()) + { + logger.debug("SMB Exception fid:" + fid, smbException); + } + throw smbException; + } + } @@ -2924,12 +2942,17 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD @Override public OpLockManager getOpLockManager(SrvSession sess, TreeConnection tree) { - return lockManager; + AlfrescoContext alfCtx = (AlfrescoContext) tree.getContext(); + return alfCtx.getOpLockManager(); } @Override public boolean isOpLocksEnabled(SrvSession sess, TreeConnection tree) { - return true; + if(getOpLockManager(sess, tree) != null) + { + return true; + } + return false; } } diff --git a/source/java/org/alfresco/filesys/repo/ContentIOControlHandler.java b/source/java/org/alfresco/filesys/repo/ContentIOControlHandler.java index c05ff8d4ce..29df048bac 100644 --- a/source/java/org/alfresco/filesys/repo/ContentIOControlHandler.java +++ b/source/java/org/alfresco/filesys/repo/ContentIOControlHandler.java @@ -185,7 +185,8 @@ public class ContentIOControlHandler implements IOControlHandler // Debug - if ( logger.isDebugEnabled()) { + if ( logger.isDebugEnabled()) + { logger.debug("IO control func=0x" + Integer.toHexString(ioFunc) + ", fid=" + fid + ", buffer=" + dataBuf); logger.debug(" Folder nodeRef=" + folderNode); } @@ -200,6 +201,11 @@ public class ContentIOControlHandler implements IOControlHandler case IOControl.CmdProbe: + if(logger.isDebugEnabled()) + { + logger.debug("CmdProbe"); + } + // Return a buffer with the signature and protocol version retBuffer = new DataBuffer(IOControl.Signature.length()); @@ -211,6 +217,7 @@ public class ContentIOControlHandler implements IOControlHandler // Get file information for a file within the current folder case IOControl.CmdFileStatus: + // Process the file status request @@ -247,7 +254,11 @@ public class ContentIOControlHandler implements IOControlHandler // Unknown I/O control code default: - throw new IOControlNotImplementedException(); + if(logger.isDebugEnabled()) + { + logger.debug("throwing IOControl not implemented exception :iofunc" + Integer.toHexString(ioFunc)); + } + throw new IOControlNotImplementedException("IO func not implemented" + Integer.toHexString(ioFunc)); } // Return the reply buffer, may be null @@ -302,6 +313,10 @@ public class ContentIOControlHandler implements IOControlHandler if ( childNode == null) { // Return an error response + if(logger.isDebugEnabled()) + { + logger.debug("FileStatusProbe StsFileNotFound"); + } respBuf.putInt(DesktopAction.StsFileNotFound); return respBuf; @@ -312,6 +327,11 @@ public class ContentIOControlHandler implements IOControlHandler if ( getCifsHelper().isDirectory( childNode)) { // Only return the status and node type for folders + if(logger.isDebugEnabled()) + { + logger.debug("FileStatusProbe StsSuccess type folder"); + } + respBuf.putInt(DesktopAction.StsSuccess); respBuf.putInt(IOControl.TypeFolder); @@ -320,6 +340,11 @@ public class ContentIOControlHandler implements IOControlHandler { // Indicate that this is a file node + if(logger.isDebugEnabled()) + { + logger.debug("FileStatusProbe StsSuccess type file"); + } + respBuf.putInt(DesktopAction.StsSuccess); respBuf.putInt(IOControl.TypeFile); @@ -652,8 +677,10 @@ public class ContentIOControlHandler implements IOControlHandler // DEBUG if ( logger.isDebugEnabled()) + { logger.debug(" Get Auth Ticket"); - + } + // Create a response buffer DataBuffer respBuf = new DataBuffer(256); @@ -729,13 +756,18 @@ public class ContentIOControlHandler implements IOControlHandler // DEBUG if ( logger.isDebugEnabled()) + { logger.debug("Error during invalidate ticket", ex2); + + } } // DEBUG if ( logger.isDebugEnabled()) + { logger.debug("Auth ticket expired or invalid"); + } } } diff --git a/source/java/org/alfresco/filesys/repo/HomeShareMapper.java b/source/java/org/alfresco/filesys/repo/HomeShareMapper.java index e02ce71339..937eb0c234 100644 --- a/source/java/org/alfresco/filesys/repo/HomeShareMapper.java +++ b/source/java/org/alfresco/filesys/repo/HomeShareMapper.java @@ -34,6 +34,7 @@ import org.alfresco.jlan.server.core.SharedDeviceList; import org.alfresco.jlan.server.filesys.DiskSharedDevice; import org.alfresco.jlan.server.filesys.FilesystemsConfigSection; import org.springframework.extensions.config.ConfigElement; +import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.filesys.alfresco.AlfrescoClientInfo; import org.alfresco.filesys.config.ServerConfigurationBean; import org.apache.commons.logging.Log; @@ -62,8 +63,6 @@ public class HomeShareMapper implements ShareMapper, InitializingBean private ServerConfiguration m_config; private FilesystemsConfigSection m_filesysConfig; - - private ServerConfigurationBean serverConfigurationBean; // Filesystem driver to be used to create home shares @@ -392,7 +391,21 @@ public class HomeShareMapper implements ShareMapper, InitializingBean // Create the disk driver and context ContentContext diskCtx = new ContentContext( getHomeFolderName(), "", "", alfClient.getHomeFolder()); - diskCtx.enableStateCache(getServerConfigurationBean(), true); + + if(m_config instanceof ServerConfigurationBean) + { + ServerConfigurationBean config = (ServerConfigurationBean)m_config; + + config.initialiseRuntimeContext(diskCtx); + + // Enable file state caching + // diskCtx.enableStateCache(serverConfigurationBean, true); + } + else + { + throw new AlfrescoRuntimeException("configuration error, unknown configuration bean"); + } + // Create a temporary shared device for the users home directory @@ -404,15 +417,4 @@ public class HomeShareMapper implements ShareMapper, InitializingBean return null; } - - public void setServerConfigurationBean(ServerConfigurationBean serverConfigurationBean) - { - this.serverConfigurationBean = serverConfigurationBean; - } - - - public ServerConfigurationBean getServerConfigurationBean() - { - return serverConfigurationBean; - } } diff --git a/source/java/org/alfresco/filesys/repo/LegacyFileStateDriver.java b/source/java/org/alfresco/filesys/repo/LegacyFileStateDriver.java index 70ae43eba7..3b0a1f170d 100644 --- a/source/java/org/alfresco/filesys/repo/LegacyFileStateDriver.java +++ b/source/java/org/alfresco/filesys/repo/LegacyFileStateDriver.java @@ -295,10 +295,9 @@ public class LegacyFileStateDriver implements ExtendedDiskInterface } @Override - public void registerContext(DeviceContext ctx, - ServerConfigurationBean serverConfig) throws DeviceContextException + public void registerContext(DeviceContext ctx) throws DeviceContextException { - diskInterface.registerContext(ctx, serverConfig); + diskInterface.registerContext(ctx); } public void setDiskInterface(ExtendedDiskInterface diskInterface) diff --git a/source/java/org/alfresco/filesys/repo/NonTransactionalRuleContentDiskDriver.java b/source/java/org/alfresco/filesys/repo/NonTransactionalRuleContentDiskDriver.java index 1e0352087a..d8fac420c4 100644 --- a/source/java/org/alfresco/filesys/repo/NonTransactionalRuleContentDiskDriver.java +++ b/source/java/org/alfresco/filesys/repo/NonTransactionalRuleContentDiskDriver.java @@ -521,10 +521,10 @@ public class NonTransactionalRuleContentDiskDriver implements ExtendedDiskInterf } @Override - public void registerContext(DeviceContext ctx, ServerConfigurationBean serverConfig) + public void registerContext(DeviceContext ctx) throws DeviceContextException { - diskInterface.registerContext(ctx, serverConfig); + diskInterface.registerContext(ctx); } public void setRepositoryDiskInterface(RepositoryDiskInterface repositoryDiskInterface)