private List<PathElement> getChildren(Resource resource) {
   final List<PathElement> pes = new ArrayList<PathElement>();
   for (String childType : resource.getChildTypes()) {
     for (Resource.ResourceEntry entry : resource.getChildren(childType)) {
       pes.add(entry.getPathElement());
     }
   }
   return pes;
 }
Ejemplo n.º 2
0
 private static void transformModulesToAttributes(
     final PathAddress address,
     final String newName,
     final String oldName,
     final TransformationContext context,
     final ModelNode model) {
   ModelNode modules = model.get(oldName).setEmptyList();
   for (Resource.ResourceEntry entry :
       context.readResourceFromRoot(address).getChildren(newName)) {
     Resource moduleResource =
         context.readResourceFromRoot(address.append(entry.getPathElement()));
     modules.add(moduleResource.getModel());
   }
 }
 void hack(final Resource rootResource, final String type) {
   rootResource.registerChild(PathElement.pathElement(type, "hack"), Resource.Factory.create());
   for (Resource.ResourceEntry entry : rootResource.getChildren(type)) {
     rootResource.removeChild(entry.getPathElement());
   }
 }