Revert "Checkstyle enforcer"
[controller.git] / opendaylight / sal / implementation / src / main / java / org / opendaylight / controller / sal / implementation / internal / FlowProgrammerService.java
index f85420ee3e099ff66394bf0f15b3f7fe74570cda..6bea30666925ddaf4991f819597fde625766026f 100644 (file)
@@ -28,8 +28,8 @@ import org.opendaylight.controller.sal.action.PopVlan;
 import org.opendaylight.controller.sal.action.SetNwDst;
 import org.opendaylight.controller.sal.core.ConstructionException;
 import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.controller.sal.core.NodeConnector;
 import org.opendaylight.controller.sal.core.Node.NodeIDType;
+import org.opendaylight.controller.sal.core.NodeConnector;
 import org.opendaylight.controller.sal.flowprogrammer.Flow;
 import org.opendaylight.controller.sal.flowprogrammer.IFlowProgrammerListener;
 import org.opendaylight.controller.sal.flowprogrammer.IFlowProgrammerService;
@@ -37,11 +37,11 @@ import org.opendaylight.controller.sal.flowprogrammer.IPluginInFlowProgrammerSer
 import org.opendaylight.controller.sal.flowprogrammer.IPluginOutFlowProgrammerService;
 import org.opendaylight.controller.sal.match.Match;
 import org.opendaylight.controller.sal.match.MatchType;
-import org.opendaylight.controller.sal.utils.StatusCode;
 import org.opendaylight.controller.sal.utils.EtherTypes;
 import org.opendaylight.controller.sal.utils.IPProtocols;
 import org.opendaylight.controller.sal.utils.NodeConnectorCreator;
 import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.sal.utils.StatusCode;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.FrameworkUtil;
 import org.slf4j.Logger;
@@ -261,6 +261,16 @@ public class FlowProgrammerService implements IFlowProgrammerService,
         }
     }
 
+    @Override
+    public void flowErrorReported(Node node, long rid, Object err) {
+        logger.error("Got error {} for message rid {} from node {}",
+                new Object[] { err, rid, node });
+
+        for (IFlowProgrammerListener l : listener) {
+            l.flowErrorReported(node, rid, err);
+        }
+    }
+
     // ---------------- OSGI TEST CODE ------------------------------//
 
     private void registerWithOSGIConsole() {
@@ -481,20 +491,33 @@ public class FlowProgrammerService implements IFlowProgrammerService,
         return flow;
     }
 
-    /*
+    /**
      * This Request ID generator starts with 1. Each aysnc message is
      * associated with an unique Request ID (!= 0).
+     * 
+     * @return Request ID
      */
     private long getNextRid() {
         return seq.getAndIncrement();
     }
 
     @Override
-    public Status sendBarrierMessage(Node node) {
+    public Status syncSendBarrierMessage(Node node) {
+        if (this.pluginFlowProgrammer != null) {
+            if (this.pluginFlowProgrammer.get(node.getType()) != null) {
+                return this.pluginFlowProgrammer.get(node.getType())
+                        .syncSendBarrierMessage(node);
+            }
+        }
+        return new Status(StatusCode.NOSERVICE, "Plugin unuvailable");
+    }
+
+    @Override
+    public Status asyncSendBarrierMessage(Node node) {
         if (this.pluginFlowProgrammer != null) {
             if (this.pluginFlowProgrammer.get(node.getType()) != null) {
                 return this.pluginFlowProgrammer.get(node.getType())
-                        .sendBarrierMessage(node);
+                        .asyncSendBarrierMessage(node);
             }
         }
         return new Status(StatusCode.NOSERVICE, "Plugin unuvailable");