Config newConfig = targetUtil.getConfig(target);
if (newConfig!=null) {
config = newConfig;
}
final ActionReport report = context.getActionReport();
NetworkConfig networkConfig = config.getNetworkConfig();
NetworkListeners nls = networkConfig.getNetworkListeners();
// ensure we don't have one of this name already
for (NetworkListener networkListener : nls.getNetworkListener()) {
if (networkListener.getName().equals(listenerName)) {
report.setMessage(localStrings.getLocalString(
"create.network.listener.fail.duplicate",
"Network Listener named {0} already exists.",
listenerName));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
}
}
if (!verifyUniquePort(networkConfig)) {
report.setMessage(localStrings.getLocalString("port.in.use",
"Port [{0}] is already taken for address [{1}], please choose another port.", port, address));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
}
Protocol prot = networkConfig.findProtocol(protocol);
if (prot == null) {
report.setMessage(localStrings.getLocalString("create.http.fail.protocolnotfound",
"The specified protocol {0} is not yet configured", protocol));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return;