-
1. Re: How to persist the attribute value change when setting in the subsystem
ctomc Mar 30, 2015 10:39 AM (in response to zhfeng)What is idea behind this? you want to calculate unique id only once if not changed and save that value?
Or would it be fine if you would just calculate the new unique id every boot?
-
2. Re: How to persist the attribute value change when setting in the subsystem
zhfeng Mar 30, 2015 12:31 PM (in response to ctomc)I just want to calculate the node id when it's not defined in the standalone.xml and save the value. It does not need to calculate it every boot.
currently the default value of node id is "1" and I have to remove the default value in my changes
public static final SimpleAttributeDefinition NODE_IDENTIFIER = new SimpleAttributeDefinitionBuilder(CommonAttributes.NODE_IDENTIFIER, ModelType.STRING, true)
- .setDefaultValue(new ModelNode().set("1"))
now the problem is how to persist and save the new calculate value in the configuration file. I tried the following codes
ModelNode node = model.get(TransactionSubsystemRootResourceDefinition.NODE_IDENTIFIER.getName()); if (!node.isDefined()) { UUID uuid = UUID.randomUUID(); node.set(new ModelNode().set(uuid.toString().substring(0, 23))); }
It works fine to change the value at the run time but the new value does not persist in the configuration file.
Thanks,
Amos
-
3. Re: How to persist the attribute value change when setting in the subsystem
zhfeng Mar 31, 2015 10:56 AM (in response to zhfeng)if I just copy a war to the deployment directory, the new node identifier value will be persisted in the standalone.xml after shutdown the server.