Merge "CCSDK PropNode can read JSON and put to ctx"
authorDan Timoney <dt5972@att.com>
Mon, 25 Jun 2018 11:50:14 +0000 (11:50 +0000)
committerGerrit Code Review <gerrit@onap.org>
Mon, 25 Jun 2018 11:50:14 +0000 (11:50 +0000)
17 files changed:
features/ccsdk-sli-plugins-all/pom.xml [new file with mode: 0644]
features/features-sli-plugins/pom.xml [new file with mode: 0644]
features/installer/pom.xml [new file with mode: 0755]
features/installer/src/assembly/assemble_installer_zip.xml [new file with mode: 0755]
features/installer/src/assembly/assemble_mvnrepo_zip.xml [new file with mode: 0755]
features/installer/src/main/resources/scripts/install-feature.sh [new file with mode: 0644]
features/pom.xml [new file with mode: 0755]
pom.xml
properties-node/features/ccsdk-properties-node/pom.xml
properties-node/installer/pom.xml
properties-node/installer/src/assembly/assemble_mvnrepo_zip.xml
restapi-call-node/features/ccsdk-restapi-call-node/pom.xml
restapi-call-node/installer/pom.xml
restapi-call-node/installer/src/assembly/assemble_mvnrepo_zip.xml
restapi-call-node/provider/pom.xml
restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/XmlJsonUtil.java
restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestXmlJsonUtil.java

