[
https://issues.jboss.org/browse/WFCORE-731?page=com.atlassian.jira.plugin...
]
Radoslav Husar edited comment on WFCORE-731 at 6/4/15 8:22 PM:
---------------------------------------------------------------
Thanks, this is uderstood and this is what I am doing. The only difference is whether im
transforming a map operation or any other operation:
{code:java}org.jboss.as.controller.transform.OperationTransformer
clearPropertiesTransformer = new org.jboss.as.controller.transform.OperationTransformer()
{
@Override
public TransformedOperation transformOperation(TransformationContext context,
PathAddress address, ModelNode operation) throws OperationFailedException {
PropertiesAttachment attachment =
context.getAttachment(PropertiesAttachment.KEY);
return new TransformedOperation(operation,
OperationResultTransformer.ORIGINAL_RESULT);
}
};
// attachment = null
builder.addRawOperationTransformationOverride(MapOperations.MAP_CLEAR_DEFINITION.getName(),
clearPropertiesTransformer);
// attachment OK
builder.addRawOperationTransformationOverride("undefine-attribute",
clearPropertiesTransformer);
{code}
Thus, the attachment is grabbed *before* the the operation created the attachment.
was (Author: rhusar):
Thanks, this is uderstood and this is what I am doing I believe. The only difference is
whether im transforming a map operation or any other operation:
{code:java}org.jboss.as.controller.transform.OperationTransformer
clearPropertiesTransformer = new org.jboss.as.controller.transform.OperationTransformer()
{
@Override
public TransformedOperation transformOperation(TransformationContext context,
PathAddress address, ModelNode operation) throws OperationFailedException {
PropertiesAttachment attachment =
context.getAttachment(PropertiesAttachment.KEY);
return new TransformedOperation(operation,
OperationResultTransformer.ORIGINAL_RESULT);
}
};
// attachment = null
builder.addRawOperationTransformationOverride(MapOperations.MAP_CLEAR_DEFINITION.getName(),
clearPropertiesTransformer);
// attachment OK
builder.addRawOperationTransformationOverride("undefine-attribute",
clearPropertiesTransformer);
{code}
TransformerAttachmentGrabber always returns null with map operations
--------------------------------------------------------------------
Key: WFCORE-731
URL:
https://issues.jboss.org/browse/WFCORE-731
Project: WildFly Core
Issue Type: Bug
Affects Versions: 2.0.0.Alpha3
Reporter: Radoslav Husar
Assignee: Kabir Khan
Fix For: 2.0.0.Alpha4
Kabir, this thing seems a bit fragile. IIUC this was deviced primarily to address the
issue with map operations not being transformable, but
org.jboss.as.subsystem.test.TransformerAttachmentGrabber doesn't work with map
operations, the attachment is always null.
I think the problem is with the step order, in
org.jboss.as.subsystem.test.TransformerAttachmentGrabber#execute because the real op being
a map operation which does attach(...) happens after the attachment is grabbed, that map
ops are runtime only
org.jboss.as.controller.operations.global.MapOperations#MAP_CLEAR_DEFINITION
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)