ONOS-3321 Added ability for applications to register a deactivation hook.

Change-Id: I284321474dbf9e39e8b61f7b907f637ba6b80aaf
diff --git a/core/api/src/main/java/org/onosproject/core/CoreService.java b/core/api/src/main/java/org/onosproject/core/CoreService.java
index 303ad39..0825a6d 100644
--- a/core/api/src/main/java/org/onosproject/core/CoreService.java
+++ b/core/api/src/main/java/org/onosproject/core/CoreService.java
@@ -50,6 +50,7 @@
 
     /**
      * Returns an existing application id from a given id.
+     *
      * @param id the short value of the id
      * @return an application id
      */
@@ -57,6 +58,7 @@
 
     /**
      * Returns an existing application id from a given id.
+     *
      * @param name the name portion of the ID to look up
      * @return an application id
      */
@@ -67,10 +69,21 @@
      * to follow the reverse DNS convention, e.g.
      * {@code org.flying.circus.app}
      *
-     * @param identifier string identifier
+     * @param name string identifier
      * @return the application id
      */
-    ApplicationId registerApplication(String identifier);
+    ApplicationId registerApplication(String name);
+
+    /**
+     * Registers a new application by its name, which is expected
+     * to follow the reverse DNS convention, e.g.
+     * {@code org.flying.circus.app}, along with its pre-deactivation hook.
+     *
+     * @param name          string identifier
+     * @param preDeactivate pre-deactivation hook
+     * @return the application id
+     */
+    ApplicationId registerApplication(String name, Runnable preDeactivate);
 
     /**
      * Returns an id generator for a given topic.