use of org.jboss.dmr.ModelNode in project wildfly by wildfly.
the class EJB3Subsystem50Parser method parseProfile.
protected void parseProfile(final XMLExtendedStreamReader reader, List<ModelNode> operations) throws XMLStreamException {
final int count = reader.getAttributeCount();
String profileName = null;
final EJBClientContext.Builder builder = new EJBClientContext.Builder();
final ModelNode operation = Util.createAddOperation();
for (int i = 0; i < count; i++) {
requireNoNamespaceAttribute(reader, i);
final String value = reader.getAttributeValue(i);
final EJB3SubsystemXMLAttribute attribute = EJB3SubsystemXMLAttribute.forName(reader.getAttributeLocalName(i));
switch(attribute) {
case NAME:
profileName = value;
break;
case EXCLUDE_LOCAL_RECEIVER:
RemotingProfileResourceDefinition.EXCLUDE_LOCAL_RECEIVER.parseAndSetParameter(value, operation, reader);
break;
case LOCAL_RECEIVER_PASS_BY_VALUE:
RemotingProfileResourceDefinition.LOCAL_RECEIVER_PASS_BY_VALUE.parseAndSetParameter(value, operation, reader);
break;
default:
throw unexpectedAttribute(reader, i);
}
}
if (profileName == null) {
throw missingRequired(reader, Collections.singleton(EJB3SubsystemXMLAttribute.NAME.getLocalName()));
}
final PathAddress address = SUBSYSTEM_PATH.append(EJB3SubsystemModel.REMOTING_PROFILE, profileName);
operation.get(OP_ADDR).set(address.toModelNode());
operations.add(operation);
while (reader.hasNext() && reader.nextTag() != XMLStreamConstants.END_ELEMENT) {
switch(EJB3SubsystemXMLElement.forName(reader.getLocalName())) {
case STATIC_EJB_DISCOVERY:
final ModelNode staticEjb = parseStaticEjbDiscoveryType(reader);
operation.get(StaticEJBDiscoveryDefinition.STATIC_EJB_DISCOVERY).set(staticEjb);
break;
case REMOTING_EJB_RECEIVER:
{
parseRemotingReceiver(reader, address, operations);
break;
}
default:
{
throw unexpectedElement(reader);
}
}
}
}
use of org.jboss.dmr.ModelNode in project wildfly by wildfly.
the class EJB3SubsystemAdd method populateModel.
@Override
protected void populateModel(final OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException {
ModelNode model = resource.getModel();
for (AttributeDefinition attr : EJB3SubsystemRootResourceDefinition.ATTRIBUTES) {
attr.validateAndSet(operation, model);
}
// WFLY-5520 deal with legacy default-clustered-sfsb-cache
ModelNode defClustered = DEFAULT_CLUSTERED_SFSB_CACHE.validateOperation(operation);
if (defClustered.isDefined()) {
boolean setDefaultSfsbCache = true;
// Assume this is a legacy script and try and adapt the params to the new attributes
if (model.hasDefined(DEFAULT_SFSB_CACHE)) {
if (model.hasDefined(DEFAULT_SFSB_PASSIVATION_DISABLED_CACHE)) {
// are the same, meaning default-clustered-sfsb-cache is redundant
if (!defClustered.equals(model.get(DEFAULT_SFSB_CACHE))) {
// No good. Log or fail
if (context.getRunningMode() == RunningMode.ADMIN_ONLY) {
EjbLogger.ROOT_LOGGER.logInconsistentAttributeNotSupported(DEFAULT_CLUSTERED_SFSB_CACHE.getName(), DEFAULT_SFSB_CACHE);
// don't overwrite default-sfsb-cache
setDefaultSfsbCache = false;
} else {
throw EjbLogger.ROOT_LOGGER.inconsistentAttributeNotSupported(DEFAULT_CLUSTERED_SFSB_CACHE.getName(), DEFAULT_SFSB_CACHE);
}
}
} else {
// The old attributes were defined; new one wasn't so, move the old default-sfsb-cache to default-passivation-disabled
model.get(DEFAULT_SFSB_PASSIVATION_DISABLED_CACHE).set(model.get(DEFAULT_SFSB_CACHE));
}
}
if (setDefaultSfsbCache) {
model.get(DEFAULT_SFSB_CACHE).set(defClustered);
EjbLogger.ROOT_LOGGER.remappingCacheAttributes(context.getCurrentAddress().toCLIStyleString(), defClustered, model.get(DEFAULT_SFSB_PASSIVATION_DISABLED_CACHE));
}
}
}
use of org.jboss.dmr.ModelNode in project wildfly by wildfly.
the class EJB3SubsystemDefaultCacheWriteHandler method applyUpdateToRuntime.
@Override
protected boolean applyUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode resolvedValue, ModelNode currentValue, HandbackHolder<Void> handbackHolder) throws OperationFailedException {
final ModelNode model = context.readResource(PathAddress.EMPTY_ADDRESS).getModel();
updateCacheService(context, model);
return false;
}
use of org.jboss.dmr.ModelNode in project wildfly by wildfly.
the class EJB3SubsystemDefaultCacheWriteHandler method updateCacheService.
void updateCacheService(final OperationContext context, final ModelNode model) throws OperationFailedException {
ModelNode cacheName = this.attribute.resolveModelAttribute(context, model);
ServiceRegistry registry = context.getServiceRegistry(true);
if (registry.getService(this.serviceName) != null) {
context.removeService(this.serviceName);
}
if (cacheName.isDefined()) {
this.installValueService(context, this.serviceName, CacheFactoryBuilder.class, CacheFactoryBuilderService.getServiceName(cacheName.asString()));
}
}
use of org.jboss.dmr.ModelNode in project wildfly by wildfly.
the class EJB3SubsystemDefaultEntityBeanOptimisticLockingWriteHandler method applyUpdateToRuntime.
@Override
protected boolean applyUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode resolvedValue, ModelNode currentValue, HandbackHolder<Void> handbackHolder) throws OperationFailedException {
final ModelNode model = context.readResource(PathAddress.EMPTY_ADDRESS).getModel();
updateOptimisticLocking(context, model);
return false;
}
Aggregations