From 366cdfdc86e8bf35cae265ac6f601bbfd34018d1 Mon Sep 17 00:00:00 2001 From: Gary Spencer Date: Fri, 12 Jan 2007 17:44:09 +0000 Subject: [PATCH] Added tag for CIFS, FTP and NFS server enable/disable. Removed tags as they only worked one way. Added NFS server bean wiring to bootstrap. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4813 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/bootstrap-context.xml | 8 +++ .../server/config/ServerConfiguration.java | 66 +++++++++++++++---- 2 files changed, 63 insertions(+), 11 deletions(-) diff --git a/config/alfresco/bootstrap-context.xml b/config/alfresco/bootstrap-context.xml index 1fe3ac8dfc..ace0c2dc91 100644 --- a/config/alfresco/bootstrap-context.xml +++ b/config/alfresco/bootstrap-context.xml @@ -284,6 +284,14 @@ + + + + + + + + diff --git a/source/java/org/alfresco/filesys/server/config/ServerConfiguration.java b/source/java/org/alfresco/filesys/server/config/ServerConfiguration.java index ea54f9e379..f1a82dcc09 100644 --- a/source/java/org/alfresco/filesys/server/config/ServerConfiguration.java +++ b/source/java/org/alfresco/filesys/server/config/ServerConfiguration.java @@ -628,7 +628,7 @@ public class ServerConfiguration extends AbstractLifecycleBean // Log the successful startup - logger.info("CIFS server started"); + logger.info("CIFS server " + (isSMBServerEnabled() ? "" : "NOT ") + "started"); } catch (UnsatisfiedLinkError ex) { @@ -670,7 +670,7 @@ public class ServerConfiguration extends AbstractLifecycleBean // Log the successful startup - logger.info("FTP server started"); + logger.info("FTP server " + (isFTPServerEnabled() ? "" : "NOT ") + "started"); } catch (Exception ex) { @@ -690,7 +690,7 @@ public class ServerConfiguration extends AbstractLifecycleBean // Log the successful startup - logger.info("NFS server started"); + logger.info("NFS server " + (isNFSServerEnabled() ? "" : "NOT ") + "started"); } catch (Exception ex) { @@ -745,19 +745,33 @@ public class ServerConfiguration extends AbstractLifecycleBean { // If the configuration section is not valid then CIFS is disabled - if ( config == null || config.getConfigElements().isEmpty() || - config.getConfigElement( "disableCIFS") != null) + if ( config == null) { setSMBServerEnabled(false); return; } + // Check if the server has been disabled + + ConfigElement elem = config.getConfigElement( "serverEnable"); + if ( elem != null) + { + // Check for the enabled attribute + + String srvEnable = elem.getAttribute( "enabled"); + if ( srvEnable != null && srvEnable.equalsIgnoreCase( "false")) + { + setSMBServerEnabled(false); + return; + } + } + // Get the network broadcast address // // Note: We need to set this first as the call to getLocalDomainName() may use a NetBIOS // name lookup, so the broadcast mask must be set before then. - ConfigElement elem = config.getConfigElement("broadcast"); + elem = config.getConfigElement("broadcast"); if (elem != null) { @@ -1513,15 +1527,30 @@ public class ServerConfiguration extends AbstractLifecycleBean { // If the configuration section is not valid then FTP is disabled - if ( config == null || config.getConfigElement( "disableFTP") != null) + if ( config == null) { setFTPServerEnabled(false); return; } + // Check if the server has been disabled + + ConfigElement elem = config.getConfigElement( "serverEnable"); + if ( elem != null) + { + // Check for the enabled attribute + + String srvEnable = elem.getAttribute( "enabled"); + if ( srvEnable != null && srvEnable.equalsIgnoreCase( "false")) + { + setFTPServerEnabled(false); + return; + } + } + // Check for a bind address - ConfigElement elem = config.getConfigElement("bindto"); + elem = config.getConfigElement("bindto"); if ( elem != null) { // Validate the bind address @@ -1703,20 +1732,35 @@ public class ServerConfiguration extends AbstractLifecycleBean { // If the configuration section is not valid then NFS is disabled - if ( config == null || config.getConfigElement( "disableNFS") != null) + if ( config == null) { setNFSServerEnabled(false); return; } - // Check if the port mapper is enabled + // Check if the server has been disabled + + ConfigElement elem = config.getConfigElement( "serverEnable"); + if ( elem != null) + { + // Check for the enabled attribute + + String srvEnable = elem.getAttribute( "enabled"); + if ( srvEnable != null && srvEnable.equalsIgnoreCase( "false")) + { + setNFSServerEnabled(false); + return; + } + } + + // Check if the port mapper is enabled if ( config.getConfigElement("enablePortMapper") != null) m_nfsPortMapper = true; // Check for the thread pool size - ConfigElement elem = config.getConfigElement("ThreadPool"); + elem = config.getConfigElement("ThreadPool"); if ( elem != null) {