diff --git a/features/ccsdk-sli-plugins-all/pom.xml b/features/ccsdk-sli-plugins-all/pom.xml
new file mode 100644 (file)
index 0000000..756e759
--- /dev/null
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+
+       <parent>
+               <groupId>org.onap.ccsdk.parent</groupId>
+               <artifactId>single-feature-parent</artifactId>
+               <version>1.1.0-SNAPSHOT</version>
+               <relativePath />
+       </parent>
+
+       <groupId>org.onap.ccsdk.sli.plugins</groupId>
+       <artifactId>ccsdk-sli-plugins-all</artifactId>
+       <version>0.3.0-SNAPSHOT</version>
+       <packaging>feature</packaging>
+
+       <name>ccsdk-sli-plugins :: features :: ${project.artifactId}</name>
+       <dependencyManagement>
+               <dependencies>
+                       <dependency>
+                               <groupId>org.opendaylight.mdsal.model</groupId>
+                               <artifactId>mdsal-model-artifacts</artifactId>
+                               <version>${odl.mdsal.model.version}</version>
+                               <type>pom</type>
+                               <scope>import</scope>
+                       </dependency>
+                       <dependency>
+                               <groupId>org.opendaylight.controller</groupId>
+                               <artifactId>mdsal-artifacts</artifactId>
+                               <version>${odl.mdsal.version}</version>
+                               <type>pom</type>
+                               <scope>import</scope>
+                       </dependency>
+               </dependencies>
+       </dependencyManagement>
+
+       <dependencies>
+               <dependency>
+                       <groupId>${project.groupId}</groupId>
+                       <artifactId>ccsdk-properties-node</artifactId>
+                       <version>${project.version}</version>
+                       <type>xml</type>
+                       <classifier>features</classifier>
+               </dependency>
+               <dependency>
+                       <groupId>${project.groupId}</groupId>
+                       <artifactId>ccsdk-restapi-call-node</artifactId>
+                       <version>${project.version}</version>
+                       <type>xml</type>
+                       <classifier>features</classifier>
+               </dependency>
+
+
+       
+       </dependencies>
+</project>
diff --git a/features/features-sli-plugins/pom.xml b/features/features-sli-plugins/pom.xml
new file mode 100644 (file)
index 0000000..0b43d1a
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.onap.ccsdk.parent</groupId>
+        <artifactId>feature-repo-parent</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+        <relativePath/>
+    </parent>
+
+    <groupId>org.onap.ccsdk.sli.plugins</groupId>
+    <artifactId>features-sli-plugins</artifactId>
+    <version>0.3.0-SNAPSHOT</version>
+    <packaging>feature</packaging>
+
+    <name>ccsdk-sli-plugins :: features :: ${project.artifactId}</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>ccsdk-sli-plugins-all</artifactId>
+            <version>${project.version}</version>
+            <type>xml</type>
+            <classifier>features</classifier>
+        </dependency>
+
+    </dependencies>
+</project>
diff --git a/features/installer/pom.xml b/features/installer/pom.xml
new file mode 100755 (executable)
index 0000000..050d3e9
--- /dev/null
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+
+       <parent>
+               <groupId>org.onap.ccsdk.parent</groupId>
+               <artifactId>odlparent-lite</artifactId>
+               <version>1.1.0-SNAPSHOT</version>
+               <relativePath />
+       </parent>
+
+       <groupId>org.onap.ccsdk.sli.plugins</groupId>
+       <artifactId>sliplugins-features-installer</artifactId>
+       <version>0.3.0-SNAPSHOT</version>
+       <packaging>pom</packaging>
+
+       <name>ccsdk-sli-plugins :: features :: ${project.artifactId}</name>
+
+       <properties>
+               <application.name>ccsdk-sli-plugins-all</application.name>
+               <features.boot>${application.name}</features.boot>
+               <features.repositories>mvn:org.onap.ccsdk.sli.plugins/${features.boot}/${project.version}/xml/features</features.repositories>
+               <include.transitive.dependencies>false</include.transitive.dependencies>
+       </properties>
+
+       <dependencies>
+
+               <dependency>
+                       <groupId>org.onap.ccsdk.sli.plugins</groupId>
+                       <artifactId>${application.name}</artifactId>
+                       <version>${project.version}</version>
+                       <type>xml</type>
+                       <classifier>features</classifier>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>*</groupId>
+                                       <artifactId>*</artifactId>
+                               </exclusion>
+                       </exclusions>
+               </dependency>
+
+
+       </dependencies>
+
+       <build>
+               <plugins>
+                       <plugin>
+                               <artifactId>maven-assembly-plugin</artifactId>
+                               <executions>
+                                       <execution>
+                                               <id>maven-repo-zip</id>
+                                               <goals>
+                                                       <goal>single</goal>
+                                               </goals>
+                                               <phase>package</phase>
+                                               <configuration>
+                                                       <attach>true</attach>
+                                                       <finalName>stage/${application.name}-${project.version}</finalName>
+                                                       <descriptors>
+                                                               <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
+                                                       </descriptors>
+                                                       <appendAssemblyId>true</appendAssemblyId>
+                                               </configuration>
+                                       </execution>
+                                       <execution>
+                                               <id>installer-zip</id>
+                                               <goals>
+                                                       <goal>single</goal>
+                                               </goals>
+                                               <phase>package</phase>
+                                               <configuration>
+                                                       <attach>true</attach>
+                                                       <finalName>${application.name}-${project.version}-installer</finalName>
+                                                       <descriptors>
+                                                               <descriptor>src/assembly/assemble_installer_zip.xml</descriptor>
+                                                       </descriptors>
+                                                       <appendAssemblyId>false</appendAssemblyId>
+                                               </configuration>
+                                       </execution>
+                               </executions>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-dependency-plugin</artifactId>
+                               <executions>
+                                       <execution>
+                                               <id>copy-dependencies</id>
+                                               <goals>
+                                                       <goal>copy-dependencies</goal>
+                                               </goals>
+                                               <phase>prepare-package</phase>
+                                               <configuration>
+                                                       <transitive>false</transitive>
+                                                       <outputDirectory>${project.build.directory}/assembly/system</outputDirectory>
+                                                       <overWriteReleases>false</overWriteReleases>
+                                                       <overWriteSnapshots>true</overWriteSnapshots>
+                                                       <overWriteIfNewer>true</overWriteIfNewer>
+                                                       <useRepositoryLayout>true</useRepositoryLayout>
+                                                       <addParentPoms>false</addParentPoms>
+                                                       <copyPom>false</copyPom>
+                             <includeGroupIds>org.onap.ccsdk.sli.plugins</includeGroupIds>
+                                                       <scope>provided</scope>
+                                               </configuration>
+                                       </execution>
+                               </executions>
+                       </plugin>
+                       <plugin>
+                               <artifactId>maven-resources-plugin</artifactId>
+                               <version>2.6</version>
+                               <executions>
+                                       <execution>
+                                               <id>copy-version</id>
+                                               <goals>
+                                                       <goal>copy-resources</goal>
+                                               </goals><!-- here the phase you need -->
+                                               <phase>validate</phase>
+                                               <configuration>
+                                                       <outputDirectory>${basedir}/target/stage</outputDirectory>
+                                                       <resources>
+                                                               <resource>
+                                                                       <directory>src/main/resources/scripts</directory>
+                                                                       <includes>
+                                                                               <include>install-feature.sh</include>
+                                                                       </includes>
+                                                                       <filtering>true</filtering>
+                                                               </resource>
+                                                       </resources>
+                                               </configuration>
+                                       </execution>
+
+                               </executions>
+                       </plugin>
+
+               </plugins>
+       </build>
+</project>
diff --git a/features/installer/src/assembly/assemble_installer_zip.xml b/features/installer/src/assembly/assemble_installer_zip.xml
new file mode 100755 (executable)
index 0000000..a6a22a9
--- /dev/null
@@ -0,0 +1,39 @@
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+       xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+       <id>bin</id>
+
+       <formats>
+               <format>zip</format>
+       </formats>
+
+       <!--  we want "system" and related files right at the root level
+                 as this file is suppose to be unzip on top of a karaf
+                 distro. -->
+       <includeBaseDirectory>false</includeBaseDirectory>
+
+       <fileSets>
+               <fileSet>
+                       <directory>target/stage/</directory>
+                       <outputDirectory>${application.name}</outputDirectory>
+                       <fileMode>755</fileMode>
+                       <includes>
+                               <include>*.sh</include>
+                       </includes>
+               </fileSet>
+               <fileSet>
+                       <directory>target/stage/</directory>
+                       <outputDirectory>${application.name}</outputDirectory>
+                       <fileMode>644</fileMode>
+                       <excludes>
+                               <exclude>*.sh</exclude>
+                       </excludes>
+               </fileSet>
+       </fileSets>
+
+
+
+</assembly>
diff --git a/features/installer/src/assembly/assemble_mvnrepo_zip.xml b/features/installer/src/assembly/assemble_mvnrepo_zip.xml
new file mode 100755 (executable)
index 0000000..86b07f1
--- /dev/null
@@ -0,0 +1,29 @@
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+       xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+       <id>repo</id>
+
+       <formats>
+               <format>zip</format>
+       </formats>
+
+       <!--  we want "system" and related files right at the root level
+                 as this file is suppose to be unzip on top of a karaf
+                 distro. -->
+       <includeBaseDirectory>false</includeBaseDirectory>
+
+       <fileSets>
+               <fileSet>
+                       <directory>target/assembly/</directory>
+                       <outputDirectory>.</outputDirectory>
+                       <excludes>
+                       </excludes>
+               </fileSet>
+       </fileSets>
+
+
+
+</assembly>
diff --git a/features/installer/src/main/resources/scripts/install-feature.sh b/features/installer/src/main/resources/scripts/install-feature.sh
new file mode 100644 (file)
index 0000000..e16e79a
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}
+ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client}
+INSTALLERDIR=$(dirname $0)
+
+REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip
+
+if [ -f ${REPOZIP} ]
+then
+       unzip -d ${ODL_HOME} ${REPOZIP}
+else
+       echo "ERROR : repo zip ($REPOZIP) not found"
+       exit 1
+fi
+
+${ODL_KARAF_CLIENT} feature:repo-add ${features.repositories}
+${ODL_KARAF_CLIENT} feature:install ${features.boot}
diff --git a/features/pom.xml b/features/pom.xml
new file mode 100755 (executable)
index 0000000..3ac87bf
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+
+       <parent>
+               <groupId>org.onap.ccsdk.parent</groupId>
+               <artifactId>odlparent-lite</artifactId>
+               <version>1.1.0-SNAPSHOT</version>
+               <relativePath/>
+       </parent>
+
+       <groupId>org.onap.ccsdk.sli.plugins</groupId>
+       <artifactId>sliplugins-feature-aggregator</artifactId>
+       <version>0.3.0-SNAPSHOT</version>
+       <packaging>pom</packaging>
+
+       <name>ccsdk-sli-plugins :: features</name>
+
+       <modules>
+        <module>ccsdk-sli-plugins-all</module>
+        <module>features-sli-plugins</module>
+        <module>installer</module>
+    </modules>
+</project>
diff --git a/pom.xml b/pom.xml
index 8c13013..b6efa94 100755 (executable)
--- a/pom.xml
+++ b/pom.xml
@@ -23,6 +23,7 @@
     <modules>
         <module>properties-node</module>
         <module>restapi-call-node</module>
