throw new IllegalArgumentException("No services");
}
Iterator<ServiceMetaData> serviceMetaDatas = serverMetaData.getServices().iterator();
if (serviceMetaDatas.hasNext())
{
ServiceMetaData serviceMetaData = serviceMetaDatas.next();
org.apache.catalina.Service service =
(org.apache.catalina.Service) getInstance(serviceMetaData, "org.apache.catalina.core.StandardService");
addLifecycleListeners(service, serviceMetaData.getListeners());
service.setName(serviceMetaData.getName());
service.setServer(catalinaServer);
catalinaServer.addService(service);
// Integrate support for on-demand contexts
onDemandContextIntegrator.registerMapper(service.getName(), service.getMapper());
// Server/Service/Executor
// Executor is useless in JBoss: the Executor will get injected in the executor field
// and used directly
// Server/Service/Connector
if (serviceMetaData.getConnectors() != null)
{
Iterator<ConnectorMetaData> connectorMetaDatas = serviceMetaData.getConnectors().iterator();
while (connectorMetaDatas.hasNext())
{
ConnectorMetaData connectorMetaData = connectorMetaDatas.next();
Connector connector = new Connector(connectorMetaData.getProtocol());
if (connectorMetaData.getAttributes() != null)
{
Iterator<QName> names = connectorMetaData.getAttributes().keySet().iterator();
while (names.hasNext())
{
QName name = names.next();
String value = (String) connectorMetaData.getAttributes().get(name);
// FIXME: This should be done by XB
value = StringPropertyReplacer.replaceProperties(value);
IntrospectionUtils.setProperty(connector, name.getLocalPart(), value);
}
}
if (executor != null)
{
IntrospectionUtils.callMethod1(connector.getProtocolHandler(), "setExecutor",
executor, java.util.concurrent.Executor.class.getName(), getClass().getClassLoader());
}
service.addConnector(connector);
}
}
// Server/Service/Engine
EngineMetaData engineMetaData = serviceMetaData.getEngine();
org.apache.catalina.Engine engine =
(org.apache.catalina.Engine) getInstance(engineMetaData, "org.apache.catalina.core.StandardEngine");
addLifecycleListeners(engine, engineMetaData.getListeners());
engine.setName(engineMetaData.getName());
// FIXME: This should be done by XB