}
}
private VirtualHostConfiguration createVirtualHostConfiguration(String virtualHostName) throws ConfigurationException
{
VirtualHostConfiguration configuration;
String configurationFile = (String)getAttribute(CONFIG_PATH);
if (configurationFile == null)
{
final MyConfiguration basicConfiguration = new MyConfiguration();
PropertiesConfiguration config = new PropertiesConfiguration();
final String type = (String) getAttribute(TYPE);
config.addProperty("type", type);
VirtualHostFactory factory = VirtualHostFactory.FACTORIES.get(type);
if(factory != null)
{
for(Map.Entry<String,Object> entry : factory.createVirtualHostConfiguration(this).entrySet())
{
config.addProperty(entry.getKey(), entry.getValue());
}
}
basicConfiguration.addConfiguration(config);
CompositeConfiguration compositeConfiguration = new CompositeConfiguration();
compositeConfiguration.addConfiguration(new SystemConfiguration());
compositeConfiguration.addConfiguration(basicConfiguration);
configuration = new VirtualHostConfiguration(virtualHostName, compositeConfiguration , _broker);
}
else
{
if (!new File(configurationFile).exists())
{
throw new IllegalConfigurationException("Configuration file '" + configurationFile + "' does not exist");
}
configuration = new VirtualHostConfiguration(virtualHostName, new File(configurationFile) , _broker);
String type = configuration.getType();
changeAttribute(TYPE,null,type);
VirtualHostFactory factory = VirtualHostFactory.FACTORIES.get(type);
if(factory != null)
{
for(Map.Entry<String,Object> entry : factory.convertVirtualHostConfiguration(configuration.getConfig()).entrySet())
{
changeAttribute(entry.getKey(), getAttribute(entry.getKey()), entry.getValue());
}
}