use of org.jboss.as.clustering.controller.ManagementResourceRegistration in project wildfly by wildfly.
the class StackResourceDefinition method register.
@SuppressWarnings("deprecation")
@Override
public ManagementResourceRegistration register(ManagementResourceRegistration parent) {
ManagementResourceRegistration registration = parent.registerSubModel(this);
ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(Attribute.class).addExtraParameters(TRANSPORT, PROTOCOLS).addCapabilities(Capability.class).setAddOperationTransformation(new AddOperationTransformation());
ResourceServiceHandler handler = new StackServiceHandler(this.serviceConfiguratorFactory);
new SimpleResourceRegistration(descriptor, handler).register(registration);
OperationDefinition legacyAddProtocolOperation = new SimpleOperationDefinitionBuilder("add-protocol", this.getResourceDescriptionResolver()).setParameters(MulticastProtocolResourceDefinition.Attribute.SOCKET_BINDING.getDefinition()).addParameter(AbstractProtocolResourceDefinition.DeprecatedAttribute.TYPE.getDefinition()).addParameter(AbstractProtocolResourceDefinition.Attribute.PROPERTIES.getDefinition()).setDeprecated(JGroupsModel.VERSION_3_0_0.getVersion()).build();
// Transform legacy /subsystem=jgroups/stack=*:add-protocol() operation -> /subsystem=jgroups/stack=*/protocol=*:add()
OperationStepHandler legacyAddProtocolHandler = new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) {
operationDeprecated(context, operation);
PathAddress address = context.getCurrentAddress();
String protocol = operation.require(AbstractProtocolResourceDefinition.DeprecatedAttribute.TYPE.getName()).asString();
PathElement protocolPath = ProtocolResourceDefinition.pathElement(protocol);
PathAddress protocolAddress = address.append(protocolPath);
ModelNode protocolOperation = Util.createAddOperation(protocolAddress);
OperationEntry addOperationEntry = context.getResourceRegistration().getOperationEntry(PathAddress.pathAddress(protocolPath), ModelDescriptionConstants.ADD);
for (AttributeDefinition attribute : addOperationEntry.getOperationDefinition().getParameters()) {
String name = attribute.getName();
if (operation.hasDefined(name)) {
protocolOperation.get(name).set(operation.get(name));
}
}
context.addStep(protocolOperation, addOperationEntry.getOperationHandler(), OperationContext.Stage.MODEL, true);
}
};
registration.registerOperationHandler(legacyAddProtocolOperation, legacyAddProtocolHandler);
OperationDefinition legacyRemoveProtocolOperation = new SimpleOperationDefinitionBuilder("remove-protocol", this.getResourceDescriptionResolver()).setParameters(AbstractProtocolResourceDefinition.DeprecatedAttribute.TYPE.getDefinition()).setDeprecated(JGroupsModel.VERSION_3_0_0.getVersion()).build();
// Transform legacy /subsystem=jgroups/stack=*:remove-protocol() operation -> /subsystem=jgroups/stack=*/protocol=*:remove()
OperationStepHandler legacyRemoveProtocolHandler = new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) {
operationDeprecated(context, operation);
PathAddress address = context.getCurrentAddress();
String protocol = operation.require(AbstractProtocolResourceDefinition.DeprecatedAttribute.TYPE.getName()).asString();
PathElement protocolPath = ProtocolResourceDefinition.pathElement(protocol);
PathAddress protocolAddress = address.append(protocolPath);
ModelNode removeOperation = Util.createRemoveOperation(protocolAddress);
context.addStep(removeOperation, context.getResourceRegistration().getOperationHandler(PathAddress.pathAddress(protocolPath), ModelDescriptionConstants.REMOVE), context.getCurrentStage());
}
};
registration.registerOperationHandler(legacyRemoveProtocolOperation, legacyRemoveProtocolHandler);
if (registration.isRuntimeOnlyRegistrationValid()) {
new StackOperationHandler().register(registration);
}
new TransportRegistration(this.serviceConfiguratorFactory).register(registration);
new ProtocolRegistration(this.serviceConfiguratorFactory).register(registration);
new RelayResourceDefinition(this.serviceConfiguratorFactory).register(registration);
return registration;
}
use of org.jboss.as.clustering.controller.ManagementResourceRegistration in project wildfly by wildfly.
the class RemoteClusterResourceDefinition method register.
@Override
public ManagementResourceRegistration register(ManagementResourceRegistration parentRegistration) {
ManagementResourceRegistration registration = parentRegistration.registerSubModel(this);
ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(Attribute.class).addCapabilities(Capability.class);
new RestartParentResourceRegistration(this.serviceConfiguratorFactory, descriptor).register(registration);
if (registration.isRuntimeOnlyRegistrationValid()) {
new OperationHandler<>(new RemoteClusterOperationExecutor(this.executors), RemoteClusterOperation.class).register(registration);
}
return registration;
}
use of org.jboss.as.clustering.controller.ManagementResourceRegistration in project wildfly by wildfly.
the class RemoteTransactionResourceDefinition method register.
@Override
public ManagementResourceRegistration register(ManagementResourceRegistration parent) {
ManagementResourceRegistration registration = parent.registerSubModel(new RemoteTransactionResourceDefinition());
Capability dependentCapability = new UnaryRequirementCapability(InfinispanClientRequirement.REMOTE_CONTAINER_CONFIGURATION, UnaryCapabilityNameResolver.PARENT);
ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(EnumSet.complementOf(EnumSet.of(Attribute.TIMEOUT))).addAttributeTranslation(Attribute.TIMEOUT, new AttributeTranslation() {
@Override
public org.jboss.as.clustering.controller.Attribute getTargetAttribute() {
return RemoteCacheContainerResourceDefinition.Attribute.TRANSACTION_TIMEOUT;
}
@Override
public UnaryOperator<PathAddress> getPathAddressTransformation() {
return PathAddress::getParent;
}
}).addResourceCapabilityReference(new TransactionResourceCapabilityReference(dependentCapability, CommonRequirement.LOCAL_TRANSACTION_PROVIDER, Attribute.MODE, EnumSet.of(TransactionMode.NONE, TransactionMode.BATCH)));
ResourceServiceHandler handler = new SimpleResourceServiceHandler(this);
new SimpleResourceRegistration(descriptor, handler).register(registration);
return registration;
}
use of org.jboss.as.clustering.controller.ManagementResourceRegistration in project wildfly by wildfly.
the class InvalidationNearCacheResourceDefinition method register.
@Override
public ManagementResourceRegistration register(ManagementResourceRegistration parent) {
ManagementResourceRegistration registration = parent.registerSubModel(this);
ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addIgnoredAttributes(InvalidationNearCacheResourceDefinition.Attribute.class);
new SimpleResourceRegistration(descriptor, null).register(registration);
return registration;
}
use of org.jboss.as.clustering.controller.ManagementResourceRegistration in project wildfly by wildfly.
the class ConnectionPoolResourceDefinition method register.
@Override
public ManagementResourceRegistration register(ManagementResourceRegistration parent) {
ManagementResourceRegistration registration = parent.registerSubModel(this);
ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(Attribute.class);
ResourceServiceHandler handler = new SimpleResourceServiceHandler(this);
new SimpleResourceRegistration(descriptor, handler).register(registration);
return registration;
}
Aggregations