WIP: Initial implementation of filterObjectives using driver subsystem.

Incomplete implementation

Change-Id: I3745d481027659d4ca44b72139e5461c02e8c3ef
diff --git a/core/api/src/main/java/org/onosproject/net/driver/AbstractBehaviour.java b/core/api/src/main/java/org/onosproject/net/driver/AbstractBehaviour.java
index eb6a302..001c490 100644
--- a/core/api/src/main/java/org/onosproject/net/driver/AbstractBehaviour.java
+++ b/core/api/src/main/java/org/onosproject/net/driver/AbstractBehaviour.java
@@ -26,4 +26,9 @@
     public void setData(DriverData data) {
         this.data = data;
     }
+
+    @Override
+    public DriverData data() {
+        return data;
+    }
 }
diff --git a/core/api/src/main/java/org/onosproject/net/driver/Behaviour.java b/core/api/src/main/java/org/onosproject/net/driver/Behaviour.java
index 7257eed..208eef7 100644
--- a/core/api/src/main/java/org/onosproject/net/driver/Behaviour.java
+++ b/core/api/src/main/java/org/onosproject/net/driver/Behaviour.java
@@ -29,4 +29,11 @@
      */
     void setData(DriverData data);
 
+    /**
+     * Obtains the driver data.
+     *
+     * @return driver data
+     */
+    DriverData data();
+
 }
diff --git a/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultFilteringObjective.java b/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultFilteringObjective.java
index 4c1b71f..da92b80 100644
--- a/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultFilteringObjective.java
+++ b/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultFilteringObjective.java
@@ -32,7 +32,7 @@
 public final class DefaultFilteringObjective implements FilteringObjective {
 
 
-    private final Criterion key;
+    private final Type type;
     private final boolean permanent;
     private final int timeout;
     private final ApplicationId appId;
@@ -41,10 +41,10 @@
     private final int id;
     private final Operation op;
 
-    private DefaultFilteringObjective(Criterion key, boolean permanent, int timeout,
+    private DefaultFilteringObjective(Type type, boolean permanent, int timeout,
                                       ApplicationId appId, int priority,
                                       List<Criterion> conditions, Operation op) {
-        this.key = key;
+        this.type = type;
         this.permanent = permanent;
         this.timeout = timeout;
         this.appId = appId;
@@ -52,14 +52,13 @@
         this.conditions = conditions;
         this.op = op;
 
-        this.id = Objects.hash(key, conditions, permanent,
+        this.id = Objects.hash(type, conditions, permanent,
                                timeout, appId, priority);
     }
 
-
     @Override
-    public Criterion key() {
-        return key;
+    public Type type() {
+        return this.type;
     }
 
     @Override
@@ -111,7 +110,7 @@
         private final ImmutableList.Builder<Criterion> listBuilder
                 = ImmutableList.builder();
 
-        private Criterion key;
+        private Type type;
         private boolean permanent = DEFAULT_PERMANENT;
         private int timeout = DEFAULT_TIMEOUT;
         private ApplicationId appId;
@@ -124,8 +123,14 @@
         }
 
         @Override
-        public Builder withKey(Criterion criterion) {
-            key = criterion;
+        public Builder permit() {
+            this.type = Type.PERMIT;
+            return this;
+        }
+
+        @Override
+        public Builder deny() {
+            this.type = Type.DENY;
             return this;
         }
 
@@ -157,11 +162,11 @@
         @Override
         public FilteringObjective add() {
             List<Criterion> conditions = listBuilder.build();
-            checkNotNull(key, "Must have a key.");
+            checkNotNull(type, "Must have a type.");
             checkArgument(!conditions.isEmpty(), "Must have at least one condition.");
             checkNotNull(appId, "Must supply an application id");
 
-            return new DefaultFilteringObjective(key, permanent, timeout,
+            return new DefaultFilteringObjective(type, permanent, timeout,
                                                 appId, priority, conditions,
                                                 Operation.ADD);
 
@@ -170,11 +175,11 @@
         @Override
         public FilteringObjective remove() {
             List<Criterion> conditions = listBuilder.build();
-            checkNotNull(key, "Must have a key.");
+            checkNotNull(type, "Must have a type.");
             checkArgument(!conditions.isEmpty(), "Must have at least one condition.");
             checkNotNull(appId, "Must supply an application id");
 
-            return new DefaultFilteringObjective(key, permanent, timeout,
+            return new DefaultFilteringObjective(type, permanent, timeout,
                                                  appId, priority, conditions,
                                                  Operation.REMOVE);
 
diff --git a/core/api/src/main/java/org/onosproject/net/flowobjective/FilteringObjective.java b/core/api/src/main/java/org/onosproject/net/flowobjective/FilteringObjective.java
index 93f62ac9..24ca2dc 100644
--- a/core/api/src/main/java/org/onosproject/net/flowobjective/FilteringObjective.java
+++ b/core/api/src/main/java/org/onosproject/net/flowobjective/FilteringObjective.java
@@ -15,6 +15,7 @@
  */
 package org.onosproject.net.flowobjective;
 
+import org.onosproject.core.ApplicationId;
 import org.onosproject.net.flow.criteria.Criterion;
 
 import java.util.Collection;
@@ -27,12 +28,23 @@
  */
 public interface FilteringObjective extends Objective {
 
+    enum Type {
+        /**
+         * Enables the filtering condition.
+         */
+        PERMIT,
+
+        /**
+         * Disables the filtering condition.
+         */
+        DENY
+    }
+
     /**
-     * Represents filtering key used in this filter.
-     *
-     * @return a criterion
+     * Obtain this filtering type.
+     * @return the type
      */
-    Criterion key();
+    public Type type();
 
     /**
      * The set of conditions the filter must provision at the device.
@@ -55,12 +67,23 @@
         public Builder addCondition(Criterion criterion);
 
         /**
-         * Add a filtering key.
-         *
-         * @param criterion new criterion
-         * @return a filtering builder.
+         * Permit this filtering condition set.
+         * @return a filtering builder
          */
-        public Builder withKey(Criterion criterion);
+        public Builder permit();
+
+        /**
+         * Deny this filtering condition set.
+         * @return a filtering builder
+         */
+        public Builder deny();
+
+        /**
+         * Assigns an application id.
+         * @param appId an application id
+         * @return a filtering builder
+         */
+        public Builder fromApp(ApplicationId appId);
 
         /**
          * Builds the filtering objective that will be added.