diff --git a/config/alfresco/bootstrap-context.xml b/config/alfresco/bootstrap-context.xml index d61866a524..217b5bf06b 100644 --- a/config/alfresco/bootstrap-context.xml +++ b/config/alfresco/bootstrap-context.xml @@ -404,9 +404,6 @@ - - org.alfresco.filesys.auth.nfs.UserMapping - org.alfresco.filesys.config.acl.DomainAccessControlBean diff --git a/config/alfresco/repository.properties b/config/alfresco/repository.properties index e52e6f813c..7a027a7d6a 100644 --- a/config/alfresco/repository.properties +++ b/config/alfresco/repository.properties @@ -679,20 +679,6 @@ authentication.ticket.useSingleTicketPerUser=true # Please, see MNT-7392 for details. kerberos.authentication.cifs.enableTicketCracking=false -# Default NFS user mappings (empty). Note these users will be able to -# authenticate through NFS without password so ensure NFS port is secure before -# enabling and adding mappings -nfs.user.mappings= -nfs.user.mappings.default.uid=0 -nfs.user.mappings.default.gid=0 - -#Example NFS user mappings -#nfs.user.mappings=admin,user1 -#nfs.user.mappings.value.admin.uid=0 -#nfs.user.mappings.value.admin.gid=0 -#nfs.user.mappings.value.user1.uid=500 -#nfs.user.mappings.value.user1.gid=500 - # FTP access ftp.enabled=false diff --git a/config/alfresco/subsystems/fileServers/default/file-servers-context.xml b/config/alfresco/subsystems/fileServers/default/file-servers-context.xml index 4a6c6d9602..d97261d33b 100644 --- a/config/alfresco/subsystems/fileServers/default/file-servers-context.xml +++ b/config/alfresco/subsystems/fileServers/default/file-servers-context.xml @@ -13,9 +13,6 @@ - - - @@ -49,26 +46,6 @@ - - - - - - - - - - - - - - - - - - - - @@ -81,9 +58,6 @@ - - - @@ -285,91 +259,12 @@ - - - - - - - ${alfresco_user_store.adminusername} - - - 0 - - - 0 - - - - - - ${filesystem.cluster.debugFlags} - - - - ${nfs.enabled} - - - - ${nfs.nfsServerPort} - - - - ${nfs.mountServerPort} - - - - - ${nfs.portMapperPort} - - - - - ${nfs.rpcRegisterPort} - - - - - ${nfs.portMapperEnabled} - - - - - - - - - - - - - - - - - - - - - - - - - - - ${nfs.sessionDebug} - - - - ${nfs.mountServerDebug} - - . */ - -package org.alfresco.filesys; - -import java.io.IOException; -import java.io.PrintStream; -import java.net.SocketException; -import java.util.Vector; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.jlan.oncrpc.mount.MountServer; -import org.alfresco.jlan.oncrpc.nfs.NFSConfigSection; -import org.alfresco.jlan.oncrpc.nfs.NFSServer; -import org.alfresco.jlan.oncrpc.portmap.PortMapperServer; -import org.alfresco.jlan.server.NetworkServer; -import org.alfresco.jlan.server.config.ServerConfiguration; -import org.springframework.extensions.surf.util.AbstractLifecycleBean; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationEvent; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -/** - * NFS Server Class - * - *

