use of org.wildfly.swarm.spi.api.annotations.MarshalDMR in project wildfly-swarm by wildfly-swarm.
the class SubsystemMarshaller method marshal.
public void marshal(List<ModelNode> list) {
for (Fraction each : this.fractions) {
MarshalDMR anno = each.getClass().getAnnotation(MarshalDMR.class);
if (anno != null) {
try {
try (AutoCloseable handle = Performance.time("marshall " + each.getClass().getSimpleName())) {
LinkedList<ModelNode> subList = Marshaller.marshal(each);
if (!isAlreadyConfigured(subList, list)) {
list.addAll(subList);
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
} else {
WildFlySubsystem subsysAnno = each.getClass().getAnnotation(WildFlySubsystem.class);
if (subsysAnno != null) {
PathAddress address = PathAddress.pathAddress(PathElement.pathElement(SUBSYSTEM, subsysAnno.value()));
if (!isAlreadyConfigured(address.toModelNode(), list)) {
ModelNode node = new ModelNode();
node.get(OP_ADDR).set(address.toModelNode());
node.get(OP).set(ADD);
list.add(node);
}
}
}
}
}
Aggregations