use of org.jboss.as.webservices.service.PropertyService in project wildfly by wildfly.
the class PropertyAdd 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 propertyName = address.getElement(address.size() - 1).getValue();
final PathElement confElem = address.getElement(address.size() - 2);
final String configType = confElem.getKey();
final String configName = confElem.getValue();
final String propertyValue = operation.has(VALUE) ? Attributes.VALUE.resolveModelAttribute(context, operation).asString() : null;
final PropertyService service = new PropertyService(propertyName, propertyValue);
final ServiceTarget target = context.getServiceTarget();
final ServiceName configServiceName = getConfigServiceName(configType, configName);
if (context.getServiceRegistry(false).getService(configServiceName) == null) {
throw WSLogger.ROOT_LOGGER.missingConfig(configName);
}
final ServiceName propertyServiceName = getPropertyServiceName(configServiceName, propertyName);
final ServiceBuilder<?> propertyServiceBuilder = target.addService(propertyServiceName, service);
ServiceController<?> controller = propertyServiceBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install();
} else {
context.reloadRequired();
}
}
Aggregations