use of org.jboss.as.webservices.config.ServerConfigImpl in project wildfly by wildfly.
the class WSModelDeploymentProcessor method internalDeploy.
@Override
public void internalDeploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit unit = phaseContext.getDeploymentUnit();
WSDeploymentBuilder.getInstance().build(unit);
if (isWebServiceDeployment(unit)) {
//note, this check works only after the WSDeploymentBuilder above has run
ServerConfigImpl config = (ServerConfigImpl) phaseContext.getServiceRegistry().getRequiredService(WSServices.CONFIG_SERVICE).getValue();
config.incrementWSDeploymentCount();
}
}
use of org.jboss.as.webservices.config.ServerConfigImpl in project wildfly by wildfly.
the class WSSubsystemAdd method createServerConfig.
private static ServerConfigImpl createServerConfig(ModelNode configuration, boolean appclient, OperationContext context) throws OperationFailedException {
final ServerConfigImpl config = ServerConfigImpl.newInstance();
try {
ModelNode wsdlHost = Attributes.WSDL_HOST.resolveModelAttribute(context, configuration);
config.setWebServiceHost(wsdlHost.isDefined() ? wsdlHost.asString() : null);
} catch (UnknownHostException e) {
throw new RuntimeException(e);
}
if (!appclient) {
config.setModifySOAPAddress(Attributes.MODIFY_WSDL_ADDRESS.resolveModelAttribute(context, configuration).asBoolean());
config.setStatisticsEnabled(Attributes.STATISTICS_ENABLED.resolveModelAttribute(context, configuration).asBoolean());
}
if (configuration.hasDefined(WSDL_PORT)) {
config.setWebServicePort(Attributes.WSDL_PORT.resolveModelAttribute(context, configuration).asInt());
}
if (configuration.hasDefined(WSDL_SECURE_PORT)) {
config.setWebServiceSecurePort(Attributes.WSDL_SECURE_PORT.resolveModelAttribute(context, configuration).asInt());
}
if (configuration.hasDefined(WSDL_URI_SCHEME)) {
config.setWebServiceUriScheme(Attributes.WSDL_URI_SCHEME.resolveModelAttribute(context, configuration).asString());
}
if (configuration.hasDefined(WSDL_PATH_REWRITE_RULE)) {
config.setWebServicePathRewriteRule(Attributes.WSDL_PATH_REWRITE_RULE.resolveModelAttribute(context, configuration).asString());
}
return config;
}
use of org.jboss.as.webservices.config.ServerConfigImpl 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;
}
use of org.jboss.as.webservices.config.ServerConfigImpl in project wildfly by wildfly.
the class WSModelDeploymentProcessor method internalUndeploy.
@Override
public void internalUndeploy(final org.jboss.as.server.deployment.DeploymentUnit context) {
if (isWebServiceDeployment(context)) {
ServerConfigImpl config = (ServerConfigImpl) context.getServiceRegistry().getRequiredService(WSServices.CONFIG_SERVICE).getValue();
config.decrementWSDeploymentCount();
}
}
use of org.jboss.as.webservices.config.ServerConfigImpl in project wildfly by wildfly.
the class WSSubsystemAdd method performBoottime.
protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
WSLogger.ROOT_LOGGER.activatingWebservicesExtension();
ModuleClassLoaderProvider.register();
final boolean appclient = context.getProcessType() == ProcessType.APPLICATION_CLIENT;
context.addStep(new AbstractDeploymentChainStep() {
protected void execute(DeploymentProcessorTarget processorTarget) {
// add the DUP for dealing with WS deployments
WSDeploymentActivator.activate(processorTarget, appclient);
}
}, OperationContext.Stage.RUNTIME);
ServiceTarget serviceTarget = context.getServiceTarget();
final boolean jmxAvailable = isJMXSubsystemAvailable(context);
if (appclient && model.hasDefined(WSDL_HOST)) {
ServerConfigImpl serverConfig = createServerConfig(model, true, context);
ServerConfigService.install(serviceTarget, serverConfig, getServerConfigDependencies(context, appclient), jmxAvailable, false);
}
if (!appclient) {
ServerConfigImpl serverConfig = createServerConfig(model, false, context);
ServerConfigService.install(serviceTarget, serverConfig, getServerConfigDependencies(context, appclient), jmxAvailable, true);
}
XTSClientIntegrationService.install(serviceTarget);
}
Aggregations