Revert "Revert "YANG runtime manager to register default serializers.""
This reverts commit 6beebeb73e2029e486b713869eed5d64e7f3b066.
Change-Id: Ia044dcbe86ae5557324f330e8659bd9e4b35cf12
diff --git a/apps/yang/BUCK b/apps/yang/BUCK
index 7af28b0..85e557c 100644
--- a/apps/yang/BUCK
+++ b/apps/yang/BUCK
@@ -3,6 +3,10 @@
'//lib:onos-yang-model',
'//lib:onos-yang-compiler-api',
'//lib:onos-yang-runtime',
+ '//lib:onos-yang-serializers-json',
+ '//lib:onos-yang-serializers-xml',
+ '//lib:onos-yang-serializers-utils',
+ '//lib:org.apache.servicemix.bundles.dom4j',
]
BUNDLES = [
@@ -12,6 +16,13 @@
'//lib:onos-yang-runtime',
]
+EXCLUDED_BUNDLES = [
+ '//lib:onos-yang-serializers-json',
+ '//lib:onos-yang-serializers-xml',
+ '//lib:onos-yang-serializers-utils',
+ '//lib:org.apache.servicemix.bundles.dom4j',
+]
+
osgi_jar (
deps = COMPILE_DEPS,
)
@@ -22,4 +33,5 @@
url = 'http://onosproject.org',
description = 'Base application to bring in the YANG libraries and assemble them for other apps to use.',
included_bundles = BUNDLES,
+ excluded_bundles = EXCLUDED_BUNDLES,
)
\ No newline at end of file
diff --git a/apps/yang/pom.xml b/apps/yang/pom.xml
index c277ece..d523e25 100644
--- a/apps/yang/pom.xml
+++ b/apps/yang/pom.xml
@@ -35,5 +35,15 @@
<artifactId>onos-yang-runtime</artifactId>
<version>${yang.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-yang-serializers-json</artifactId>
+ <version>${yang.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-yang-serializers-xml</artifactId>
+ <version>${yang.version}</version>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
diff --git a/apps/yang/src/main/java/org/onosproject/yang/YangRuntimeManager.java b/apps/yang/src/main/java/org/onosproject/yang/YangRuntimeManager.java
index 1df5f13..c9a9ce9 100644
--- a/apps/yang/src/main/java/org/onosproject/yang/YangRuntimeManager.java
+++ b/apps/yang/src/main/java/org/onosproject/yang/YangRuntimeManager.java
@@ -36,6 +36,8 @@
import org.onosproject.yang.runtime.impl.DefaultYangModelRegistry;
import org.onosproject.yang.runtime.impl.DefaultYangRuntimeHandler;
import org.onosproject.yang.runtime.impl.DefaultYangSerializerRegistry;
+import org.onosproject.yang.serializers.json.JsonSerializer;
+import org.onosproject.yang.serializers.xml.XmlSerializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -66,6 +68,8 @@
serializerRegistry = new DefaultYangSerializerRegistry();
modelRegistry = new DefaultYangModelRegistry();
runtimeService = new DefaultYangRuntimeHandler(serializerRegistry, modelRegistry);
+ serializerRegistry.registerSerializer(new JsonSerializer());
+ serializerRegistry.registerSerializer(new XmlSerializer());
log.info("Started");
}