Fix AR-1464: Locale is carried into and out of the Content stack.

ApplicationContextHelper now gives out a singleton ApplicationContext and includes a 'closeApplicationContext' method.
Pulled all "org.alfresco.repo.content/**Test" classes into a single test suite.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5722 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-05-18 14:26:08 +00:00
parent 7649017ac0
commit e3223d97fb
24 changed files with 288 additions and 143 deletions

View File

@@ -35,17 +35,40 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
*/
public class ApplicationContextHelper
{
private static ClassPathXmlApplicationContext instance;
/** location of required configuration files */
public static final String[] CONFIG_LOCATIONS = new String[] { "classpath:alfresco/application-context.xml" };
/**
* Instantiates a new application context.
* Provides a static, single instance of the application context. This method can be
* called repeatedly.
*
* @return Returns a new application context
*/
public static ApplicationContext getApplicationContext()
public synchronized static ApplicationContext getApplicationContext()
{
return new ClassPathXmlApplicationContext(CONFIG_LOCATIONS);
if (instance != null)
{
return instance;
}
instance = new ClassPathXmlApplicationContext(CONFIG_LOCATIONS);
return instance;
}
/**
* Closes and releases the application context. On the next call to
* {@link #getApplicationContext()}, a new context will be given.
*/
public synchronized void closeApplicationContext()
{
if (instance == null)
{
// Nothing to do
return;
}
instance.close();
instance = null;
}
public static void main(String ... args)