summaryrefslogtreecommitdiffstats
path: root/netconf/restconf/restconf-nb-bierman02/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'netconf/restconf/restconf-nb-bierman02/src/main')
-rw-r--r--netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/md/sal/rest/schema/SchemaExportContentYangBodyWriter.java2
-rw-r--r--netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/md/sal/rest/schema/SchemaExportContentYinBodyWriter.java2
-rw-r--r--netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/DepthAwareNormalizedNodeWriter.java2
-rw-r--r--netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java2
-rw-r--r--netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonToPatchBodyReader.java2
-rw-r--r--netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/RestconfDocumentedExceptionMapper.java20
-rw-r--r--netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlNormalizedNodeBodyReader.java2
-rw-r--r--netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlToPatchBodyReader.java2
-rw-r--r--netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/BrokerFacade.java41
-rw-r--r--netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/ControllerContext.java2
-rw-r--r--netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/JSONRestconfServiceImpl.java4
-rw-r--r--netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java113
-rw-r--r--netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/web/WebInitializer.java15
-rw-r--r--netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/streams/listeners/ListenerAdapter.java4
-rw-r--r--netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/streams/listeners/Notificator.java2
-rw-r--r--netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/DatastoreIdentifierBuilder.java6
-rw-r--r--netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/ModuleRevisionBuilder.java2
-rw-r--r--netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/RevisionBuilder.java9
18 files changed, 116 insertions, 116 deletions
diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/md/sal/rest/schema/SchemaExportContentYangBodyWriter.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/md/sal/rest/schema/SchemaExportContentYangBodyWriter.java
index 679cf02..82442cf 100644
--- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/md/sal/rest/schema/SchemaExportContentYangBodyWriter.java
+++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/md/sal/rest/schema/SchemaExportContentYangBodyWriter.java
@@ -45,7 +45,7 @@ public class SchemaExportContentYangBodyWriter implements MessageBodyWriter<Sche
final MultivaluedMap<String, Object> httpHeaders, final OutputStream entityStream) throws IOException,
WebApplicationException {
final SourceIdentifier sourceId = new SourceIdentifier(context.getModule().getName(),
- context.getModule().getQNameModule().getRevision().get());
+ context.getModule().getQNameModule().getRevision().orElseThrow());
final YangTextSchemaSource yangTextSchemaSource;
try {
yangTextSchemaSource = context.getSourceProvider().getSource(sourceId).get();
diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/md/sal/rest/schema/SchemaExportContentYinBodyWriter.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/md/sal/rest/schema/SchemaExportContentYinBodyWriter.java
index 9f4f8be..5fbb8b3 100644
--- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/md/sal/rest/schema/SchemaExportContentYinBodyWriter.java
+++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/md/sal/rest/schema/SchemaExportContentYinBodyWriter.java
@@ -43,7 +43,7 @@ public class SchemaExportContentYinBodyWriter implements MessageBodyWriter<Schem
final MultivaluedMap<String, Object> httpHeaders, final OutputStream entityStream) throws
WebApplicationException {
try {
- YinExportUtils.writeModuleAsYinText(context.getModule(), entityStream);
+ YinExportUtils.writeModuleAsYinText(context.getModule().asEffectiveStatement(), entityStream);
} catch (final XMLStreamException e) {
throw new IllegalStateException(e);
}
diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/DepthAwareNormalizedNodeWriter.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/DepthAwareNormalizedNodeWriter.java
index b9d7a7a..842fb74 100644
--- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/DepthAwareNormalizedNodeWriter.java
+++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/DepthAwareNormalizedNodeWriter.java
@@ -279,7 +279,7 @@ public class DepthAwareNormalizedNodeWriter implements RestconfNormalizedNodeWri
for (final QName qname : qnames) {
final Optional<? extends NormalizedNode> child = node.findChildByArg(new NodeIdentifier(qname));
if (child.isPresent()) {
- write(child.get());
+ write(child.orElseThrow());
} else {
LOG.info("No child for key element {} found", qname);
}
diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java
index aecea7a..4f02a08 100644
--- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java
+++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java
@@ -125,7 +125,7 @@ public class JsonNormalizedNodeBodyReader
final JsonParserStream jsonParser = JsonParserStream.create(writer,
JSONCodecFactorySupplier.DRAFT_LHOTKA_NETMOD_YANG_JSON_02.getShared(path.getSchemaContext()),
parentInference);
- final JsonReader reader = new JsonReader(new InputStreamReader(nonEmptyInputStreamOptional.get(),
+ final JsonReader reader = new JsonReader(new InputStreamReader(nonEmptyInputStreamOptional.orElseThrow(),
StandardCharsets.UTF_8));
jsonParser.parse(reader);
diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonToPatchBodyReader.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonToPatchBodyReader.java
index ce5a8c4..3fe1233 100644
--- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonToPatchBodyReader.java
+++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonToPatchBodyReader.java
@@ -114,7 +114,7 @@ public class JsonToPatchBodyReader extends AbstractIdentifierAwareJaxRsProvider
return new PatchContext(path, null, null);
}
- final JsonReader jsonReader = new JsonReader(new InputStreamReader(nonEmptyInputStreamOptional.get(),
+ final JsonReader jsonReader = new JsonReader(new InputStreamReader(nonEmptyInputStreamOptional.orElseThrow(),
StandardCharsets.UTF_8));
AtomicReference<String> patchId = new AtomicReference<>();
final List<PatchEntity> resultList = read(jsonReader, path, patchId);
diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/RestconfDocumentedExceptionMapper.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/RestconfDocumentedExceptionMapper.java
index ff0be39..19d93f0 100644
--- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/RestconfDocumentedExceptionMapper.java
+++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/RestconfDocumentedExceptionMapper.java
@@ -54,8 +54,8 @@ import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONNormalizedNodeStreamWriter;
import org.opendaylight.yangtools.yang.data.codec.gson.JsonWriterFactory;
import org.opendaylight.yangtools.yang.data.codec.xml.XMLStreamNormalizedNodeStreamWriter;
+import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
-import org.opendaylight.yangtools.yang.data.impl.schema.SchemaAwareBuilders;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
@@ -123,14 +123,14 @@ public class RestconfDocumentedExceptionMapper implements ExceptionMapper<Restco
final var errorsSchemaNode = errorsEntry.getValue();
final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> errContBuild =
- SchemaAwareBuilders.containerBuilder(errorsSchemaNode);
+ Builders.containerBuilder();
final var schemaList = ControllerContext.findInstanceDataChildrenByName(errorsSchemaNode,
Draft02.RestConfModule.ERROR_LIST_SCHEMA_NODE);
final DataSchemaNode errListSchemaNode = ControllerContext.getFirst(schemaList);
checkState(errListSchemaNode instanceof ListSchemaNode, "Found Error SchemaNode isn't ListSchemaNode");
- final CollectionNodeBuilder<MapEntryNode, SystemMapNode> listErorsBuilder = SchemaAwareBuilders
- .mapBuilder((ListSchemaNode) errListSchemaNode);
+ final CollectionNodeBuilder<MapEntryNode, SystemMapNode> listErorsBuilder = Builders
+ .mapBuilder();
for (final RestconfError error : errors) {
@@ -155,21 +155,21 @@ public class RestconfDocumentedExceptionMapper implements ExceptionMapper<Restco
checkArgument(errListSchemaNode instanceof ListSchemaNode,
"errListSchemaNode has to be of type ListSchemaNode");
final ListSchemaNode listStreamSchemaNode = (ListSchemaNode) errListSchemaNode;
- final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> errNodeValues = SchemaAwareBuilders
- .mapEntryBuilder(listStreamSchemaNode);
+ final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> errNodeValues = Builders
+ .mapEntryBuilder();
var lsChildDataSchemaNode = ControllerContext.findInstanceDataChildrenByName(
listStreamSchemaNode, "error-type");
final DataSchemaNode errTypSchemaNode = ControllerContext.getFirst(lsChildDataSchemaNode);
checkState(errTypSchemaNode instanceof LeafSchemaNode);
- errNodeValues.withChild(SchemaAwareBuilders.leafBuilder((LeafSchemaNode) errTypSchemaNode)
+ errNodeValues.withChild(Builders.leafBuilder()
.withValue(error.getErrorType().elementBody()).build());
lsChildDataSchemaNode = ControllerContext.findInstanceDataChildrenByName(
listStreamSchemaNode, "error-tag");
final DataSchemaNode errTagSchemaNode = ControllerContext.getFirst(lsChildDataSchemaNode);
checkState(errTagSchemaNode instanceof LeafSchemaNode);
- errNodeValues.withChild(SchemaAwareBuilders.leafBuilder((LeafSchemaNode) errTagSchemaNode)
+ errNodeValues.withChild(Builders.leafBuilder()
.withValue(error.getErrorTag().elementBody()).build());
if (error.getErrorAppTag() != null) {
@@ -177,7 +177,7 @@ public class RestconfDocumentedExceptionMapper implements ExceptionMapper<Restco
listStreamSchemaNode, "error-app-tag");
final DataSchemaNode errAppTagSchemaNode = ControllerContext.getFirst(lsChildDataSchemaNode);
checkState(errAppTagSchemaNode instanceof LeafSchemaNode);
- errNodeValues.withChild(SchemaAwareBuilders.leafBuilder((LeafSchemaNode) errAppTagSchemaNode)
+ errNodeValues.withChild(Builders.leafBuilder()
.withValue(error.getErrorAppTag()).build());
}
@@ -185,7 +185,7 @@ public class RestconfDocumentedExceptionMapper implements ExceptionMapper<Restco
listStreamSchemaNode, "error-message");
final DataSchemaNode errMsgSchemaNode = ControllerContext.getFirst(lsChildDataSchemaNode);
checkState(errMsgSchemaNode instanceof LeafSchemaNode);
- errNodeValues.withChild(SchemaAwareBuilders.leafBuilder((LeafSchemaNode) errMsgSchemaNode)
+ errNodeValues.withChild(Builders.leafBuilder()
.withValue(error.getErrorMessage()).build());
if (error.getErrorInfo() != null) {
diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlNormalizedNodeBodyReader.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlNormalizedNodeBodyReader.java
index 84a7978..cc03aa6 100644
--- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlNormalizedNodeBodyReader.java
+++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlNormalizedNodeBodyReader.java
@@ -107,7 +107,7 @@ public class XmlNormalizedNodeBodyReader extends AbstractIdentifierAwareJaxRsPro
return new NormalizedNodeContext(path, null);
}
- final Document doc = UntrustedXML.newDocumentBuilder().parse(nonEmptyInputStreamOptional.get());
+ final Document doc = UntrustedXML.newDocumentBuilder().parse(nonEmptyInputStreamOptional.orElseThrow());
return parse(path, doc);
}
diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlToPatchBodyReader.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlToPatchBodyReader.java
index 9cc4766..7716cea 100644
--- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlToPatchBodyReader.java
+++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlToPatchBodyReader.java
@@ -107,7 +107,7 @@ public class XmlToPatchBodyReader extends AbstractIdentifierAwareJaxRsProvider i
return new PatchContext(path, null, null);
}
- final Document doc = UntrustedXML.newDocumentBuilder().parse(nonEmptyInputStreamOptional.get());
+ final Document doc = UntrustedXML.newDocumentBuilder().parse(nonEmptyInputStreamOptional.orElseThrow());
return parse(path, doc);
} catch (final RestconfDocumentedException e) {
throw e;
diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/BrokerFacade.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/BrokerFacade.java
index ca867cb..60ab9ab 100644
--- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/BrokerFacade.java
+++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/BrokerFacade.java
@@ -81,11 +81,10 @@ import org.opendaylight.yangtools.yang.data.api.schema.UserMapNode;
import org.opendaylight.yangtools.yang.data.api.schema.builder.CollectionNodeBuilder;
import org.opendaylight.yangtools.yang.data.api.schema.builder.DataContainerNodeBuilder;
import org.opendaylight.yangtools.yang.data.api.schema.builder.NormalizedNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
-import org.opendaylight.yangtools.yang.data.impl.schema.SchemaAwareBuilders;
import org.opendaylight.yangtools.yang.data.util.DataSchemaContextNode;
import org.opendaylight.yangtools.yang.data.util.DataSchemaContextTree;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
@@ -186,7 +185,7 @@ public class BrokerFacade implements Closeable {
final String withDefa) {
final Optional<DOMDataBroker> domDataBrokerService = mountPoint.getService(DOMDataBroker.class);
if (domDataBrokerService.isPresent()) {
- try (DOMDataTreeReadTransaction tx = domDataBrokerService.get().newReadOnlyTransaction()) {
+ try (DOMDataTreeReadTransaction tx = domDataBrokerService.orElseThrow().newReadOnlyTransaction()) {
return readDataViaTransaction(tx, CONFIGURATION, path, withDefa);
}
}
@@ -218,7 +217,7 @@ public class BrokerFacade implements Closeable {
public NormalizedNode readOperationalData(final DOMMountPoint mountPoint, final YangInstanceIdentifier path) {
final Optional<DOMDataBroker> domDataBrokerService = mountPoint.getService(DOMDataBroker.class);
if (domDataBrokerService.isPresent()) {
- try (DOMDataTreeReadTransaction tx = domDataBrokerService.get().newReadOnlyTransaction()) {
+ try (DOMDataTreeReadTransaction tx = domDataBrokerService.orElseThrow().newReadOnlyTransaction()) {
return readDataViaTransaction(tx, OPERATIONAL, path);
}
}
@@ -290,7 +289,7 @@ public class BrokerFacade implements Closeable {
final Optional<DOMDataBroker> domDataBrokerService = mountPoint.getService(DOMDataBroker.class);
if (domDataBrokerService.isPresent()) {
final DOMDataTreeReadWriteTransaction newReadWriteTransaction =
- domDataBrokerService.get().newReadWriteTransaction();
+ domDataBrokerService.orElseThrow().newReadWriteTransaction();
final Status status = readDataViaTransaction(newReadWriteTransaction, CONFIGURATION, path) != null
? Status.OK : Status.CREATED;
final FluentFuture<? extends CommitInfo> future = putDataViaTransaction(
@@ -318,7 +317,7 @@ public class BrokerFacade implements Closeable {
final Optional<DOMDataBroker> optional = mountPoint.getService(DOMDataBroker.class);
if (optional.isPresent()) {
- patchTransaction = optional.get().newReadWriteTransaction();
+ patchTransaction = optional.orElseThrow().newReadWriteTransaction();
} else {
// if mount point does not have broker it is not possible to continue and global error is reported
LOG.error("Http Patch {} has failed - device {} does not support broker service",
@@ -474,7 +473,8 @@ public class BrokerFacade implements Closeable {
final Optional<DOMDataBroker> domDataBrokerService = mountPoint.getService(DOMDataBroker.class);
if (domDataBrokerService.isPresent()) {
FluentFuture<? extends CommitInfo> future =
- postDataViaTransaction(domDataBrokerService.get().newReadWriteTransaction(), CONFIGURATION, path,
+ postDataViaTransaction(domDataBrokerService.orElseThrow().newReadWriteTransaction(),
+ CONFIGURATION, path,
payload, modelContext(mountPoint), insert, point);
isMounted.remove();
return future;
@@ -492,14 +492,15 @@ public class BrokerFacade implements Closeable {
final DOMMountPoint mountPoint, final YangInstanceIdentifier path) {
final Optional<DOMDataBroker> domDataBrokerService = mountPoint.getService(DOMDataBroker.class);
if (domDataBrokerService.isPresent()) {
- return deleteDataViaTransaction(domDataBrokerService.get().newReadWriteTransaction(), CONFIGURATION, path);
+ return deleteDataViaTransaction(domDataBrokerService.orElseThrow().newReadWriteTransaction(),
+ CONFIGURATION, path);
}
throw dataBrokerUnavailable(path);
}
// RPC
public ListenableFuture<? extends DOMRpcResult> invokeRpc(final @NonNull QName type,
- final @NonNull NormalizedNode input) {
+ final @NonNull ContainerNode input) {
if (rpcService == null) {
throw new RestconfDocumentedException(Status.SERVICE_UNAVAILABLE);
}
@@ -568,13 +569,13 @@ public class BrokerFacade implements Closeable {
final DataSchemaNode baseSchemaNode = baseSchemaCtxTree.findChild(path).orElseThrow().getDataSchemaNode();
if (result instanceof ContainerNode) {
final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> builder =
- SchemaAwareBuilders.containerBuilder((ContainerSchemaNode) baseSchemaNode);
+ Builders.containerBuilder();
buildCont(builder, (ContainerNode) result, baseSchemaCtxTree, path, trim);
return builder.build();
}
final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> builder =
- SchemaAwareBuilders.mapEntryBuilder((ListSchemaNode) baseSchemaNode);
+ Builders.mapEntryBuilder();
buildMapEntryBuilder(builder, (MapEntryNode) result, baseSchemaCtxTree, path, trim,
((ListSchemaNode) baseSchemaNode).getKeyDefinition());
return builder.build();
@@ -589,12 +590,12 @@ public class BrokerFacade implements Closeable {
final DataSchemaNode childSchema = baseSchemaCtxTree.findChild(path).orElseThrow().getDataSchemaNode();
if (child instanceof ContainerNode) {
final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> childBuilder =
- SchemaAwareBuilders.containerBuilder((ContainerSchemaNode) childSchema);
+ Builders.containerBuilder();
buildCont(childBuilder, (ContainerNode) child, baseSchemaCtxTree, path, trim);
builder.withChild(childBuilder.build());
} else if (child instanceof MapNode) {
final CollectionNodeBuilder<MapEntryNode, SystemMapNode> childBuilder =
- SchemaAwareBuilders.mapBuilder((ListSchemaNode) childSchema);
+ Builders.mapBuilder();
buildList(childBuilder, (MapNode) child, baseSchemaCtxTree, path, trim,
((ListSchemaNode) childSchema).getKeyDefinition());
builder.withChild(childBuilder.build());
@@ -602,7 +603,7 @@ public class BrokerFacade implements Closeable {
final Object defaultVal = ((LeafSchemaNode) childSchema).getType().getDefaultValue().orElse(null);
final Object nodeVal = child.body();
final NormalizedNodeBuilder<NodeIdentifier, Object, LeafNode<Object>> leafBuilder =
- SchemaAwareBuilders.leafBuilder((LeafSchemaNode) childSchema);
+ Builders.leafBuilder();
if (keys.contains(child.getIdentifier().getNodeType())) {
leafBuilder.withValue(child.body());
builder.withChild(leafBuilder.build());
@@ -628,10 +629,10 @@ public class BrokerFacade implements Closeable {
final List<QName> keys) {
for (final MapEntryNode mapEntryNode : result.body()) {
final YangInstanceIdentifier actualNode = path.node(mapEntryNode.getIdentifier());
- final DataSchemaNode childSchema = baseSchemaCtxTree.findChild(actualNode).orElseThrow()
- .getDataSchemaNode();
+ // final DataSchemaNode childSchema = baseSchemaCtxTree.findChild(actualNode).orElseThrow()
+ // .getDataSchemaNode();
final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> mapEntryBuilder =
- SchemaAwareBuilders.mapEntryBuilder((ListSchemaNode) childSchema);
+ Builders.mapEntryBuilder();
buildMapEntryBuilder(mapEntryBuilder, mapEntryNode, baseSchemaCtxTree, actualNode, trim, keys);
builder.withChild(mapEntryBuilder.build());
}
@@ -645,12 +646,12 @@ public class BrokerFacade implements Closeable {
final DataSchemaNode childSchema = baseSchemaCtxTree.findChild(path).orElseThrow().getDataSchemaNode();
if (child instanceof ContainerNode) {
final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> builderChild =
- SchemaAwareBuilders.containerBuilder((ContainerSchemaNode) childSchema);
+ Builders.containerBuilder();
buildCont(builderChild, result, baseSchemaCtxTree, actualPath, trim);
builder.withChild(builderChild.build());
} else if (child instanceof MapNode) {
final CollectionNodeBuilder<MapEntryNode, SystemMapNode> childBuilder =
- SchemaAwareBuilders.mapBuilder((ListSchemaNode) childSchema);
+ Builders.mapBuilder();
buildList(childBuilder, (MapNode) child, baseSchemaCtxTree, path, trim,
((ListSchemaNode) childSchema).getKeyDefinition());
builder.withChild(childBuilder.build());
@@ -658,7 +659,7 @@ public class BrokerFacade implements Closeable {
final Object defaultVal = ((LeafSchemaNode) childSchema).getType().getDefaultValue().orElse(null);
final Object nodeVal = child.body();
final NormalizedNodeBuilder<NodeIdentifier, Object, LeafNode<Object>> leafBuilder =
- SchemaAwareBuilders.leafBuilder((LeafSchemaNode) childSchema);
+ Builders.leafBuilder();
if (trim) {
if (defaultVal == null || !defaultVal.equals(nodeVal)) {
leafBuilder.withValue(child.body());
diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/ControllerContext.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/ControllerContext.java
index bd79377..2e191e0 100644
--- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/ControllerContext.java
+++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/ControllerContext.java
@@ -573,7 +573,7 @@ public final class ControllerContext implements EffectiveModelContextListener, C
throw new RestconfDocumentedException("Mount point does not exist.", ErrorType.PROTOCOL,
ErrorTag.DATA_MISSING);
}
- final DOMMountPoint mount = mountOpt.get();
+ final DOMMountPoint mount = mountOpt.orElseThrow();
final EffectiveModelContext mountPointSchema = getModelContext(mount);
if (mountPointSchema == null) {
diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/JSONRestconfServiceImpl.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/JSONRestconfServiceImpl.java
index 296fd91..1716f8f 100644
--- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/JSONRestconfServiceImpl.java
+++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/JSONRestconfServiceImpl.java
@@ -137,7 +137,7 @@ public class JSONRestconfServiceImpl implements JSONRestconfService {
final Optional<String> result = Optional.of(toJson(readData));
- LOG.debug("get returning: {}", result.get());
+ LOG.debug("get returning: {}", result.orElseThrow());
return result;
} catch (final Exception e) {
@@ -157,7 +157,7 @@ public class JSONRestconfServiceImpl implements JSONRestconfService {
throws OperationFailedException {
requireNonNull(uriPath, "uriPath can't be null");
- final String actualInput = input.isPresent() ? input.get() : null;
+ final String actualInput = input.isPresent() ? input.orElseThrow() : null;
LOG.debug("invokeRpc: uriPath: {}, input: {}", uriPath, actualInput);
diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java
index b3a1a9c..377f0e5 100644
--- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java
+++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java
@@ -67,7 +67,6 @@ import org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult;
import org.opendaylight.netconf.sal.rest.api.Draft02;
import org.opendaylight.netconf.sal.rest.api.RestconfService;
import org.opendaylight.netconf.sal.rest.impl.NormalizedNodeContext;
-import org.opendaylight.netconf.sal.restconf.impl.ControllerContext.FoundChild;
import org.opendaylight.netconf.sal.streams.listeners.ListenerAdapter;
import org.opendaylight.netconf.sal.streams.listeners.NotificationListenerAdapter;
import org.opendaylight.netconf.sal.streams.listeners.Notificator;
@@ -109,14 +108,11 @@ import org.opendaylight.yangtools.yang.data.api.schema.builder.DataContainerNode
import org.opendaylight.yangtools.yang.data.api.schema.builder.ListNodeBuilder;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
-import org.opendaylight.yangtools.yang.data.impl.schema.SchemaAwareBuilders;
import org.opendaylight.yangtools.yang.data.tree.api.ModifiedNodeDoesNotExistException;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.opendaylight.yangtools.yang.model.api.FeatureDefinition;
-import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
@@ -217,7 +213,7 @@ public final class RestconfImpl implements RestconfService {
checkState(modulesSchemaNode instanceof ContainerSchemaNode);
final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> moduleContainerBuilder =
- SchemaAwareBuilders.containerBuilder((ContainerSchemaNode) modulesSchemaNode);
+ Builders.containerBuilder();
moduleContainerBuilder.withChild(makeModuleMapNode(controllerContext.getAllModules()));
return new NormalizedNodeContext(InstanceIdentifierContext.ofStack(stack, null),
@@ -253,7 +249,7 @@ public final class RestconfImpl implements RestconfService {
checkState(modulesSchemaNode instanceof ContainerSchemaNode);
final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> moduleContainerBuilder =
- SchemaAwareBuilders.containerBuilder((ContainerSchemaNode) modulesSchemaNode);
+ Builders.containerBuilder();
moduleContainerBuilder.withChild(mountPointModulesMap);
return new NormalizedNodeContext(InstanceIdentifierContext.ofStack(stack, null),
@@ -306,7 +302,7 @@ public final class RestconfImpl implements RestconfService {
checkState(streamSchemaNode instanceof ListSchemaNode);
final CollectionNodeBuilder<MapEntryNode, SystemMapNode> listStreamsBuilder =
- SchemaAwareBuilders.mapBuilder((ListSchemaNode) streamSchemaNode);
+ Builders.mapBuilder();
for (final String streamName : availableStreams) {
listStreamsBuilder.withChild(toStreamEntryNode(streamName, streamSchemaNode));
@@ -322,7 +318,7 @@ public final class RestconfImpl implements RestconfService {
checkState(streamsContainerSchemaNode instanceof ContainerSchemaNode);
final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> streamsContainerBuilder =
- SchemaAwareBuilders.containerBuilder((ContainerSchemaNode) streamsContainerSchemaNode);
+ Builders.containerBuilder();
streamsContainerBuilder.withChild(listStreamsBuilder.build());
return new NormalizedNodeContext(InstanceIdentifierContext.ofStack(stack),
@@ -411,7 +407,7 @@ public final class RestconfImpl implements RestconfService {
final SchemaNode schema = payload.getInstanceIdentifierContext().getSchemaNode();
final ListenableFuture<? extends DOMRpcResult> response;
final DOMMountPoint mountPoint = payload.getInstanceIdentifierContext().getMountPoint();
- final NormalizedNode input = nonnullInput(schema, payload.getData());
+ final ContainerNode input = nonnullInput(schema, (ContainerNode) payload.getData());
final EffectiveModelContext schemaContext;
if (mountPoint != null) {
@@ -421,7 +417,7 @@ public final class RestconfImpl implements RestconfService {
throw new RestconfDocumentedException("Rpc service is missing.");
}
schemaContext = modelContext(mountPoint);
- response = mountRpcServices.get().invokeRpc(schema.getQName(), input);
+ response = mountRpcServices.orElseThrow().invokeRpc(schema.getQName(), input);
} else {
final XMLNamespace namespace = schema.getQName().getNamespace();
if (namespace.toString().equals(SAL_REMOTE_NAMESPACE)) {
@@ -512,7 +508,7 @@ public final class RestconfImpl implements RestconfService {
if (mountRpcServices.isEmpty()) {
throw new RestconfDocumentedException("Rpc service is missing.");
}
- response = mountRpcServices.get().invokeRpc(rpc.getQName(), input);
+ response = mountRpcServices.orElseThrow().invokeRpc(rpc.getQName(), input);
} else {
response = broker.invokeRpc(rpc.getQName(), input);
}
@@ -534,7 +530,7 @@ public final class RestconfImpl implements RestconfService {
return new NormalizedNodeContext(iic, result, QueryParametersParser.parseWriterParameters(uriInfo));
}
- private static @NonNull NormalizedNode nonnullInput(final SchemaNode rpc, final NormalizedNode input) {
+ private static @NonNull ContainerNode nonnullInput(final SchemaNode rpc, final ContainerNode input) {
return input != null ? input : defaultInput(rpc.getQName());
}
@@ -599,7 +595,7 @@ public final class RestconfImpl implements RestconfService {
final QName rpcQName = payload.getInstanceIdentifierContext().getSchemaNode().getQName();
final Optional<DataContainerChild> path =
value.findChildByArg(new NodeIdentifier(QName.create(rpcQName, "path")));
- final Object pathValue = path.isPresent() ? path.get().body() : null;
+ final Object pathValue = path.isPresent() ? path.orElseThrow().body() : null;
if (!(pathValue instanceof YangInstanceIdentifier)) {
LOG.debug("Instance identifier {} was not normalized correctly", rpcQName);
@@ -1312,7 +1308,7 @@ public final class RestconfImpl implements RestconfService {
if (optAugNode.isEmpty()) {
return null;
}
- final DataContainerChild augNode = optAugNode.get();
+ final DataContainerChild augNode = optAugNode.orElseThrow();
if (!(augNode instanceof AugmentationNode)) {
return null;
}
@@ -1321,7 +1317,7 @@ public final class RestconfImpl implements RestconfService {
if (enumNode.isEmpty()) {
return null;
}
- final Object rawValue = enumNode.get().body();
+ final Object rawValue = enumNode.orElseThrow().body();
if (!(rawValue instanceof String)) {
return null;
}
@@ -1375,7 +1371,7 @@ public final class RestconfImpl implements RestconfService {
checkState(moduleSchemaNode instanceof ListSchemaNode);
final CollectionNodeBuilder<MapEntryNode, SystemMapNode> listModuleBuilder =
- SchemaAwareBuilders.mapBuilder((ListSchemaNode) moduleSchemaNode);
+ Builders.mapBuilder();
for (final Module module : modules) {
listModuleBuilder.withChild(toModuleEntryNode(module, moduleSchemaNode));
@@ -1386,38 +1382,38 @@ public final class RestconfImpl implements RestconfService {
private static MapEntryNode toModuleEntryNode(final Module module, final DataSchemaNode moduleSchemaNode) {
checkArgument(moduleSchemaNode instanceof ListSchemaNode,
"moduleSchemaNode has to be of type ListSchemaNode");
- final ListSchemaNode listModuleSchemaNode = (ListSchemaNode) moduleSchemaNode;
+ // final ListSchemaNode listModuleSchemaNode = (ListSchemaNode) moduleSchemaNode;
final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> moduleNodeValues =
- SchemaAwareBuilders.mapEntryBuilder(listModuleSchemaNode);
+ Builders.mapEntryBuilder();
- var instanceDataChildrenByName =
- ControllerContext.findInstanceDataChildrenByName(listModuleSchemaNode, "name");
- final LeafSchemaNode nameSchemaNode = getFirstLeaf(instanceDataChildrenByName);
+ // var instanceDataChildrenByName =
+ // ControllerContext.findInstanceDataChildrenByName(listModuleSchemaNode, "name");
+ // final LeafSchemaNode nameSchemaNode = getFirstLeaf(instanceDataChildrenByName);
moduleNodeValues.withChild(
- SchemaAwareBuilders.leafBuilder(nameSchemaNode).withValue(module.getName()).build());
+ Builders.leafBuilder().withValue(module.getName()).build());
final QNameModule qNameModule = module.getQNameModule();
- instanceDataChildrenByName =
- ControllerContext.findInstanceDataChildrenByName(listModuleSchemaNode, "revision");
- final LeafSchemaNode revisionSchemaNode = getFirstLeaf(instanceDataChildrenByName);
+ // instanceDataChildrenByName =
+ // ControllerContext.findInstanceDataChildrenByName(listModuleSchemaNode, "revision");
+ // final LeafSchemaNode revisionSchemaNode = getFirstLeaf(instanceDataChildrenByName);
final Optional<Revision> revision = qNameModule.getRevision();
- moduleNodeValues.withChild(SchemaAwareBuilders.leafBuilder(revisionSchemaNode)
+ moduleNodeValues.withChild(Builders.leafBuilder()
.withValue(revision.map(Revision::toString).orElse("")).build());
- instanceDataChildrenByName =
- ControllerContext.findInstanceDataChildrenByName(listModuleSchemaNode, "namespace");
- final LeafSchemaNode namespaceSchemaNode = getFirstLeaf(instanceDataChildrenByName);
- moduleNodeValues.withChild(SchemaAwareBuilders.leafBuilder(namespaceSchemaNode)
+ // instanceDataChildrenByName =
+ // ControllerContext.findInstanceDataChildrenByName(listModuleSchemaNode, "namespace");
+ // final LeafSchemaNode namespaceSchemaNode = getFirstLeaf(instanceDataChildrenByName);
+ moduleNodeValues.withChild(Builders.leafBuilder()
.withValue(qNameModule.getNamespace().toString()).build());
- instanceDataChildrenByName =
- ControllerContext.findInstanceDataChildrenByName(listModuleSchemaNode, "feature");
- final LeafListSchemaNode featureSchemaNode = getFirst(instanceDataChildrenByName, LeafListSchemaNode.class);
+ // instanceDataChildrenByName =
+ // ControllerContext.findInstanceDataChildrenByName(listModuleSchemaNode, "feature");
+ // final LeafListSchemaNode featureSchemaNode = getFirst(instanceDataChildrenByName, LeafListSchemaNode.class);
final ListNodeBuilder<Object, SystemLeafSetNode<Object>> featuresBuilder =
- SchemaAwareBuilders.leafSetBuilder(featureSchemaNode);
+ Builders.leafSetBuilder();
for (final FeatureDefinition feature : module.getFeatures()) {
- featuresBuilder.withChild(SchemaAwareBuilders.leafSetEntryBuilder(featureSchemaNode)
+ featuresBuilder.withChild(Builders.leafSetEntryBuilder()
.withValue(feature.getQName().getLocalName()).build());
}
moduleNodeValues.withChild(featuresBuilder.build());
@@ -1428,39 +1424,40 @@ public final class RestconfImpl implements RestconfService {
protected MapEntryNode toStreamEntryNode(final String streamName, final DataSchemaNode streamSchemaNode) {
checkArgument(streamSchemaNode instanceof ListSchemaNode,
"streamSchemaNode has to be of type ListSchemaNode");
- final ListSchemaNode listStreamSchemaNode = (ListSchemaNode) streamSchemaNode;
+ // final ListSchemaNode listStreamSchemaNode = (ListSchemaNode) streamSchemaNode;
final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> streamNodeValues =
- SchemaAwareBuilders.mapEntryBuilder(listStreamSchemaNode);
+ Builders.mapEntryBuilder();
- var instanceDataChildrenByName =
- ControllerContext.findInstanceDataChildrenByName(listStreamSchemaNode, "name");
- final LeafSchemaNode nameSchemaNode = getFirstLeaf(instanceDataChildrenByName);
+ // var instanceDataChildrenByName =
+ // ControllerContext.findInstanceDataChildrenByName(listStreamSchemaNode, "name");
+ // final LeafSchemaNode nameSchemaNode = getFirstLeaf(instanceDataChildrenByName);
streamNodeValues.withChild(
- SchemaAwareBuilders.leafBuilder(nameSchemaNode).withValue(streamName).build());
+ Builders.leafBuilder().withValue(streamName).build());
- instanceDataChildrenByName =
- ControllerContext.findInstanceDataChildrenByName(listStreamSchemaNode, "description");
- final LeafSchemaNode descriptionSchemaNode = getFirstLeaf(instanceDataChildrenByName);
- streamNodeValues.withChild(SchemaAwareBuilders.leafBuilder(descriptionSchemaNode)
+ // instanceDataChildrenByName =
+ // ControllerContext.findInstanceDataChildrenByName(listStreamSchemaNode, "description");
+ // final LeafSchemaNode descriptionSchemaNode = getFirstLeaf(instanceDataChildrenByName);
+ streamNodeValues.withChild(Builders.leafBuilder()
.withValue("DESCRIPTION_PLACEHOLDER")
.build());
- instanceDataChildrenByName =
- ControllerContext.findInstanceDataChildrenByName(listStreamSchemaNode, "replay-support");
- final LeafSchemaNode replaySupportSchemaNode = getFirstLeaf(instanceDataChildrenByName);
- streamNodeValues.withChild(SchemaAwareBuilders.leafBuilder(replaySupportSchemaNode)
+ // instanceDataChildrenByName =
+ // ControllerContext.findInstanceDataChildrenByName(listStreamSchemaNode, "replay-support");
+ // final LeafSchemaNode replaySupportSchemaNode = getFirstLeaf(instanceDataChildrenByName);
+ streamNodeValues.withChild(Builders.leafBuilder()
.withValue(Boolean.TRUE).build());
- instanceDataChildrenByName =
- ControllerContext.findInstanceDataChildrenByName(listStreamSchemaNode, "replay-log-creation-time");
- final LeafSchemaNode replayLogCreationTimeSchemaNode = getFirstLeaf(instanceDataChildrenByName);
+ // instanceDataChildrenByName =
+ // ControllerContext.findInstanceDataChildrenByName(listStreamSchemaNode, "replay-log-creation-time");
+ // final LeafSchemaNode replayLogCreationTimeSchemaNode = getFirstLeaf(instanceDataChildrenByName);
streamNodeValues.withChild(
- SchemaAwareBuilders.leafBuilder(replayLogCreationTimeSchemaNode).withValue("").build());
+ Builders.leafBuilder().withValue("").build());
- instanceDataChildrenByName = ControllerContext.findInstanceDataChildrenByName(listStreamSchemaNode, "events");
- final LeafSchemaNode eventsSchemaNode = getFirstLeaf(instanceDataChildrenByName);
+ // instanceDataChildrenByName =
+ // ControllerContext.findInstanceDataChildrenByName(listStreamSchemaNode, "events");
+ // final LeafSchemaNode eventsSchemaNode = getFirstLeaf(instanceDataChildrenByName);
streamNodeValues.withChild(
- SchemaAwareBuilders.leafBuilder(eventsSchemaNode).withValue(Empty.value()).build());
+ Builders.leafBuilder().withValue(Empty.value()).build());
return streamNodeValues.build();
}
@@ -1527,10 +1524,12 @@ public final class RestconfImpl implements RestconfService {
.build()));
}
+ /*
private static LeafSchemaNode getFirstLeaf(final List<FoundChild> children) {
return getFirst(children, LeafSchemaNode.class);
}
+
private static <T extends DataSchemaNode> T getFirst(final List<FoundChild> children, final Class<T> expected) {
checkState(!children.isEmpty());
final var first = children.get(0);
@@ -1538,6 +1537,8 @@ public final class RestconfImpl implements RestconfService {
return expected.cast(first.child);
}
+ */
+
private static EffectiveModelContext modelContext(final DOMMountPoint mountPoint) {
return mountPoint.getService(DOMSchemaService.class)
.flatMap(svc -> Optional.ofNullable(svc.getGlobalContext()))
diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/web/WebInitializer.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/web/WebInitializer.java
index 1f9b5f4..ab52d60 100644
--- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/web/WebInitializer.java
+++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/web/WebInitializer.java
@@ -16,7 +16,7 @@ import org.opendaylight.aaa.filterchain.filters.CustomFilterAdapter;
import org.opendaylight.aaa.web.FilterDetails;
import org.opendaylight.aaa.web.ServletDetails;
import org.opendaylight.aaa.web.WebContext;
-import org.opendaylight.aaa.web.WebContextBuilder;
+import org.opendaylight.aaa.web.WebContext.Builder;
import org.opendaylight.aaa.web.WebContextSecurer;
import org.opendaylight.aaa.web.WebServer;
import org.opendaylight.aaa.web.servlet.ServletSupport;
@@ -37,14 +37,13 @@ public class WebInitializer {
public WebInitializer(final WebServer webServer, final WebContextSecurer webContextSecurer,
final ServletSupport servletSupport, final RestconfApplication webApp,
final CustomFilterAdapterConfiguration customFilterAdapterConfig) throws ServletException {
+ Builder webContextBuilder = WebContext.builder().contextPath("/restconf").supportsSessions(false)
+ .addServlet(ServletDetails.builder().servlet(servletSupport.createHttpServletBuilder(webApp).build())
+ .addUrlPattern("/*").build())
- WebContextBuilder webContextBuilder = WebContext.builder().contextPath("restconf").supportsSessions(false)
- .addServlet(ServletDetails.builder().servlet(servletSupport.createHttpServletBuilder(webApp).build())
- .addUrlPattern("/*").build())
-
- // Allows user to add javax.servlet.Filter(s) in front of REST services
- .addFilter(FilterDetails.builder().filter(new CustomFilterAdapter(customFilterAdapterConfig))
- .addUrlPattern("/*").build());
+ // Allows user to add javax.servlet.Filter(s) in front of REST services
+ .addFilter(FilterDetails.builder().filter(new CustomFilterAdapter(customFilterAdapterConfig))
+ .addUrlPattern("/*").build());
webContextSecurer.requireAuthentication(webContextBuilder, "/*");
diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/streams/listeners/ListenerAdapter.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/streams/listeners/ListenerAdapter.java
index fc85862..041e645 100644
--- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/streams/listeners/ListenerAdapter.java
+++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/streams/listeners/ListenerAdapter.java
@@ -222,7 +222,7 @@ public class ListenerAdapter extends AbstractCommonSubscriber implements Cluster
return;
}
- NormalizedNode normalizedNode = optionalNormalizedNode.get();
+ NormalizedNode normalizedNode = optionalNormalizedNode.orElseThrow();
YangInstanceIdentifier yiid = YangInstanceIdentifier.builder(parentYiid)
.append(normalizedNode.getIdentifier()).build();
@@ -402,7 +402,7 @@ public class ListenerAdapter extends AbstractCommonSubscriber implements Cluster
private void writeIdentifierWithNamespacePrefix(final Element element, final StringBuilder textContent,
final QName qualifiedName) {
final Module module = controllerContext.getGlobalSchema().findModule(qualifiedName.getModule())
- .get();
+ .orElseThrow();
textContent.append(module.getName());
textContent.append(":");
diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/streams/listeners/Notificator.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/streams/listeners/Notificator.java
index 5bfa79f..1ba4255 100644
--- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/streams/listeners/Notificator.java
+++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/streams/listeners/Notificator.java
@@ -136,8 +136,6 @@ public final class Notificator {
/**
* Delete {@link ListenerAdapter} listener specified in parameter.
*
- * @param <T>
- *
* @param listener
* ListenerAdapter
*/
diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/DatastoreIdentifierBuilder.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/DatastoreIdentifierBuilder.java
index 42defe5..b01c2f4 100644
--- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/DatastoreIdentifierBuilder.java
+++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/DatastoreIdentifierBuilder.java
@@ -6,15 +6,17 @@
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.DatastoreIdentifier.Enumeration;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.DatastoreIdentifier;
/**
**/
public class DatastoreIdentifierBuilder {
public static DatastoreIdentifier getDefaultInstance(final String defaultValue) {
- return new DatastoreIdentifier(Enumeration.valueOf(defaultValue));
+ QName qName = QName.create(defaultValue);
+ return DatastoreIdentifier.of(qName);
}
}
diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/ModuleRevisionBuilder.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/ModuleRevisionBuilder.java
index dfd0aeb..cc447f2 100644
--- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/ModuleRevisionBuilder.java
+++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/ModuleRevisionBuilder.java
@@ -7,7 +7,7 @@
*/
package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.restconf.restconf.modules;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.restconf.restconf.modules.Module.Revision;
+import org.opendaylight.yangtools.yang.common.Revision;
/**
* The purpose of generated class in src/main/java for Union types is to create
diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/RevisionBuilder.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/RevisionBuilder.java
index d09646a..4df5da8 100644
--- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/RevisionBuilder.java
+++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/RevisionBuilder.java
@@ -9,8 +9,8 @@ package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.r
import java.util.regex.Pattern;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.RevisionIdentifier;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.restconf.restconf.modules.Module.Revision;
+
+import org.opendaylight.yangtools.yang.common.Revision;
/**
**/
@@ -26,11 +26,10 @@ public class RevisionBuilder {
if (defaultValue != null) {
if (REVISION_PATTERN.matcher(defaultValue).matches()) {
- RevisionIdentifier id = new RevisionIdentifier(defaultValue);
- return new Revision(id);
+ return Revision.of(defaultValue);
}
if (defaultValue.isEmpty()) {
- return new Revision(defaultValue);
+ return Revision.of(defaultValue);
}
}