- /**
- * Creates artificial schema node for schema defined rpc. This artificial schema looks like:
- * <pre>
- * {@code
- * rpc
- * rpc-name
- * // All schema nodes from remote schema
- * rpc-name
- * rpc
- * }
- * </pre>
- *
- * This makes the translation of schema defined rpc request
- * to xml use schema which is crucial for some types of nodes e.g. identity-ref.
- */
- public static DataNodeContainer createSchemaForRpc(final QName rpcName, final SchemaContext schemaContext) {
- Preconditions.checkNotNull(rpcName);
- Preconditions.checkNotNull(schemaContext);
-
- for (final RpcDefinition rpcDefinition : schemaContext.getOperations()) {
- if(rpcDefinition.getQName().equals(rpcName)) {
- final NodeContainerProxy rpcBodyProxy = new NodeContainerProxy(rpcName, rpcDefinition.getInput().getChildNodes());
- return new NodeContainerProxy(NETCONF_RPC_QNAME, Sets.<DataSchemaNode>newHashSet(rpcBodyProxy));
- }
- }
-
- throw new IllegalArgumentException("Rpc " + rpcName + " not found in schema context " + schemaContext + ". Unable to invoke Rpc");
- }
-
- public static CompositeNodeTOImpl wrap(final QName name, final Node<?> node) {
- if (node != null) {
- return new CompositeNodeTOImpl(name, null, Collections.<Node<?>> singletonList(node));
+ if(Iterables.isEmpty(dataPath.getPathArguments())) {
+ Preconditions.checkArgument(lastChildOverride.isPresent(), "Data has to be present when creating structure for top level element");
+ Preconditions.checkArgument(lastChildOverride.get() instanceof DataContainerChild<?, ?>,
+ "Data has to be either container or a list node when creating structure for top level element, but was: %s", lastChildOverride.get());
+ configContent = lastChildOverride.get();