Fix unimplemented createInstance 19/10619/1
authorDan Timoney <dtimoney@att.com>
Wed, 6 Sep 2017 18:04:27 +0000 (14:04 -0400)
committerDan Timoney <dtimoney@att.com>
Wed, 6 Sep 2017 18:04:27 +0000 (14:04 -0400)
The createInstance() method in the provider yang-generated Module class
has a default implementation that throws an UnsupportedOperationException.
Replaced default implementation with correct code to create an instance
of the asdcApi and dataChange provider classes.

Change-Id: I1f2b199702a9094f6808ec077d6752c4c5c0c30d
Issue-ID: CCSDK-77
Signed-off-by: Dan Timoney <dtimoney@att.com>
asdcApi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/northbound/asdcapi/provider/impl/rev140523/AsdcApiProviderModule.java
dataChange/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/northbound/datachange/provider/impl/rev140523/DataChangeProviderModule.java

index ddf8093..26dc942 100644 (file)
@@ -8,9 +8,9 @@
  * 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.
@@ -20,6 +20,9 @@
  */
 
 package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.asdcapi.provider.impl.rev140523;
+
+import org.onap.ccsdk.sli.northbound.asdcapi.AsdcApiProvider;
+
 public class AsdcApiProviderModule extends org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.asdcapi.provider.impl.rev140523.AbstractAsdcApiProviderModule {
     public AsdcApiProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
@@ -36,8 +39,21 @@ public class AsdcApiProviderModule extends org.opendaylight.yang.gen.v1.org.onap
 
     @Override
     public java.lang.AutoCloseable createInstance() {
-        // TODO:implement
-        throw new java.lang.UnsupportedOperationException();
+
+
+        final AsdcApiProvider provider = new AsdcApiProvider(getDataBrokerDependency()
+                , getNotificationServiceDependency()
+                , getRpcRegistryDependency());
+
+        return new AutoCloseable() {
+
+           @Override
+           public void close() throws Exception {
+
+               provider.close();
+           }
+       };
+
     }
 
 }
index 0655ae2..e210613 100644 (file)
@@ -8,9 +8,9 @@
  * 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.
@@ -20,6 +20,9 @@
  */
 
 package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.provider.impl.rev140523;
+
+import org.onap.ccsdk.sli.northbound.DataChangeProvider;
+
 public class DataChangeProviderModule extends org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.provider.impl.rev140523.AbstractDataChangeProviderModule {
     public DataChangeProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
@@ -36,8 +39,17 @@ public class DataChangeProviderModule extends org.opendaylight.yang.gen.v1.org.o
 
     @Override
     public java.lang.AutoCloseable createInstance() {
-        // TODO:implement
-        throw new java.lang.UnsupportedOperationException();
+        final DataChangeProvider provider = new DataChangeProvider(getDataBrokerDependency()
+                , getNotificationServiceDependency()
+                , getRpcRegistryDependency());
+
+        return new AutoCloseable() {
+
+           @Override
+           public void close() throws Exception {
+               provider.close();
+           }
+       };
     }
 
 }