use of org.jboss.as.controller.OperationFailedException in project wildfly by wildfly.
the class IdentityStoreRemoveStepHandler method updateModel.
@Override
protected void updateModel(OperationContext context, ModelNode operation) throws OperationFailedException {
checkIfLastIdentityStore(context);
super.updateModel(context, operation);
context.addStep(new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
PathAddress address = context.getCurrentAddress();
String configurationName = address.getElement(address.size() - 2).getValue();
String partitionManagerName = address.getElement(address.size() - 3).getValue();
String identityStoreName = address.getLastElement().getValue();
context.removeService(PartitionManagerService.createIdentityStoreServiceName(partitionManagerName, configurationName, identityStoreName));
context.completeStep(OperationContext.ResultHandler.NOOP_RESULT_HANDLER);
}
}, OperationContext.Stage.RUNTIME);
}
use of org.jboss.as.controller.OperationFailedException in project wildfly by wildfly.
the class LogStoreParticipantDeleteHandler method refreshParticipant.
void refreshParticipant(OperationContext context) {
final ModelNode operation = Util.createEmptyOperation("refresh-log-store", context.getCurrentAddress().getParent().getParent());
context.addStep(operation, new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
probeHandler.execute(context, operation);
}
}, OperationContext.Stage.MODEL);
}
use of org.jboss.as.controller.OperationFailedException in project wildfly by wildfly.
the class LogStoreParticipantOperationHandler method execute.
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
MBeanServer mbs = TransactionExtension.getMBeanServer(context);
final Resource resource = context.readResource(PathAddress.EMPTY_ADDRESS);
try {
// Get the internal object name
final ObjectName on = LogStoreResource.getObjectName(resource);
// Invoke the MBean operation
mbs.invoke(on, operationName, null, null);
} catch (Exception e) {
throw new OperationFailedException("JMX error: " + e.getMessage());
}
// refresh the attributes of this participant (the status attribute should have changed to PREPARED
refreshParticipant(context);
context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER);
}
use of org.jboss.as.controller.OperationFailedException in project wildfly by wildfly.
the class CacheServiceHandler method installServices.
@Override
public void installServices(OperationContext context, ModelNode model) throws OperationFailedException {
PathAddress cacheAddress = context.getCurrentAddress();
PathAddress containerAddress = cacheAddress.getParent();
String containerName = containerAddress.getLastElement().getValue();
String cacheName = cacheAddress.getLastElement().getValue();
ServiceTarget target = context.getServiceTarget();
ServiceName moduleServiceName = CacheComponent.MODULE.getServiceName(cacheAddress);
if (model.hasDefined(MODULE.getName())) {
new ModuleBuilder(moduleServiceName, MODULE).configure(context, model).build(target).install();
} else {
new AliasServiceBuilder<>(moduleServiceName, CacheContainerComponent.MODULE.getServiceName(containerAddress), Module.class).build(target).install();
}
this.builderFactory.createBuilder(cacheAddress).configure(context, model).build(target).setInitialMode(ServiceController.Mode.PASSIVE).install();
new CacheBuilder<>(CACHE.getServiceName(cacheAddress), containerName, cacheName).configure(context).build(target).install();
new XAResourceRecoveryBuilder(cacheAddress).build(target).install();
new BinderServiceBuilder<>(InfinispanBindingFactory.createCacheConfigurationBinding(containerName, cacheName), CONFIGURATION.getServiceName(cacheAddress), Configuration.class).build(target).install();
BinderServiceBuilder<?> bindingBuilder = new BinderServiceBuilder<>(InfinispanBindingFactory.createCacheBinding(containerName, cacheName), CACHE.getServiceName(cacheAddress), Cache.class);
ModelNodes.optionalString(JNDI_NAME.resolveModelAttribute(context, model)).map(jndiName -> ContextNames.bindInfoFor(JndiNameFactory.parse(jndiName).getAbsoluteName())).ifPresent(aliasBinding -> bindingBuilder.alias(aliasBinding));
bindingBuilder.build(target).install();
for (CacheBuilderProvider provider : ServiceLoader.load(this.providerClass, this.providerClass.getClassLoader())) {
for (CapabilityServiceBuilder<?> builder : provider.getBuilders(requirement -> CLUSTERING_CAPABILITIES.get(requirement).getServiceName(cacheAddress), containerName, cacheName)) {
builder.configure(context).build(target).install();
}
}
}
use of org.jboss.as.controller.OperationFailedException in project wildfly by wildfly.
the class BinaryKeyedJDBCStoreResourceDefinition method buildTransformation.
static void buildTransformation(ModelVersion version, ResourceTransformationDescriptionBuilder parent) {
ResourceTransformationDescriptionBuilder builder = InfinispanModel.VERSION_4_0_0.requiresTransformation(version) ? parent.addChildRedirection(PATH, LEGACY_PATH) : parent.addChildResource(PATH);
if (InfinispanModel.VERSION_4_0_0.requiresTransformation(version)) {
builder.setCustomResourceTransformer(new ResourceTransformer() {
@Override
public void transformResource(ResourceTransformationContext context, PathAddress address, Resource resource) throws OperationFailedException {
final ModelNode model = resource.getModel();
final ModelNode binaryTableModel = Resource.Tools.readModel(resource.removeChild(BinaryTableResourceDefinition.PATH));
if (binaryTableModel != null && binaryTableModel.isDefined()) {
model.get(DeprecatedAttribute.TABLE.getName()).set(binaryTableModel);
}
final ModelNode properties = model.remove(StoreResourceDefinition.Attribute.PROPERTIES.getName());
final ResourceTransformationContext childContext = context.addTransformedResource(PathAddress.EMPTY_ADDRESS, resource);
LegacyPropertyResourceTransformer.transformPropertiesToChildrenResources(properties, address, childContext);
context.processChildren(resource);
}
});
}
BinaryTableResourceDefinition.buildTransformation(version, builder);
JDBCStoreResourceDefinition.buildTransformation(version, builder);
}
Aggregations