Search in sources :

Example 51 with ServiceName

use of org.jboss.msc.service.ServiceName in project wildfly by wildfly.

the class WSIntegrationProcessorJAXWS_HANDLER method propagateNamingContext.

private static void propagateNamingContext(final ComponentDescription jaxwsHandlerDescription, final EJBEndpoint ejbEndpoint) {
    final ServiceName ejbContextServiceName = ejbEndpoint.getContextServiceName();
    final DeploymentDescriptorEnvironment ejbEnv = ejbEndpoint.getDeploymentDescriptorEnvironment();
    // configure JAXWS EJB3 handler to be able to see EJB3 environment
    jaxwsHandlerDescription.setContextServiceName(ejbContextServiceName);
    jaxwsHandlerDescription.setDeploymentDescriptorEnvironment(ejbEnv);
    jaxwsHandlerDescription.addDependency(ejbContextServiceName, ServiceBuilder.DependencyType.REQUIRED);
}
Also used : ServiceName(org.jboss.msc.service.ServiceName) DeploymentDescriptorEnvironment(org.jboss.as.ee.component.DeploymentDescriptorEnvironment)

Example 52 with ServiceName

use of org.jboss.msc.service.ServiceName in project wildfly by wildfly.

the class DeploymentModelBuilderJAXWS_POJO method build.

@Override
protected void build(final Deployment dep, final DeploymentUnit unit) {
    WSLogger.ROOT_LOGGER.trace("Creating JAXWS POJO endpoints meta data model");
    WSEndpointConfigMapping ecm = unit.getAttachment(WSAttachmentKeys.WS_ENDPOINT_CONFIG_MAPPING_KEY);
    for (final POJOEndpoint pojoEndpoint : getJaxwsPojos(unit)) {
        final String pojoEndpointName = pojoEndpoint.getName();
        WSLogger.ROOT_LOGGER.tracef("POJO name: %s", pojoEndpointName);
        final String pojoEndpointClassName = pojoEndpoint.getClassName();
        WSLogger.ROOT_LOGGER.tracef("POJO class: %s", pojoEndpointClassName);
        final Endpoint ep = newHttpEndpoint(pojoEndpointClassName, pojoEndpointName, dep);
        final ServiceName componentViewName = pojoEndpoint.getComponentViewName();
        if (componentViewName != null) {
            ep.setProperty(COMPONENT_VIEW_NAME, componentViewName);
        }
        if (ecm != null) {
            ep.setEndpointConfig(ecm.getConfig(pojoEndpointClassName));
        }
    }
}
Also used : POJOEndpoint(org.jboss.as.webservices.metadata.model.POJOEndpoint) Endpoint(org.jboss.wsf.spi.deployment.Endpoint) ServiceName(org.jboss.msc.service.ServiceName) POJOEndpoint(org.jboss.as.webservices.metadata.model.POJOEndpoint) WSEndpointConfigMapping(org.jboss.as.webservices.deployers.WSEndpointConfigMapping)

Example 53 with ServiceName

use of org.jboss.msc.service.ServiceName in project wildfly by wildfly.

the class EndpointConfigAdd method performRuntime.

@Override
protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException {
    //modify the runtime if we're booting, otherwise set reload required and leave the runtime unchanged
    if (context.isBooting()) {
        final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
        final String name = address.getLastElement().getValue();
        //get the server config object from the ServerConfigService (service installed but not started yet, but the object is fine for our needs here)
        final ServerConfig serverConfig = ASHelper.getMSCService(WSServices.CONFIG_SERVICE, ServerConfig.class, context);
        if (serverConfig == null) {
            throw WSLogger.ROOT_LOGGER.serviceNotAvailable(WSServices.CONFIG_SERVICE.getCanonicalName());
        }
        final ServiceName serviceName = getEndpointConfigServiceName(name);
        final ConfigService endpointConfigService = new ConfigService(serverConfig, name, false);
        final ServiceTarget target = context.getServiceTarget();
        final ServiceBuilder<?> serviceBuilder = target.addService(serviceName, endpointConfigService);
        for (ServiceName sn : PackageUtils.getServiceNameDependencies(context, serviceName, address, Constants.PROPERTY)) {
            //get a new injector instance each time
            serviceBuilder.addDependency(sn, PropertyService.class, endpointConfigService.getPropertiesInjector());
        }
        for (ServiceName sn : PackageUtils.getServiceNameDependencies(context, serviceName, address, Constants.PRE_HANDLER_CHAIN)) {
            //get a new injector instance each time
            serviceBuilder.addDependency(sn, UnifiedHandlerChainMetaData.class, endpointConfigService.getPreHandlerChainsInjector());
        }
        for (ServiceName sn : PackageUtils.getServiceNameDependencies(context, serviceName, address, Constants.POST_HANDLER_CHAIN)) {
            //get a new injector instance each time
            serviceBuilder.addDependency(sn, UnifiedHandlerChainMetaData.class, endpointConfigService.getPostHandlerChainsInjector());
        }
        serviceBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install();
    } else {
        context.reloadRequired();
    }
}
Also used : ServerConfig(org.jboss.wsf.spi.management.ServerConfig) ConfigService(org.jboss.as.webservices.service.ConfigService) ServiceName(org.jboss.msc.service.ServiceName) PackageUtils.getEndpointConfigServiceName(org.jboss.as.webservices.dmr.PackageUtils.getEndpointConfigServiceName) PathAddress(org.jboss.as.controller.PathAddress) ServiceTarget(org.jboss.msc.service.ServiceTarget)

Example 54 with ServiceName

use of org.jboss.msc.service.ServiceName in project wildfly by wildfly.

the class HandlerAdd method performRuntime.

