authorizerConfig.reset(); ManagementResourceRegistration rootResourceRegistration = rootDescriptionProvider != null ? ManagementResourceRegistration.Factory.create(rootDescriptionProvider, authorizerConfig) : ManagementResourceRegistration.Factory.create(rootResourceDefinition, authorizerConfig); final ModelControllerImpl controller = new ModelControllerImpl(container, target, rootResourceRegistration,
WritableAuthorizerConfiguration authorizerConfig = authorizer.getWritableAuthorizerConfiguration(); authorizerConfig.reset(); ManagementResourceRegistration rootResourceRegistration = ManagementResourceRegistration.Factory.forProcessType(processType).createRegistration(rootResourceDefinition, authorizerConfig, capabilityRegistry); final ModelControllerImpl controller = new ModelControllerImpl(container, target, rootResourceRegistration,
WritableAuthorizerConfiguration authorizerConfig = authorizer.getWritableAuthorizerConfiguration(); authorizerConfig.reset(); ManagementResourceRegistration rootResourceRegistration = ManagementResourceRegistration.Factory.forProcessType(processType).createRegistration(rootResourceDefinition, authorizerConfig, capabilityRegistry); final ModelControllerImpl controller = new ModelControllerImpl(container, target, rootResourceRegistration,
final ServiceTarget target = context.getChildTarget(); final ExecutorService executorService = injectedExecutorService.getOptionalValue(); ManagementResourceRegistration rootResourceRegistration = rootDescriptionProvider != null ? ManagementResourceRegistration.Factory.create(rootDescriptionProvider) : ManagementResourceRegistration.Factory.create(rootResourceDefinition); final ModelControllerImpl controller = new ModelControllerImpl(container, target, rootResourceRegistration,
ManagementResourceRegistration rr = ManagementResourceRegistration.Factory.forProcessType(getProcessType()).createRegistration(rd); ModelTestUtils.checkModelAgainstDefinition(transformed, rr); return legacyModel;
ManagementResourceRegistration rr = ManagementResourceRegistration.Factory.forProcessType(getProcessType()).createRegistration(rd); ModelTestUtils.checkModelAgainstDefinition(transformed, rr); return legacyModel;
/** * Checks that the transformed model is the same as the model built up in the legacy subsystem controller via the transformed operations, * and that the transformed model is valid according to the resource definition in the legacy subsystem controller. * * @param kernelServices the main kernel services * @param modelVersion the model version of the targetted legacy subsystem * @param legacyModelFixer use to touch up the model read from the legacy controller, use sparingly when the legacy model is just wrong. May be {@code null} * @return the whole model of the legacy controller */ ModelNode checkSubsystemModelTransformation(KernelServices kernelServices, ModelVersion modelVersion, ModelFixer legacyModelFixer) throws IOException { KernelServices legacy = kernelServices.getLegacyServices(modelVersion); ModelNode legacyModel = legacy.readWholeModel(); ModelNode legacySubsystem = legacyModel.require(SUBSYSTEM); legacySubsystem = legacySubsystem.require(mainSubsystemName); if (legacyModelFixer != null) { legacySubsystem = legacyModelFixer.fixModel(legacySubsystem); } //1) Check that the transformed model is the same as the whole model read from the legacy controller. //The transformed model is done via the resource transformers //The model in the legacy controller is built up via transformed operations ModelNode transformed = kernelServices.readTransformedModel(modelVersion).get(SUBSYSTEM, mainSubsystemName); ModelTestUtils.compare(legacySubsystem, transformed, true); //2) Check that the transformed model is valid according to the resource definition in the legacy subsystem controller ResourceDefinition rd = TransformerRegistry.loadSubsystemDefinitionFromFile(this.getClass(), mainSubsystemName, modelVersion); Assert.assertNotNull("Could not load legacy dmr for subsystem '" + mainSubsystemName + "' version: '" + modelVersion + "' please add it", rd); ManagementResourceRegistration rr = ManagementResourceRegistration.Factory.create(rd); ModelTestUtils.checkModelAgainstDefinition(transformed, rr); return legacyModel; }
private SubsystemRegistrationImpl(String name, ModelVersion version, ManagementResourceRegistration profileRegistration, ManagementResourceRegistration deploymentsRegistration, ExtensionRegistryType extensionRegistryType, String extensionModuleName, ProcessType processType) { assert profileRegistration != null; this.name = name; this.profileRegistration = profileRegistration; if (deploymentsRegistration == null){ this.deploymentsRegistration = ManagementResourceRegistration.Factory.forProcessType(processType).createRegistration(new SimpleResourceDefinition(null, NonResolvingResourceDescriptionResolver.INSTANCE)); }else { this.deploymentsRegistration = deploymentsRegistration; } this.version = version; this.extensionRegistryType = extensionRegistryType; this.extensionModuleName = extensionModuleName; }
private SubsystemRegistrationImpl(String name, ModelVersion version, ManagementResourceRegistration profileRegistration, ManagementResourceRegistration deploymentsRegistration, ExtensionRegistryType extensionRegistryType, String extensionModuleName, ProcessType processType) { assert profileRegistration != null; this.name = name; this.profileRegistration = profileRegistration; if (deploymentsRegistration == null){ this.deploymentsRegistration = ManagementResourceRegistration.Factory.forProcessType(processType).createRegistration(new SimpleResourceDefinition(null, NonResolvingResourceDescriptionResolver.INSTANCE)); }else { this.deploymentsRegistration = deploymentsRegistration; } this.version = version; this.extensionRegistryType = extensionRegistryType; this.extensionModuleName = extensionModuleName; }
@Override public void transformResource(final ResourceTransformationContext context, final PathAddress address, final Resource resource) { // Transform the model recursively final ModelNode recursive = Resource.Tools.readModel(resource); final ModelNode result = transformModel(context, recursive); // Create the target registration based on the old resource definition final TransformationTarget target = context.getTarget(); final ResourceDefinition definition = loader.load(target); final ManagementResourceRegistration targetDefinition = ManagementResourceRegistration.Factory.create(definition); final Resource transformed = TransformationUtils.modelToResource(address, targetDefinition, result, false); // Add the model recursively context.addTransformedRecursiveResource(PathAddress.EMPTY_ADDRESS, transformed); }
@Override public void transformResource(final ResourceTransformationContext context, final PathAddress address, final Resource resource) { // Transform the model recursively final ModelNode recursive = Resource.Tools.readModel(resource); final ModelNode result = transformModel(context, recursive); // Create the target registration based on the old resource definition final TransformationTarget target = context.getTarget(); final ResourceDefinition definition = loader.load(target); final ManagementResourceRegistration targetDefinition = ManagementResourceRegistration.Factory.create(definition); final Resource transformed = TransformationUtils.modelToResource(address, targetDefinition, result, false); // Add the model recursively context.addTransformedRecursiveResource(PathAddress.EMPTY_ADDRESS, transformed); }
/** * Create a new root model node registration. * * @param resourceDefinition the facotry for the model description provider for the root model node * @return the new root model node registration * * @throws SecurityException if the caller does not have {@link ImmutableManagementResourceRegistration#ACCESS_PERMISSION} */ public ManagementResourceRegistration createRegistration(final ResourceDefinition resourceDefinition) { return createRegistration(resourceDefinition, null, null); }
/** * Create a new root model node registration. * * @param resourceDefinition the facotry for the model description provider for the root model node * @return the new root model node registration * * @throws SecurityException if the caller does not have {@link ImmutableManagementResourceRegistration#ACCESS_PERMISSION} */ public static ManagementResourceRegistration create(final ResourceDefinition resourceDefinition) { return create(resourceDefinition, null); }
private ManagementResourceRegistration getDummyRegistration() { return ManagementResourceRegistration.Factory.create(new DescriptionProvider() { @Override public ModelNode getModelDescription(Locale locale) { return new ModelNode(); } }); }
/** * Returns a ManagementResourceRegistration's Factory that will use the specified {@code processType} * to determine whether resource metrics are registered or not. * * If the {@code processType} id {@code null}, metrics are <em>always</em> registered. * * @param processType can be {@code null} * @return a Factory which creates ManagementResourceRegistration that * dynamically determine whether resource metrics are actually registered */ public static Factory forProcessType(ProcessType processType) { return new Factory(processType); }
/** * Create a new root model node registration. * * @param rootModelDescriptionProvider the model description provider for the root model node * @return the new root model node registration * * @throws SecurityException if the caller does not have {@link ImmutableManagementResourceRegistration#ACCESS_PERMISSION} */ public static ManagementResourceRegistration create(final DescriptionProvider rootModelDescriptionProvider) { return create(rootModelDescriptionProvider, null); }
/** * Create a new root model node registration. * * @param resourceDefinition the facotry for the model description provider for the root model node * @return the new root model node registration * * @throws SecurityException if the caller does not have {@link ImmutableManagementResourceRegistration#ACCESS_PERMISSION} */ public ManagementResourceRegistration createRegistration(final ResourceDefinition resourceDefinition) { return createRegistration(resourceDefinition, null, null); }
/** * Returns a ManagementResourceRegistration's Factory that will use the specified {@code processType} * to determine whether resource metrics are registered or not. * * If the {@code processType} id {@code null}, metrics are <em>always</em> registered. * * @param processType can be {@code null} * @return a Factory which creates ManagementResourceRegistration that * dynamically determine whether resource metrics are actually registered */ public static Factory forProcessType(ProcessType processType) { return new Factory(processType); }
private ManagementResourceRegistration getDummyRegistration() { return ManagementResourceRegistration.Factory.create(new DescriptionProvider() { @Override public ModelNode getModelDescription(Locale locale) { return new ModelNode(); } }); }