+        <module>features</module>
     </modules>
 
     <scm>
index 420ba49..fd38cb2 100644 (file)
 
     <name>ccsdk-sli-plugins :: properties-node :: ${project.artifactId}</name>
 
-    <properties>
-        <skip.karaf.featureTest>true</skip.karaf.featureTest>
-    </properties>
 
+       <dependencyManagement>
+               <dependencies>
+                    <dependency>
+                <groupId>org.opendaylight.mdsal.model</groupId>
+                <artifactId>mdsal-model-artifacts</artifactId>
+                <version>${odl.mdsal.model.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller</groupId>
+                <artifactId>mdsal-artifacts</artifactId>
+                <version>${odl.mdsal.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+               </dependencies>
+       </dependencyManagement>
+       
     <dependencies>
-        <dependency>
-            <groupId>org.opendaylight.controller</groupId>
-            <artifactId>odl-mdsal-broker</artifactId>
-            <type>xml</type>
-            <classifier>features</classifier>
-        </dependency>
+
         <dependency>
             <groupId>org.onap.ccsdk.sli.core</groupId>
             <artifactId>ccsdk-sli</artifactId>
index c9a11c6..965bdbb 100755 (executable)
                         </goals>
                         <phase>package</phase>
                         <configuration>
-                            <attach>false</attach>
+                            <attach>true</attach>
                             <finalName>stage/${application.name}-${project.version}</finalName>
                             <descriptors>
                                 <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
                             </descriptors>
-                            <appendAssemblyId>false</appendAssemblyId>
+                            <appendAssemblyId>true</appendAssemblyId>
                         </configuration>
                     </execution>
                     <execution>
index 2ee2244..9cdc788 100644 (file)
@@ -25,7 +25,7 @@
     xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
-    <id>mvnrepo_zip</id>
+    <id>repo</id>
     <formats>
         <format>zip</format>
     </formats>
index 43dcc74..822a6d1 100644 (file)
@@ -1,53 +1,55 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+       <modelVersion>4.0.0</modelVersion>
 
-    <parent>
-        <groupId>org.onap.ccsdk.parent</groupId>
-        <artifactId>single-feature-parent</artifactId>
-        <version>1.1.0-SNAPSHOT</version>
-        <relativePath />
-    </parent>
+       <parent>
+               <groupId>org.onap.ccsdk.parent</groupId>
+               <artifactId>single-feature-parent</artifactId>
+               <version>1.1.0-SNAPSHOT</version>
+               <relativePath />
+       </parent>
 
-    <groupId>org.onap.ccsdk.sli.plugins</groupId>
-    <artifactId>ccsdk-restapi-call-node</artifactId>
-    <version>0.3.0-SNAPSHOT</version>
-    <packaging>feature</packaging>
+       <groupId>org.onap.ccsdk.sli.plugins</groupId>
+       <artifactId>ccsdk-restapi-call-node</artifactId>
+       <version>0.3.0-SNAPSHOT</version>
+       <packaging>feature</packaging>
 
-    <name>ccsdk-sli-plugins :: restapi-call-node :: ${project.artifactId}</name>
+       <name>ccsdk-sli-plugins :: restapi-call-node :: ${project.artifactId}</name>
 
+       <dependencyManagement>
+               <dependencies>
+                       <dependency>
+                               <groupId>org.opendaylight.mdsal.model</groupId>
+                               <artifactId>mdsal-model-artifacts</artifactId>
+                               <version>${odl.mdsal.model.version}</version>
+                               <type>pom</type>
+                               <scope>import</scope>
+                       </dependency>
+                       <dependency>
+                               <groupId>org.opendaylight.controller</groupId>
+                               <artifactId>mdsal-artifacts</artifactId>
+                               <version>${odl.mdsal.version}</version>
+                               <type>pom</type>
+                               <scope>import</scope>
+                       </dependency>
+               </dependencies>
+       </dependencyManagement>
 
-    <properties>
-        <skip.karaf.featureTest>true</skip.karaf.featureTest>
-    </properties>
+       <dependencies>
 
-
-    <dependencies>
-        <dependency>
-            <groupId>org.opendaylight.controller</groupId>
-            <artifactId>odl-mdsal-broker</artifactId>
-            <type>xml</type>
-            <classifier>features</classifier>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.ccsdk.sli.core</groupId>
-            <artifactId>ccsdk-sli</artifactId>
-            <version>${ccsdk.sli.core.version}</version>
-            <type>xml</type>
-            <classifier>features</classifier>
-        </dependency>
-        <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>restapi-call-node-provider</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-client</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.codehaus.jettison</groupId>
-            <artifactId>jettison</artifactId>
-        </dependency>
-    </dependencies>
+               <dependency>
+                       <groupId>org.onap.ccsdk.sli.core</groupId>
+                       <artifactId>ccsdk-sli</artifactId>
+                       <version>${ccsdk.sli.core.version}</version>
+                       <type>xml</type>
+                       <classifier>features</classifier>
+               </dependency>
+               <dependency>
+                       <groupId>${project.groupId}</groupId>
+                       <artifactId>restapi-call-node-provider</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+       </dependencies>
 </project>
index 0badf58..8e2f402 100755 (executable)
                                                </goals>
                                                <phase>package</phase>
                                                <configuration>
-                                                       <attach>false</attach>
+                                                       <attach>true</attach>
                                                        <finalName>stage/${application.name}-${project.version}</finalName>
                                                        <descriptors>
                                                                <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
                                                        </descriptors>
-                                                       <appendAssemblyId>false</appendAssemblyId>
+                                                       <appendAssemblyId>true</appendAssemblyId>
                                                </configuration>
                                        </execution>
                                        <execution>
index cb56f2c..35e79db 100644 (file)
@@ -25,7 +25,7 @@
        xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
-       <id>mvnrepo_zip</id>
+       <id>repo</id>
        <formats>
                <format>zip</format>
        </formats>
index 4831356..18a20ce 100755 (executable)
         <dependency>
             <groupId>com.sun.jersey</groupId>
             <artifactId>jersey-client</artifactId>
-            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>com.sun.jersey.contribs.jersey-oauth</groupId>
             <artifactId>oauth-signature</artifactId>
             <version>${jersey.version}</version>
-            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>com.sun.jersey.contribs.jersey-oauth</groupId>
             <artifactId>oauth-client</artifactId>
             <version>${jersey.version}</version>
-            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.codehaus.jettison</groupId>
             <artifactId>jettison</artifactId>
-            <scope>provided</scope>
         </dependency>
     </dependencies>
 </project>
index 965d3da..8a0ca8d 100644 (file)
@@ -55,8 +55,14 @@ public final class XmlJsonUtil {
             escape = false;
         }
 
+        boolean quotes = true;
+        if (var.startsWith("\"")) {
+            var = var.substring(1);
+            quotes = false;
+        }
+
         Object o = createStructure(varmap, var);
-        return generateJson(o, escape);
+        return generateJson(o, escape, quotes);
     }
 
     private static Object createStructure(Map<String, String> flatmap, String var) {
@@ -159,22 +165,26 @@ public final class XmlJsonUtil {
         return null;
     }
 
-    private static String generateJson(Object o, boolean escape) {
+    private static String generateJson(Object o, boolean escape, boolean quotes) {
         if (o == null)
             return null;
 
         StringBuilder ss = new StringBuilder();
-        generateJson(ss, o, 0, false, escape);
+        generateJson(ss, o, 0, false, escape, quotes);
         return ss.toString();
     }
 
     @SuppressWarnings("unchecked")
-    private static void generateJson(StringBuilder ss, Object o, int indent, boolean padFirst, boolean escape) {
+    private static void generateJson(StringBuilder ss, Object o, int indent, boolean padFirst, boolean escape, boolean quotes) {
         if (o instanceof String) {
             String s = escape ? escapeJson((String) o) : (String) o;
             if (padFirst)
                 ss.append(pad(indent));
-            ss.append('"').append(s).append('"');
+            if (quotes) {
+                ss.append('"').append(s).append('"');
+            } else {
+                ss.append(s);
+            }
             return;
         }
 
@@ -193,7 +203,7 @@ public final class XmlJsonUtil {
                 Object v = entry.getValue();
                 String key = entry.getKey();
                 ss.append(pad(indent + 1)).append('"').append(key).append("\": ");
-                generateJson(ss, v, indent + 1, false, escape);
+                generateJson(ss, v, indent + 1, false, escape, true);
             }
 
             ss.append("\n");
@@ -215,7 +225,7 @@ public final class XmlJsonUtil {
                     ss.append(",\n");
                 first = false;
 
-                generateJson(ss, o1, indent + 1, true, escape);
+                generateJson(ss, o1, indent + 1, true, escape, quotes);
             }
 
             ss.append("\n");
index 579d194..fcbd844 100644 (file)
@@ -144,6 +144,12 @@ public class TestXmlJsonUtil {
 
         ss = XmlJsonUtil.getJson(mm, "service-data.vnf-config-information");
         log.info(ss);
+
+        ss = XmlJsonUtil.getJson(mm, "service-data.vnf-config-information.vnf-host-ip-address");
+        log.info(ss);
+
+        ss = XmlJsonUtil.getJson(mm, "\"service-data.vnf-config-information.vnf-host-ip-address");
+        log.info(ss);
     }
 
     @Test