}
public void export(Logger logger, String applicationRootPath, String categories, String filterPropertiesFileName, Properties initProperties, String exportFile, String exportName) throws SerializerException
{
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
SpringComponentManager scm = null;
try
{
JetspeedBeanDefinitionFilter filter = null;
if (filterPropertiesFileName != null)
{
filter = new JetspeedBeanDefinitionFilter("file:"+filterPropertiesFileName, categories);
}
else
{
filter = new JetspeedBeanDefinitionFilter(categories);
}
String assemblyRootPath = "file:"+applicationRootPath+"/WEB-INF/assembly";
String[] bootConfig = {assemblyRootPath+"/boot/*.xml"};
String[] appConfig = { assemblyRootPath+"/*.xml", assemblyRootPath+"/override/*.xml" };
ClassLoader extendedClassLoader = contextClassLoader;
File webInfClasses = new File(applicationRootPath, "WEB-INF/classes");
if (webInfClasses.exists())
{
extendedClassLoader = new URLClassLoader(new URL[]{webInfClasses.toURL()}, contextClassLoader);
}
Thread.currentThread().setContextClassLoader(extendedClassLoader);
scm = new SpringComponentManager(filter, bootConfig, appConfig, applicationRootPath, true);
scm.start();
Configuration config = (Configuration)scm.getComponent("portal_configuration");
if (config != null)
{
new JetspeedActions(config.getStringArray(PortalConfigurationConstants.SUPPORTED_PORTLET_MODES), config.getStringArray(PortalConfigurationConstants.SUPPORTED_WINDOW_STATES));
}
JetspeedSerializer serializer = (JetspeedSerializer)scm.getComponent(JetspeedSerializer.class.getName());
HashMap settings = new HashMap();
settings.put(JetspeedSerializer.KEY_LOGGER, logger);
if (exportFile != null)
{
if (exportName == null)
{
exportName = JetspeedSerializer.DEFAULT_TAG_SNAPSHOT_NAME;
}
serializer.exportData(exportName, exportFile, settings);
}
scm.stop();
}
catch (Exception e)
{
if (e instanceof SerializerException)
{
throw (SerializerException)e;
}
logger.error(e.getMessage(),e);
throw new SerializerException(SerializerException.EXPORT_ERROR.create(e.getMessage()));
}
finally
{
Thread.currentThread().setContextClassLoader(contextClassLoader);
if (scm != null)
{
scm.stop();
}
}
}