use of org.jboss.as.controller.registry.ManagementResourceRegistration in project wildfly by wildfly.
the class PooledConnectionFactoryStatisticsService method start.
@Override
public void start(StartContext context) throws StartException {
ROOT_LOGGER.debugf("start PooledConnectionFactoryStatisticsService");
synchronized (POOL_STATISTICS) {
ResourceAdapterDeployment raDeployment = injectedRADeployment.getValue();
CommonDeployment deployment = raDeployment.getDeployment();
StatisticsPlugin poolStats = deployment.getConnectionManagers()[0].getPool().getStatistics();
poolStats.setEnabled(statsEnabled);
int poolStatsSize = poolStats.getNames().size();
if (poolStatsSize > 0) {
if (registration != null) {
if (poolStatsSize > 0) {
if (registration.getSubModel(PathAddress.pathAddress(POOL_STATISTICS)) == null) {
// TODO WFLY-5285 get rid of redundant .setRuntimeOnly once WFCORE-959 is integrated
ManagementResourceRegistration poolRegistration = registration.registerSubModel(new StatisticsResourceDefinition(POOL_STATISTICS, DataSourcesSubsystemProviders.RESOURCE_NAME, poolStats));
poolRegistration.setRuntimeOnly(true);
}
}
}
}
}
}
use of org.jboss.as.controller.registry.ManagementResourceRegistration in project wildfly by wildfly.
the class MessagingXmlInstallDeploymentUnitProcessor method createDeploymentSubModel.
static ManagementResourceRegistration createDeploymentSubModel(final PathAddress address, final DeploymentUnit unit) {
final Resource root = unit.getAttachment(DeploymentModelUtils.DEPLOYMENT_RESOURCE);
synchronized (root) {
final ManagementResourceRegistration registration = unit.getAttachment(DeploymentModelUtils.MUTABLE_REGISTRATION_ATTACHMENT);
final PathAddress subsystemAddress = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, MessagingExtension.SUBSYSTEM_NAME));
final Resource subsystem = getOrCreate(root, subsystemAddress);
Set<String> childTypes = subsystem.getChildTypes();
final ManagementResourceRegistration subModel = registration.getSubModel(subsystemAddress.append(address));
if (subModel == null) {
throw new IllegalStateException(address.toString());
}
getOrCreate(subsystem, address);
return subModel;
}
}
use of org.jboss.as.controller.registry.ManagementResourceRegistration in project wildfly by wildfly.
the class ModClusterExtension method initialize.
@Override
public void initialize(ExtensionContext context) {
ROOT_LOGGER.debugf("Activating mod_cluster extension");
final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, ModClusterModel.CURRENT.getVersion());
final ManagementResourceRegistration registration = subsystem.registerSubsystemModel(new ModClusterSubsystemResourceDefinition(context.isRuntimeOnlyRegistrationValid()));
final ManagementResourceRegistration configuration = registration.registerSubModel(new ModClusterConfigResourceDefinition());
configuration.registerSubModel(new ModClusterSSLResourceDefinition());
final ManagementResourceRegistration dynamicLoadProvider = configuration.registerSubModel(DynamicLoadProviderDefinition.INSTANCE);
dynamicLoadProvider.registerSubModel(LoadMetricDefinition.INSTANCE);
dynamicLoadProvider.registerSubModel(CustomLoadMetricDefinition.INSTANCE);
subsystem.registerXMLElementWriter(new ModClusterSubsystemXMLWriter());
}
use of org.jboss.as.controller.registry.ManagementResourceRegistration in project wildfly by wildfly.
the class AbstractProtocolResourceDefinition method register.
@Override
public void register(ManagementResourceRegistration parent) {
ManagementResourceRegistration registration = parent.registerSubModel(this);
ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver());
this.descriptorConfigurator.accept(descriptor);
new RestartParentResourceRegistration<>(this.parentBuilderFactory, descriptor, this.handler).register(registration);
this.registrationConfigurator.accept(parent, registration);
}
use of org.jboss.as.controller.registry.ManagementResourceRegistration in project wildfly by wildfly.
the class ChannelResourceDefinition method register.
@Override
public void register(ManagementResourceRegistration parentRegistration) {
ManagementResourceRegistration registration = parentRegistration.registerSubModel(this);
ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(Attribute.class).addCapabilities(Capability.class).addCapabilities(CLUSTERING_CAPABILITIES.values()).addAlias(DeprecatedAttribute.STATS_ENABLED, Attribute.STATISTICS_ENABLED).addOperationTranslator(new OperationStepHandler() {
@SuppressWarnings("deprecation")
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
// Handle recipe for version < 4.0 where stack was not required and the stack attribute would use default-stack for a default value
if (!operation.hasDefined(Attribute.STACK.getName())) {
ModelNode parentModel = context.readResourceFromRoot(context.getCurrentAddress().getParent()).getModel();
// If default-stack is not defined either, then recipe must be for version >= 4.0 and so this really is an invalid operation
if (parentModel.hasDefined(JGroupsSubsystemResourceDefinition.Attribute.DEFAULT_STACK.getName())) {
operation.get(Attribute.STACK.getName()).set(parentModel.get(JGroupsSubsystemResourceDefinition.Attribute.DEFAULT_STACK.getName()));
}
}
}
}).addRuntimeResourceRegistration(new ProtocolResourceRegistrationHandler());
ResourceServiceHandler handler = new ChannelServiceHandler();
new SimpleResourceRegistration(descriptor, handler).register(registration);
if (this.allowRuntimeOnlyRegistration) {
new MetricHandler<>(new ChannelMetricExecutor(), ChannelMetric.class).register(registration);
}
new ForkResourceDefinition().register(registration);
}
Aggregations