use of org.jboss.as.controller.registry.ManagementResourceRegistration in project wildfly by wildfly.
the class NamingExtension method initialize.
/**
* {@inheritDoc}
*/
@Override
public void initialize(ExtensionContext context) {
final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, CURRENT_MODEL_VERSION);
final ManagementResourceRegistration registration = subsystem.registerSubsystemModel(new NamingSubsystemRootResourceDefinition());
registration.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);
registration.registerSubModel(NamingBindingResourceDefinition.INSTANCE);
registration.registerSubModel(RemoteNamingResourceDefinition.INSTANCE);
if (context.isRuntimeOnlyRegistrationValid()) {
registration.registerOperationHandler(NamingSubsystemRootResourceDefinition.JNDI_VIEW, JndiViewOperation.INSTANCE, false);
}
subsystem.registerXMLElementWriter(NamingSubsystemXMLPersister.INSTANCE);
if (context.isRegisterTransformers()) {
registerTransformers(subsystem);
}
}
use of org.jboss.as.controller.registry.ManagementResourceRegistration in project wildfly by wildfly.
the class StringTableResourceDefinition method register.
@Override
public void register(ManagementResourceRegistration parentRegistration) {
ManagementResourceRegistration registration = parentRegistration.registerSubModel(this);
ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(Attribute.class).addAttributes(TableResourceDefinition.Attribute.class).addAttributes(TableResourceDefinition.ColumnAttribute.class);
ResourceServiceHandler handler = new SimpleResourceServiceHandler<>(address -> new StringTableBuilder(address.getParent().getParent()));
new SimpleResourceRegistration(descriptor, handler).register(registration);
}
use of org.jboss.as.controller.registry.ManagementResourceRegistration in project wildfly by wildfly.
the class TransactionResourceDefinition method register.
@Override
public void register(ManagementResourceRegistration parentRegistration) {
ManagementResourceRegistration registration = parentRegistration.registerSubModel(this);
parentRegistration.registerAlias(LEGACY_PATH, new SimpleAliasEntry(registration));
ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(Attribute.class);
ResourceServiceHandler handler = new SimpleResourceServiceHandler<>(address -> new TransactionBuilder(address.getParent()));
new SimpleResourceRegistration(descriptor, handler).register(registration);
if (this.allowRuntimeOnlyRegistration) {
new MetricHandler<>(new TransactionMetricExecutor(), TransactionMetric.class).register(registration);
}
}
use of org.jboss.as.controller.registry.ManagementResourceRegistration in project wildfly by wildfly.
the class NoTransportResourceDefinition method register.
@Override
public void register(ManagementResourceRegistration parentRegistration) {
ManagementResourceRegistration registration = parentRegistration.registerSubModel(this);
ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addCapabilities(CLUSTERING_CAPABILITIES.values());
ResourceServiceHandler handler = new NoTransportServiceHandler();
new SimpleResourceRegistration(descriptor, handler).register(registration);
}
use of org.jboss.as.controller.registry.ManagementResourceRegistration in project wildfly by wildfly.
the class StorePropertyResourceDefinition method register.
@Override
public void register(ManagementResourceRegistration parentRegistration) {
ManagementResourceRegistration registration = parentRegistration.registerSubModel(this);
AbstractAddStepHandler addHandler = new AbstractAddStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) {
context.createResource(PathAddress.EMPTY_ADDRESS);
String name = context.getCurrentAddressValue();
String value = operation.get(VALUE.getName()).asString();
PathAddress storeAddress = context.getCurrentAddress().getParent();
ModelNode putOperation = Operations.createMapPutOperation(storeAddress, StoreResourceDefinition.Attribute.PROPERTIES, name, value);
context.addStep(putOperation, MapOperations.MAP_PUT_HANDLER, context.getCurrentStage());
}
};
this.registerAddOperation(registration, addHandler);
AbstractRemoveStepHandler removeHandler = new AbstractRemoveStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) {
context.removeResource(PathAddress.EMPTY_ADDRESS);
String name = context.getCurrentAddressValue();
PathAddress storeAddress = context.getCurrentAddress().getParent();
ModelNode putOperation = Operations.createMapRemoveOperation(storeAddress, StoreResourceDefinition.Attribute.PROPERTIES, name);
context.addStep(putOperation, MapOperations.MAP_REMOVE_HANDLER, context.getCurrentStage());
}
};
this.registerRemoveOperation(registration, removeHandler);
OperationStepHandler readHandler = new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) {
PathAddress address = context.getCurrentAddress().getParent();
String key = context.getCurrentAddressValue();
ModelNode getOperation = Operations.createMapGetOperation(address, StoreResourceDefinition.Attribute.PROPERTIES, key);
context.addStep(getOperation, MapOperations.MAP_GET_HANDLER, context.getCurrentStage());
}
};
OperationStepHandler writeHandler = new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) {
PathAddress address = context.getCurrentAddress().getParent();
String key = context.getCurrentAddressValue();
String value = Operations.getAttributeValue(operation).asString();
ModelNode putOperation = Operations.createMapPutOperation(address, StoreResourceDefinition.Attribute.PROPERTIES, key, value);
context.addStep(putOperation, MapOperations.MAP_PUT_HANDLER, context.getCurrentStage());
}
};
registration.registerReadWriteAttribute(VALUE, readHandler, writeHandler);
}
Aggregations