Add blueprint wiring for restconf connector
[netconf.git] / restconf / sal-rest-connector / src / main / java / org / opendaylight / netconf / sal / restconf / impl / BrokerFacade.java
index 6eb40c47b72667a407eef846631826bcf9ae5932..6b4787064c1dc2e2e572c8aa818c49ab28d8032c 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -40,7 +40,6 @@ import org.opendaylight.controller.md.sal.dom.api.DOMNotificationService;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
-import org.opendaylight.controller.sal.core.api.Broker.ConsumerSession;
 import org.opendaylight.netconf.sal.restconf.impl.RestconfError.ErrorTag;
 import org.opendaylight.netconf.sal.restconf.impl.RestconfError.ErrorType;
 import org.opendaylight.netconf.sal.streams.listeners.ListenerAdapter;
@@ -84,7 +83,6 @@ public class BrokerFacade {
     private static final BrokerFacade INSTANCE = new BrokerFacade();
 
     private volatile DOMRpcService rpcService;
-    private volatile ConsumerSession context;
 
     private DOMDataBroker domDataBroker;
     private DOMNotificationService domNotification;
@@ -99,16 +97,12 @@ public class BrokerFacade {
         this.domNotification = domNotification;
     }
 
-    public void setContext(final ConsumerSession context) {
-        this.context = context;
-    }
-
     public static BrokerFacade getInstance() {
         return BrokerFacade.INSTANCE;
     }
 
     private void checkPreconditions() {
-        if (this.context == null || this.domDataBroker == null) {
+        if (this.domDataBroker == null) {
             throw new RestconfDocumentedException(Status.SERVICE_UNAVAILABLE);
         }
     }
@@ -332,8 +326,7 @@ public class BrokerFacade {
         boolean withoutError = true;
 
         for (final PatchEntity patchEntity : patchContext.getData()) {
-            final PatchEditOperation operation = PatchEditOperation.valueOf(patchEntity.getOperation().toUpperCase());
-
+            final PatchEditOperation operation = patchEntity.getOperation();
             switch (operation) {
                 case CREATE:
                     if (withoutError) {
@@ -616,17 +609,17 @@ public class BrokerFacade {
                 final NormalizedNodeAttrBuilder<NodeIdentifier, Object, LeafNode<Object>> leafBuilder =
                         Builders.leafBuilder((LeafSchemaNode) childSchema);
                 if (keys.contains(child.getNodeType())) {
-                    leafBuilder.withValue(((LeafNode) child).getValue());
+                    leafBuilder.withValue(((LeafNode<?>) child).getValue());
                     builder.withChild(leafBuilder.build());
                 } else {
                     if (trim) {
                         if (defaultVal == null || !defaultVal.equals(nodeVal)) {
-                            leafBuilder.withValue(((LeafNode) child).getValue());
+                            leafBuilder.withValue(((LeafNode<?>) child).getValue());
                             builder.withChild(leafBuilder.build());
                         }
                     } else {
                         if (defaultVal != null && defaultVal.equals(nodeVal)) {
-                            leafBuilder.withValue(((LeafNode) child).getValue());
+                            leafBuilder.withValue(((LeafNode<?>) child).getValue());
                             builder.withChild(leafBuilder.build());
                         }
                     }
@@ -672,12 +665,12 @@ public class BrokerFacade {
                         Builders.leafBuilder((LeafSchemaNode) childSchema);
                 if (trim) {
                     if (defaultVal == null || !defaultVal.equals(nodeVal)) {
-                        leafBuilder.withValue(((LeafNode) child).getValue());
+                        leafBuilder.withValue(((LeafNode<?>) child).getValue());
                         builder.withChild(leafBuilder.build());
                     }
                 } else {
                     if (defaultVal != null && defaultVal.equals(nodeVal)) {
-                        leafBuilder.withValue(((LeafNode) child).getValue());
+                        leafBuilder.withValue(((LeafNode<?>) child).getValue());
                         builder.withChild(leafBuilder.build());
                     }
                 }