Search in sources :

Example 1 with PathAddressTransformer

use of org.jboss.as.controller.transform.PathAddressTransformer in project wildfly by wildfly.

the class TimerServiceResourceDefinition method registerDataStoreTransformers.

private static void registerDataStoreTransformers(ResourceTransformationDescriptionBuilder timerService) {
    DataStoreTransformer dataStoreTransformer = new DataStoreTransformer();
    timerService.getAttributeBuilder().setDiscard(DiscardAttributeChecker.ALWAYS, //this is ok, as default-data-store only has any sense with new model, but it is always set!
    EJB3SubsystemModel.DEFAULT_DATA_STORE).end();
    timerService.discardOperations(ModelDescriptionConstants.ADD);
    timerService.setCustomResourceTransformer(dataStoreTransformer);
    timerService.rejectChildResource(EJB3SubsystemModel.DATABASE_DATA_STORE_PATH);
    ResourceTransformationDescriptionBuilder fileDataStore = timerService.addChildRedirection(EJB3SubsystemModel.FILE_DATA_STORE_PATH, new PathAddressTransformer() {

        @Override
        public PathAddress transform(PathElement current, Builder builder) {
            return builder.getCurrent();
        }
    });
    fileDataStore.addOperationTransformationOverride(ModelDescriptionConstants.ADD).inheritResourceAttributeDefinitions().setCustomOperationTransformer(dataStoreTransformer).end();
}
Also used : PathElement(org.jboss.as.controller.PathElement) SimpleAttributeDefinitionBuilder(org.jboss.as.controller.SimpleAttributeDefinitionBuilder) ResourceTransformationDescriptionBuilder(org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder) PathAddress(org.jboss.as.controller.PathAddress) ResourceTransformationDescriptionBuilder(org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder) PathAddressTransformer(org.jboss.as.controller.transform.PathAddressTransformer)

Example 2 with PathAddressTransformer

use of org.jboss.as.controller.transform.PathAddressTransformer in project wildfly by wildfly.

the class BackupsResourceDefinition method buildTransformation.

static void buildTransformation(ModelVersion version, ResourceTransformationDescriptionBuilder parent) {
    PathAddressTransformer addressTransformer = new PathAddressTransformer() {

        @Override
        public PathAddress transform(PathElement current, Builder builder) {
            return builder.next();
        }
    };
    ResourceTransformationDescriptionBuilder builder = InfinispanModel.VERSION_4_0_0.requiresTransformation(version) ? parent.addChildRedirection(PATH, addressTransformer) : parent.addChildResource(PATH);
    BackupResourceDefinition.buildTransformation(version, builder);
}
Also used : PathElement(org.jboss.as.controller.PathElement) ResourceTransformationDescriptionBuilder(org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder) ResourceTransformationDescriptionBuilder(org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder) PathAddressTransformer(org.jboss.as.controller.transform.PathAddressTransformer)

Aggregations

PathElement (org.jboss.as.controller.PathElement)2 PathAddressTransformer (org.jboss.as.controller.transform.PathAddressTransformer)2 ResourceTransformationDescriptionBuilder (org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder)2 PathAddress (org.jboss.as.controller.PathAddress)1 SimpleAttributeDefinitionBuilder (org.jboss.as.controller.SimpleAttributeDefinitionBuilder)1