private void addOrderedChildTypeInfo(OperationContext context, Resource resource, ModelNode operation) { OrderedChildTypesAttachment attachment = context.getAttachment(OrderedChildTypesAttachment.KEY); if (attachment != null) { attachment.addOrderedChildResourceTypes(PathAddress.pathAddress(operation.get(OP_ADDR)), resource); } }
Node getOrCreate(final PathElement element, final Iterator<PathElement> i, PathAddress current, OrderedChildTypesAttachment orderedChildTypesAttachment) { if (i.hasNext()) { final PathElement next = i.next(); final PathAddress addr = current.append(next); Map<PathElement, Node> children = childrenByType.get(next.getKey()); if (children == null) { children = new LinkedHashMap<PathElement, SyncModelOperationHandler.Node>(); childrenByType.put(next.getKey(), children); } Node node = children.get(next); if (node == null) { node = new Node(next, addr); children.put(next, node); Set<String> orderedChildTypes = orderedChildTypesAttachment.getOrderedChildTypes(addr); if (orderedChildTypes != null) { node.orderedChildTypes.addAll(orderedChildTypes); } } return node.getOrCreate(next, i, addr, orderedChildTypesAttachment); } else if (element == null) { throw new IllegalStateException(); } else { if (address.equals(current)) { return this; } else { throw new IllegalStateException(current.toString()); } } }
final OrderedChildTypesAttachment orderedChildTypesAttachment = new OrderedChildTypesAttachment(); final ReadMasterDomainOperationsHandler readOperationHandler = new ReadMasterDomainOperationsHandler(); final ModelNode localOperations = operationExecutor.executeReadOnly(OPERATION, transformedResource, readOperationHandler, ModelController.OperationTransactionControl.COMMIT);
Node getOrCreate(final PathElement element, final Iterator<PathElement> i, PathAddress current, OrderedChildTypesAttachment orderedChildTypesAttachment) { if (i.hasNext()) { final PathElement next = i.next(); final PathAddress addr = current.append(next); Map<PathElement, Node> children = childrenByType.get(next.getKey()); if (children == null) { children = new LinkedHashMap<PathElement, SyncModelOperationHandler.Node>(); childrenByType.put(next.getKey(), children); } Node node = children.get(next); if (node == null) { node = new Node(next, addr); children.put(next, node); Set<String> orderedChildTypes = orderedChildTypesAttachment.getOrderedChildTypes(addr); if (orderedChildTypes != null) { node.orderedChildTypes.addAll(orderedChildTypes); } } return node.getOrCreate(next, i, addr, orderedChildTypesAttachment); } else if (element == null) { throw new IllegalStateException(); } else { if (address.equals(current)) { return this; } else { throw new IllegalStateException(current.toString()); } } }
final OrderedChildTypesAttachment orderedChildTypesAttachment = new OrderedChildTypesAttachment(); final ReadMasterDomainOperationsHandler readOperationHandler = new ReadMasterDomainOperationsHandler(); final ModelNode localOperations = operationExecutor.executeReadOnly(OPERATION, transformedResource, readOperationHandler, ModelController.OperationTransactionControl.COMMIT);
private void addOrderedChildTypeInfo(OperationContext context, Resource resource, ModelNode operation) { OrderedChildTypesAttachment attachment = context.getAttachment(OrderedChildTypesAttachment.KEY); if (attachment != null) { attachment.addOrderedChildResourceTypes(PathAddress.pathAddress(operation.get(OP_ADDR)), resource); } }
protected ModelNode createAddOperation(final OrderedChildTypesAttachment orderedChildTypesAttachment, final ModelNode address, final Resource resource, final Set<PathElement> children) { ModelNode addOp = createAddOperation(address, resource.getModel(), children); if (orderedChildTypesAttachment != null) { orderedChildTypesAttachment.addOrderedChildResourceTypes(PathAddress.pathAddress(address), resource); } return addOp; }
protected ModelNode createAddOperation(final OrderedChildTypesAttachment orderedChildTypesAttachment, final ModelNode address, final Resource resource, final Set<PathElement> children) { ModelNode addOp = createAddOperation(address, resource.getModel(), children); if (orderedChildTypesAttachment != null) { orderedChildTypesAttachment.addOrderedChildResourceTypes(PathAddress.pathAddress(address), resource); } return addOp; }