ONOS-3725 Adding ability to retain pending configs.

This allows up-load of configurations before their backing classes are registered by apps/subsystems.

 Validation and delegation of network config change events is deferred until the class registration.

Change-Id: Ifc9c97fbc86e764cb03cecb1f73f7191de3e7754
diff --git a/core/api/src/main/java/org/onosproject/net/config/NetworkConfigService.java b/core/api/src/main/java/org/onosproject/net/config/NetworkConfigService.java
index f1b22c4..c3760c6 100644
--- a/core/api/src/main/java/org/onosproject/net/config/NetworkConfigService.java
+++ b/core/api/src/main/java/org/onosproject/net/config/NetworkConfigService.java
@@ -135,6 +135,28 @@
                                            JsonNode json);
 
     /**
+     * Applies configuration for the specified subject and configuration
+     * key using the raw JSON object. If configuration already exists, it
+     * will be updated. If the specified configuration key does not yet have
+     * a registered class associated with it, the configuration will be pending
+     * and null value will be returned. Once the backing configuration class is
+     * registered, the configuration will be validated and accepted.
+     *
+     * @param subjectClassKey subject class key
+     * @param subject         configuration subject
+     * @param configKey       configuration class key
+     * @param json            raw JSON node containing the configuration data
+     * @param <S>             type of subject
+     * @param <C>             type of configuration
+     * @return configuration object or null if configuration key does not have
+     *                                  a registered class yet
+     * @throws IllegalArgumentException if the supplied JSON node contains
+     *                                  invalid data
+     */
+    <S, C extends Config<S>> C applyConfig(String subjectClassKey, S subject,
+                                           String configKey, JsonNode json);
+
+    /**
      * Clears any configuration for the specified subject and configuration
      * class. If one does not exist, this call has no effect.
      *
@@ -145,4 +167,13 @@
      */
     <S, C extends Config<S>> void removeConfig(S subject, Class<C> configClass);
 
+    /**
+     * Clears any configuration for the specified subject and configuration
+     * key. If one does not exist, this call has no effect.
+     *
+     * @param subject     configuration subject
+     * @param configKey   configuration key
+     * @param <S>         type of subject
+     */
+    <S> void removeConfig(String subjectClassKey, S subject, String configKey);
 }