DataSchemaContainerProxy(final Set<DataSchemaNode> realChildSchema) { realChildSchemas = realChildSchema; mappedChildSchemas = new HashMap<>(); for (DataSchemaNode schema : realChildSchemas) { mappedChildSchemas.put(schema.getQName(), schema); } }
/** * Set the associated attributes. * * @param attributes parsed attributes */ public final void setAttributes(final Map<QName, String> attributes) { checkState(this.attributes == null, "Node '%s' has already set its attributes to %s.", getSchema().getQName(), this.attributes); this.attributes = attributes; }
private static void checkUniqueRuntimeBeansGeneratedClasses(final Map<String, QName> uniqueGeneratedClassesNames, final DataSchemaNode when, final Collection<RuntimeBeanEntry> runtimeBeans) { for (RuntimeBeanEntry runtimeBean : runtimeBeans) { final String javaNameOfRuntimeMXBean = runtimeBean.getJavaNameOfRuntimeMXBean(); if (uniqueGeneratedClassesNames.containsKey(javaNameOfRuntimeMXBean)) { QName firstDefinedQName = uniqueGeneratedClassesNames.get(javaNameOfRuntimeMXBean); throw new NameConflictException(javaNameOfRuntimeMXBean, firstDefinedQName, when.getQName()); } uniqueGeneratedClassesNames.put(javaNameOfRuntimeMXBean, when.getQName()); } }
@Override public boolean apply(final DataSchemaNode node) { return Objects.equal(node.getQName().getLocalName(), name); } };
@Override public boolean apply(final DataSchemaNode node) { return Objects.equal(node.getQName().getNamespace(), namespace); } };
public static AugmentationIdentifier augmentationIdentifierFrom(final AugmentationSchemaNode augmentation) { final ImmutableSet.Builder<QName> potentialChildren = ImmutableSet.builder(); for (final DataSchemaNode child : augmentation.getChildNodes()) { potentialChildren.add(child.getQName()); } return new AugmentationIdentifier(potentialChildren.build()); }
public static Set<DataSchemaNode> getRealSchemasForAugment(final DataNodeContainer targetSchema, final AugmentationSchemaNode augmentSchema) { final Set<DataSchemaNode> realChildNodes = new HashSet<>(); for (final DataSchemaNode dataSchemaNode : augmentSchema.getChildNodes()) { final DataSchemaNode realChild = targetSchema.getDataChildByName(dataSchemaNode.getQName()); realChildNodes.add(realChild); } return realChildNodes; }
private AugmentationIdentifier getAugmentationIdentifier(final AugmentationSchema augment) { final Set<QName> childNames = new HashSet<>(); for (final DataSchemaNode child : augment.getChildNodes()) { childNames.add(child.getQName()); } return new AugmentationIdentifier(childNames); }
private static boolean isFromAugment(final DataNodeContainer schema, final DataSchemaNode childSchema) { if (!(schema instanceof AugmentationTarget)) { return false; } for (final AugmentationSchemaNode augmentation : ((AugmentationTarget) schema).getAvailableAugmentations()) { if (augmentation.getDataChildByName(childSchema.getQName()) != null) { return true; } } return false; }
@Override public ImmutableMap<String, AnyxmlNodeCodecContext<?>> getAnyxmlNodes(final Class<?> parentClass, final DataNodeContainer childSchema) { final Map<String, DataSchemaNode> getterToAnyxmlSchema = new HashMap<>(); for (final DataSchemaNode anyxml : childSchema.getChildNodes()) { if (anyxml instanceof AnyXmlSchemaNode) { getterToAnyxmlSchema.put(getGetterName(anyxml.getQName(), false), anyxml); } } return getAnyxmlNodesUsingReflection(parentClass, getterToAnyxmlSchema); }
private static DataNodeContainer augmentationProxy(final AugmentationSchemaNode augmentation, final DataNodeContainer schema) { final Set<DataSchemaNode> children = new HashSet<>(); for (final DataSchemaNode augNode : augmentation.getChildNodes()) { children.add(schema.getDataChildByName(augNode.getQName())); } return new EffectiveAugmentationSchema(augmentation, children); }
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <T extends DataSchemaNode> DataContainerCodecPrototype<T> from(final Class<?> cls, final T schema, final CodecContextFactory factory) { return new DataContainerCodecPrototype(cls, NodeIdentifier.create(schema.getQName()), schema, factory); }
private static AugmentationSchema findCorrespondingAugment(final DataSchemaNode parent, final DataSchemaNode child) { if (parent instanceof AugmentationTarget && !(parent instanceof ChoiceSchemaNode)) { for (final AugmentationSchema augmentation : ((AugmentationTarget) parent).getAvailableAugmentations()) { final DataSchemaNode childInAugmentation = augmentation.getDataChildByName(child.getQName()); if (childInAugmentation != null) { return augmentation; } } } return null; } }
private void setValue(final AbstractNodeDataWithSchema parent, final String value) { checkArgument(parent instanceof SimpleNodeDataWithSchema, "Node %s is not a simple type", parent.getSchema().getQName()); final SimpleNodeDataWithSchema parentSimpleNode = (SimpleNodeDataWithSchema) parent; checkArgument(parentSimpleNode.getValue() == null, "Node '%s' has already set its value to '%s'", parentSimpleNode.getSchema().getQName(), parentSimpleNode.getValue()); final Object translatedValue = translateValueByType(value, parentSimpleNode.getSchema()); parentSimpleNode.setValue(translatedValue); }
public static SchemaAwareApplyOperation from(final DataNodeContainer resolvedTree, final AugmentationTarget augSchemas, final AugmentationIdentifier identifier, final DataTreeConfiguration treeConfig) { for (final AugmentationSchemaNode potential : augSchemas.getAvailableAugmentations()) { for (final DataSchemaNode child : potential.getChildNodes()) { if (identifier.getPossibleChildNames().contains(child.getQName())) { return new AugmentationModificationStrategy(potential, resolvedTree, treeConfig); } } } return null; }
public static SchemaAwareApplyOperation from(final DataNodeContainer resolvedTree, final AugmentationTarget augSchemas, final AugmentationIdentifier identifier, final DataTreeConfiguration treeConfig) { for (final AugmentationSchemaNode potential : augSchemas.getAvailableAugmentations()) { for (final DataSchemaNode child : potential.getChildNodes()) { if (identifier.getPossibleChildNames().contains(child.getQName())) { return new AugmentationModificationStrategy(potential, resolvedTree, treeConfig); } } } return null; }
@Override public void addChild(final AbstractNodeDataWithSchema newChild) { if (predicateTemplate != null) { final DataSchemaNode childSchema = newChild.getSchema(); if (childSchema instanceof LeafSchemaNode) { populateKeyValue(childSchema.getQName(), newChild); } } super.addChild(newChild); }
public static RpcRoutingStrategy from(final RpcDefinition rpc) { ContainerSchemaNode input = rpc.getInput(); if (input != null) { for (DataSchemaNode schemaNode : input.getChildNodes()) { Optional<QName> context = getRoutingContext(schemaNode); if (context.isPresent()) { return new RoutedRpcStrategy(rpc.getQName(), context.get(), schemaNode.getQName()); } } } return new GlobalRpcStrategy(rpc.getQName()); }
public static RpcRoutingStrategy from(final RpcDefinition rpc) { for (DataSchemaNode schemaNode : rpc.getInput().getChildNodes()) { Optional<QName> context = getRoutingContext(schemaNode); if (context.isPresent()) { return new RoutedRpcStrategy(rpc.getQName(), context.get(), schemaNode.getQName()); } } return new GlobalRpcStrategy(rpc.getQName()); }
@Override public void leafSetEntryNode(final Object value) throws IOException { LeafNodeCodecContext<?> ctx = (LeafNodeCodecContext<?>) current(); getDelegate().leafSetEntryNode(ctx.getSchema().getQName(), ctx.getValueCodec().serialize(value)); }