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);
}
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));
}
}
}
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();
}
}
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();
}
}
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();
}
}
Aggregations