@Override
protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException {
    // modify the runtime if we're booting, otherwise set reload required and leave the runtime unchanged
    if (context.isBooting()) {
        final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
        final PathElement confElem = address.getElement(address.size() - 3);
        final String configType = confElem.getKey();
        final String configName = confElem.getValue();
        final String handlerChainType = address.getElement(address.size() - 2).getKey();
        final String handlerChainId = address.getElement(address.size() - 2).getValue();
        final String handlerName = address.getElement(address.size() - 1).getValue();
        final String handlerClass = operation.require(CLASS).asString();
        final HandlerService service = new HandlerService(handlerName, handlerClass, counter.incrementAndGet());
        final ServiceTarget target = context.getServiceTarget();
        final ServiceName configServiceName = getConfigServiceName(configType, configName);
        final ServiceRegistry registry = context.getServiceRegistry(false);
        if (registry.getService(configServiceName) == null) {
            throw WSLogger.ROOT_LOGGER.missingConfig(configName);
        }
        final ServiceName handlerChainServiceName = getHandlerChainServiceName(configServiceName, handlerChainType, handlerChainId);
        if (registry.getService(handlerChainServiceName) == null) {
            throw WSLogger.ROOT_LOGGER.missingHandlerChain(configName, handlerChainType, handlerChainId);
        }
        final ServiceName handlerServiceName = getHandlerServiceName(handlerChainServiceName, handlerName);
        final ServiceBuilder<?> handlerServiceBuilder = target.addService(handlerServiceName, service);
        ServiceController<?> controller = handlerServiceBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install();
    } else {
        context.reloadRequired();
    }
}
Also used : PathElement(org.jboss.as.controller.PathElement) HandlerService(org.jboss.as.webservices.service.HandlerService) PackageUtils.getHandlerServiceName(org.jboss.as.webservices.dmr.PackageUtils.getHandlerServiceName) PackageUtils.getConfigServiceName(org.jboss.as.webservices.dmr.PackageUtils.getConfigServiceName) PackageUtils.getHandlerChainServiceName(org.jboss.as.webservices.dmr.PackageUtils.getHandlerChainServiceName) ServiceName(org.jboss.msc.service.ServiceName) PathAddress(org.jboss.as.controller.PathAddress) ServiceTarget(org.jboss.msc.service.ServiceTarget) ServiceRegistry(org.jboss.msc.service.ServiceRegistry)

Example 55 with ServiceName

use of org.jboss.msc.service.ServiceName in project wildfly by wildfly.

the class HandlerChainAdd method performRuntime.

@Override
protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException {
    //modify the runtime if we're booting, otherwise set reload required and leave the runtime unchanged
    if (context.isBooting()) {
        final String protocolBindings = getAttributeValue(operation, PROTOCOL_BINDINGS);
        final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
        final PathElement confElem = address.getElement(address.size() - 2);
        final String configType = confElem.getKey();
        final String configName = confElem.getValue();
        final String handlerChainType = address.getElement(address.size() - 1).getKey();
        final String handlerChainId = address.getElement(address.size() - 1).getValue();
        final ServiceName configServiceName = getConfigServiceName(configType, configName);
        if (context.getServiceRegistry(false).getService(configServiceName) == null) {
            throw WSLogger.ROOT_LOGGER.missingConfig(configName);
        }
        final ServiceName handlerChainServiceName = getHandlerChainServiceName(configServiceName, handlerChainType, handlerChainId);
        final HandlerChainService service = new HandlerChainService(handlerChainType, handlerChainId, protocolBindings);
        final ServiceTarget target = context.getServiceTarget();
        final ServiceBuilder<?> handlerChainServiceBuilder = target.addService(handlerChainServiceName, service);
        for (ServiceName sn : PackageUtils.getServiceNameDependencies(context, handlerChainServiceName, address, HANDLER)) {
            //get a new injector instance each time
            handlerChainServiceBuilder.addDependency(sn, UnifiedHandlerMetaData.class, service.getHandlersInjector());
        }
        handlerChainServiceBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install();
    } else {
        context.reloadRequired();
    }
}
Also used : HandlerChainService(org.jboss.as.webservices.service.HandlerChainService) PathElement(org.jboss.as.controller.PathElement) PackageUtils.getConfigServiceName(org.jboss.as.webservices.dmr.PackageUtils.getConfigServiceName) PackageUtils.getHandlerChainServiceName(org.jboss.as.webservices.dmr.PackageUtils.getHandlerChainServiceName) ServiceName(org.jboss.msc.service.ServiceName) PathAddress(org.jboss.as.controller.PathAddress) ServiceTarget(org.jboss.msc.service.ServiceTarget)

Aggregations

ServiceName (org.jboss.msc.service.ServiceName)323 ServiceTarget (org.jboss.msc.service.ServiceTarget)62 PathAddress (org.jboss.as.controller.PathAddress)57 ModelNode (org.jboss.dmr.ModelNode)53 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)47 ServiceRegistry (org.jboss.msc.service.ServiceRegistry)45 OperationFailedException (org.jboss.as.controller.OperationFailedException)35 ServiceController (org.jboss.msc.service.ServiceController)26 Module (org.jboss.modules.Module)24 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)22 EEModuleDescription (org.jboss.as.ee.component.EEModuleDescription)22 ContextNames (org.jboss.as.naming.deployment.ContextNames)21 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)20 BinderService (org.jboss.as.naming.service.BinderService)20 ArrayList (java.util.ArrayList)17 HashSet (java.util.HashSet)17 ServiceBuilder (org.jboss.msc.service.ServiceBuilder)16 HashMap (java.util.HashMap)14 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)14 OperationContext (org.jboss.as.controller.OperationContext)12