Create and start the various server components required to run the NFS server. - * - * @author GKSpencer - */ -public class NFSServerBean extends AbstractLifecycleBean -{ - // Debug logging - - private static final Log logger = LogFactory.getLog("org.alfresco.nfs.server"); - - // Server configuration and sections - - private ServerConfiguration m_filesysConfig; - private NFSConfigSection m_nfsConfig; - - private NfsServerNodeMonitor nodeMonitor; - - // List of NFS server components - - private Vector m_serverList = new Vector(); - - /** - * Class constructor - * - * @param serverConfig ServerConfiguration - */ - public NFSServerBean(ServerConfiguration serverConfig) - { - m_filesysConfig = serverConfig; - } - - /** - * Return the server configuration - * - * @return ServerConfiguration - */ - public final ServerConfiguration getConfiguration() - { - return m_filesysConfig; - } - - public void setNodeMonitor(NfsServerNodeMonitor nodeMonitor) - { - this.nodeMonitor = nodeMonitor; - } - - /** - * Check if the server is started/enabled - * - * @return Returns true if the server started up without any errors - */ - public boolean isStarted() - { - return (!m_serverList.isEmpty() && m_filesysConfig.isServerRunning( "NFS")); - } - - /** - * Start the NFS server components - * - * @exception SocketException If a network error occurs - * @exception IOException If an I/O error occurs - */ - public final void startServer() throws SocketException, IOException - { - try - { - // Create the NFS, mount and portmapper servers, if enabled - - m_nfsConfig = (NFSConfigSection) m_filesysConfig.getConfigSection( NFSConfigSection.SectionName); - - if (m_nfsConfig != null) - { - // Create the portmapper server, if enabled - - if (m_nfsConfig.hasNFSPortMapper()) - m_serverList.add(new PortMapperServer(m_filesysConfig)); - - // Create the mount and main NFS servers - - m_serverList.add(new MountServer(m_filesysConfig)); - NFSServer nfsServer = new NFSServer(m_filesysConfig); - m_serverList.add(nfsServer); - if (null != nodeMonitor) - { - nodeMonitor.setNfsServer(nfsServer); - } - - // Add the servers to the configuration - - for (NetworkServer server : m_serverList) - { - m_filesysConfig.addServer(server); - } - } - - // Start the server(s) - - for (NetworkServer server : m_serverList) - { - if (logger.isInfoEnabled()) - logger.info("Starting server " + server.getProtocolName() + " ..."); - - // Start the server - - server.startServer(); - } - } - catch (Throwable e) - { - for (NetworkServer server : m_serverList) - { - getConfiguration().removeServer(server.getProtocolName()); - } - - m_serverList.clear(); - throw new AlfrescoRuntimeException("Failed to start NFS Server", e); - } - } - - /** - * Stop the NFS server components - */ - public final void stopServer() - { - if (null != nodeMonitor) - { - nodeMonitor.setEnabled(false); - } - - if (m_filesysConfig == null) - { - // initialisation failed - return; - } - - // Shutdown the NFS server components, in reverse order - - for ( int i = m_serverList.size() - 1; i >= 0; i--) - { - // Get the current server from the list - - NetworkServer server = m_serverList.get( i); - if (logger.isInfoEnabled()) - logger.info("Shutting server " + server.getProtocolName() + " ..."); - - // Stop the server - - server.shutdownServer(false); - - // Remove the server from the global list - - getConfiguration().removeServer(server.getProtocolName()); - } - - // Clear the server list - - m_serverList.clear(); - } - - /** - * Runs the NFS server directly - * - * @param args String[] - */ - public static void main(String[] args) - { - PrintStream out = System.out; - - out.println("NFS Server Test"); - out.println("----------------"); - - try - { - // Create the configuration service in the same way that Spring creates it - - ApplicationContext ctx = new ClassPathXmlApplicationContext("alfresco/application-context.xml"); - - // Get the NFS server bean - - NFSServerBean server = (NFSServerBean) ctx.getBean("nfsServer"); - if (server == null) - { - throw new AlfrescoRuntimeException("Server bean 'nfsServer' not defined"); - } - - // Stop the FTP server, if running - - NetworkServer srv = server.getConfiguration().findServer("FTP"); - if ( srv != null) - srv.shutdownServer(true); - - // Stop the CIFS server, if running - - srv = server.getConfiguration().findServer("SMB"); - if ( srv != null) - srv.shutdownServer(true); - - // Only wait for shutdown if the NFS server is enabled - - if ( server.getConfiguration().hasConfigSection( NFSConfigSection.SectionName)) - { - - // NFS server should have automatically started - // Wait for shutdown via the console - - out.println("Enter 'x' to shutdown ..."); - boolean shutdown = false; - - // Wait while the server runs, user may stop the server by typing a key - - while (shutdown == false) - { - - // Wait for the user to enter the shutdown key - - int ch = System.in.read(); - - if (ch == 'x' || ch == 'X') - shutdown = true; - - synchronized (server) - { - server.wait(20); - } - } - - // Stop the server - - server.stopServer(); - } - } - catch (Exception ex) - { - ex.printStackTrace(); - } - System.exit(1); - } - - @Override - protected void onBootstrap(ApplicationEvent event) - { - try - { - startServer(); - } - catch (SocketException e) - { - throw new AlfrescoRuntimeException("Failed to start NFS server", e); - } - catch (IOException e) - { - throw new AlfrescoRuntimeException("Failed to start NFS server", e); - } - } - - @Override - protected void onShutdown(ApplicationEvent event) - { - stopServer(); - - // Clear the configuration - m_filesysConfig = null; - } -} diff --git a/source/java/org/alfresco/filesys/NfsServerNodeMonitor.java b/source/java/org/alfresco/filesys/NfsServerNodeMonitor.java deleted file mode 100644 index 5eac76912f..0000000000 --- a/source/java/org/alfresco/filesys/NfsServerNodeMonitor.java +++ /dev/null @@ -1,370 +0,0 @@ -/* - * Copyright (C) 2006-2011 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.filesys; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.filesys.repo.ContentContext; -import org.alfresco.jlan.oncrpc.nfs.NFSServer; -import org.alfresco.jlan.oncrpc.nfs.ShareDetails; -import org.alfresco.jlan.server.core.DeviceContext; -import org.alfresco.model.ContentModel; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy; -import org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy; -import org.alfresco.repo.node.NodeServicePolicies.OnDeleteChildAssociationPolicy; -import org.alfresco.repo.node.NodeServicePolicies.OnDeleteNodePolicy; -import org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.namespace.QName; -import org.apache.log4j.Logger; -import org.springframework.beans.factory.InitializingBean; - -/** - * Node monitor for NFS server which updates NFS cache on renaming or deleting nodes not through NFS protocol. This monitor may be dynamically enabled or disabled. It handles nodes - * for ${filesystem.name} device name - * - * @author Dmitry Velichkevich - */ -public class NfsServerNodeMonitor - implements - NodeServicePolicies.OnUpdatePropertiesPolicy, - NodeServicePolicies.BeforeDeleteNodePolicy, - NodeServicePolicies.OnCreateChildAssociationPolicy, - NodeServicePolicies.OnDeleteChildAssociationPolicy, - NodeServicePolicies.OnDeleteNodePolicy, - InitializingBean -{ - private static final Logger LOGGER = Logger.getLogger(NfsServerNodeMonitor.class); - - public static final char NIX_SEPARATOR = '/'; - public static final String NIX_SEPARATOR_STR = "/"; - - // - // Not static fields (or bean properties) - // - - private Boolean enabled; - - private String targetDeviceName; - - // Calculable value - private StoreRef targetStoreRef; - - private List filesystemContexts; - - private NodeService nodeService; - private PolicyComponent policyComponent; - private PermissionService permissionService; - - /** - * Calculable value (see {@link NFSServerBean}) - */ - private NFSServer nfsServer; - - private Map cachedNodes = new HashMap(); - - public NfsServerNodeMonitor() - { - } - - /** - * Enables or disables policy handlers - * - * @param enabled {@link Boolean} value which determines working state of the handler - */ - public void setEnabled(boolean enabled) - { - Object previousState = this.enabled; - this.enabled = enabled; - if (null != previousState) - { - initialize(); - } - } - - public Boolean isEnabled() - { - return enabled; - } - - public void setTargetDeviceName(String targetDeviceName) - { - this.targetDeviceName = targetDeviceName; - } - - public String getTargetDeviceName() - { - return targetDeviceName; - } - - public void setFilesystemContexts(List filesystemContexts) - { - this.filesystemContexts = filesystemContexts; - } - - public StoreRef getTargetStoreRef() - { - return targetStoreRef; - } - - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - public void setNfsServer(NFSServer nfsServer) - { - this.nfsServer = nfsServer; - } - - @Override - public void afterPropertiesSet() throws Exception - { - initialize(); - } - - /** - * Performs all check on mandatory properties, searches for {@link StoreRef} for root path of target device and registers policy handlers for NFS cache updating on node - * properties updating and node deleting - */ - private void initialize() - { - if (enabled) - { - if (null == filesystemContexts) - { - throw new AlfrescoRuntimeException("'filesystemContexts' property is not configured"); - } - for (DeviceContext context : filesystemContexts) - { - if ((context instanceof ContentContext) && (null != context.getDeviceName()) && context.getDeviceName().equals(targetDeviceName)) - { - ContentContext targetContext = (ContentContext) context; - if (null != targetContext.getStoreName()) - { - targetStoreRef = new StoreRef(targetContext.getStoreName()); - } - break; - } - } - if (null == targetStoreRef) - { - throw new AlfrescoRuntimeException("Target Store Reference can't be found for '" + targetDeviceName - + "' device name. Check correctness of 'targetDeviceName' and 'filesystemContexts' properties configurations"); - } - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("StoreRef='" + targetStoreRef + "' was found for '" + targetDeviceName + "' device name"); - } - - policyComponent.bindAssociationBehaviour(OnCreateChildAssociationPolicy.QNAME, this, new JavaBehaviour(this, "onCreateChildAssociation")); - policyComponent.bindAssociationBehaviour(OnDeleteChildAssociationPolicy.QNAME, this, new JavaBehaviour(this, "onDeleteChildAssociation")); - policyComponent.bindClassBehaviour(OnDeleteNodePolicy.QNAME, this, new JavaBehaviour(this, "onDeleteNode")); - policyComponent.bindClassBehaviour(BeforeDeleteNodePolicy.QNAME, this, new JavaBehaviour(this, "beforeDeleteNode")); - policyComponent.bindClassBehaviour(OnUpdatePropertiesPolicy.QNAME, this, new JavaBehaviour(this, "onUpdateProperties")); - } - else - { - LOGGER.warn("NodeMonitor for NFS server is not enabled! Cache of NFS server will be never synchronized with target filesystem"); - } - } - - @Override - public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) - { - if (enabled && (null != nfsServer) && targetStoreRef.equals(nodeRef.getStoreRef())) - { - int dbId = DefaultTypeConverter.INSTANCE.intValue(nodeService.getProperty(nodeRef, ContentModel.PROP_NODE_DBID)); - if (null == findShareDetailsForId(dbId)) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Node with nodeRef='" + nodeRef + "' and dbId='" + dbId + "' is not in NFS server cache"); - } - - return; - } - cachedNodes.put(nodeRef, dbId); - - String oldName = DefaultTypeConverter.INSTANCE.convert(String.class, before.get(ContentModel.PROP_NAME)); - String newName = DefaultTypeConverter.INSTANCE.convert(String.class, after.get(ContentModel.PROP_NAME)); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("oldName='" + oldName + "', newName='" + newName + "'"); - } - - if (((null == oldName) && (null != newName)) || ((null != oldName) && !oldName.equals(newName))) - { - updateNfsCache(nodeRef, null); - } - } - } - - @Override - public void beforeDeleteNode(NodeRef nodeRef) - { - if (enabled && (null != nfsServer) && (null != nodeRef) && targetStoreRef.equals(nodeRef.getStoreRef())) - { - int dbId = DefaultTypeConverter.INSTANCE.intValue(nodeService.getProperty(nodeRef, ContentModel.PROP_NODE_DBID)); - cachedNodes.put(nodeRef, dbId); - } - } - - @Override - public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isNodeArchived) - { - updateNfsCache(childAssocRef.getChildRef(), null); - } - - @Override - public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode) - { - updateNfsCache(childAssocRef.getChildRef(), null); - } - - @Override - public void onDeleteChildAssociation(ChildAssociationRef childAssocRef) - { - updateNfsCache(childAssocRef.getChildRef(), null); - } - - /** - * Searches for {@link ShareDetails} to access NFS server cache for specific device name (e.g. 'Alfresco', etc) - * - * @param fileId - {@link Integer} value which contains fileId specific to device - * @return {@link ShareDetails} instance which contains fileId key in the cache or null if such instance was not found - */ - private ShareDetails findShareDetailsForId(int fileId) - { - if ((null == nfsServer) || (null == nfsServer.getShareDetails())) - { - return null; - } - - Hashtable details = nfsServer.getShareDetails().getShareDetails(); - for (Integer key : details.keySet()) - { - ShareDetails shareDetails = details.get(key); - if (null != shareDetails.getFileIdCache().findPath(fileId)) - { - return shareDetails; - } - } - - return null; - } - - /** - * Updates NFS cache for specified node. newPath equal to null determines that node should be deleted from the cache - * - * @param nodeRef - {@link NodeRef} value of the target node - * @param newPath - {@link String} value or null to determine new cache value for specified node - */ - private void updateNfsCache(NodeRef nodeRef, String newPath) - { - if (!enabled || nfsServer == null || !targetStoreRef.equals(nodeRef.getStoreRef())) - { - return; - } - int dbId = -1; - if (cachedNodes.containsKey(nodeRef)) - { - dbId = (null != cachedNodes.get(nodeRef)) ? (cachedNodes.get(nodeRef)) : (-1); - cachedNodes.remove(nodeRef); - } - else - { - if (nodeService.exists(nodeRef)) - { - dbId = DefaultTypeConverter.INSTANCE.intValue(nodeService.getProperty(nodeRef, ContentModel.PROP_NODE_DBID)); - } - } - - ShareDetails shareDetails = findShareDetailsForId(dbId); - if (null != shareDetails) - { - if (null != newPath) - { - shareDetails.getFileIdCache().addPath(dbId, newPath); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Path='" + newPath + "' in cache was set for NodeRef='" + nodeRef + "', dbId ='" + dbId + "'"); - } - } - else - { - shareDetails.getFileIdCache().deletePath(dbId); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Cache field for node with NodeRef='" + nodeRef + "', dbId='" + dbId + "' was removed"); - } - } - } - } - - @Override - public boolean equals(Object obj) - { - if (obj instanceof NfsServerNodeMonitor) - { - NfsServerNodeMonitor converted = (NfsServerNodeMonitor) obj; - return areEqual(targetDeviceName, converted.getTargetDeviceName()) && areEqual(targetStoreRef, converted.getTargetStoreRef()); - } - return false; - } - - private boolean areEqual(Object left, Object right) - { - return (null != left) ? (left.equals(right)) : (null == right); - } - - @Override - public int hashCode() - { - int result = (null != targetDeviceName) ? (targetDeviceName.hashCode()) : (31); - return result * 37 + ((null != targetStoreRef) ? (targetStoreRef.hashCode()) : (43)); - } -} diff --git a/source/java/org/alfresco/filesys/config/NFSConfigBean.java b/source/java/org/alfresco/filesys/config/NFSConfigBean.java deleted file mode 100644 index b63f525350..0000000000 --- a/source/java/org/alfresco/filesys/config/NFSConfigBean.java +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.filesys.config; - -import org.alfresco.jlan.oncrpc.RpcAuthenticator; - -// TODO: Auto-generated Javadoc -/** - * The Class NFSConfigBean. - * - * @author dward - */ -public class NFSConfigBean -{ - - /** The server enabled. */ - private boolean serverEnabled; - - /** The port mapper enabled. */ - private boolean portMapperEnabled; - - /** The thread pool. */ - private Integer threadPool; - - /** The packet pool. */ - private Integer packetPool; - - /** The port mapper port. */ - private Integer portMapperPort; - - /** The mount server port. */ - private Integer mountServerPort; - - /** The NFS server port. */ - private Integer NFSServerPort; - - /** The debug flags. */ - private String debugFlags; - - /** The mount server debug. */ - private boolean mountServerDebug; - - /** The port mapper debug. */ - private boolean portMapperDebug; - - /** The rpc authenticator. */ - private RpcAuthenticator rpcAuthenticator; - - /** RPC register port */ - private Integer rpcRegisterPort; - - /** - * Checks if is server enabled. - * - * @return true, if is server enabled - */ - public boolean getServerEnabled() - { - return serverEnabled; - } - - /** - * Sets the server enabled. - * - * @param serverEnabled - * the new server enabled - */ - public void setServerEnabled(boolean serverEnabled) - { - this.serverEnabled = serverEnabled; - } - - /** - * Checks if is port mapper enabled. - * - * @return true, if is port mapper enabled - */ - public boolean getPortMapperEnabled() - { - return portMapperEnabled; - } - - /** - * Sets the port mapper enabled. - * - * @param portMapperEnabled - * the new port mapper enabled - */ - public void setPortMapperEnabled(boolean portMapperEnabled) - { - this.portMapperEnabled = portMapperEnabled; - } - - /** - * Gets the thread pool. - * - * @return the thread pool - */ - public Integer getThreadPool() - { - return threadPool; - } - - /** - * Sets the thread pool. - * - * @param threadPool - * the new thread pool - */ - public void setThreadPool(Integer threadPool) - { - this.threadPool = threadPool; - } - - /** - * Gets the packet pool. - * - * @return the packet pool - */ - public Integer getPacketPool() - { - return packetPool; - } - - /** - * Sets the packet pool. - * - * @param packetPool - * the new packet pool - */ - public void setPacketPool(Integer packetPool) - { - this.packetPool = packetPool; - } - - /** - * Gets the port mapper port. - * - * @return the port mapper port - */ - public Integer getPortMapperPort() - { - return portMapperPort; - } - - /** - * Sets the port mapper port. - * - * @param portMapperPort - * the new port mapper port - */ - public void setPortMapperPort(Integer portMapperPort) - { - this.portMapperPort = portMapperPort; - } - - /** - * Gets the mount server port. - * - * @return the mount server port - */ - public Integer getMountServerPort() - { - return mountServerPort; - } - - /** - * Sets the mount server port. - * - * @param mountServerPort - * the new mount server port - */ - public void setMountServerPort(Integer mountServerPort) - { - this.mountServerPort = mountServerPort; - } - - /** - * Gets the nFS server port. - * - * @return the nFS server port - */ - public Integer getNfsServerPort() - { - return NFSServerPort; - } - - /** - * Sets the nFS server port. - * - * @param serverPort - * the new nFS server port - */ - public void setNfsServerPort(Integer serverPort) - { - NFSServerPort = serverPort; - } - - /** - * Gets the debug flags. - * - * @return the debug flags - */ - public String getDebugFlags() - { - return debugFlags; - } - - /** - * Sets the debug flags. - * - * @param debugFlags - * the new debug flags - */ - public void setDebugFlags(String debugFlags) - { - this.debugFlags = debugFlags; - } - - /** - * Checks if is mount server debug. - * - * @return true, if is mount server debug - */ - public boolean getMountServerDebug() - { - return mountServerDebug; - } - - /** - * Sets the mount server debug. - * - * @param mountServerDebug - * the new mount server debug - */ - public void setMountServerDebug(boolean mountServerDebug) - { - this.mountServerDebug = mountServerDebug; - } - - /** - * Checks if is port mapper debug. - * - * @return true, if is port mapper debug - */ - public boolean getPortMapperDebug() - { - return portMapperDebug; - } - - /** - * Sets the port mapper debug. - * - * @param portMapperDebug - * the new port mapper debug - */ - public void setPortMapperDebug(boolean portMapperDebug) - { - this.portMapperDebug = portMapperDebug; - } - - /** - * Gets the rpc authenticator. - * - * @return the rpc authenticator - */ - public RpcAuthenticator getRpcAuthenticator() - { - return rpcAuthenticator; - } - - /** - * Sets the rpc authenticator. - * - * @param rpcAuthenticator - * the new rpc authenticator - */ - public void setRpcAuthenticator(RpcAuthenticator rpcAuthenticator) - { - this.rpcAuthenticator = rpcAuthenticator; - } - - /** - * Set the RPC registration port - * - * @param rpcRegPort Integer - */ - public void setRpcRegisterPort(Integer rpcRegPort) - { - this.rpcRegisterPort = rpcRegPort; - } - - /** - * Return the RPC register port - * - * @return Integer - */ - public Integer getRpcRegisterPort() - { - return rpcRegisterPort; - } -} diff --git a/source/java/org/alfresco/filesys/config/ServerConfigurationBean.java b/source/java/org/alfresco/filesys/config/ServerConfigurationBean.java index 882260fe9a..980ea302c2 100644 --- a/source/java/org/alfresco/filesys/config/ServerConfigurationBean.java +++ b/source/java/org/alfresco/filesys/config/ServerConfigurationBean.java @@ -103,7 +103,6 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp { private CIFSConfigBean cifsConfigBean; private FTPConfigBean ftpConfigBean; - private NFSConfigBean nfsConfigBean; private List filesystemContexts; private SecurityConfigBean securityConfigBean; private CoreServerConfigBean coreServerConfigBean; @@ -139,11 +138,6 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp { this.ftpConfigBean = ftpConfigBean; } - - public void setNfsConfigBean(NFSConfigBean nfsConfigBean) - { - this.nfsConfigBean = nfsConfigBean; - } public void setFilesystemContexts(List filesystemContexts) { @@ -1560,197 +1554,6 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp } } - /** - * Process the NFS server configuration - */ - protected void processNFSServerConfig() - { - // If the configuration section is not valid then NFS is disabled - - if (nfsConfigBean == null) - { - removeConfigSection(NFSConfigSection.SectionName); - return; - } - - // Check if the server has been disabled - - if (!nfsConfigBean.getServerEnabled()) - { - removeConfigSection(NFSConfigSection.SectionName); - return; - } - - // Create the NFS configuration section - - NFSConfigSection nfsConfig = new NFSConfigSection(this); - - try - { - // Check if the port mapper is enabled - - if (nfsConfigBean.getPortMapperEnabled()) - nfsConfig.setNFSPortMapper(true); - - // Check for the thread pool size - - Integer poolSize = nfsConfigBean.getThreadPool(); - - if (poolSize != null) - { - - // Range check the pool size value - - if (poolSize < 4) - { - throw new AlfrescoRuntimeException("NFS thread pool size is below minimum of 4"); - } - // Set the thread pool size - - nfsConfig.setNFSThreadPoolSize(poolSize); - } - - // NFS packet pool size - - Integer pktPoolSize = nfsConfigBean.getPacketPool(); - - if (pktPoolSize != null) - { - // Range check the pool size value - - if (pktPoolSize < 10) - throw new AlfrescoRuntimeException("NFS packet pool size is below minimum of 10"); - - if (pktPoolSize < nfsConfig.getNFSThreadPoolSize() + 1) - throw new AlfrescoRuntimeException("NFS packet pool must be at least thread pool size plus one"); - - // Set the packet pool size - - nfsConfig.setNFSPacketPoolSize(pktPoolSize); - } - - // Check for a port mapper server port - - Integer portMapperPort = nfsConfigBean.getPortMapperPort(); - if (portMapperPort != null) - { - nfsConfig.setPortMapperPort(portMapperPort); - if ( nfsConfig.getPortMapperPort() == -1) - { - logger.info("NFS portmapper registration disabled"); - } - else - { - if (nfsConfig.getPortMapperPort() <= 0 || nfsConfig.getPortMapperPort() >= 65535) - { - throw new AlfrescoRuntimeException("NFS Port mapper server port out of valid range"); - } - } - } - - // Check for a mount server port - - Integer mountServerPort = nfsConfigBean.getMountServerPort(); - if (mountServerPort != null) - { - nfsConfig.setMountServerPort(mountServerPort); - if (nfsConfig.getMountServerPort() < 0 || nfsConfig.getMountServerPort() >= 65535) - { - throw new AlfrescoRuntimeException("NFS Mount server port out of valid range"); - } - } - - // Check for an NFS server port - - Integer nfsServerPort = nfsConfigBean.getNfsServerPort(); - if (nfsServerPort != null) - { - nfsConfig.setNFSServerPort(nfsServerPort); - if (nfsConfig.getNFSServerPort() < 0 || nfsConfig.getNFSServerPort() >= 65535) - { - throw new AlfrescoRuntimeException("NFS server port out of valid range"); - } - } - - // Check for an RPC registration port - - Integer rpcRegisterPort = nfsConfigBean.getRpcRegisterPort(); - if ( rpcRegisterPort != null) - { - nfsConfig.setRPCRegistrationPort( rpcRegisterPort); - if ( nfsConfig.getRPCRegistrationPort() < 0 || nfsConfig.getRPCRegistrationPort() >= 65535) - { - throw new AlfrescoRuntimeException("RPC registrtion port out of valid range"); - } - } - - // Check for NFS debug flags - - String flags = nfsConfigBean.getDebugFlags(); - int nfsDbg = 0; - - if (flags != null && flags.length() > 0) - { - - // Parse the flags - - flags = flags.toUpperCase(); - StringTokenizer token = new StringTokenizer(flags, ","); - - while (token.hasMoreTokens()) - { - - // Get the current debug flag token - - String dbg = token.nextToken().trim(); - - // Find the debug flag name - - int idx = 0; - - while (idx < m_nfsDebugStr.length && m_nfsDebugStr[idx].equalsIgnoreCase(dbg) == false) - idx++; - - if (idx >= m_nfsDebugStr.length) - throw new AlfrescoRuntimeException("Invalid NFS debug flag, " + dbg); - - // Set the debug flag - - nfsDbg += 1 << idx; - } - - // Set the NFS debug flags - - nfsConfig.setNFSDebug(nfsDbg); - } - - // Check if mount server debug output is enabled - - if (nfsConfigBean.getMountServerDebug()) - nfsConfig.setMountServerDebug(true); - - // Check if portmapper debug output is enabled - - if (nfsConfigBean.getPortMapperDebug()) - nfsConfig.setPortMapperDebug(true); - - // Create the RPC authenticator - RpcAuthenticator rpcAuthenticator = nfsConfigBean.getRpcAuthenticator(); - if (rpcAuthenticator != null) - { - nfsConfig.setRpcAuthenticator(rpcAuthenticator); - } - else - { - throw new AlfrescoRuntimeException("RPC authenticator configuration missing, require user mappings"); - } - } - catch (InvalidConfigurationException ex) - { - throw new AlfrescoRuntimeException(ex.getMessage()); - } - } - /** * Process the filesystems configuration */