use of org.jboss.dmr.ModelNode in project wildfly by wildfly.
the class EJB3SubsystemDefaultEntityBeanOptimisticLockingWriteHandler method updateOptimisticLocking.
void updateOptimisticLocking(final OperationContext context, final ModelNode model) throws OperationFailedException {
final ModelNode enabled = EJB3SubsystemRootResourceDefinition.DEFAULT_ENTITY_BEAN_OPTIMISTIC_LOCKING.resolveModelAttribute(context, model);
final ServiceRegistry serviceRegistry = context.getServiceRegistry(true);
ServiceController<?> existingService = serviceRegistry.getService(SERVICE_NAME);
// if a default optimistic locking config is installed, remove it
if (existingService != null) {
context.removeService(existingService);
}
if (enabled.isDefined()) {
final Service<Boolean> newDefaultPoolConfigService = new ValueService<Boolean>(new ImmediateValue<Boolean>(enabled.asBoolean()));
ServiceController<?> newController = context.getServiceTarget().addService(SERVICE_NAME, newDefaultPoolConfigService).install();
}
}
use of org.jboss.dmr.ModelNode in project wildfly by wildfly.
the class EJB3SubsystemDefaultEntityBeanOptimisticLockingWriteHandler method revertUpdateToRuntime.
@Override
protected void revertUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode valueToRestore, ModelNode valueToRevert, Void handback) throws OperationFailedException {
final ModelNode restored = context.readResource(PathAddress.EMPTY_ADDRESS).getModel().clone();
restored.get(attributeName).set(valueToRestore);
updateOptimisticLocking(context, restored);
}
use of org.jboss.dmr.ModelNode in project wildfly by wildfly.
the class EJB3SubsystemDefaultPoolWriteHandler method updatePoolService.
void updatePoolService(final OperationContext context, final ModelNode model) throws OperationFailedException {
final ModelNode poolName = poolAttribute.resolveModelAttribute(context, model);
final ServiceRegistry serviceRegistry = context.getServiceRegistry(true);
ServiceController<?> existingDefaultPoolConfigService = serviceRegistry.getService(poolConfigServiceName);
// if a default MDB pool is already installed, then remove it first
if (existingDefaultPoolConfigService != null) {
context.removeService(existingDefaultPoolConfigService);
}
if (poolName.isDefined()) {
// now install default pool config service which points to an existing pool config service
final ValueInjectionService<PoolConfig> newDefaultPoolConfigService = new ValueInjectionService<PoolConfig>();
ServiceController<?> newController = context.getServiceTarget().addService(poolConfigServiceName, newDefaultPoolConfigService).addDependency(StrictMaxPoolConfigService.EJB_POOL_CONFIG_BASE_SERVICE_NAME.append(poolName.asString()), PoolConfig.class, newDefaultPoolConfigService.getInjector()).install();
}
}
use of org.jboss.dmr.ModelNode in project wildfly by wildfly.
the class PassivationStoreResourceDefinition method registerTransformers_1_2_1_and_1_3_0.
/*
* This transformer does the following:
* - maps <passivation-store/> to <cluster-passivation-store/>
* - sets appropriate defaults for IDLE_TIMEOUT, IDLE_TIMEOUT_UNIT, PASSIVATE_EVENTS_ON_REPLICATE, and CLIENT_MAPPINGS_CACHE
*/
@SuppressWarnings("deprecation")
static void registerTransformers_1_2_1_and_1_3_0(ResourceTransformationDescriptionBuilder parent) {
ResourceTransformationDescriptionBuilder child = parent.addChildRedirection(INSTANCE.getPathElement(), PathElement.pathElement(EJB3SubsystemModel.CLUSTER_PASSIVATION_STORE));
child.getAttributeBuilder().setValueConverter(AttributeConverter.Factory.createHardCoded(new ModelNode(true), true), EJB3SubsystemModel.PASSIVATE_EVENTS_ON_REPLICATE).setValueConverter(AttributeConverter.Factory.createHardCoded(new ModelNode("default"), true), EJB3SubsystemModel.CLIENT_MAPPINGS_CACHE).setValueConverter(AttributeConverter.Factory.createHardCoded(new ModelNode().set(Long.valueOf(Integer.MAX_VALUE)), true), EJB3SubsystemModel.IDLE_TIMEOUT).setValueConverter(AttributeConverter.Factory.createHardCoded(new ModelNode().set(TimeUnit.SECONDS.name()), true), EJB3SubsystemModel.IDLE_TIMEOUT_UNIT);
}
use of org.jboss.dmr.ModelNode in project wildfly by wildfly.
the class PassivationStoreWriteHandler method applyUpdateToRuntime.
@Override
protected boolean applyUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode newValue, ModelNode currentValue, HandbackHolder<Void> handbackHolder) throws OperationFailedException {
ModelNode model = context.readResource(PathAddress.EMPTY_ADDRESS).getModel();
this.applyModelToRuntime(context, operation, attributeName, model);
return false;
}
Aggregations