Fix AR-431, AR-432.

Modified the Repository bootstrap mechanism so it's performed after all other initialisation and the order of bootstrap is explicit.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2414 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2006-02-16 15:11:53 +00:00
parent 6fac677245
commit 6cb16abef4
14 changed files with 388 additions and 189 deletions

View File

@@ -29,6 +29,9 @@ import org.alfresco.filesys.smb.server.SMBServer;
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.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
@@ -38,7 +41,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
*
* @author GKSpencer
*/
public class CIFSServer
public class CIFSServer implements ApplicationListener
{
private static final Log logger = LogFactory.getLog("org.alfresco.smb.server");
@@ -78,6 +81,29 @@ public class CIFSServer
return (filesysConfig != null && filesysConfig.isSMBServerEnabled());
}
/*
* (non-Javadoc)
* @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
*/
public void onApplicationEvent(ApplicationEvent event)
{
if (event instanceof ContextRefreshedEvent)
{
try
{
startServer();
}
catch (SocketException e)
{
throw new AlfrescoRuntimeException("Failed to start CIFS server", e);
}
catch (IOException e)
{
throw new AlfrescoRuntimeException("Failed to start CIFS server", e);
}
}
}
/**
* Start the CIFS server components
*
@@ -237,4 +263,6 @@ public class CIFSServer
}
System.exit(1);
}
}

View File

@@ -27,6 +27,9 @@ import org.alfresco.filesys.server.config.ServerConfiguration;
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.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
@@ -36,7 +39,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
*
* @author GKSpencer
*/
public class FTPServer
public class FTPServer implements ApplicationListener
{
private static final Log logger = LogFactory.getLog("org.alfresco.ftp.server");
@@ -76,6 +79,29 @@ public class FTPServer
return (filesysConfig != null && filesysConfig.isFTPServerEnabled());
}
/*
* (non-Javadoc)
* @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
*/
public void onApplicationEvent(ApplicationEvent event)
{
if (event instanceof ContextRefreshedEvent)
{
try
{
startServer();
}
catch (SocketException e)
{
throw new AlfrescoRuntimeException("Failed to start FTP server", e);
}
catch (IOException e)
{
throw new AlfrescoRuntimeException("Failed to start FTP server", e);
}
}
}
/**
* Start the FTP server components
*

View File

@@ -20,6 +20,7 @@ import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.security.Provider;
import java.security.Security;
@@ -78,6 +79,9 @@ import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.transaction.TransactionService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
/**
* <p>
@@ -85,7 +89,7 @@ import org.apache.commons.logging.LogFactory;
*
* @author Gary K. Spencer
*/
public class ServerConfiguration
public class ServerConfiguration implements ApplicationListener
{
// Debug logging
@@ -407,6 +411,18 @@ public class ServerConfiguration
return initialised;
}
/*
* (non-Javadoc)
* @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
*/
public void onApplicationEvent(ApplicationEvent event)
{
if (event instanceof ContextRefreshedEvent)
{
init();
}
}
/**
* Initialize the configuration using the configuration service
*/