static TransformersSubRegistration registerTransformers(TransformersSubRegistration parent) { TransformersSubRegistration policy = parent.registerSubResource(SASL_POLICY_CONFIG_PATH); RejectExpressionValuesTransformer rejectExpression = new RejectExpressionValuesTransformer(FORWARD_SECRECY, NO_ACTIVE, NO_ANONYMOUS, NO_DICTIONARY, NO_PLAIN_TEXT, PASS_CREDENTIALS); policy.registerOperationTransformer(ADD, rejectExpression); policy.registerOperationTransformer(WRITE_ATTRIBUTE_OPERATION, rejectExpression.getWriteAttributeTransformer()); return policy; } }
private static TransformersSubRegistration getTransformersSubRegistration(TransformationDescription description, TransformersSubRegistration subRegistration) { for (final Map.Entry<String, OperationTransformer> entry : description.getOperationTransformers().entrySet()) { subRegistration.registerOperationTransformer(entry.getKey(), entry.getValue()); } for (final TransformationDescription child : description.getChildren()) { register(child, subRegistration); } subRegistration.discardOperations(description.getDiscardedOperations().toArray(new String[description.getDiscardedOperations().size()])); return subRegistration; }
TransformersSubRegistration expressions = transformers.registerSubResource(ExposeModelResourceExpression.INSTANCE.getPathElement()); expressions.discardOperations(ADD, REMOVE, WRITE_ATTRIBUTE_OPERATION, READ_ATTRIBUTE_OPERATION); TransformersSubRegistration resolved = transformers.registerSubResource(ExposeModelResourceResolved.INSTANCE.getPathElement()); resolved.discardOperations(WRITE_ATTRIBUTE_OPERATION); resolved.registerOperationTransformer(ADD, new AbstractOperationTransformer() { @Override protected ModelNode transform(TransformationContext context, PathAddress address, ModelNode operation) { resolved.registerOperationTransformer(REMOVE, new AbstractOperationTransformer() { @Override protected ModelNode transform(TransformationContext context, PathAddress address, ModelNode operation) { resolved.registerOperationTransformer(READ_ATTRIBUTE_OPERATION, new OperationTransformer() { TransformersSubRegistration remoting = transformers.registerSubResource(RemotingConnectorResource.REMOTE_CONNECTOR_CONFIG_PATH, (ResourceTransformer) rejectTransformer); remoting.registerOperationTransformer(ADD, rejectTransformer); remoting.registerOperationTransformer(WRITE_ATTRIBUTE_OPERATION, rejectTransformer.getWriteAttributeTransformer());
static void registerTransformers120(TransformersSubRegistration parent) { TransformersSubRegistration reg = parent.registerSubResource(SocketBindingGroupResourceDefinition.PATH, ResourceTransformer.DEFAULT); SocketBindingTransformers.registerTransformers(reg); } }
/** * Register a transformation description as a sub-resource at a given {@linkplain TransformersSubRegistration}. * * @param description the transformation description. * @param parent the parent registration * @return the created sub registration */ public static TransformersSubRegistration register(final TransformationDescription description, TransformersSubRegistration parent) { final TransformersSubRegistration registration = parent.registerSubResource( description.getPath(), description.getPathAddressTransformer(), description.getResourceTransformer(), description.getOperationTransformer(), description.isInherited()); for (final Map.Entry<String, OperationTransformer> entry : description.getOperationTransformers().entrySet()) { registration.registerOperationTransformer(entry.getKey(), entry.getValue()); } registration.discardOperations(description.getDiscardedOperations().toArray(new String[description.getDiscardedOperations().size()])); for (final TransformationDescription child : description.getChildren()) { register(child, registration); } return registration; }
static void registerTransformers120(TransformersSubRegistration parent) { parent.registerSubResource(PathElement.pathElement(DEPLOYMENT), AddNameFromAddressResourceTransformer.INSTANCE); }
/** * Register a transformation description as a sub-resource at a given {@linkplain TransformersSubRegistration}. * * @param description the transformation description. * @param parent the parent registration * @return the created sub registration */ public static TransformersSubRegistration register(final TransformationDescription description, TransformersSubRegistration parent) { final TransformersSubRegistration registration = parent.registerSubResource( description.getPath(), description.getPathAddressTransformer(), description.getResourceTransformer(), description.getOperationTransformer(), description.isInherited()); for (final Map.Entry<String, OperationTransformer> entry : description.getOperationTransformers().entrySet()) { registration.registerOperationTransformer(entry.getKey(), entry.getValue()); } registration.discardOperations(description.getDiscardedOperations().toArray(new String[description.getDiscardedOperations().size()])); for (final TransformationDescription child : description.getChildren()) { register(child, registration); } return registration; }
static TransformersSubRegistration registerTransformers(TransformersSubRegistration parent) { TransformersSubRegistration property = parent.registerSubResource(PropertyResource.PATH); RejectExpressionValuesTransformer rejectPropertyExpression = new RejectExpressionValuesTransformer(PropertyResource.VALUE); property.registerOperationTransformer(ADD, rejectPropertyExpression); property.registerOperationTransformer(WRITE_ATTRIBUTE_OPERATION, rejectPropertyExpression.getWriteAttributeTransformer()); return property; } }
private static TransformersSubRegistration getTransformersSubRegistration(TransformationDescription description, TransformersSubRegistration subRegistration) { for (final Map.Entry<String, OperationTransformer> entry : description.getOperationTransformers().entrySet()) { subRegistration.registerOperationTransformer(entry.getKey(), entry.getValue()); } for (final TransformationDescription child : description.getChildren()) { register(child, subRegistration); } subRegistration.discardOperations(description.getDiscardedOperations().toArray(new String[description.getDiscardedOperations().size()])); return subRegistration; }
private static void initializeDomainRegistry(TransformerRegistry registry, ModelVersion modelVersion) { TransformersSubRegistration domain = registry.getDomainRegistration(modelVersion); if (modelVersion == VERSION_1_2 || modelVersion == VERSION_1_3) { // Discard all operations to the newly introduced jsf extension domain.registerSubResource(JSF_EXTENSION, IGNORED_EXTENSIONS); JSFSubsystemTransformers.registerTransformers120(registry, domain); PathsTransformers.registerTransformers120(domain); DeploymentTransformers.registerTransformers120(domain); SystemPropertyTransformers.registerTransformers120(domain); SocketBindingGroupTransformers.registerTransformers120(domain); ServerGroupTransformers.registerTransformers120(domain); //Add the domain interface and path name. This is from a read attribute handler but in < 1.4.0 it existed in the model domain.registerSubResource(PathElement.pathElement(INTERFACE), AddNameFromAddressResourceTransformer.INSTANCE); domain.registerSubResource(PathElement.pathElement(PATH), AddNameFromAddressResourceTransformer.INSTANCE); } else if (modelVersion == VERSION_1_4) { //TODO not sure if these should be handled here for 1.4.0 or if it is better in the tests? //Add the domain interface name. This is currently from a read attribute handler but in < 1.4.0 it existed in the model domain.registerSubResource(PathElement.pathElement(INTERFACE), AddNameFromAddressResourceTransformer.INSTANCE); domain.registerSubResource(PathElement.pathElement(PATH), AddNameFromAddressResourceTransformer.INSTANCE); } }
/** * Register a transformation description as a sub-resource at a given {@linkplain TransformersSubRegistration}. * * @param description the transformation description. * @param parent the parent registration * @return the created sub registration */ public static TransformersSubRegistration register(final TransformationDescription description, TransformersSubRegistration parent) { final TransformersSubRegistration registration; if (description.getPath() == null) { //root registration registration = parent; } else { registration = parent.registerSubResource( description.getPath(), description.getPathAddressTransformer(), description.getResourceTransformer(), description.getOperationTransformer(), description.isInherited(), description.isPlaceHolder()); } for (final Map.Entry<String, OperationTransformer> entry : description.getOperationTransformers().entrySet()) { registration.registerOperationTransformer(entry.getKey(), entry.getValue()); } registration.discardOperations(description.getDiscardedOperations().toArray(new String[description.getDiscardedOperations().size()])); for (final TransformationDescription child : description.getChildren()) { register(child, registration); } return registration; }
static void registerTransformers120(TransformersSubRegistration parent) { TransformersSubRegistration reg = parent.registerSubResource(JvmResourceDefinition.GLOBAL.getPathElement(), ResourceTransformer.DEFAULT); RejectExpressionValuesTransformer rejectExpression = new RejectExpressionValuesTransformer(AGENT_PATH, HEAP_SIZE, JAVA_HOME, MAX_HEAP_SIZE, PERMGEN_SIZE, MAX_PERMGEN_SIZE, STACK_SIZE, OPTIONS, ENVIRONMENT_VARIABLES, ENV_CLASSPATH_IGNORED, AGENT_LIB, JAVA_AGENT); reg.registerOperationTransformer(ADD, rejectExpression); reg.registerOperationTransformer(WRITE_ATTRIBUTE_OPERATION, rejectExpression.getWriteAttributeTransformer()); }
/** * Register a transformation description as a sub-resource at a given {@linkplain SubsystemRegistration}. * * @param description the subsystem transformation description * @param registration the subsystem registrations * @param range the model version range the transformation applies to * @return the create sub registration */ public static TransformersSubRegistration register(TransformationDescription description, SubsystemRegistration registration, ModelVersionRange range) { final TransformersSubRegistration subRegistration = registration.registerModelTransformers(range, description.getResourceTransformer(), description.getOperationTransformer()); for (final Map.Entry<String, OperationTransformer> entry : description.getOperationTransformers().entrySet()) { subRegistration.registerOperationTransformer(entry.getKey(), entry.getValue()); } for (final TransformationDescription child : description.getChildren()) { register(child, subRegistration); } subRegistration.discardOperations(description.getDiscardedOperations().toArray(new String[description.getDiscardedOperations().size()])); return subRegistration; }
/** * {@inheritDoc} */ @Override public void initialize(ExtensionContext context) { final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, MANAGEMENT_API_MAJOR_VERSION, MANAGEMENT_API_MINOR_VERSION, MANAGEMENT_API_MICRO_VERSION); final ManagementResourceRegistration registration = subsystem.registerSubsystemModel(NamingSubsystemRootResourceDefinition.INSTANCE); 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(NamingSubsystem13Parser.INSTANCE); if (context.isRegisterTransformers()) { // register 1.1.0 transformer final TransformersSubRegistration transformersSubRegistration110 = subsystem.registerModelTransformers(VERSION_1_1_0, ResourceTransformer.DEFAULT); transformersSubRegistration110.registerSubResource(NamingSubsystemModel.BINDING_PATH,new Naming11Transformer()); } }
/** * Register a transformation description as a sub-resource at a given {@linkplain TransformersSubRegistration}. * * @param description the transformation description. * @param parent the parent registration * @return the created sub registration */ public static TransformersSubRegistration register(final TransformationDescription description, TransformersSubRegistration parent) { final TransformersSubRegistration registration; if (description.getPath() == null) { //root registration registration = parent; } else { registration = parent.registerSubResource( description.getPath(), description.getPathAddressTransformer(), description.getResourceTransformer(), description.getOperationTransformer(), description.isInherited(), description.isPlaceHolder()); } for (final Map.Entry<String, OperationTransformer> entry : description.getOperationTransformers().entrySet()) { registration.registerOperationTransformer(entry.getKey(), entry.getValue()); } registration.discardOperations(description.getDiscardedOperations().toArray(new String[description.getDiscardedOperations().size()])); for (final TransformationDescription child : description.getChildren()) { register(child, registration); } return registration; }
/** * Register the transformers for older model versions. * * @param subsystem the subsystems registration */ private static void registerTransformers(final SubsystemRegistration subsystem) { // Transformations to the 1.1.0 Model // - we need to reject expressions for transport (and similarly for protocol properties) for these operations // transport=TRANSPORT/property=<name>:add(value=<value>) // transport=TRANSPORT/property=<name>:write-attribute(name=value, value=<value>) // transport=TRANSPORT:add(...,properties=<list of properties>) final ModelVersion version110 = ModelVersion.create(1, 1, 0); final RejectExpressionValuesTransformer TRANSFORMER = new RejectExpressionValuesTransformer(PropertyResource.VALUE, TransportResource.PROPERTIES, ProtocolResource.PROPERTIES, TransportResource.SHARED); final TransformersSubRegistration registration = subsystem.registerModelTransformers(version110, ResourceTransformer.DEFAULT); final TransformersSubRegistration stack = registration.registerSubResource(StackResource.STACK_PATH); // reject expressions for transport properties, for the add and write-attribute op final TransformersSubRegistration transport = stack.registerSubResource(TransportResource.TRANSPORT_PATH, (ResourceTransformer)TRANSFORMER) ; transport.registerOperationTransformer(ADD, TRANSFORMER); transport.registerOperationTransformer(WRITE_ATTRIBUTE_OPERATION, TRANSFORMER.getWriteAttributeTransformer()); final TransformersSubRegistration transport_property = transport.registerSubResource(PropertyResource.PROPERTY_PATH) ; transport_property.registerOperationTransformer(ADD, TRANSFORMER); transport_property.registerOperationTransformer(WRITE_ATTRIBUTE_OPERATION, TRANSFORMER.getWriteAttributeTransformer()); // reject expressions for transport properties, for the add and write-attribute op final TransformersSubRegistration protocol = stack.registerSubResource(ProtocolResource.PROTOCOL_PATH, (ResourceTransformer)TRANSFORMER) ; protocol.registerOperationTransformer(ADD, TRANSFORMER); final TransformersSubRegistration protocol_property = protocol.registerSubResource(PropertyResource.PROPERTY_PATH) ; protocol_property.registerOperationTransformer(ADD, TRANSFORMER); protocol_property.registerOperationTransformer(WRITE_ATTRIBUTE_OPERATION, TRANSFORMER.getWriteAttributeTransformer()); }
/** * Register a transformation description as a sub-resource at a given {@linkplain SubsystemRegistration}. * * @param description the subsystem transformation description * @param registration the subsystem registrations * @param range the model version range the transformation applies to * @return the create sub registration */ public static TransformersSubRegistration register(TransformationDescription description, SubsystemRegistration registration, ModelVersionRange range) { final TransformersSubRegistration subRegistration = registration.registerModelTransformers(range, description.getResourceTransformer(), description.getOperationTransformer()); for (final Map.Entry<String, OperationTransformer> entry : description.getOperationTransformers().entrySet()) { subRegistration.registerOperationTransformer(entry.getKey(), entry.getValue()); } for (final TransformationDescription child : description.getChildren()) { register(child, subRegistration); } subRegistration.discardOperations(description.getDiscardedOperations().toArray(new String[description.getDiscardedOperations().size()])); return subRegistration; }
static TransformersSubRegistration registerTransformers(TransformersSubRegistration parent) { TransformersSubRegistration sasl = parent.registerSubResource(SASL_CONFIG_PATH); RejectExpressionValuesTransformer rejectPropertyExpression = new RejectExpressionValuesTransformer(SERVER_AUTH_ATTRIBUTE, REUSE_SESSION_ATTRIBUTE); sasl.registerOperationTransformer(ADD, rejectPropertyExpression); sasl.registerOperationTransformer(WRITE_ATTRIBUTE_OPERATION, rejectPropertyExpression.getWriteAttributeTransformer()); SaslPolicyResourceTransformers.registerTransformers(sasl); PropertyResourceTransformers.registerTransformers(sasl); return sasl; } }
private void registerTransformers_1_1(SubsystemRegistration registration) { RejectExpressionValuesTransformer rejectExpression = new RejectExpressionValuesTransformer(RemotingSubsystemRootResource.ATTRIBUTES); final TransformersSubRegistration subsystem = registration.registerModelTransformers(VERSION_1_1, rejectExpression); subsystem.registerOperationTransformer(ADD, rejectExpression); subsystem.registerOperationTransformer(WRITE_ATTRIBUTE_OPERATION, rejectExpression.getWriteAttributeTransformer()); TransformersSubRegistration connector = subsystem.registerSubResource(ConnectorResource.PATH); PropertyResourceTransformers.registerTransformers(connector); SaslResourceTransformers.registerTransformers(connector); TransformersSubRegistration remoteOutboundConnection = subsystem.registerSubResource(RemoteOutboundConnectionResourceDefinition.ADDRESS); RejectExpressionValuesTransformer rejectUserNameExpression = new RejectExpressionValuesTransformer(RemoteOutboundConnectionResourceDefinition.USERNAME); remoteOutboundConnection.registerOperationTransformer(ADD, rejectUserNameExpression); remoteOutboundConnection.registerOperationTransformer(WRITE_ATTRIBUTE_OPERATION, rejectUserNameExpression.getWriteAttributeTransformer()); PropertyResourceTransformers.registerTransformers(remoteOutboundConnection); TransformersSubRegistration localOutboundConnection = subsystem.registerSubResource(LocalOutboundConnectionResourceDefinition.ADDRESS); PropertyResourceTransformers.registerTransformers(localOutboundConnection); TransformersSubRegistration outboundConnection = subsystem.registerSubResource(GenericOutboundConnectionResourceDefinition.ADDRESS); PropertyResourceTransformers.registerTransformers(outboundConnection); }
TransformersSubRegistration jsfSubsystem = parent.registerSubResource(PathElement.pathElement(SUBSYSTEM, JSF_SUBSYSTEM)); jsfSubsystem.registerOperationTransformer(ADD, new OperationTransformer() { jsfSubsystem.registerOperationTransformer(WRITE_ATTRIBUTE_OPERATION, new OperationTransformer() { @Override public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) throws OperationFailedException { jsfSubsystem.registerOperationTransformer(UNDEFINE_ATTRIBUTE_OPERATION, new OperationTransformer() { @Override public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) throws OperationFailedException {