[
https://issues.jboss.org/browse/WFCORE-731?page=com.atlassian.jira.plugin...
]
Kabir Khan commented on WFCORE-731:
-----------------------------------
KernelServices.executeAndGrabTransformerAttachment() and TransformerAttachmentGrabber are
only for the subsystem tests, in order to be able to get hold of the attachment and pass
that into the KernelServices.transformOperation() method. This is IIRC because in the test
framework operations on the main controller and transformation are two separate steps.
While in the real world a write would cause transformation to happen and be pushed to the
servers.
I believe all you need to do is to overwrite the **standard** write handler for your
attribute(s) which is where any map operation will end up.
{code}
class MyClusteringAttributeWriteHandler extends AbstractWriteAttributeHandler<Void>
{
....
@Override
protected void finishModelStage(OperationContext context, ModelNode operation,
String attributeName, ModelNode newValue, ModelNode oldValue, Resource model) throws
OperationFailedException {
super.finishModelStage(context, operation, attributeName, newValue, oldValue,
model);
if (!context.isBooting()) {
TransformerOperationAttachment attachment =
TransformerOperationAttachment.getOrCreate(context);
//Figure out what changed, and set in the TOA
attachment.attachIfAbsent(MyClusteringAttachment.KEY, new
MyClusteringAttachment(....));
}
}
{code}
When figuring out what changed 'oldValue' should be the map before the write
attribute takes place, 'newValue' should be the map with the write attribute
taking place.
Of course there may be problems, so please provide more details if there are.
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)