Search in sources :

Example 1 with ServerConfigImpl

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();
    }
}
Also used : ServerConfigImpl(org.jboss.as.webservices.config.ServerConfigImpl) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 2 with ServerConfigImpl

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;
}
Also used : UnknownHostException(java.net.UnknownHostException) ServerConfigImpl(org.jboss.as.webservices.config.ServerConfigImpl) ModelNode(org.jboss.dmr.ModelNode)

Example 3 with ServerConfigImpl

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;
}
Also used : UnknownHostException(java.net.UnknownHostException) OperationFailedException(org.jboss.as.controller.OperationFailedException) ServerConfigImpl(org.jboss.as.webservices.config.ServerConfigImpl) DisabledOperationException(org.jboss.as.webservices.config.DisabledOperationException)

Example 4 with ServerConfigImpl

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();
    }
}
Also used : ServerConfigImpl(org.jboss.as.webservices.config.ServerConfigImpl)

Example 5 with ServerConfigImpl

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);
}
Also used : DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) ServiceTarget(org.jboss.msc.service.ServiceTarget) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) ServerConfigImpl(org.jboss.as.webservices.config.ServerConfigImpl)

Aggregations

ServerConfigImpl (org.jboss.as.webservices.config.ServerConfigImpl)6 UnknownHostException (java.net.UnknownHostException)2 OperationFailedException (org.jboss.as.controller.OperationFailedException)1 AbstractDeploymentChainStep (org.jboss.as.server.AbstractDeploymentChainStep)1 DeploymentProcessorTarget (org.jboss.as.server.DeploymentProcessorTarget)1 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)1 DisabledOperationException (org.jboss.as.webservices.config.DisabledOperationException)1 ModelNode (org.jboss.dmr.ModelNode)1 ServiceTarget (org.jboss.msc.service.ServiceTarget)1 ClientConfig (org.jboss.wsf.spi.metadata.config.ClientConfig)1