use of org.jboss.as.webservices.config.DisabledOperationException in project wildfly by wildfly.
the class WSServerConfigAttributeHandler method updateServerConfig.
/**
* Returns true if the update operation succeeds in modifying the runtime, false otherwise.
*
* @param context
* @param attributeName
* @param value
* @return
* @throws OperationFailedException
* @throws DisabledOperationException
*/
private boolean updateServerConfig(OperationContext context, String attributeName, String value, boolean isRevert) throws OperationFailedException, DisabledOperationException {
ServerConfigImpl config = (ServerConfigImpl) context.getServiceRegistry(false).getRequiredService(WSServices.CONFIG_SERVICE).getValue();
try {
if (MODIFY_WSDL_ADDRESS.equals(attributeName)) {
final boolean modifyWSDLAddress = value != null && Boolean.parseBoolean(value);
config.setModifySOAPAddress(modifyWSDLAddress, isRevert);
} else if (WSDL_HOST.equals(attributeName)) {
final String host = value != null ? value : null;
try {
config.setWebServiceHost(host, isRevert);
} catch (final UnknownHostException e) {
throw new OperationFailedException(e.getMessage(), e);
}
} else if (WSDL_PORT.equals(attributeName)) {
final int port = value != null ? Integer.parseInt(value) : -1;
config.setWebServicePort(port, isRevert);
} else if (WSDL_SECURE_PORT.equals(attributeName)) {
final int securePort = value != null ? Integer.parseInt(value) : -1;
config.setWebServiceSecurePort(securePort, isRevert);
} else if (WSDL_PATH_REWRITE_RULE.equals(attributeName)) {
final String path = value != null ? value : null;
config.setWebServicePathRewriteRule(path, isRevert);
} else if (WSDL_URI_SCHEME.equals(attributeName)) {
if (value == null || value.equals("http") || value.equals("https")) {
config.setWebServiceUriScheme(value, isRevert);
} else {
throw new IllegalArgumentException(attributeName + " = " + value);
}
} else if (STATISTICS_ENABLED.equals(attributeName)) {
final boolean enabled = value != null ? Boolean.parseBoolean(value) : false;
config.setStatisticsEnabled(enabled);
} else {
throw new IllegalArgumentException(attributeName);
}
} catch (DisabledOperationException doe) {
// the WS stack rejected the runtime update
if (!isRevert) {
return false;
} else {
throw doe;
}
}
return true;
}
Aggregations