ConfigSupport.apply(new SingleConfigCode<HttpService>() {
public Object run(HttpService param) throws PropertyVetoException, TransactionFailure {
String docroot = "${com.sun.aas.instanceRoot}/docroot"; // default
String accessLog = "${com.sun.aas.instanceRoot}/logs/access"; // default
VirtualServer newVirtualServer = param.createChild(VirtualServer.class);
newVirtualServer.setId(virtualServerId);
newVirtualServer.setHosts(hosts);
newVirtualServer.setNetworkListeners(networkListeners);
newVirtualServer.setDefaultWebModule(defaultWebModule);
newVirtualServer.setState(state);
newVirtualServer.setLogFile(logFile);
// 1. add properties
// 2. check if the access-log and docroot properties have
// been specified. We will use with default
// values if the properties have not been specified.
if (properties != null) {
for (Map.Entry entry : properties.entrySet()) {
String pn = (String) entry.getKey();
String pv = (String)entry.getValue();
if ("docroot".equals(pn)) {
docroot = pv;
} else if ("accesslog".equals(pn)) {
accessLog = pv;
} else {
Property property = newVirtualServer.createChild(Property.class);
property.setName(pn);
property.setValue(pv);
newVirtualServer.getProperty().add(property);
}
}
}
newVirtualServer.setDocroot(docroot);
newVirtualServer.setAccessLog(accessLog);
param.getVirtualServer().add(newVirtualServer);
return newVirtualServer;
}
}, httpService);