diff options
Diffstat (limited to 'mdsal-resource')
14 files changed, 784 insertions, 784 deletions
diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index fbad6e210..140810ff9 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -1,134 +1,134 @@ <?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> - <artifactId>mdsal-resource</artifactId> - <groupId>org.onap.ccsdk.sli.adaptors</groupId> - <version>0.0.1-SNAPSHOT</version> - </parent> - <artifactId>mdsal-resource-features</artifactId> - <name>MD-SAL Resource Adaptor - Features</name> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>mdsal-resource</artifactId> + <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>mdsal-resource-features</artifactId> + <name>MD-SAL Resource Adaptor - Features</name> - <packaging>jar</packaging> + <packaging>jar</packaging> - <dependencies> + <dependencies> - <dependency> - <groupId>org.onap.ccsdk.sli.adaptors</groupId> - <artifactId>mdsal-resource-provider</artifactId> - <version>${project.version}</version> - </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <artifactId>mdsal-resource-provider</artifactId> + <version>${project.version}</version> + </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.6</version> - <scope>compile</scope> - </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.6</version> + <scope>compile</scope> + </dependency> - <dependency> - <groupId>org.opendaylight.mdsal</groupId> - <artifactId>features-mdsal</artifactId> - <version>${odl.mdsal.features.version}</version> - <classifier>features</classifier> - <type>xml</type> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>features-mdsal</artifactId> + <version>${odl.mdsal.features.version}</version> + <classifier>features</classifier> + <type>xml</type> - <scope>runtime</scope> - </dependency> + <scope>runtime</scope> + </dependency> - <!-- dependency for opendaylight-karaf-empty for use by testing --> - <dependency> - <groupId>org.opendaylight.odlparent</groupId> - <artifactId>opendaylight-karaf-empty</artifactId> - <version>${odl.karaf.empty.distro.version}</version> - <type>zip</type> - </dependency> + <!-- dependency for opendaylight-karaf-empty for use by testing --> + <dependency> + <groupId>org.opendaylight.odlparent</groupId> + <artifactId>opendaylight-karaf-empty</artifactId> + <version>${odl.karaf.empty.distro.version}</version> + <type>zip</type> + </dependency> - <dependency> - <!-- Required for launching the feature tests --> - <groupId>org.opendaylight.odlparent</groupId> - <artifactId>features-test</artifactId> - <version>${odl.commons.opendaylight.version}</version> - <scope>test</scope> - </dependency> + <dependency> + <!-- Required for launching the feature tests --> + <groupId>org.opendaylight.odlparent</groupId> + <artifactId>features-test</artifactId> + <version>${odl.commons.opendaylight.version}</version> + <scope>test</scope> + </dependency> - <dependency> - <groupId>org.opendaylight.yangtools</groupId> - <artifactId>features-yangtools</artifactId> - <version>${odl.yangtools.version}</version> - <classifier>features</classifier> - <type>xml</type> - <scope>runtime</scope> - </dependency> - </dependencies> + <dependency> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>features-yangtools</artifactId> + <version>${odl.yangtools.version}</version> + <classifier>features</classifier> + <type>xml</type> + <scope>runtime</scope> + </dependency> + </dependencies> - <build> - <resources> - <resource> - <filtering>true</filtering> - <directory>src/main/resources</directory> - </resource> - </resources> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-resources-plugin</artifactId> - <executions> - <execution> - <id>filter</id> - <goals> - <goal>resources</goal> - </goals> - <phase>generate-resources</phase> - </execution> - </executions> - </plugin> - <!-- launches the feature test, which validates that your karaf feature - can be installed inside of a karaf container. It doesn't validate that your - functionality works correctly, just that you have all of the dependent bundles - defined correctly. - <plugin> + <build> + <resources> + <resource> + <filtering>true</filtering> + <directory>src/main/resources</directory> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>filter</id> + <goals> + <goal>resources</goal> + </goals> + <phase>generate-resources</phase> + </execution> + </executions> + </plugin> + <!-- launches the feature test, which validates that your karaf feature + can be installed inside of a karaf container. It doesn't validate that your + functionality works correctly, just that you have all of the dependent bundles + defined correctly. + <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.16</version> - <configuration> - <systemPropertyVariables> - <karaf.distro.groupId>org.opendaylight.controller</karaf.distro.groupId> - <karaf.distro.artifactId>opendaylight-karaf-empty</karaf.distro.artifactId> - <karaf.distro.version>${odl.karaf.empty.distro.version}</karaf.distro.version> - </systemPropertyVariables> - <dependenciesToScan> - <dependency>org.opendaylight.yangtools:features-test</dependency> - </dependenciesToScan> - </configuration> - </plugin> - --> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <executions> - <execution> - <id>attach-artifacts</id> - <goals> - <goal>attach-artifact</goal> - </goals> - <phase>package</phase> - <configuration> - <artifacts> - <artifact> - <file>${project.build.directory}/classes/${features.file}</file> - <type>xml</type> - <classifier>features</classifier> - </artifact> - </artifacts> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.16</version> + <configuration> + <systemPropertyVariables> + <karaf.distro.groupId>org.opendaylight.controller</karaf.distro.groupId> + <karaf.distro.artifactId>opendaylight-karaf-empty</karaf.distro.artifactId> + <karaf.distro.version>${odl.karaf.empty.distro.version}</karaf.distro.version> + </systemPropertyVariables> + <dependenciesToScan> + <dependency>org.opendaylight.yangtools:features-test</dependency> + </dependenciesToScan> + </configuration> + </plugin> + --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>attach-artifacts</id> + <goals> + <goal>attach-artifact</goal> + </goals> + <phase>package</phase> + <configuration> + <artifacts> + <artifact> + <file>${project.build.directory}/classes/${features.file}</file> + <type>xml</type> + <classifier>features</classifier> + </artifact> + </artifacts> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> diff --git a/mdsal-resource/features/src/main/resources/features.xml b/mdsal-resource/features/src/main/resources/features.xml index 5f4a954b4..6ed0b1ebe 100644 --- a/mdsal-resource/features/src/main/resources/features.xml +++ b/mdsal-resource/features/src/main/resources/features.xml @@ -4,7 +4,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 ONAP Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 0e52c1306..d636f8d91 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -1,138 +1,138 @@ <?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> - <artifactId>mdsal-resource</artifactId> - <groupId>org.onap.ccsdk.sli.adaptors</groupId> - <version>0.0.1-SNAPSHOT</version> - </parent> - <artifactId>mdsal-resource-installer</artifactId> - <name>MDSAL Resource - Karaf Installer</name> - <packaging>pom</packaging> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>mdsal-resource</artifactId> + <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>mdsal-resource-installer</artifactId> + <name>MDSAL Resource - Karaf Installer</name> + <packaging>pom</packaging> - <properties> - <application.name>sdnc-mdsal-resource</application.name> - <features.boot>sdnc-mdsal-resource</features.boot> - <features.repositories>mvn:org.onap.ccsdk.sli.adaptors/mdsal-resource-features/${project.version}/xml/features</features.repositories> - <include.transitive.dependencies>false</include.transitive.dependencies> - </properties> + <properties> + <application.name>sdnc-mdsal-resource</application.name> + <features.boot>sdnc-mdsal-resource</features.boot> + <features.repositories>mvn:org.onap.ccsdk.sli.adaptors/mdsal-resource-features/${project.version}/xml/features</features.repositories> + <include.transitive.dependencies>false</include.transitive.dependencies> + </properties> - <dependencies> + <dependencies> - <dependency> - <groupId>org.onap.ccsdk.sli.adaptors</groupId> - <artifactId>mdsal-resource-features</artifactId> - <version>${project.version}</version> - <classifier>features</classifier> - <type>xml</type> - <exclusions> - <exclusion> - <groupId>*</groupId> - <artifactId>*</artifactId> - </exclusion> - </exclusions> - </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <artifactId>mdsal-resource-features</artifactId> + <version>${project.version}</version> + <classifier>features</classifier> + <type>xml</type> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> - <dependency> - <groupId>org.onap.ccsdk.sli.adaptors</groupId> - <artifactId>mdsal-resource-provider</artifactId> - <version>${project.version}</version> - </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <artifactId>mdsal-resource-provider</artifactId> + <version>${project.version}</version> + </dependency> - </dependencies> + </dependencies> - <build> - <plugins> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <version>2.6</version> - <executions> - <execution> - <id>maven-repo-zip</id> - <goals> - <goal>single</goal> - </goals> - <phase>package</phase> - <configuration> - <attach>false</attach> - <finalName>stage/${application.name}-${project.version}</finalName> - <descriptors> - <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor> - </descriptors> - <appendAssemblyId>false</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</includeGroupIds> - <excludeArtifactIds>sli-common,sli-provider,dblib-provider</excludeArtifactIds> - <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> + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <id>maven-repo-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <attach>false</attach> + <finalName>stage/${application.name}-${project.version}</finalName> + <descriptors> + <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor> + </descriptors> + <appendAssemblyId>false</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</includeGroupIds> + <excludeArtifactIds>sli-common,sli-provider,dblib-provider</excludeArtifactIds> + <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> + </executions> + </plugin> - </plugins> - </build> + </plugins> + </build> </project> diff --git a/mdsal-resource/installer/src/assembly/assemble_installer_zip.xml b/mdsal-resource/installer/src/assembly/assemble_installer_zip.xml index e278872a1..5f32ff4ce 100644 --- a/mdsal-resource/installer/src/assembly/assemble_installer_zip.xml +++ b/mdsal-resource/installer/src/assembly/assemble_installer_zip.xml @@ -3,7 +3,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 ONAP Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,37 +22,37 @@ <!-- 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>installer_zip</id> - <formats> - <format>zip</format> - </formats> + 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>installer_zip</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> + <!-- 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> + <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> diff --git a/mdsal-resource/installer/src/assembly/assemble_mvnrepo_zip.xml b/mdsal-resource/installer/src/assembly/assemble_mvnrepo_zip.xml index 1edacdb6d..6b7d23f89 100644 --- a/mdsal-resource/installer/src/assembly/assemble_mvnrepo_zip.xml +++ b/mdsal-resource/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -3,7 +3,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 ONAP Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,27 +22,27 @@ <!-- 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>mvnrepo_zip</id> - <formats> - <format>zip</format> - </formats> + 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> + <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> + <!-- 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> + <fileSets> + <fileSet> + <directory>target/assembly/</directory> + <outputDirectory>.</outputDirectory> + <excludes> + </excludes> + </fileSet> + </fileSets> diff --git a/mdsal-resource/installer/src/main/resources/scripts/install-feature.sh b/mdsal-resource/installer/src/main/resources/scripts/install-feature.sh index 9a47d2225..214dbbe7e 100644 --- a/mdsal-resource/installer/src/main/resources/scripts/install-feature.sh +++ b/mdsal-resource/installer/src/main/resources/scripts/install-feature.sh @@ -30,10 +30,10 @@ REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip if [ -f ${REPOZIP} ] then - unzip -d ${ODL_HOME} ${REPOZIP} + unzip -d ${ODL_HOME} ${REPOZIP} else - echo "ERROR : repo zip ($REPOZIP) not found" - exit 1 + echo "ERROR : repo zip ($REPOZIP) not found" + exit 1 fi ${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 4501edd14..a6f68b434 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -1,21 +1,21 @@ <?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/maven-v4_0_0.xsd"> - <parent> - <groupId>org.onap.ccsdk.sli.adaptors</groupId> - <artifactId>sdnc-adaptors</artifactId> - <version>0.0.1-SNAPSHOT</version> - </parent> + <parent> + <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <artifactId>sdnc-adaptors</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> - <modelVersion>4.0.0</modelVersion> - <packaging>pom</packaging> - <groupId>org.onap.ccsdk.sli.adaptors</groupId> - <artifactId>mdsal-resource</artifactId> + <modelVersion>4.0.0</modelVersion> + <packaging>pom</packaging> + <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <artifactId>mdsal-resource</artifactId> - <name>MD-SAL Resource Adaptor</name> - <description>The MD-SAL resource adaptor allows service logic to access persistent data from MD-SAL config and operational trees</description> + <name>MD-SAL Resource Adaptor</name> + <description>The MD-SAL resource adaptor allows service logic to access persistent data from MD-SAL config and operational trees</description> - <version>0.0.1-SNAPSHOT</version> + <version>0.0.1-SNAPSHOT</version> <dependencyManagement> diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 0092f6996..92dada640 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -1,122 +1,122 @@ <?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.sli.adaptors</groupId> - <artifactId>mdsal-resource</artifactId> - <version>0.0.1-SNAPSHOT</version> - </parent> - <artifactId>mdsal-resource-provider</artifactId> - <packaging>bundle</packaging> - <name>MD-SAL Resource Adaptor - Provider</name> - <url>http://maven.apache.org</url> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> - <dependencies> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <artifactId>mdsal-resource</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>mdsal-resource-provider</artifactId> + <packaging>bundle</packaging> + <name>MD-SAL Resource Adaptor - Provider</name> + <url>http://maven.apache.org</url> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.sli.core</groupId> - <artifactId>sli-common</artifactId> - <version>${sdnctl.sli.version}</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.sli.core</groupId> - <artifactId>sli-provider</artifactId> - <version>${sdnctl.sli.version}</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>equinoxSDK381</groupId> - <artifactId>org.eclipse.osgi</artifactId> - <version>${equinox.osgi.version}</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>${slf4j.version}</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - <version>${slf4j.version}</version> - </dependency> - <dependency> - <groupId>commons-codec</groupId> - <artifactId>commons-codec</artifactId> - <version>${commons.codec.version}</version> - </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-common</artifactId> + <version>${sdnctl.sli.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-provider</artifactId> + <version>${sdnctl.sli.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>equinoxSDK381</groupId> + <artifactId>org.eclipse.osgi</artifactId> + <version>${equinox.osgi.version}</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>${slf4j.version}</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl-over-slf4j</artifactId> + <version>${slf4j.version}</version> + </dependency> + <dependency> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + <version>${commons.codec.version}</version> + </dependency> - </dependencies> + </dependencies> - <build> - <plugins> + <build> + <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <version>${bundle.plugin.version}</version> - <extensions>true</extensions> - <configuration> - <instructions> - <Bundle-SymbolicName>org.openecomp.sdnc.sli.resource.mdsal</Bundle-SymbolicName> - <Bundle-Activator>org.openecomp.sdnc.sli.resource.mdsal.MdsalResourceActivator</Bundle-Activator> - <Export-Package>org.openecomp.sdnc.sli.resource.mdsal</Export-Package> - <Import-Package>org.openecomp.sdnc.sli.*,org.osgi.framework.*,org.slf4j.*,com.mysql.jdbc.*</Import-Package> - <!-- <Embed-Dependency>*;scope=compile|runtime;artifactId=!sli-common|org.eclipse.osgi|slf4j-api|jcl-over-slf4j|mysql-connector-java|xml-apis</Embed-Dependency> --> - <Import-Package>*</Import-Package> - <Embed-Transitive>true</Embed-Transitive> - </instructions> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <version>${bundle.plugin.version}</version> + <extensions>true</extensions> + <configuration> + <instructions> + <Bundle-SymbolicName>org.openecomp.sdnc.sli.resource.mdsal</Bundle-SymbolicName> + <Bundle-Activator>org.openecomp.sdnc.sli.resource.mdsal.MdsalResourceActivator</Bundle-Activator> + <Export-Package>org.openecomp.sdnc.sli.resource.mdsal</Export-Package> + <Import-Package>org.openecomp.sdnc.sli.*,org.osgi.framework.*,org.slf4j.*,com.mysql.jdbc.*</Import-Package> + <!-- <Embed-Dependency>*;scope=compile|runtime;artifactId=!sli-common|org.eclipse.osgi|slf4j-api|jcl-over-slf4j|mysql-connector-java|xml-apis</Embed-Dependency> --> + <Import-Package>*</Import-Package> + <Embed-Transitive>true</Embed-Transitive> + </instructions> - </configuration> + </configuration> - </plugin> + </plugin> - </plugins> - <pluginManagement> - <plugins> - <!--This plugin's configuration is used to store Eclipse m2e settings - only. It has no influence on the Maven build itself. --> - <plugin> - <groupId>org.eclipse.m2e</groupId> - <artifactId>lifecycle-mapping</artifactId> - <version>1.0.0</version> - <configuration> - <lifecycleMappingMetadata> - <pluginExecutions> - <pluginExecution> - <pluginExecutionFilter> - <groupId> - com.brocade.developer - </groupId> - <artifactId> - providermodule-plugin - </artifactId> - <versionRange> - [1.2.0.100-SNAPSHOT,) - </versionRange> - <goals> - <goal>process</goal> - </goals> - </pluginExecutionFilter> - <action> - <ignore /> - </action> - </pluginExecution> - </pluginExecutions> - </lifecycleMappingMetadata> - </configuration> - </plugin> - </plugins> - </pluginManagement> - </build> + </plugins> + <pluginManagement> + <plugins> + <!--This plugin's configuration is used to store Eclipse m2e settings + only. It has no influence on the Maven build itself. --> + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>1.0.0</version> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <pluginExecution> + <pluginExecutionFilter> + <groupId> + com.brocade.developer + </groupId> + <artifactId> + providermodule-plugin + </artifactId> + <versionRange> + [1.2.0.100-SNAPSHOT,) + </versionRange> + <goals> + <goal>process</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore /> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> </project> diff --git a/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/ConfigResource.java b/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/ConfigResource.java index ed0ed0638..4a89ad8f6 100644 --- a/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/ConfigResource.java +++ b/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/ConfigResource.java @@ -33,118 +33,118 @@ import org.w3c.dom.Document; public class ConfigResource implements SvcLogicResource { - private static final Logger LOG = LoggerFactory.getLogger(ConfigResource.class); + private static final Logger LOG = LoggerFactory.getLogger(ConfigResource.class); - private RestService restService; + private RestService restService; - public ConfigResource(String sdncProtocol, String sdncHost, String sdncPort, String sdncUser, String sdncPasswd) - { - restService = new RestService(sdncProtocol, sdncHost, sdncPort, sdncUser, sdncPasswd, RestService.PayloadType.XML); - } + public ConfigResource(String sdncProtocol, String sdncHost, String sdncPort, String sdncUser, String sdncPasswd) + { + restService = new RestService(sdncProtocol, sdncHost, sdncPort, sdncUser, sdncPasswd, RestService.PayloadType.XML); + } - @Override - public QueryStatus isAvailable(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException - { - return(query(resource, false, null, key, prefix, null, null)); - } + @Override + public QueryStatus isAvailable(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException + { + return(query(resource, false, null, key, prefix, null, null)); + } - @Override - public QueryStatus exists(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException - { + @Override + public QueryStatus exists(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException + { - return(query(resource, false, null, key, prefix, null, null)); + return(query(resource, false, null, key, prefix, null, null)); - } + } - @Override - public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix, - String orderBy, SvcLogicContext ctx) throws SvcLogicException { + @Override + public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix, + String orderBy, SvcLogicContext ctx) throws SvcLogicException { - String module = resource; - StringBuffer restQuery = new StringBuffer(); + String module = resource; + StringBuffer restQuery = new StringBuffer(); - String[] keyParts = key.split("/"); + String[] keyParts = key.split("/"); - for (String keyPart : keyParts) { - if (restQuery.length() > 0) { - restQuery.append("/"); - } - if (keyPart.startsWith("$")) { + for (String keyPart : keyParts) { + if (restQuery.length() > 0) { + restQuery.append("/"); + } + if (keyPart.startsWith("$")) { - restQuery.append(ctx.resolve(keyPart.substring(1))); - } else { - restQuery.append(keyPart); - } - } + restQuery.append(ctx.resolve(keyPart.substring(1))); + } else { + restQuery.append(keyPart); + } + } - String restQueryStr = restQuery.toString(); - if ((restQueryStr.startsWith("'") && restQueryStr.endsWith("'")) || - (restQueryStr.startsWith("\"") && restQueryStr.endsWith("\""))) { - restQueryStr = restQueryStr.substring(1, restQueryStr.length()-1); - } + String restQueryStr = restQuery.toString(); + if ((restQueryStr.startsWith("'") && restQueryStr.endsWith("'")) || + (restQueryStr.startsWith("\"") && restQueryStr.endsWith("\""))) { + restQueryStr = restQueryStr.substring(1, restQueryStr.length()-1); + } - String urlString = "restconf/config/" + module + ":" + restQueryStr; + String urlString = "restconf/config/" + module + ":" + restQueryStr; LOG.info("Querying resource: " + resource + ". At URL: " + urlString); - Document results = restService.get(urlString); + Document results = restService.get(urlString); - if (results == null) { - return(QueryStatus.NOT_FOUND); - } else { + if (results == null) { + return(QueryStatus.NOT_FOUND); + } else { - if (ctx != null) { - ctx.mergeDocument(prefix, results); - } - return(QueryStatus.SUCCESS); - } + if (ctx != null) { + ctx.mergeDocument(prefix, results); + } + return(QueryStatus.SUCCESS); + } - } + } - @Override - public QueryStatus reserve(String resource, String select, String key, String prefix, - SvcLogicContext ctx) throws SvcLogicException { + @Override + public QueryStatus reserve(String resource, String select, String key, String prefix, + SvcLogicContext ctx) throws SvcLogicException { - return(QueryStatus.SUCCESS); + return(QueryStatus.SUCCESS); - } + } - @Override - public QueryStatus release(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { + @Override + public QueryStatus release(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { - return(QueryStatus.SUCCESS); - } + return(QueryStatus.SUCCESS); + } - @Override - public QueryStatus delete(String arg0, String arg1, SvcLogicContext arg2) - throws SvcLogicException { - // TODO Auto-generated method stub - return(QueryStatus.SUCCESS); - } + @Override + public QueryStatus delete(String arg0, String arg1, SvcLogicContext arg2) + throws SvcLogicException { + // TODO Auto-generated method stub + return(QueryStatus.SUCCESS); + } - @Override - public QueryStatus save(String arg0, boolean arg1, boolean localOnly, String arg2, - Map<String, String> arg3, String arg4, SvcLogicContext arg5) - throws SvcLogicException { - // TODO Auto-generated method stub - return(QueryStatus.SUCCESS); - } + @Override + public QueryStatus save(String arg0, boolean arg1, boolean localOnly, String arg2, + Map<String, String> arg3, String arg4, SvcLogicContext arg5) + throws SvcLogicException { + // TODO Auto-generated method stub + return(QueryStatus.SUCCESS); + } - @Override - public QueryStatus notify(String resource, String action, String key, - SvcLogicContext ctx) throws SvcLogicException { - return(QueryStatus.SUCCESS); - } + @Override + public QueryStatus notify(String resource, String action, String key, + SvcLogicContext ctx) throws SvcLogicException { + return(QueryStatus.SUCCESS); + } - public QueryStatus update(String resource, String key, - Map<String, String> parms, String prefix, SvcLogicContext ctx) - throws SvcLogicException { - return(QueryStatus.SUCCESS); - } + public QueryStatus update(String resource, String key, + Map<String, String> parms, String prefix, SvcLogicContext ctx) + throws SvcLogicException { + return(QueryStatus.SUCCESS); + } diff --git a/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/MdsalResourceActivator.java b/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/MdsalResourceActivator.java index ea0bab263..9be03e9d4 100644 --- a/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/MdsalResourceActivator.java +++ b/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/MdsalResourceActivator.java @@ -38,69 +38,69 @@ public class MdsalResourceActivator implements BundleActivator { - private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR"; + private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR"; - public LinkedList<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>(); + public LinkedList<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>(); - private static final Logger LOG = LoggerFactory - .getLogger(MdsalResourceActivator.class); + private static final Logger LOG = LoggerFactory + .getLogger(MdsalResourceActivator.class); - @Override - public void start(BundleContext ctx) throws Exception { + @Override + public void start(BundleContext ctx) throws Exception { - // Read properties - Properties props = new Properties(); + // Read properties + Properties props = new Properties(); - String propDir = System.getenv(SDNC_CONFIG_DIR); - if (propDir == null) { + String propDir = System.getenv(SDNC_CONFIG_DIR); + if (propDir == null) { - propDir = "/opt/sdnc/data/properties"; - } - String propPath = propDir + "/mdsal-resource.properties"; + propDir = "/opt/sdnc/data/properties"; + } + String propPath = propDir + "/mdsal-resource.properties"; - File propFile = new File(propPath); + File propFile = new File(propPath); - if (!propFile.exists()) { + if (!propFile.exists()) { - throw new ConfigurationException( - "Missing configuration properties file : " - + propFile); - } - try { + throw new ConfigurationException( + "Missing configuration properties file : " + + propFile); + } + try { - props.load(new FileInputStream(propFile)); - } catch (Exception e) { - throw new ConfigurationException( - "Could not load properties file " + propPath, e); + props.load(new FileInputStream(propFile)); + } catch (Exception e) { + throw new ConfigurationException( + "Could not load properties file " + propPath, e); - } + } - String sdncUser = props.getProperty("org.openecomp.sdnc.sli.resource.mdsal.sdnc-user", "admin"); - String sdncPasswd = props.getProperty("org.openecomp.sdnc.sli.resource.mdsal.sdnc-passwd", "admin"); - String sdncHost = props.getProperty("org.openecomp.sdnc.sli.resource.mdsal.sdnc-host", "localhost"); - String sdncProtocol = props.getProperty("org.openecomp.sdnc.sli.resource.mdsal.sdnc-protocol", "https"); - String sdncPort = props.getProperty("org.openecomp.sdnc.sli.resource.mdsal.sdnc-port", "8443"); + String sdncUser = props.getProperty("org.openecomp.sdnc.sli.resource.mdsal.sdnc-user", "admin"); + String sdncPasswd = props.getProperty("org.openecomp.sdnc.sli.resource.mdsal.sdnc-passwd", "admin"); + String sdncHost = props.getProperty("org.openecomp.sdnc.sli.resource.mdsal.sdnc-host", "localhost"); + String sdncProtocol = props.getProperty("org.openecomp.sdnc.sli.resource.mdsal.sdnc-protocol", "https"); + String sdncPort = props.getProperty("org.openecomp.sdnc.sli.resource.mdsal.sdnc-port", "8443"); - // Advertise MD-SAL resource adaptors - SvcLogicResource impl = new ConfigResource(sdncProtocol, sdncHost, sdncPort, sdncUser, sdncPasswd); + // Advertise MD-SAL resource adaptors + SvcLogicResource impl = new ConfigResource(sdncProtocol, sdncHost, sdncPort, sdncUser, sdncPasswd); - LOG.debug("Registering MdsalResource service "+impl.getClass().getName()); - registrations.add(ctx.registerService(impl.getClass().getName(), impl, null)); + LOG.debug("Registering MdsalResource service "+impl.getClass().getName()); + registrations.add(ctx.registerService(impl.getClass().getName(), impl, null)); - impl = new OperationalResource(sdncProtocol, sdncHost, sdncPort, sdncUser, sdncPasswd); + impl = new OperationalResource(sdncProtocol, sdncHost, sdncPort, sdncUser, sdncPasswd); - LOG.debug("Registering MdsalResource service "+impl.getClass().getName()); - registrations.add(ctx.registerService(impl.getClass().getName(), impl, null)); - } + LOG.debug("Registering MdsalResource service "+impl.getClass().getName()); + registrations.add(ctx.registerService(impl.getClass().getName(), impl, null)); + } - @Override - public void stop(BundleContext ctx) throws Exception { + @Override + public void stop(BundleContext ctx) throws Exception { - for (ServiceRegistration registration : registrations) - { - registration.unregister(); - } - } + for (ServiceRegistration registration : registrations) + { + registration.unregister(); + } + } } diff --git a/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/OperationalResource.java b/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/OperationalResource.java index 32323e3b1..9374d2ab4 100644 --- a/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/OperationalResource.java +++ b/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/OperationalResource.java @@ -33,52 +33,52 @@ import org.w3c.dom.Document; public class OperationalResource implements SvcLogicResource { - private static final Logger LOG = LoggerFactory.getLogger(OperationalResource.class); + private static final Logger LOG = LoggerFactory.getLogger(OperationalResource.class); - private RestService restService; + private RestService restService; - public OperationalResource(String sdncProtocol, String sdncHost, String sdncPort, String sdncUser, String sdncPasswd) - { - restService = new RestService(sdncProtocol, sdncHost, sdncPort, sdncUser, sdncPasswd, RestService.PayloadType.XML); + public OperationalResource(String sdncProtocol, String sdncHost, String sdncPort, String sdncUser, String sdncPasswd) + { + restService = new RestService(sdncProtocol, sdncHost, sdncPort, sdncUser, sdncPasswd, RestService.PayloadType.XML); - } + } - @Override - public QueryStatus isAvailable(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException - { - return(query(resource, false, null, key, prefix, null, null)); - } + @Override + public QueryStatus isAvailable(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException + { + return(query(resource, false, null, key, prefix, null, null)); + } - @Override - public QueryStatus exists(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException - { + @Override + public QueryStatus exists(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException + { - return(query(resource, false, null, key, prefix, null, null)); + return(query(resource, false, null, key, prefix, null, null)); - } + } - @Override - public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix, - String orderBy, SvcLogicContext ctx) throws SvcLogicException { + @Override + public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix, + String orderBy, SvcLogicContext ctx) throws SvcLogicException { - String module = resource; - StringBuffer restQuery = new StringBuffer(); + String module = resource; + StringBuffer restQuery = new StringBuffer(); - String[] keyParts = key.split("/"); + String[] keyParts = key.split("/"); - for (String keyPart : keyParts) { - if (restQuery.length() > 0) { - restQuery.append("/"); - } - if (keyPart.startsWith("$")) { + for (String keyPart : keyParts) { + if (restQuery.length() > 0) { + restQuery.append("/"); + } + if (keyPart.startsWith("$")) { - restQuery.append(ctx.resolve(keyPart.substring(1))); - } else { - restQuery.append(keyPart); - } - } + restQuery.append(ctx.resolve(keyPart.substring(1))); + } else { + restQuery.append(keyPart); + } + } String restQueryStr = restQuery.toString(); if ((restQueryStr.startsWith("'") && restQueryStr.endsWith("'")) || @@ -86,66 +86,66 @@ public class OperationalResource implements SvcLogicResource { restQueryStr = restQueryStr.substring(1, restQueryStr.length()-1); } - String urlString = "restconf/operational/" + module + ":" + restQueryStr; + String urlString = "restconf/operational/" + module + ":" + restQueryStr; LOG.info("Querying resource: " + resource + ". At URL: " + urlString); - Document results = restService.get(urlString); + Document results = restService.get(urlString); - if (results == null) { - return(QueryStatus.NOT_FOUND); - } else { + if (results == null) { + return(QueryStatus.NOT_FOUND); + } else { - if (ctx != null) { - ctx.mergeDocument(prefix, results); - } - return(QueryStatus.SUCCESS); - } + if (ctx != null) { + ctx.mergeDocument(prefix, results); + } + return(QueryStatus.SUCCESS); + } - } + } - @Override - public QueryStatus reserve(String resource, String select, String key, String prefix, - SvcLogicContext ctx) throws SvcLogicException { + @Override + public QueryStatus reserve(String resource, String select, String key, String prefix, + SvcLogicContext ctx) throws SvcLogicException { - return(QueryStatus.SUCCESS); + return(QueryStatus.SUCCESS); - } + } - @Override - public QueryStatus release(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { + @Override + public QueryStatus release(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { - return(QueryStatus.SUCCESS); - } + return(QueryStatus.SUCCESS); + } - @Override - public QueryStatus delete(String arg0, String arg1, SvcLogicContext arg2) - throws SvcLogicException { - // TODO Auto-generated method stub - return(QueryStatus.SUCCESS); - } + @Override + public QueryStatus delete(String arg0, String arg1, SvcLogicContext arg2) + throws SvcLogicException { + // TODO Auto-generated method stub + return(QueryStatus.SUCCESS); + } - @Override - public QueryStatus save(String arg0, boolean arg1, boolean localOnly, String arg2, - Map<String, String> arg3, String arg4, SvcLogicContext arg5) - throws SvcLogicException { - // TODO Auto-generated method stub - return(QueryStatus.SUCCESS); - } + @Override + public QueryStatus save(String arg0, boolean arg1, boolean localOnly, String arg2, + Map<String, String> arg3, String arg4, SvcLogicContext arg5) + throws SvcLogicException { + // TODO Auto-generated method stub + return(QueryStatus.SUCCESS); + } - @Override - public QueryStatus notify(String resource, String action, String key, - SvcLogicContext ctx) throws SvcLogicException { - return(QueryStatus.SUCCESS); - } + @Override + public QueryStatus notify(String resource, String action, String key, + SvcLogicContext ctx) throws SvcLogicException { + return(QueryStatus.SUCCESS); + } - public QueryStatus update(String resource, String key, - Map<String, String> parms, String prefix, SvcLogicContext ctx) - throws SvcLogicException { - return(QueryStatus.SUCCESS); - } + public QueryStatus update(String resource, String key, + Map<String, String> parms, String prefix, SvcLogicContext ctx) + throws SvcLogicException { + return(QueryStatus.SUCCESS); + } } diff --git a/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/RestService.java b/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/RestService.java index 21d3439d4..a7b77e5bd 100644 --- a/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/RestService.java +++ b/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/RestService.java @@ -46,167 +46,167 @@ import org.w3c.dom.Document; public class RestService { - - private static final Logger LOG = LoggerFactory.getLogger(ConfigResource.class); - - public enum PayloadType { - XML, - JSON - } - - private class SdncAuthenticator extends Authenticator { - - private String user; - private String passwd; - - SdncAuthenticator(String user, String passwd) { - this.user = user; - this.passwd = passwd; - } - @Override - protected PasswordAuthentication getPasswordAuthentication() { - return new PasswordAuthentication(user, passwd.toCharArray()); - } - - } - - private String user; - private String passwd; - private PayloadType payloadType; - - private String protocol; - private String host; - private String port; - - public RestService(String protocol, String host, String port, String user, String passwd, PayloadType payloadType) { - this.protocol = protocol; - this.host = host; - this.port = port; - this.user = user; - this.passwd = passwd; - this.payloadType = payloadType; - } - - private HttpURLConnection getRestConnection(String urlString, String method) throws IOException - { - - URL sdncUrl = new URL(urlString); - Authenticator.setDefault(new SdncAuthenticator(user, passwd)); - - HttpURLConnection conn = (HttpURLConnection) sdncUrl.openConnection(); - - String authStr = user+":"+passwd; - String encodedAuthStr = new String(Base64.encodeBase64(authStr.getBytes())); - - conn.addRequestProperty("Authentication", "Basic "+encodedAuthStr); - - conn.setRequestMethod(method); - - if (payloadType == PayloadType.XML) { - conn.setRequestProperty("Content-Type", "application/xml"); - conn.setRequestProperty("Accept", "application/xml"); - } else { - - conn.setRequestProperty("Content-Type", "application/json"); - conn.setRequestProperty("Accept", "application/json"); - } - - conn.setDoInput(true); - conn.setDoOutput(true); - conn.setUseCaches(false); - - return(conn); - - } - - - private Document send(String urlString, byte[] msgBytes, String method) { - Document response = null; - String fullUrl = protocol + "://" + host + ":" + port + "/" + urlString; - LOG.info("Sending REST "+method +" to "+fullUrl); - - if (msgBytes != null) { - LOG.info("Message body:\n"+msgBytes); - } - - try { - HttpURLConnection conn = getRestConnection(fullUrl, method); - - if (conn instanceof HttpsURLConnection) { - HostnameVerifier hostnameVerifier = new HostnameVerifier() { - @Override - public boolean verify(String hostname, SSLSession session) { - return true; - } - }; - ((HttpsURLConnection)conn).setHostnameVerifier(hostnameVerifier); - } - - // Write message - if (msgBytes != null) { - conn.setRequestProperty("Content-Length", ""+msgBytes.length); - DataOutputStream outStr = new DataOutputStream(conn.getOutputStream()); - outStr.write(msgBytes); - outStr.close(); - } else { - conn.setRequestProperty("Content-Length", "0"); - } - - - // Read response - BufferedReader respRdr; - - LOG.info("Response: "+conn.getResponseCode()+" "+conn.getResponseMessage()); - - - if (conn.getResponseCode() < 300) { - - respRdr = new BufferedReader(new InputStreamReader(conn.getInputStream())); - } else { - respRdr = new BufferedReader(new InputStreamReader(conn.getErrorStream())); - } - - StringBuffer respBuff = new StringBuffer(); - - String respLn; - - while ((respLn = respRdr.readLine()) != null) { - respBuff.append(respLn+"\n"); - } - respRdr.close(); - - String respString = respBuff.toString(); - - LOG.info("Response body :\n"+respString); - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - - - response = db.parse(new ByteArrayInputStream(respString.getBytes())); - - } catch (Exception e) { - - LOG.error("Caught exception executing REST command", e); - } - - return (response); - } - - - public Document get(String urlString) { - return(send(urlString, null, "GET")); - } - - public Document delete(String urlString) { - return(send(urlString, null, "DELETE")); - } - - public Document post(String urlString, byte[] msgBytes) { - return(send(urlString, msgBytes, "POST")); - } - - public Document put(String urlString, byte[] msgBytes) { - return(send(urlString, msgBytes, "PUT")); - } + + private static final Logger LOG = LoggerFactory.getLogger(ConfigResource.class); + + public enum PayloadType { + XML, + JSON + } + + private class SdncAuthenticator extends Authenticator { + + private String user; + private String passwd; + + SdncAuthenticator(String user, String passwd) { + this.user = user; + this.passwd = passwd; + } + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(user, passwd.toCharArray()); + } + + } + + private String user; + private String passwd; + private PayloadType payloadType; + + private String protocol; + private String host; + private String port; + + public RestService(String protocol, String host, String port, String user, String passwd, PayloadType payloadType) { + this.protocol = protocol; + this.host = host; + this.port = port; + this.user = user; + this.passwd = passwd; + this.payloadType = payloadType; + } + + private HttpURLConnection getRestConnection(String urlString, String method) throws IOException + { + + URL sdncUrl = new URL(urlString); + Authenticator.setDefault(new SdncAuthenticator(user, passwd)); + + HttpURLConnection conn = (HttpURLConnection) sdncUrl.openConnection(); + + String authStr = user+":"+passwd; + String encodedAuthStr = new String(Base64.encodeBase64(authStr.getBytes())); + + conn.addRequestProperty("Authentication", "Basic "+encodedAuthStr); + + conn.setRequestMethod(method); + + if (payloadType == PayloadType.XML) { + conn.setRequestProperty("Content-Type", "application/xml"); + conn.setRequestProperty("Accept", "application/xml"); + } else { + + conn.setRequestProperty("Content-Type", "application/json"); + conn.setRequestProperty("Accept", "application/json"); + } + + conn.setDoInput(true); + conn.setDoOutput(true); + conn.setUseCaches(false); + + return(conn); + + } + + + private Document send(String urlString, byte[] msgBytes, String method) { + Document response = null; + String fullUrl = protocol + "://" + host + ":" + port + "/" + urlString; + LOG.info("Sending REST "+method +" to "+fullUrl); + + if (msgBytes != null) { + LOG.info("Message body:\n"+msgBytes); + } + + try { + HttpURLConnection conn = getRestConnection(fullUrl, method); + + if (conn instanceof HttpsURLConnection) { + HostnameVerifier hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + ((HttpsURLConnection)conn).setHostnameVerifier(hostnameVerifier); + } + + // Write message + if (msgBytes != null) { + conn.setRequestProperty("Content-Length", ""+msgBytes.length); + DataOutputStream outStr = new DataOutputStream(conn.getOutputStream()); + outStr.write(msgBytes); + outStr.close(); + } else { + conn.setRequestProperty("Content-Length", "0"); + } + + + // Read response + BufferedReader respRdr; + + LOG.info("Response: "+conn.getResponseCode()+" "+conn.getResponseMessage()); + + + if (conn.getResponseCode() < 300) { + + respRdr = new BufferedReader(new InputStreamReader(conn.getInputStream())); + } else { + respRdr = new BufferedReader(new InputStreamReader(conn.getErrorStream())); + } + + StringBuffer respBuff = new StringBuffer(); + + String respLn; + + while ((respLn = respRdr.readLine()) != null) { + respBuff.append(respLn+"\n"); + } + respRdr.close(); + + String respString = respBuff.toString(); + + LOG.info("Response body :\n"+respString); + + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder db = dbf.newDocumentBuilder(); + + + response = db.parse(new ByteArrayInputStream(respString.getBytes())); + + } catch (Exception e) { + + LOG.error("Caught exception executing REST command", e); + } + + return (response); + } + + + public Document get(String urlString) { + return(send(urlString, null, "GET")); + } + + public Document delete(String urlString) { + return(send(urlString, null, "DELETE")); + } + + public Document post(String urlString, byte[] msgBytes) { + return(send(urlString, msgBytes, "POST")); + } + + public Document put(String urlString, byte[] msgBytes) { + return(send(urlString, msgBytes, "PUT")); + } } diff --git a/mdsal-resource/provider/src/main/resources/crtables.sql b/mdsal-resource/provider/src/main/resources/crtables.sql index a5dea5bf0..f8f57166e 100644 --- a/mdsal-resource/provider/src/main/resources/crtables.sql +++ b/mdsal-resource/provider/src/main/resources/crtables.sql @@ -3,7 +3,7 @@ -- openECOMP : SDN-C -- ================================================================================ -- Copyright (C) 2017 ONAP Intellectual Property. All rights --- reserved. +-- reserved. -- ================================================================================ -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. diff --git a/mdsal-resource/provider/src/main/resources/svclogic.properties b/mdsal-resource/provider/src/main/resources/svclogic.properties index 1a2cf0c78..e113161e8 100644 --- a/mdsal-resource/provider/src/main/resources/svclogic.properties +++ b/mdsal-resource/provider/src/main/resources/svclogic.properties @@ -3,7 +3,7 @@ # openECOMP : SDN-C # ================================================================================ # Copyright (C) 2017 ONAP Intellectual Property. All rights -# reserved. +# reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. |