[ONOS-4260]Alarm and fault managment application refactoring according to ONOS architecture

Change-Id: I47e9db37eb5fc27ac19db2e4cb87774736b44685
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmConsumer.java b/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmConsumer.java
new file mode 100644
index 0000000..d417afa
--- /dev/null
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmConsumer.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.incubator.net.faultmanagement.alarm;
+
+import org.onosproject.net.driver.HandlerBehaviour;
+
+import java.util.List;
+
+/**
+ * Abstraction of a device behaviour capable of retrieving/consuming list of
+ * pending alarms from the device.
+ */
+public interface AlarmConsumer extends HandlerBehaviour {
+
+    /**
+     * Returns the list of active alarms consumed from the device.
+     * This means that subsequent retrieval of alarms will not contain
+     * any duplicates.
+     *
+     * @return list of alarms consumed from the device
+     */
+    List<Alarm> consumeAlarms();
+
+}
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProvider.java b/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProvider.java
index 8ee6f2f..0b5b875 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProvider.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProvider.java
@@ -19,30 +19,18 @@
 import org.onosproject.net.provider.Provider;
 
 /**
- * Abstraction of a Alarm provider.
+ * Abstraction of an entity capable of supplying alarms collected from
+ * network devices.
  */
 public interface AlarmProvider extends Provider {
 
     /**
-     * Triggers an asynchronous discovery of the alarms on the specified device, intended to refresh internal alarm
-     * model for the device. An indirect result of this should be a event sent later with discovery result ie a set of
-     * alarms.
+     * Triggers an asynchronous discovery of the alarms on the specified device,
+     * intended to refresh internal alarm model for the device. An indirect
+     * result of this should be a event sent later with discovery result
+     * ie a set of alarms.
      *
      * @param deviceId ID of device to be probed
      */
     void triggerProbe(DeviceId deviceId);
-
-    /**
-     * Register a listener for alarms.
-     *
-     * @param listener the listener to notify
-     */
-    void addAlarmListener(AlarmListener listener);
-
-    /**
-     * Unregister a listener.
-     *
-     * @param listener the listener to unregister
-     */
-    void removeAlarmListener(AlarmListener listener);
 }
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmListener.java b/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProviderRegistryAdapter.java
similarity index 60%
rename from incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmListener.java
rename to incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProviderRegistryAdapter.java
index f09c196..327fd1e 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmListener.java
+++ b/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProviderRegistryAdapter.java
@@ -13,13 +13,30 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.onosproject.incubator.net.faultmanagement.alarm;
 
-import org.onosproject.event.EventListener;
+import org.onosproject.net.provider.ProviderId;
 
+import java.util.Set;
 
 /**
- * Entity capable of receiving Alarm related events.
+ * Adapter for Alarm Provider Registry.
  */
-public interface AlarmListener extends EventListener<AlarmEvent> {
+public class AlarmProviderRegistryAdapter implements AlarmProviderRegistry {
+
+    @Override
+    public AlarmProviderService register(AlarmProvider provider) {
+        return null;
+    }
+
+    @Override
+    public void unregister(AlarmProvider provider) {
+
+    }
+
+    @Override
+    public Set<ProviderId> getProviders() {
+        return null;
+    }
 }