if( m_installations.containsKey( name ) )
{
final String message =
REZ.getString( "deploy.already-deployed.error",
name );
throw new DeploymentException( message );
}
Installation installation = null;
boolean success = false;
try
{
//m_baseWorkDirectory
installation = m_installer.install( name, location );
final Configuration config = getConfigurationFor( installation.getConfig() );
final Configuration environment = getConfigurationFor( installation.getEnvironment() );
final Configuration assembly = getConfigurationFor( installation.getAssembly() );
final File directory = installation.getDirectory();
final ClassLoader classLoader =
m_classLoaderManager.createClassLoader( environment,
installation.getSource(),
installation.getDirectory(),
installation.getWorkDirectory(),
installation.getClassPath() );
//assemble all the blocks for application
final SarMetaData metaData =
m_assembler.assembleSar( name, assembly, directory, classLoader );
storeConfigurationSchemas( metaData, classLoader );
verify( metaData, classLoader );
//Setup configuration for all the applications blocks
setupConfiguration( metaData, config.getChildren() );
final Configuration logs = environment.getChild( "logs" );
final Logger logger =
m_logManager.createHierarchy( metaData, logs, classLoader );
//Finally add application to kernel
m_kernel.addApplication( metaData, classLoader, logger, environment );
m_installations.put( metaData.getName(), installation );
final String message =
REZ.getString( "deploy.notice.sar.add",
metaData.getName(),
Arrays.asList( installation.getClassPath() ) );
getLogger().debug( message );
success = true;
}
catch( final DeploymentException de )
{
throw de;
}
catch( final AssemblyException ae )
{
throw new DeploymentException( ae.getMessage(), ae );
}
catch( final Exception e )
{
//From classloaderManager/kernel
throw new DeploymentException( e.getMessage(), e );
}
finally
{
if( !success && null != installation )
{