Merged V3.2 to HEAD

15837: ETHREEOH-2701: Do not allow partial initialization of file server configuration bean
      - Even when all of the file servers are disabled, this bean must be queryable by the rest of the system
      - Therefore if it fails to initialize, the server should fail to start
      - Fatal exceptions now propagated by AbstractServerConfigurationBean.init()


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@15839 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2009-08-20 14:58:10 +00:00
parent 33cb2a4d75
commit a96352a781

View File

@@ -432,8 +432,6 @@ public abstract class AbstractServerConfigurationBean extends ServerConfiguratio
// Initialize the filesystems // Initialize the filesystems
boolean filesysInitOK = false;
try try
{ {
// Process the core server configuration // Process the core server configuration
@@ -444,94 +442,81 @@ public abstract class AbstractServerConfigurationBean extends ServerConfiguratio
// Process the filesystems configuration // Process the filesystems configuration
processFilesystemsConfig(); processFilesystemsConfig();
}
catch (Exception ex)
{
// Configuration error
throw new AlfrescoRuntimeException("File server configuration error, " + ex.getMessage(), ex);
}
// Indicate that the filesystems were initialized // Initialize the CIFS and FTP servers, if the filesystem(s) initialized successfully
filesysInitOK = true;
// Initialize the CIFS server
try
{
// Process the CIFS server configuration
processCIFSServerConfig();
// Log the successful startup
logger.info("CIFS server " + (isSMBServerEnabled() ? "" : "NOT ") + "started");
}
catch (UnsatisfiedLinkError ex)
{
// Error accessing the Win32NetBIOS DLL code
logger.error("Error accessing Win32 NetBIOS, check DLL is on the path");
// Disable the CIFS server
removeConfigSection( CIFSConfigSection.SectionName);
}
catch (Throwable ex)
{
// Configuration error
logger.error("CIFS server configuration error, " + ex.getMessage(), ex);
// Disable the CIFS server
removeConfigSection( CIFSConfigSection.SectionName);
}
// Initialize the FTP server
try
{
// Process the FTP server configuration
processFTPServerConfig();
// Log the successful startup
logger.info("FTP server " + (isFTPServerEnabled() ? "" : "NOT ") + "started");
} }
catch (Exception ex) catch (Exception ex)
{ {
// Configuration error // Configuration error
logger.error("File server configuration error, " + ex.getMessage(), ex); logger.error("FTP server configuration error, " + ex.getMessage(), ex);
} }
// Initialize the CIFS and FTP servers, if the filesystem(s) initialized successfully // Initialize the NFS server
if ( filesysInitOK == true) try
{ {
// Initialize the CIFS server // Process the NFS server configuration
processNFSServerConfig();
try // Log the successful startup
{
// Process the CIFS server configuration logger.info("NFS server " + (isNFSServerEnabled() ? "" : "NOT ") + "started");
processCIFSServerConfig(); }
catch (Exception ex)
// Log the successful startup
logger.info("CIFS server " + (isSMBServerEnabled() ? "" : "NOT ") + "started");
}
catch (UnsatisfiedLinkError ex)
{
// Error accessing the Win32NetBIOS DLL code
logger.error("Error accessing Win32 NetBIOS, check DLL is on the path");
// Disable the CIFS server
removeConfigSection( CIFSConfigSection.SectionName);
}
catch (Throwable ex)
{
// Configuration error
logger.error("CIFS server configuration error, " + ex.getMessage(), ex);
// Disable the CIFS server
removeConfigSection( CIFSConfigSection.SectionName);
}
// Initialize the FTP server
try
{
// Process the FTP server configuration
processFTPServerConfig();
// Log the successful startup
logger.info("FTP server " + (isFTPServerEnabled() ? "" : "NOT ") + "started");
}
catch (Exception ex)
{
// Configuration error
logger.error("FTP server configuration error, " + ex.getMessage(), ex);
}
// Initialize the NFS server
try
{
// Process the NFS server configuration
processNFSServerConfig();
// Log the successful startup
logger.info("NFS server " + (isNFSServerEnabled() ? "" : "NOT ") + "started");
}
catch (Exception ex)
{
// Configuration error
logger.error("NFS server configuration error, " + ex.getMessage(), ex);
}
}
else
{ {
// Log the error // Configuration error
logger.error("CIFS and FTP servers not started due to filesystem initialization error"); logger.error("NFS server configuration error, " + ex.getMessage(), ex);
} }
} }