Market place initial code 01/6401/1
authorMurali-P <murali.p@huawei.com>
Mon, 31 Jul 2017 05:36:26 +0000 (11:06 +0530)
committerMurali-P <murali.p@huawei.com>
Mon, 31 Jul 2017 05:36:26 +0000 (11:06 +0530)
Resolved:VNFSDK-53
VNF SDK market place

Change-Id: Ic9ac5491b4a43d03bce105abb295e10c476e1560
Signed-off-by: Murali-P <murali.p@huawei.com>
139 files changed:
vnfmarket-be/deployment/pom.xml [new file with mode: 0644]
vnfmarket-be/deployment/src/main/release/License.txt [new file with mode: 0644]
vnfmarket-be/deployment/src/main/release/bin/start.sh [new file with mode: 0644]
vnfmarket-be/deployment/src/main/release/bin/stop.sh [new file with mode: 0644]
vnfmarket-be/deployment/src/main/release/conf/catalina.policy [new file with mode: 0644]
vnfmarket-be/deployment/src/main/release/conf/catalina.properties [new file with mode: 0644]
vnfmarket-be/deployment/src/main/release/conf/context.xml [new file with mode: 0644]
vnfmarket-be/deployment/src/main/release/conf/server.xml [new file with mode: 0644]
vnfmarket-be/deployment/src/main/release/conf/web.xml [new file with mode: 0644]
vnfmarket-be/deployment/src/main/release/etc/conf/lifeCycleConfig.json [new file with mode: 0644]
vnfmarket-be/deployment/src/main/release/etc/conf/restclient.json [new file with mode: 0644]
vnfmarket-be/deployment/src/main/release/etc/microservice/marketplace_rest.json [new file with mode: 0644]
vnfmarket-be/deployment/src/main/release/init/marketplace_tables_mysql.sql [new file with mode: 0644]
vnfmarket-be/pom.xml [new file with mode: 0644]
vnfmarket-be/portal-marketplace/pom.xml [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/Gruntfile.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/README.md [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/bower.json [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/index.html [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/karma.conf.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/app.config.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/app.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/assets/images/open_o_diagram.png [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/about/about-test.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/about/about.html [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/about/aboutCtrl.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/about/aboutModule.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/about/aboutRoute.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/about/aboutService.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/home/dashboard.html [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/home/home-test.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/home/home.html [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/home/homeCtrl.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/home/homeModule.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/home/homeRoute.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/home/homeService.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/layouts/main-page/main-page.html [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/layouts/main-page/mainPageCtrl.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/layouts/nav-bar/navBarService.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/layouts/side-nav/sidenav.html [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/layouts/side-nav/sidenavCtrl.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/layouts/side-nav/sidenavService.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/marketplace/marketplace-test.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/marketplace/marketplace.html [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/marketplace/marketplaceCtrl.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/marketplace/marketplaceModule.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/marketplace/marketplaceRoute.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/marketplace/marketplaceService.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/user/user-test.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/user/user.html [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/user/userCtrl.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/user/userModule.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/user/userRoute.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/user/userService.js [new file with mode: 0644]
vnfmarket-be/portal-marketplace/src/main/webapp/package.json [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/pom.xml [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/CommonConstant.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/CommonErrorResponse.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/FileUtil.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/HttpServerAddrConfig.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/HttpServerPathConfig.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/JsonUtil.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/MsbAddrConfig.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/RestUtil.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/ToolUtil.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/common/MarketplaceResourceType.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/common/Parameters.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/connection/ConnectionUtil.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/entity/BaseData.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/entity/PackageData.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/exception/ErrorCodeException.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/exception/MarketplaceResourceException.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/impl/MarketplaceDaoImpl.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/inf/IMarketplaceDao.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/mapper/IMarketplaceMapper.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/resource/PackageManager.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/util/MarketplaceDbUtil.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/wrapper/BaseHandler.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/wrapper/PackageHandler.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/CsarPackage.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/CsarQueryCondition.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/EnumOnboardState.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/EnumOperationStatus.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/EnumOperationalState.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/EnumProcessState.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/EnumResult.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/EnumType.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/EnumUsageState.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/VnfPackage.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/request/PackageBasicInfo.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/response/CsarFileUriResponse.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/response/PackageMeta.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/response/PackageResponse.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/response/UploadPackageResponse.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/filemanage/FileManager.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/filemanage/FileManagerFactory.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/filemanage/FileManagerType.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/filemanage/http/HttpFileManagerImpl.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/filemanage/http/ToolUtil.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/model/parser/EnumPackageFormat.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/model/parser/EnumTemplateType.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/msb/AppServletContextListener.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/msb/MsbDetails.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/msb/MsbDetailsHolder.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/msb/MsbRegister.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/msb/MsbRegistration.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/msb/MsbServer.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/OnBoardingOperResult.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/OnBoardingResult.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/OnBoardingStep.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/OnBoardingSteps.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/OnBoradingRequest.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/OperationDetails.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/OperationResult.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/ResultKey.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutor.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestHook.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifeCycleTestReq.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutor.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestHook.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/ValidateLifecycleTestResponse.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/VmsInfo.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/VnfInfo.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/onboardmanager/OnBoardingHandler.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/resource/PackageResource.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/rest/RestConstant.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/rest/RestResponse.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/rest/RestfulClient.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/rest/RestfulUtil.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/wrapper/PackageWrapper.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/resources/generalconfig/OnBoardingSteps.json [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/resources/log4j.properties [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/resources/marketplace.properties [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/resources/mybatis/configuration/configuration.xml [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/resources/mybatis/sql/MarketplaceMapper.xml [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/main/webapp/WEB-INF/web.xml [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/openo/vnfsdk/marketplace/VnfSdkMarketplaceAppTest.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/openo/vnfsdk/marketplace/resource/PackageResourceTest.java [new file with mode: 0644]

diff --git a/vnfmarket-be/deployment/pom.xml b/vnfmarket-be/deployment/pom.xml
new file mode 100644 (file)
index 0000000..39c36bd
--- /dev/null
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright (c) 2017, Huawei Technologies Co., Ltd.
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<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.openo.vnf-sdk.marketplace</groupId>
+        <artifactId>vnf-sdk-marketplace-core-parent</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>vnf-sdk-marketplace-deployment</artifactId>
+    <name>vnf-sdk-marketplace/deployment</name>
+    <packaging>pom</packaging>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.codehaus.gmaven</groupId>
+                    <artifactId>groovy-maven-plugin</artifactId>
+                    <version>2.0</version>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.gmaven</groupId>
+                <artifactId>gmaven-plugin</artifactId>
+                <version>1.5</version>
+                <executions>
+                    <execution>
+                        <id>VnfSdkMarketplace package</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>execute</goal>
+                        </goals>
+                        <configuration>
+                            <source>
+                                System.out.println("******** Going to make release zip ********")
+
+                                deployFolder = "${project.build.directory}/deployoutput"
+                                deployUnzip = "${project.build.directory}/deployunzip"
+                                outfileName = "VnfSdkMarketplace-.${project.version}.zip"
+
+                                ant.delete(dir: "${deployFolder}")
+                                ant.mkdir(dir: "${deployFolder}")
+
+                                ant.delete(dir: "${deployUnzip}")
+                                ant.mkdir(dir: "${deployUnzip}")
+
+                                ant.mkdir(dir: "${deployUnzip}/webapps/ROOT")
+                                ant.mkdir(dir: "${deployUnzip}/webapps/openoui#marketplace#v1")
+
+                                ant.copy(todir: "${deployUnzip}") {
+                                fileset(dir: "${basedir}/src/main/release"){
+                                exclude(name: "**/.gitignore")
+                                }
+                                }
+
+                                ant.copy(todir: "${deployUnzip}/webapps/ROOT") {
+                                fileset(dir: "${project.build.directory}/../../vnf-sdk-marketplace/target/ROOT")
+                                }
+
+                                ant.zip(destfile: "${deployFolder}/${outfileName}") {
+                                fileset(dir: "${deployUnzip}")
+                                }
+                                System.out.println("******** completed. ************")
+                            </source>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+             <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>attach-artifacts</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>attach-artifact</goal>
+                        </goals>
+                        <configuration>
+                            <artifacts>
+                                <artifact>
+                                    <file>${project.build.directory}/deployoutput/VnfSdkMarketplace-.${project.version}.zip</file>
+                                    <type>zip</type>
+                                </artifact>
+                            </artifacts>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/vnfmarket-be/deployment/src/main/release/License.txt b/vnfmarket-be/deployment/src/main/release/License.txt
new file mode 100644 (file)
index 0000000..8e698ec
--- /dev/null
@@ -0,0 +1,362 @@
+THIS LICENSE FILE CONTAINS THE LICENSE APPLICABLE DEPENDING ON THE TYPE OF CONTRIBUTIONS.
+
+APACHE LICENSE 2 IS APPLICABLE FOR SOURCE CODE, CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL FOR DOCUMENTATION
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+
+Apache License Version 2.0, January 2004 http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License.
+
+Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License.
+
+Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution.
+
+You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and You must cause any modified files to carry prominent notices stating that You changed the files; and You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions.
+
+Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks.
+
+This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty.
+
+Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability.
+
+In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability.
+
+While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Attribution 4.0 International
+
+https://creativecommons.org/licenses/by/4.0/legalcode
+
+Creative Commons Corporation ("Creative Commons") is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an "as-is" basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
+
+Using Creative Commons Public Licenses
+
+Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.
+
+    Considerations for licensors: Our public licenses are
+    intended for use by those authorized to give the public
+    permission to use material in ways otherwise restricted by
+    copyright and certain other rights. Our licenses are
+    irrevocable. Licensors should read and understand the terms
+    and conditions of the license they choose before applying it.
+    Licensors should also secure all rights necessary before
+    applying our licenses so that the public can reuse the
+    material as expected. Licensors should clearly mark any
+    material not subject to the license. This includes other CC-
+    licensed material, or material used under an exception or
+    limitation to copyright. More considerations for licensors:
+    wiki.creativecommons.org/Considerations_for_licensors
+    Considerations for the public: By using one of our public
+    licenses, a licensor grants the public permission to use the
+    licensed material under specified terms and conditions. If
+    the licensor's permission is not necessary for any reason--for
+    example, because of any applicable exception or limitation to
+    copyright--then that use is not regulated by the license. Our
+    licenses grant only permissions under copyright and certain
+    other rights that a licensor has authority to grant. Use of
+    the licensed material may still be restricted for other
+    reasons, including because others have copyright or other
+    rights in the material. A licensor may make special requests,
+    such as asking that all changes be marked or described.
+    Although not required by our licenses, you are encouraged to
+    respect those requests where reasonable. More_considerations
+    for the public: 
+    wiki.creativecommons.org/Considerations_for_licensees
+Creative Commons Attribution 4.0 International Public License
+
+By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
+
+
+Section 1 -- Definitions.
+
+ a. Adapted Material means material subject to Copyright and Similar
+    Rights that is derived from or based upon the Licensed Material
+    and in which the Licensed Material is translated, altered,
+    arranged, transformed, or otherwise modified in a manner requiring
+    permission under the Copyright and Similar Rights held by the
+    Licensor. For purposes of this Public License, where the Licensed
+    Material is a musical work, performance, or sound recording,
+    Adapted Material is always produced where the Licensed Material is
+    synched in timed relation with a moving image.
+ b. Adapter's License means the license You apply to Your Copyright
+    and Similar Rights in Your contributions to Adapted Material in
+    accordance with the terms and conditions of this Public License.
+ c. Copyright and Similar Rights means copyright and/or similar rights
+    closely related to copyright including, without limitation,
+    performance, broadcast, sound recording, and Sui Generis Database
+    Rights, without regard to how the rights are labeled or
+    categorized. For purposes of this Public License, the rights
+    specified in Section 2(b)(1)-(2) are not Copyright and Similar
+    Rights.
+ d. Effective Technological Measures means those measures that, in the
+    absence of proper authority, may not be circumvented under laws
+    fulfilling obligations under Article 11 of the WIPO Copyright
+    Treaty adopted on December 20, 1996, and/or similar international
+    agreements.
+ e. Exceptions and Limitations means fair use, fair dealing, and/or
+    any other exception or limitation to Copyright and Similar Rights
+    that applies to Your use of the Licensed Material.
+ f. Licensed Material means the artistic or literary work, database,
+    or other material to which the Licensor applied this Public
+    License.
+ g. Licensed Rights means the rights granted to You subject to the
+    terms and conditions of this Public License, which are limited to
+    all Copyright and Similar Rights that apply to Your use of the
+    Licensed Material and that the Licensor has authority to license.
+ h. Licensor means the individual(s) or entity(ies) granting rights
+    under this Public License.
+ i. Share means to provide material to the public by any means or
+    process that requires permission under the Licensed Rights, such
+    as reproduction, public display, public performance, distribution,
+    dissemination, communication, or importation, and to make material
+    available to the public including in ways that members of the
+    public may access the material from a place and at a time
+    individually chosen by them.
+ j. Sui Generis Database Rights means rights other than copyright
+    resulting from Directive 96/9/EC of the European Parliament and of
+    the Council of 11 March 1996 on the legal protection of databases,
+    as amended and/or succeeded, as well as other essentially
+    equivalent rights anywhere in the world.
+ k. You means the individual or entity exercising the Licensed Rights
+    under this Public License. Your has a corresponding meaning.
+
+Section 2 -- Scope.
+
+ a. License grant.
+      1. Subject to the terms and conditions of this Public License,
+         the Licensor hereby grants You a worldwide, royalty-free,
+         non-sublicensable, non-exclusive, irrevocable license to
+         exercise the Licensed Rights in the Licensed Material to:
+           a. reproduce and Share the Licensed Material, in whole or
+              in part; and
+           b. produce, reproduce, and Share Adapted Material.
+      2. Exceptions and Limitations. For the avoidance of doubt, where
+         Exceptions and Limitations apply to Your use, this Public
+         License does not apply, and You do not need to comply with
+         its terms and conditions.
+      3. Term. The term of this Public License is specified in Section
+         6(a).
+      4. Media and formats; technical modifications allowed. The
+         Licensor authorizes You to exercise the Licensed Rights in
+         all media and formats whether now known or hereafter created,
+         and to make technical modifications necessary to do so. The
+         Licensor waives and/or agrees not to assert any right or
+         authority to forbid You from making technical modifications
+         necessary to exercise the Licensed Rights, including
+         technical modifications necessary to circumvent Effective
+         Technological Measures. For purposes of this Public License,
+         simply making modifications authorized by this Section 2(a)
+         (4) never produces Adapted Material.
+      5. Downstream recipients.
+           a. Offer from the Licensor -- Licensed Material. Every
+              recipient of the Licensed Material automatically
+              receives an offer from the Licensor to exercise the
+              Licensed Rights under the terms and conditions of this
+              Public License.
+           b. No downstream restrictions. You may not offer or impose
+              any additional or different terms or conditions on, or
+              apply any Effective Technological Measures to, the
+              Licensed Material if doing so restricts exercise of the
+              Licensed Rights by any recipient of the Licensed
+              Material.
+      6. No endorsement. Nothing in this Public License constitutes or
+         may be construed as permission to assert or imply that You
+         are, or that Your use of the Licensed Material is, connected
+         with, or sponsored, endorsed, or granted official status by,
+         the Licensor or others designated to receive attribution as
+         provided in Section 3(a)(1)(A)(i).
+ b. Other rights.
+      1. Moral rights, such as the right of integrity, are not
+         licensed under this Public License, nor are publicity,
+         privacy, and/or other similar personality rights; however, to
+         the extent possible, the Licensor waives and/or agrees not to
+         assert any such rights held by the Licensor to the limited
+         extent necessary to allow You to exercise the Licensed
+         Rights, but not otherwise.
+      2. Patent and trademark rights are not licensed under this
+         Public License.
+      3. To the extent possible, the Licensor waives any right to
+         collect royalties from You for the exercise of the Licensed
+         Rights, whether directly or through a collecting society
+         under any voluntary or waivable statutory or compulsory
+         licensing scheme. In all other cases the Licensor expressly
+         reserves any right to collect such royalties.
+
+Section 3 -- License Conditions.
+
+Your exercise of the Licensed Rights is expressly made subject to the following conditions.
+
+ a. Attribution.
+      1. If You Share the Licensed Material (including in modified
+         form), You must:
+           a. retain the following if it is supplied by the Licensor
+              with the Licensed Material:
+                i. identification of the creator(s) of the Licensed
+                   Material and any others designated to receive
+                   attribution, in any reasonable manner requested by
+                   the Licensor (including by pseudonym if
+                   designated);
+               ii. a copyright notice;
+              iii. a notice that refers to this Public License;
+               iv. a notice that refers to the disclaimer of
+                   warranties;
+                v. a URI or hyperlink to the Licensed Material to the
+                   extent reasonably practicable;
+           b. indicate if You modified the Licensed Material and
+              retain an indication of any previous modifications; and
+           c. indicate the Licensed Material is licensed under this
+              Public License, and include the text of, or the URI or
+              hyperlink to, this Public License.
+      2. You may satisfy the conditions in Section 3(a)(1) in any
+         reasonable manner based on the medium, means, and context in
+         which You Share the Licensed Material. For example, it may be
+         reasonable to satisfy the conditions by providing a URI or
+         hyperlink to a resource that includes the required
+         information.
+      3. If requested by the Licensor, You must remove any of the
+         information required by Section 3(a)(1)(A) to the extent
+         reasonably practicable.
+      4. If You Share Adapted Material You produce, the Adapter's
+         License You apply must not prevent recipients of the Adapted
+         Material from complying with this Public License.
+
+Section 4 -- Sui Generis Database Rights.
+
+Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
+
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
+    to extract, reuse, reproduce, and Share all or a substantial
+    portion of the contents of the database;
+ b. if You include all or a substantial portion of the database
+    contents in a database in which You have Sui Generis Database
+    Rights, then the database in which You have Sui Generis Database
+    Rights (but not its individual contents) is Adapted Material; and
+ c. You must comply with the conditions in Section 3(a) if You Share
+    all or a substantial portion of the contents of the database.
+For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
+
+
+Section 5 -- Disclaimer of Warranties and Limitation of Liability.
+
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
+    EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
+    AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
+    ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
+    IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
+    WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
+    PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
+    ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
+    KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
+    ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
+    TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
+    NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
+    INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
+    COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
+    USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
+    ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
+    DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
+    IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
+ c. The disclaimer of warranties and limitation of liability provided
+    above shall be interpreted in a manner that, to the extent
+    possible, most closely approximates an absolute disclaimer and
+    waiver of all liability.
+
+Section 6 -- Term and Termination.
+
+ a. This Public License applies for the term of the Copyright and
+    Similar Rights licensed here. However, if You fail to comply with
+    this Public License, then Your rights under this Public License
+    terminate automatically.
+ b. Where Your right to use the Licensed Material has terminated under
+    Section 6(a), it reinstates:
+      1. automatically as of the date the violation is cured, provided
+         it is cured within 30 days of Your discovery of the
+         violation; or
+      2. upon express reinstatement by the Licensor.
+    For the avoidance of doubt, this Section 6(b) does not affect any
+    right the Licensor may have to seek remedies for Your violations
+    of this Public License.
+ c. For the avoidance of doubt, the Licensor may also offer the
+    Licensed Material under separate terms or conditions or stop
+    distributing the Licensed Material at any time; however, doing so
+    will not terminate this Public License.
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
+    License.
+
+Section 7 -- Other Terms and Conditions.
+
+ a. The Licensor shall not be bound by any additional or different
+    terms or conditions communicated by You unless expressly agreed.
+ b. Any arrangements, understandings, or agreements regarding the
+    Licensed Material not stated herein are separate from and
+    independent of the terms and conditions of this Public License.
+
+Section 8 -- Interpretation.
+
+ a. For the avoidance of doubt, this Public License does not, and
+    shall not be interpreted to, reduce, limit, restrict, or impose
+    conditions on any use of the Licensed Material that could lawfully
+    be made without permission under this Public License.
+ b. To the extent possible, if any provision of this Public License is
+    deemed unenforceable, it shall be automatically reformed to the
+    minimum extent necessary to make it enforceable. If the provision
+    cannot be reformed, it shall be severed from this Public License
+    without affecting the enforceability of the remaining terms and
+    conditions.
+ c. No term or condition of this Public License will be waived and no
+    failure to comply consented to unless expressly agreed to by the
+    Licensor.
+ d. Nothing in this Public License constitutes or may be interpreted
+    as a limitation upon, or waiver of, any privileges and immunities
+    that apply to the Licensor or You, including from the legal
+    processes of any jurisdiction or authority.
+Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the "Licensor." The text of the Creative Commons public licenses is dedicated to the public domain under the CC0 Public Domain Dedication. Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark "Creative Commons" or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
+
+Creative Commons may be contacted at creativecommons.org.
\ No newline at end of file
diff --git a/vnfmarket-be/deployment/src/main/release/bin/start.sh b/vnfmarket-be/deployment/src/main/release/bin/start.sh
new file mode 100644 (file)
index 0000000..0724e98
--- /dev/null
@@ -0,0 +1,45 @@
+# Copyright 2017 Huawei Technologies Co., Ltd.
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+#     http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#!/bin/bash
+SCRIPT_DIR=`dirname "$0"`
+export APP_ROOT=`cd "$SCRIPT_DIR"/../; pwd`
+
+if [ -z "$JAVA_HOME" ]
+then
+    echo "There is no JAVA_HOME"
+    exit 1
+fi
+
+if [ -z "$CATALINA_HOME" ]
+then
+    echo "There is no CATALINA_HOME"
+    exit 1
+fi
+
+if [ -z "$APP_ROOT" ]
+then
+    echo "There is no APP_ROOT"
+    exit 1
+fi
+
+export CATALINA_BASE=$APP_ROOT
+
+LOG_DIR=$CATALINA_BASE/logs
+if [ ! -d "$LOG_DIR" ]; then
+  mkdir $LOG_DIR
+fi
+$CATALINA_HOME/bin/catalina.sh start
+
+
diff --git a/vnfmarket-be/deployment/src/main/release/bin/stop.sh b/vnfmarket-be/deployment/src/main/release/bin/stop.sh
new file mode 100644 (file)
index 0000000..c60ffd8
--- /dev/null
@@ -0,0 +1,40 @@
+# Copyright 2017 Huawei Technologies Co., Ltd.
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+#     http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#!/bin/bash
+SCRIPT_DIR=`dirname "$0"`
+export APP_ROOT=`cd "$SCRIPT_DIR"/../; pwd`
+
+if [ -z "$JAVA_HOME" ]
+then
+    echo "There is no JAVA_HOME"
+    exit 1
+fi
+
+if [ -z "$CATALINA_HOME" ]
+then
+    echo "There is no CATALINA_HOME"
+    exit 1
+fi
+
+if [ -z "$APP_ROOT" ]
+then
+    echo "There is no APP_ROOT"
+    exit 1
+fi
+
+export CATALINA_BASE=$APP_ROOT
+
+$CATALINA_HOME/bin/catalina.sh stop
+
diff --git a/vnfmarket-be/deployment/src/main/release/conf/catalina.policy b/vnfmarket-be/deployment/src/main/release/conf/catalina.policy
new file mode 100644 (file)
index 0000000..354d7d6
--- /dev/null
@@ -0,0 +1,248 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// ============================================================================
+// catalina.policy - Security Policy Permissions for Tomcat 7
+//
+// This file contains a default set of security policies to be enforced (by the
+// JVM) when Catalina is executed with the "-security" option.  In addition
+// to the permissions granted here, the following additional permissions are
+// granted to each web application:
+//
+// * Read access to the web application's document root directory
+// * Read, write and delete access to the web application's working directory
+// ============================================================================
+
+
+// ========== SYSTEM CODE PERMISSIONS =========================================
+
+
+// These permissions apply to javac
+grant codeBase "file:${java.home}/lib/-" {
+        permission java.security.AllPermission;
+};
+
+// These permissions apply to all shared system extensions
+grant codeBase "file:${java.home}/jre/lib/ext/-" {
+        permission java.security.AllPermission;
+};
+
+// These permissions apply to javac when ${java.home] points at $JAVA_HOME/jre
+grant codeBase "file:${java.home}/../lib/-" {
+        permission java.security.AllPermission;
+};
+
+// These permissions apply to all shared system extensions when
+// ${java.home} points at $JAVA_HOME/jre
+grant codeBase "file:${java.home}/lib/ext/-" {
+        permission java.security.AllPermission;
+};
+
+
+// ========== CATALINA CODE PERMISSIONS =======================================
+
+
+// These permissions apply to the daemon code
+grant codeBase "file:${catalina.home}/bin/commons-daemon.jar" {
+        permission java.security.AllPermission;
+};
+
+// These permissions apply to the logging API
+// Note: If tomcat-juli.jar is in ${catalina.base} and not in ${catalina.home},
+// update this section accordingly.
+//  grant codeBase "file:${catalina.base}/bin/tomcat-juli.jar" {..}
+grant codeBase "file:${catalina.home}/bin/tomcat-juli.jar" {
+        permission java.io.FilePermission
+         "${java.home}${file.separator}lib${file.separator}logging.properties", "read";
+
+        permission java.io.FilePermission
+         "${catalina.base}${file.separator}conf${file.separator}logging.properties", "read";
+        permission java.io.FilePermission
+         "${catalina.base}${file.separator}logs", "read, write";
+        permission java.io.FilePermission
+         "${catalina.base}${file.separator}logs${file.separator}*", "read, write";
+
+        permission java.lang.RuntimePermission "shutdownHooks";
+        permission java.lang.RuntimePermission "getClassLoader";
+        permission java.lang.RuntimePermission "setContextClassLoader";
+
+        permission java.util.logging.LoggingPermission "control";
+
+        permission java.util.PropertyPermission "java.util.logging.config.class", "read";
+        permission java.util.PropertyPermission "java.util.logging.config.file", "read";
+        permission java.util.PropertyPermission "org.apache.juli.ClassLoaderLogManager.debug", "read";
+        permission java.util.PropertyPermission "catalina.base", "read";
+
+        // Note: To enable per context logging configuration, permit read access to
+        // the appropriate file. Be sure that the logging configuration is
+        // secure before enabling such access.
+        // E.g. for the examples web application (uncomment and unwrap
+        // the following to be on a single line):
+        // permission java.io.FilePermission "${catalina.base}${file.separator}
+        //  webapps${file.separator}examples${file.separator}WEB-INF
+        //  ${file.separator}classes${file.separator}logging.properties", "read";
+};
+
+// These permissions apply to the server startup code
+grant codeBase "file:${catalina.home}/bin/bootstrap.jar" {
+        permission java.security.AllPermission;
+};
+
+// These permissions apply to the servlet API classes
+// and those that are shared across all class loaders
+// located in the "lib" directory
+grant codeBase "file:${catalina.home}/lib/-" {
+        permission java.security.AllPermission;
+};
+
+
+// If using a per instance lib directory, i.e. ${catalina.base}/lib,
+// then the following permission will need to be uncommented
+// grant codeBase "file:${catalina.base}/lib/-" {
+//         permission java.security.AllPermission;
+// };
+
+
+// ========== WEB APPLICATION PERMISSIONS =====================================
+
+
+// These permissions are granted by default to all web applications
+// In addition, a web application will be given a read FilePermission
+// and JndiPermission for all files and directories in its document root.
+grant {
+    // Required for JNDI lookup of named JDBC DataSource's and
+    // javamail named MimePart DataSource used to send mail
+    permission java.util.PropertyPermission "java.home", "read";
+    permission java.util.PropertyPermission "java.naming.*", "read";
+    permission java.util.PropertyPermission "javax.sql.*", "read";
+
+    // OS Specific properties to allow read access
+    permission java.util.PropertyPermission "os.name", "read";
+    permission java.util.PropertyPermission "os.version", "read";
+    permission java.util.PropertyPermission "os.arch", "read";
+    permission java.util.PropertyPermission "file.separator", "read";
+    permission java.util.PropertyPermission "path.separator", "read";
+    permission java.util.PropertyPermission "line.separator", "read";
+
+    // JVM properties to allow read access
+    permission java.util.PropertyPermission "java.version", "read";
+    permission java.util.PropertyPermission "java.vendor", "read";
+    permission java.util.PropertyPermission "java.vendor.url", "read";
+    permission java.util.PropertyPermission "java.class.version", "read";
+    permission java.util.PropertyPermission "java.specification.version", "read";
+    permission java.util.PropertyPermission "java.specification.vendor", "read";
+    permission java.util.PropertyPermission "java.specification.name", "read";
+
+    permission java.util.PropertyPermission "java.vm.specification.version", "read";
+    permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
+    permission java.util.PropertyPermission "java.vm.specification.name", "read";
+    permission java.util.PropertyPermission "java.vm.version", "read";
+    permission java.util.PropertyPermission "java.vm.vendor", "read";
+    permission java.util.PropertyPermission "java.vm.name", "read";
+
+    // Required for OpenJMX
+    permission java.lang.RuntimePermission "getAttribute";
+
+    // Allow read of JAXP compliant XML parser debug
+    permission java.util.PropertyPermission "jaxp.debug", "read";
+
+    // All JSPs need to be able to read this package
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.tomcat";
+
+    // Precompiled JSPs need access to these packages.
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.el";
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.runtime";
+    permission java.lang.RuntimePermission
+     "accessClassInPackage.org.apache.jasper.runtime.*";
+
+    // Precompiled JSPs need access to these system properties.
+    permission java.util.PropertyPermission
+     "org.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER", "read";
+    permission java.util.PropertyPermission
+     "org.apache.el.parser.COERCE_TO_ZERO", "read";
+
+    // The cookie code needs these.
+    permission java.util.PropertyPermission
+     "org.apache.catalina.STRICT_SERVLET_COMPLIANCE", "read";
+    permission java.util.PropertyPermission
+     "org.apache.tomcat.util.http.ServerCookie.STRICT_NAMING", "read";
+    permission java.util.PropertyPermission
+     "org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR", "read";
+
+    // Applications using Comet need to be able to access this package
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.comet";
+
+    // Applications using the legacy WebSocket implementation need to be able to access this package
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.websocket";
+
+    // Applications using the JSR-356 WebSocket implementation need to be able to access these packages
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.tomcat.websocket";
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.tomcat.websocket.server";
+};
+
+
+// The Manager application needs access to the following packages to support the
+// session display functionality. These settings support the following
+// configurations:
+// - default CATALINA_HOME == CATALINA_BASE
+// - CATALINA_HOME != CATALINA_BASE, per instance Manager in CATALINA_BASE
+// - CATALINA_HOME != CATALINA_BASE, shared Manager in CATALINA_HOME
+grant codeBase "file:${catalina.base}/webapps/manager/-" {
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina";
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.ha.session";
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager";
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager.util";
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.util";
+};
+grant codeBase "file:${catalina.home}/webapps/manager/-" {
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina";
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.ha.session";
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager";
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager.util";
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.util";
+};
+
+// You can assign additional permissions to particular web applications by
+// adding additional "grant" entries here, based on the code base for that
+// application, /WEB-INF/classes/, or /WEB-INF/lib/ jar files.
+//
+// Different permissions can be granted to JSP pages, classes loaded from
+// the /WEB-INF/classes/ directory, all jar files in the /WEB-INF/lib/
+// directory, or even to individual jar files in the /WEB-INF/lib/ directory.
+//
+// For instance, assume that the standard "examples" application
+// included a JDBC driver that needed to establish a network connection to the
+// corresponding database and used the scrape taglib to get the weather from
+// the NOAA web server.  You might create a "grant" entries like this:
+//
+// The permissions granted to the context root directory apply to JSP pages.
+// grant codeBase "file:${catalina.base}/webapps/examples/-" {
+//      permission java.net.SocketPermission "dbhost.mycompany.com:5432", "connect";
+//      permission java.net.SocketPermission "*.noaa.gov:80", "connect";
+// };
+//
+// The permissions granted to the context WEB-INF/classes directory
+// grant codeBase "file:${catalina.base}/webapps/examples/WEB-INF/classes/-" {
+// };
+//
+// The permission granted to your JDBC driver
+// grant codeBase "jar:file:${catalina.base}/webapps/examples/WEB-INF/lib/driver.jar!/-" {
+//      permission java.net.SocketPermission "dbhost.mycompany.com:5432", "connect";
+// };
+// The permission granted to the scrape taglib
+// grant codeBase "jar:file:${catalina.base}/webapps/examples/WEB-INF/lib/scrape.jar!/-" {
+//      permission java.net.SocketPermission "*.noaa.gov:80", "connect";
+// };
+
diff --git a/vnfmarket-be/deployment/src/main/release/conf/catalina.properties b/vnfmarket-be/deployment/src/main/release/conf/catalina.properties
new file mode 100644 (file)
index 0000000..23d4edb
--- /dev/null
@@ -0,0 +1,133 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# List of comma-separated packages that start with or equal this string
+# will cause a security exception to be thrown when
+# passed to checkPackageAccess unless the
+# corresponding RuntimePermission ("accessClassInPackage."+package) has
+# been granted.
+package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.jasper.,\
+org.apache.naming.resources.,org.apache.tomcat.
+#
+# List of comma-separated packages that start with or equal this string
+# will cause a security exception to be thrown when
+# passed to checkPackageDefinition unless the
+# corresponding RuntimePermission ("defineClassInPackage."+package) has
+# been granted.
+#
+# by default, no packages are restricted for definition, and none of
+# the class loaders supplied with the JDK call checkPackageDefinition.
+#
+package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,\
+org.apache.jasper.,org.apache.naming.,org.apache.tomcat.
+
+#
+#
+# List of comma-separated paths defining the contents of the "common"
+# classloader. Prefixes should be used to define what is the repository type.
+# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute.
+# If left as blank,the JVM system loader will be used as Catalina's "common"
+# loader.
+# Examples:
+#     "foo": Add this folder as a class repository
+#     "foo/*.jar": Add all the JARs of the specified folder as class
+#                  repositories
+#     "foo/bar.jar": Add bar.jar as a class repository
+common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar
+
+#
+# List of comma-separated paths defining the contents of the "server"
+# classloader. Prefixes should be used to define what is the repository type.
+# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute.
+# If left as blank, the "common" loader will be used as Catalina's "server"
+# loader.
+# Examples:
+#     "foo": Add this folder as a class repository
+#     "foo/*.jar": Add all the JARs of the specified folder as class
+#                  repositories
+#     "foo/bar.jar": Add bar.jar as a class repository
+server.loader=
+
+#
+# List of comma-separated paths defining the contents of the "shared"
+# classloader. Prefixes should be used to define what is the repository type.
+# Path may be relative to the CATALINA_BASE path or absolute. If left as blank,
+# the "common" loader will be used as Catalina's "shared" loader.
+# Examples:
+#     "foo": Add this folder as a class repository
+#     "foo/*.jar": Add all the JARs of the specified folder as class
+#                  repositories
+#     "foo/bar.jar": Add bar.jar as a class repository
+# Please note that for single jars, e.g. bar.jar, you need the URL form
+# starting with file:.
+shared.loader=
+
+# List of JAR files that should not be scanned using the JarScanner
+# functionality. This is typically used to scan JARs for configuration
+# information. JARs that do not contain such information may be excluded from
+# the scan to speed up the scanning process. This is the default list. JARs on
+# this list are excluded from all scans. Scan specific lists (to exclude JARs
+# from individual scans) follow this. The list must be a comma separated list of
+# JAR file names.
+# The JARs listed below include:
+# - Tomcat Bootstrap JARs
+# - Tomcat API JARs
+# - Catalina JARs
+# - Jasper JARs
+# - Tomcat JARs
+# - Common non-Tomcat JARs
+# - Test JARs (JUnit, Cobertura and dependencies)
+tomcat.util.scan.DefaultJarScanner.jarsToSkip=\
+bootstrap.jar,commons-daemon.jar,tomcat-juli.jar,\
+annotations-api.jar,el-api.jar,jsp-api.jar,servlet-api.jar,websocket-api.jar,\
+catalina.jar,catalina-ant.jar,catalina-ha.jar,catalina-tribes.jar,\
+jasper.jar,jasper-el.jar,ecj-*.jar,\
+tomcat-api.jar,tomcat-util.jar,tomcat-coyote.jar,tomcat-dbcp.jar,\
+tomcat-jni.jar,tomcat-spdy.jar,\
+tomcat-i18n-en.jar,tomcat-i18n-es.jar,tomcat-i18n-fr.jar,tomcat-i18n-ja.jar,\
+tomcat-juli-adapters.jar,catalina-jmx-remote.jar,catalina-ws.jar,\
+tomcat-jdbc.jar,\
+tools.jar,\
+commons-beanutils*.jar,commons-codec*.jar,commons-collections*.jar,\
+commons-dbcp*.jar,commons-digester*.jar,commons-fileupload*.jar,\
+commons-httpclient*.jar,commons-io*.jar,commons-lang*.jar,commons-logging*.jar,\
+commons-math*.jar,commons-pool*.jar,\
+jstl.jar,taglibs-standard-spec-*.jar,\
+geronimo-spec-jaxrpc*.jar,wsdl4j*.jar,\
+ant.jar,ant-junit*.jar,aspectj*.jar,jmx.jar,h2*.jar,hibernate*.jar,httpclient*.jar,\
+jmx-tools.jar,jta*.jar,log4j.jar,log4j-1*.jar,mail*.jar,slf4j*.jar,\
+xercesImpl.jar,xmlParserAPIs.jar,xml-apis.jar,\
+junit.jar,junit-*.jar,hamcrest*.jar,org.hamcrest*.jar,ant-launcher.jar,\
+cobertura-*.jar,asm-*.jar,dom4j-*.jar,icu4j-*.jar,jaxen-*.jar,jdom-*.jar,\
+jetty-*.jar,oro-*.jar,servlet-api-*.jar,tagsoup-*.jar,xmlParserAPIs-*.jar,\
+xom-*.jar
+
+# Additional JARs (over and above the default JARs listed above) to skip when
+# scanning for Servlet 3.0 pluggability features. These features include web
+# fragments, annotations, SCIs and classes that match @HandlesTypes. The list
+# must be a comma separated list of JAR file names.
+org.apache.catalina.startup.ContextConfig.jarsToSkip=
+
+# Additional JARs (over and above the default JARs listed above) to skip when
+# scanning for TLDs. The list must be a comma separated list of JAR file names.
+org.apache.catalina.startup.TldConfig.jarsToSkip=tomcat7-websocket.jar
+
+#
+# String cache configuration.
+tomcat.util.buf.StringCache.byte.enabled=true
+#tomcat.util.buf.StringCache.char.enabled=true
+#tomcat.util.buf.StringCache.trainThreshold=500000
+#tomcat.util.buf.StringCache.cacheSize=5000
diff --git a/vnfmarket-be/deployment/src/main/release/conf/context.xml b/vnfmarket-be/deployment/src/main/release/conf/context.xml
new file mode 100644 (file)
index 0000000..c4cc767
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2017 Huawei Technologies Co., Ltd.
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!-- The contents of this file will be loaded for each web application -->
+<Context>
+
+    <!-- Default set of monitored resources -->
+    <WatchedResource>WEB-INF/web.xml</WatchedResource>
+
+    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
+    <!--
+    <Manager pathname="" />
+    -->
+
+    <!-- Uncomment this to enable Comet connection tacking (provides events
+         on session expiration as well as webapp lifecycle) -->
+    <!--
+    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
+    -->
+
+</Context>
\ No newline at end of file
diff --git a/vnfmarket-be/deployment/src/main/release/conf/server.xml b/vnfmarket-be/deployment/src/main/release/conf/server.xml
new file mode 100644 (file)
index 0000000..f27833f
--- /dev/null
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2017 Huawei Technologies Co., Ltd.
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!-- Note: A "Server" is not itself a "Container", so you may not define 
+    subcomponents such as "Valves" at this level. Documentation at /docs/config/server.html -->
+<Server port="9194" shutdown="SHUTDOWN">
+    <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
+    <!-- Security listener. Documentation at /docs/config/listeners.html <Listener 
+        className="org.apache.catalina.security.SecurityListener" /> -->
+    <!--APR library loader. Documentation at /docs/apr.html -->
+    <Listener className="org.apache.catalina.core.AprLifecycleListener"
+        SSLEngine="on" />
+    <!-- Prevent memory leaks due to use of particular java/javax APIs -->
+    <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
+    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
+    <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
+
+    <!-- Global JNDI resources Documentation at /docs/jndi-resources-howto.html -->
+    <GlobalNamingResources>
+        <!-- Editable user database that can also be used by UserDatabaseRealm 
+            to authenticate users -->
+        <Resource name="UserDatabase" auth="Container"
+            type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved"
+            factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
+            pathname="conf/tomcat-users.xml" />
+    </GlobalNamingResources>
+
+    <!-- A "Service" is a collection of one or more "Connectors" that share 
+        a single "Container" Note: A "Service" is not itself a "Container", so you 
+        may not define subcomponents such as "Valves" at this level. Documentation 
+        at /docs/config/service.html -->
+    <Service name="Catalina">
+
+        <!--The connectors can use a shared executor, you can define one or more 
+            named thread pools -->
+        <!-- <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="150" 
+            minSpareThreads="4"/> -->
+
+
+        <!-- A "Connector" represents an endpoint by which requests are received 
+            and responses are returned. Documentation at : Java HTTP Connector: /docs/config/http.html 
+            (blocking & non-blocking) Java AJP Connector: /docs/config/ajp.html APR (HTTP/AJP) 
+            Connector: /docs/apr.html Define a non-SSL HTTP/1.1 Connector on port 8080 -->
+        <Connector port="8702" protocol="HTTP/1.1"
+            connectionTimeout="20000" redirectPort="8443" />
+        <!-- A "Connector" using the shared thread pool -->
+        <!-- <Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1" 
+            connectionTimeout="20000" redirectPort="8443" /> -->
+        <!-- Define a SSL HTTP/1.1 Connector on port 8443 This connector uses the 
+            BIO implementation that requires the JSSE style configuration. When using 
+            the APR/native implementation, the OpenSSL style configuration is required 
+            as described in the APR/native documentation -->
+        <!-- <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol" 
+            maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" 
+            sslProtocol="TLS" /> -->
+
+        <!-- Define an AJP 1.3 Connector on port 8009 -->
+
+
+        <!-- An Engine represents the entry point (within Catalina) that processes 
+            every request. The Engine implementation for Tomcat stand alone analyzes 
+            the HTTP headers included with the request, and passes them on to the appropriate 
+            Host (virtual host). Documentation at /docs/config/engine.html -->
+
+        <!-- You should set jvmRoute to support load-balancing via AJP ie : <Engine 
+            name="Catalina" defaultHost="localhost" jvmRoute="jvm1"> -->
+        <Engine name="Catalina" defaultHost="localhost">
+
+            <!--For clustering, please take a look at documentation at: /docs/cluster-howto.html 
+                (simple how to) /docs/config/cluster.html (reference documentation) -->
+            <!-- <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> -->
+
+            <!-- Use the LockOutRealm to prevent attempts to guess user passwords 
+                via a brute-force attack -->
+            <Realm className="org.apache.catalina.realm.LockOutRealm">
+                <!-- This Realm uses the UserDatabase configured in the global JNDI resources 
+                    under the key "UserDatabase". Any edits that are performed against this UserDatabase 
+                    are immediately available for use by the Realm. -->
+                <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
+                    resourceName="UserDatabase" />
+            </Realm>
+
+            <Host name="localhost" appBase="webapps" unpackWARs="true"
+                autoDeploy="true">
+                <!-- SingleSignOn valve, share authentication between web applications 
+                    Documentation at: /docs/config/valve.html -->
+                <!-- <Valve className="org.apache.catalina.authenticator.SingleSignOn" 
+                    /> -->
+
+                <!-- Proxy log processes all example. Documentation at: /docs/config/valve.html 
+                    Note: The pattern used is equivalent to using pattern="common" -->
+                <Valve className="org.apache.catalina.valves.AccessLogValve"
+                    directory="logs" prefix="localhost_proxy_log." suffix=".txt"
+                    pattern="%h %l %u %t &quot;%r&quot; %s %b" />
+
+            </Host>
+        </Engine>
+    </Service>
+</Server>
diff --git a/vnfmarket-be/deployment/src/main/release/conf/web.xml b/vnfmarket-be/deployment/src/main/release/conf/web.xml
new file mode 100644 (file)
index 0000000..4daae22
--- /dev/null
@@ -0,0 +1,4697 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2017 Huawei Technologies Co., Ltd.
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+                      http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+  version="3.0">
+
+  <!-- ======================== Introduction ============================== -->
+  <!-- This document defines default values for *all* web applications      -->
+  <!-- loaded into this instance of Tomcat.  As each application is         -->
+  <!-- deployed, this file is processed, followed by the                    -->
+  <!-- "/WEB-INF/web.xml" deployment descriptor from your own               -->
+  <!-- applications.                                                        -->
+  <!--                                                                      -->
+  <!-- WARNING:  Do not configure application-specific resources here!      -->
+  <!-- They should go in the "/WEB-INF/web.xml" file in your application.   -->
+
+
+  <!-- ================== Built In Servlet Definitions ==================== -->
+
+
+  <!-- The default servlet for all web applications, that serves static     -->
+  <!-- resources.  It processes all requests that are not mapped to other   -->
+  <!-- servlets with servlet mappings (defined either here or in your own   -->
+  <!-- web.xml file).  This servlet supports the following initialization   -->
+  <!-- parameters (default values are in square brackets):                  -->
+  <!--                                                                      -->
+  <!--   debug               Debugging detail level for messages logged     -->
+  <!--                       by this servlet. Useful values are 0, 1, and   -->
+  <!--                       11 where higher values mean more detail. [0]   -->
+  <!--                                                                      -->
+  <!--   fileEncoding        Encoding to be used to read static resources   -->
+  <!--                       [platform default]                             -->
+  <!--                                                                      -->
+  <!--   input               Input buffer size (in bytes) when reading      -->
+  <!--                       resources to be served.  [2048]                -->
+  <!--                                                                      -->
+  <!--   listings            Should directory listings be produced if there -->
+  <!--                       is no welcome file in this directory?  [false] -->
+  <!--                       WARNING: Listings for directories with many    -->
+  <!--                       entries can be slow and may consume            -->
+  <!--                       significant proportions of server resources.   -->
+  <!--                                                                      -->
+  <!--   output              Output buffer size (in bytes) when writing     -->
+  <!--                       resources to be served.  [2048]                -->
+  <!--                                                                      -->
+  <!--   readonly            Is this context "read only", so HTTP           -->
+  <!--                       commands like PUT and DELETE are               -->
+  <!--                       rejected?  [true]                              -->
+  <!--                                                                      -->
+  <!--   readmeFile          File to display together with the directory    -->
+  <!--                       contents. [null]                               -->
+  <!--                                                                      -->
+  <!--   sendfileSize        If the connector used supports sendfile, this  -->
+  <!--                       represents the minimal file size in KB for     -->
+  <!--                       which sendfile will be used. Use a negative    -->
+  <!--                       value to always disable sendfile.  [48]        -->
+  <!--                                                                      -->
+  <!--   useAcceptRanges     Should the Accept-Ranges header be included    -->
+  <!--                       in responses where appropriate? [true]         -->
+  <!--                                                                      -->
+  <!--  For directory listing customization. Checks localXsltFile, then     -->
+  <!--  globalXsltFile, then defaults to original behavior.                 -->
+  <!--                                                                      -->
+  <!--   localXsltFile       Make directory listings an XML doc and         -->
+  <!--                       pass the result to this style sheet residing   -->
+  <!--                       in that directory. This overrides              -->
+  <!--                       contextXsltFile and globalXsltFile[null]       -->
+  <!--                                                                      -->
+  <!--   contextXsltFile     Make directory listings an XML doc and         -->
+  <!--                       pass the result to this style sheet which is   -->
+  <!--                       relative to the context root. This overrides   -->
+  <!--                       globalXsltFile[null]                           -->
+  <!--                                                                      -->
+  <!--   globalXsltFile      Site wide configuration version of             -->
+  <!--                       localXsltFile. This argument must either be an -->
+  <!--                       absolute or relative (to either                -->
+  <!--                       $CATALINA_BASE/conf or $CATALINA_HOME/conf)    -->
+  <!--                       path that points to a location below either    -->
+  <!--                       $CATALINA_BASE/conf (checked first) or         -->
+  <!--                       $CATALINA_HOME/conf (checked second).[null]    -->
+  <!--                                                                      -->
+  <!--   showServerInfo      Should server information be presented in the  -->
+  <!--                       response sent to clients when directory        -->
+  <!--                       listings is enabled? [true]                    -->
+
+    <servlet>
+        <servlet-name>default</servlet-name>
+        <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
+        <init-param>
+            <param-name>debug</param-name>
+            <param-value>0</param-value>
+        </init-param>
+        <init-param>
+            <param-name>listings</param-name>
+            <param-value>false</param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+
+  <!-- The JSP page compiler and execution servlet, which is the mechanism  -->
+  <!-- used by Tomcat to support JSP pages.  Traditionally, this servlet    -->
+  <!-- is mapped to the URL pattern "*.jsp".  This servlet supports the     -->
+  <!-- following initialization parameters (default values are in square    -->
+  <!-- brackets):                                                           -->
+  <!--                                                                      -->
+  <!--   checkInterval       If development is false and checkInterval is   -->
+  <!--                       greater than zero, background compilations are -->
+  <!--                       enabled. checkInterval is the time in seconds  -->
+  <!--                       between checks to see if a JSP page (and its   -->
+  <!--                       dependent files) needs to  be recompiled. [0]  -->
+  <!--                                                                      -->
+  <!--   classdebuginfo      Should the class file be compiled with         -->
+  <!--                       debugging information?  [true]                 -->
+  <!--                                                                      -->
+  <!--   classpath           What class path should I use while compiling   -->
+  <!--                       generated servlets?  [Created dynamically      -->
+  <!--                       based on the current web application]          -->
+  <!--                                                                      -->
+  <!--   compiler            Which compiler Ant should use to compile JSP   -->
+  <!--                       pages.  See the jasper documentation for more  -->
+  <!--                       information.                                   -->
+  <!--                                                                      -->
+  <!--   compilerSourceVM    Compiler source VM. [1.6]                      -->
+  <!--                                                                      -->
+  <!--   compilerTargetVM    Compiler target VM. [1.6]                      -->
+  <!--                                                                      -->
+  <!--   development         Is Jasper used in development mode? If true,   -->
+  <!--                       the frequency at which JSPs are checked for    -->
+  <!--                       modification may be specified via the          -->
+  <!--                       modificationTestInterval parameter. [true]     -->
+  <!--                                                                      -->
+  <!--   displaySourceFragment                                              -->
+  <!--                       Should a source fragment be included in        -->
+  <!--                       exception messages? [true]                     -->
+  <!--                                                                      -->
+  <!--   dumpSmap            Should the SMAP info for JSR45 debugging be    -->
+  <!--                       dumped to a file? [false]                      -->
+  <!--                       False if suppressSmap is true                  -->
+  <!--                                                                      -->
+  <!--   enablePooling       Determines whether tag handler pooling is      -->
+  <!--                       enabled. This is a compilation option. It will -->
+  <!--                       not alter the behaviour of JSPs that have      -->
+  <!--                       already been compiled. [true]                  -->
+  <!--                                                                      -->
+  <!--   engineOptionsClass  Allows specifying the Options class used to    -->
+  <!--                       configure Jasper. If not present, the default  -->
+  <!--                       EmbeddedServletOptions will be used.           -->
+  <!--                                                                      -->
+  <!--   errorOnUseBeanInvalidClassAttribute                                -->
+  <!--                       Should Jasper issue an error when the value of -->
+  <!--                       the class attribute in an useBean action is    -->
+  <!--                       not a valid bean class?  [true]                -->
+  <!--                                                                      -->
+  <!--   fork                Tell Ant to fork compiles of JSP pages so that -->
+  <!--                       a separate JVM is used for JSP page compiles   -->
+  <!--                       from the one Tomcat is running in. [true]      -->
+  <!--                                                                      -->
+  <!--   genStringAsCharArray                                               -->
+  <!--                       Should text strings be generated as char       -->
+  <!--                       arrays, to improve performance in some cases?  -->
+  <!--                       [false]                                        -->
+  <!--                                                                      -->
+  <!--   ieClassId           The class-id value to be sent to Internet      -->
+  <!--                       Explorer when using <jsp:plugin> tags.         -->
+  <!--                       [clsid:8AD9C840-044E-11D1-B3E9-00805F499D93]   -->
+  <!--                                                                      -->
+  <!--   javaEncoding        Java file encoding to use for generating java  -->
+  <!--                       source files. [UTF8]                           -->
+  <!--                                                                      -->
+  <!--   keepgenerated       Should we keep the generated Java source code  -->
+  <!--                       for each page instead of deleting it? [true]   -->
+  <!--                                                                      -->
+  <!--   mappedfile          Should we generate static content with one     -->
+  <!--                       print statement per input line, to ease        -->
+  <!--                       debugging?  [true]                             -->
+  <!--                                                                      -->
+  <!--   maxLoadedJsps       The maximum number of JSPs that will be loaded -->
+  <!--                       for a web application. If more than this       -->
+  <!--                       number of JSPs are loaded, the least recently  -->
+  <!--                       used JSPs will be unloaded so that the number  -->
+  <!--                       of JSPs loaded at any one time does not exceed -->
+  <!--                       this limit. A value of zero or less indicates  -->
+  <!--                       no limit. [-1]                                 -->
+  <!--                                                                      -->
+  <!--   jspIdleTimeout      The amount of time in seconds a JSP can be     -->
+  <!--                       idle before it is unloaded. A value of zero    -->
+  <!--                       or less indicates never unload. [-1]           -->
+  <!--                                                                      -->
+  <!--   modificationTestInterval                                           -->
+  <!--                       Causes a JSP (and its dependent files) to not  -->
+  <!--                       be checked for modification during the         -->
+  <!--                       specified time interval (in seconds) from the  -->
+  <!--                       last time the JSP was checked for              -->
+  <!--                       modification. A value of 0 will cause the JSP  -->
+  <!--                       to be checked on every proxy.                 -->
+  <!--                       Used in development mode only. [4]             -->
+  <!--                                                                      -->
+  <!--   recompileOnFail     If a JSP compilation fails should the          -->
+  <!--                       modificationTestInterval be ignored and the    -->
+  <!--                       next proxy trigger a re-compilation attempt?  -->
+  <!--                       Used in development mode only and is disabled  -->
+  <!--                       by default as compilation may be expensive and -->
+  <!--                       could lead to excessive resource usage.        -->
+  <!--                       [false]                                        -->
+  <!--                                                                      -->
+  <!--   scratchdir          What scratch directory should we use when      -->
+  <!--                       compiling JSP pages?  [default work directory  -->
+  <!--                       for the current web application]               -->
+  <!--                                                                      -->
+  <!--   suppressSmap        Should the generation of SMAP info for JSR45   -->
+  <!--                       debugging be suppressed?  [false]              -->
+  <!--                                                                      -->
+  <!--   trimSpaces          Should white spaces in template text between   -->
+  <!--                       actions or directives be trimmed?  [false]     -->
+  <!--                                                                      -->
+  <!--   xpoweredBy          Determines whether X-Powered-By response       -->
+  <!--                       header is added by generated servlet.  [false] -->
+  <!--                                                                      -->
+  <!--   quoteAttributeEL    When EL is used in an attribute value on a     -->
+  <!--                       JSP page should the rules for quoting of       -->
+  <!--                       attributes described in JSP.1.6 be applied to  -->
+  <!--                       the expression? [true]                         -->
+
+    <servlet>
+        <servlet-name>jsp</servlet-name>
+        <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
+        <init-param>
+            <param-name>fork</param-name>
+            <param-value>false</param-value>
+        </init-param>
+        <init-param>
+            <param-name>xpoweredBy</param-name>
+            <param-value>false</param-value>
+        </init-param>
+        <load-on-startup>3</load-on-startup>
+    </servlet>
+
+
+  <!-- NOTE: An SSI Filter is also available as an alternative SSI          -->
+  <!-- implementation. Use either the Servlet or the Filter but NOT both.   -->
+  <!--                                                                      -->
+  <!-- Server Side Includes processing servlet, which processes SSI         -->
+  <!-- directives in HTML pages consistent with similar support in web      -->
+  <!-- servers like Apache.  Traditionally, this servlet is mapped to the   -->
+  <!-- URL pattern "*.shtml".  This servlet supports the following          -->
+  <!-- initialization parameters (default values are in square brackets):   -->
+  <!--                                                                      -->
+  <!--   buffered            Should output from this servlet be buffered?   -->
+  <!--                       (0=false, 1=true)  [0]                         -->
+  <!--                                                                      -->
+  <!--   debug               Debugging detail level for messages logged     -->
+  <!--                       by this servlet.  [0]                          -->
+  <!--                                                                      -->
+  <!--   expires             The number of seconds before a page with SSI   -->
+  <!--                       directives will expire.  [No default]          -->
+  <!--                                                                      -->
+  <!--   isVirtualWebappRelative                                            -->
+  <!--                       Should "virtual" paths be interpreted as       -->
+  <!--                       relative to the context root, instead of       -->
+  <!--                       the server root? [false]                       -->
+  <!--                                                                      -->
+  <!--   inputEncoding       The encoding to assume for SSI resources if    -->
+  <!--                       one is not available from the resource.        -->
+  <!--                       [Platform default]                             -->
+  <!--                                                                      -->
+  <!--   outputEncoding      The encoding to use for the page that results  -->
+  <!--                       from the SSI processing. [UTF-8]               -->
+  <!--                                                                      -->
+  <!--   allowExec           Is use of the exec command enabled? [false]    -->
+
+<!--
+    <servlet>
+        <servlet-name>ssi</servlet-name>
+        <servlet-class>
+          org.apache.catalina.ssi.SSIServlet
+        </servlet-class>
+        <init-param>
+          <param-name>buffered</param-name>
+          <param-value>1</param-value>
+        </init-param>
+        <init-param>
+          <param-name>debug</param-name>
+          <param-value>0</param-value>
+        </init-param>
+        <init-param>
+          <param-name>expires</param-name>
+          <param-value>666</param-value>
+        </init-param>
+        <init-param>
+          <param-name>isVirtualWebappRelative</param-name>
+          <param-value>false</param-value>
+        </init-param>
+        <load-on-startup>4</load-on-startup>
+    </servlet>
+-->
+
+
+  <!-- Common Gateway Includes (CGI) processing servlet, which supports     -->
+  <!-- execution of external applications that conform to the CGI spec      -->
+  <!-- requirements.  Typically, this servlet is mapped to the URL pattern  -->
+  <!-- "/cgi-bin/*", which means that any CGI applications that are         -->
+  <!-- executed must be present within the web application.  This servlet   -->
+  <!-- supports the following initialization parameters (default values     -->
+  <!-- are in square brackets):                                             -->
+  <!--                                                                      -->
+  <!--   cgiPathPrefix        The CGI search path will start at             -->
+  <!--                        webAppRootDir + File.separator + this prefix. -->
+  <!--                        If not set, then webAppRootDir is used.       -->
+  <!--                        Recommended value: WEB-INF/cgi                -->
+  <!--                                                                      -->
+  <!--   debug                Debugging detail level for messages logged    -->
+  <!--                        by this servlet. Useful values range from 0   -->
+  <!--                        to 5 where 0 means no logging and 5 means     -->
+  <!--                        maximum logging. Values of 10 or more mean    -->
+  <!--                        maximum logging plus debug info added to the  -->
+  <!--                        HTTP response. If an error occurs and debug   -->
+  <!--                        is 10 or more the standard error page         -->
+  <!--                        mechanism will be disabled and a response     -->
+  <!--                        body with debug information will be produced. -->
+  <!--                        Note that any value of 10 or more has the     -->
+  <!--                        same effect as a value of 10. If set to 10 or -->
+  <!--                        more the standard error page mechanism will   -->
+  <!--                        be disabled and a debug page shown instead.   -->
+  <!--                        The debug page is not considered secure and   -->
+  <!--                        should not be enabled for production systems. -->
+  <!--                        [0]                                           -->
+  <!--                                                                      -->
+  <!--   executable           Name of the executable used to run the        -->
+  <!--                        script. [perl]                                -->
+  <!--                                                                      -->
+  <!--   parameterEncoding    Name of parameter encoding to be used with    -->
+  <!--                        CGI servlet.                                  -->
+  <!--                        [System.getProperty("file.encoding","UTF-8")] -->
+  <!--                                                                      -->
+  <!--   passShellEnvironment Should the shell environment variables (if    -->
+  <!--                        any) be passed to the CGI script? [false]     -->
+  <!--                                                                      -->
+  <!--   stderrTimeout        The time (in milliseconds) to wait for the    -->
+  <!--                        reading of stderr to complete before          -->
+  <!--                        terminating the CGI process. [2000]           -->
+
+<!--
+    <servlet>
+        <servlet-name>cgi</servlet-name>
+        <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
+        <init-param>
+          <param-name>debug</param-name>
+          <param-value>0</param-value>
+        </init-param>
+        <init-param>
+          <param-name>cgiPathPrefix</param-name>
+          <param-value>WEB-INF/cgi</param-value>
+        </init-param>
+         <load-on-startup>5</load-on-startup>
+    </servlet>
+-->
+
+
+  <!-- ================ Built In Servlet Mappings ========================= -->
+
+
+  <!-- The servlet mappings for the built in servlets defined above.  Note  -->
+  <!-- that, by default, the CGI and SSI servlets are *not* mapped.  You    -->
+  <!-- must uncomment these mappings (or add them to your application's own -->
+  <!-- web.xml deployment descriptor) to enable these services              -->
+
+    <!-- The mapping for the default servlet -->
+    <servlet-mapping>
+        <servlet-name>default</servlet-name>
+        <url-pattern>/</url-pattern>
+    </servlet-mapping>
+
+    <!-- The mappings for the JSP servlet -->
+    <servlet-mapping>
+        <servlet-name>jsp</servlet-name>
+        <url-pattern>*.jsp</url-pattern>
+        <url-pattern>*.jspx</url-pattern>
+    </servlet-mapping>
+
+    <!-- The mapping for the SSI servlet -->
+<!--
+    <servlet-mapping>
+        <servlet-name>ssi</servlet-name>
+        <url-pattern>*.shtml</url-pattern>
+    </servlet-mapping>
+-->
+
+    <!-- The mapping for the CGI Gateway servlet -->
+
+<!--
+    <servlet-mapping>
+        <servlet-name>cgi</servlet-name>
+        <url-pattern>/cgi-bin/*</url-pattern>
+    </servlet-mapping>
+-->
+
+
+  <!-- ================== Built In Filter Definitions ===================== -->
+
+  <!-- A filter that sets various security related HTTP Response headers.   -->
+  <!-- This filter supports the following initialization parameters         -->
+  <!-- (default values are in square brackets):                             -->
+  <!--                                                                      -->
+  <!--   hstsEnabled         Should the HTTP Strict Transport Security      -->
+  <!--                       (HSTS) header be added to the response? See    -->
+  <!--                       RFC 6797 for more information on HSTS. [true]  -->
+  <!--                                                                      -->
+  <!--   hstsMaxAgeSeconds   The max age value that should be used in the   -->
+  <!--                       HSTS header. Negative values will be treated   -->
+  <!--                       as zero. [0]                                   -->
+  <!--                                                                      -->
+  <!--   hstsIncludeSubDomains                                              -->
+  <!--                       Should the includeSubDomains parameter be      -->
+  <!--                       included in the HSTS header.                   -->
+  <!--                                                                      -->
+  <!--   antiClickJackingEnabled                                            -->
+  <!--                       Should the anti click-jacking header           -->
+  <!--                       X-Frame-Options be added to every response?    -->
+  <!--                       [true]                                         -->
+  <!--                                                                      -->
+  <!--   antiClickJackingOption                                             -->
+  <!--                       What value should be used for the header. Must -->
+  <!--                       be one of DENY, SAMEORIGIN, ALLOW-FROM         -->
+  <!--                       (case-insensitive). [DENY]                     -->
+  <!--                                                                      -->
+  <!--   antiClickJackingUri IF ALLOW-FROM is used, what URI should be      -->
+  <!--                       allowed? []                                    -->
+  <!--                                                                      -->
+  <!--   blockContentTypeSniffingEnabled                                    -->
+  <!--                       Should the header that blocks content type     -->
+  <!--                       sniffing be added to every response? [true]    -->
+<!--
+    <filter>
+        <filter-name>httpHeaderSecurity</filter-name>
+        <filter-class>org.apache.catalina.filters.HttpHeaderSecurityFilter</filter-class>
+        <async-supported>true</async-supported>
+    </filter>
+-->
+
+  <!-- A filter that sets character encoding that is used to decode -->
+  <!-- parameters in a POST request -->
+<!--
+    <filter>
+        <filter-name>setCharacterEncodingFilter</filter-name>
+        <filter-class>org.apache.catalina.filters.SetCharacterEncodingFilter</filter-class>
+        <init-param>
+            <param-name>encoding</param-name>
+            <param-value>UTF-8</param-value>
+        </init-param>
+        <async-supported>true</async-supported>
+    </filter>
+-->
+
+  <!-- A filter that triggers request parameters parsing and rejects the    -->
+  <!-- request if some parameters were skipped because of parsing errors or -->
+  <!-- request size limitations.                                            -->
+<!--
+    <filter>
+        <filter-name>failedRequestFilter</filter-name>
+        <filter-class>
+          org.apache.catalina.filters.FailedRequestFilter
+        </filter-class>
+        <async-supported>true</async-supported>
+    </filter>
+-->
+
+
+  <!-- NOTE: An SSI Servlet is also available as an alternative SSI         -->
+  <!-- implementation. Use either the Servlet or the Filter but NOT both.   -->
+  <!--                                                                      -->
+  <!-- Server Side Includes processing filter, which processes SSI          -->
+  <!-- directives in HTML pages consistent with similar support in web      -->
+  <!-- servers like Apache.  Traditionally, this filter is mapped to the    -->
+  <!-- URL pattern "*.shtml", though it can be mapped to "*" as it will     -->
+  <!-- selectively enable/disable SSI processing based on mime types. For   -->
+  <!-- this to work you will need to uncomment the .shtml mime type         -->
+  <!-- definition towards the bottom of this file.                          -->
+  <!-- The contentType init param allows you to apply SSI processing to JSP -->
+  <!-- pages, javascript, or any other content you wish.  This filter       -->
+  <!-- supports the following initialization parameters (default values are -->
+  <!-- in square brackets):                                                 -->
+  <!--                                                                      -->
+  <!--   contentType         A regex pattern that must be matched before    -->
+  <!--                       SSI processing is applied.                     -->
+  <!--                       [text/x-server-parsed-html(;.*)?]              -->
+  <!--                                                                      -->
+  <!--   debug               Debugging detail level for messages logged     -->
+  <!--                       by this servlet.  [0]                          -->
+  <!--                                                                      -->
+  <!--   expires             The number of seconds before a page with SSI   -->
+  <!--                       directives will expire.  [No default]          -->
+  <!--                                                                      -->
+  <!--   isVirtualWebappRelative                                            -->
+  <!--                       Should "virtual" paths be interpreted as       -->
+  <!--                       relative to the context root, instead of       -->
+  <!--                       the server root? [false]                       -->
+  <!--                                                                      -->
+  <!--   allowExec           Is use of the exec command enabled? [false]    -->
+
+<!--
+    <filter>
+        <filter-name>ssi</filter-name>
+        <filter-class>
+          org.apache.catalina.ssi.SSIFilter
+        </filter-class>
+        <init-param>
+          <param-name>contentType</param-name>
+          <param-value>text/x-server-parsed-html(;.*)?</param-value>
+        </init-param>
+        <init-param>
+          <param-name>debug</param-name>
+          <param-value>0</param-value>
+        </init-param>
+        <init-param>
+          <param-name>expires</param-name>
+          <param-value>666</param-value>
+        </init-param>
+        <init-param>
+          <param-name>isVirtualWebappRelative</param-name>
+          <param-value>false</param-value>
+        </init-param>
+    </filter>
+-->
+
+
+  <!-- ==================== Built In Filter Mappings ====================== -->
+
+  <!-- The mapping for the HTTP header security Filter -->
+<!--
+    <filter-mapping>
+        <filter-name>httpHeaderSecurity</filter-name>
+        <url-pattern>/*</url-pattern>
+        <dispatcher>REQUEST</dispatcher>
+    </filter-mapping>
+-->
+
+  <!-- The mapping for the Set Character Encoding Filter -->
+<!--
+    <filter-mapping>
+        <filter-name>setCharacterEncodingFilter</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+-->
+
+  <!-- The mapping for the Failed Request Filter -->
+<!--
+    <filter-mapping>
+        <filter-name>failedRequestFilter</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+-->
+
+  <!-- The mapping for the SSI Filter -->
+<!--
+    <filter-mapping>
+        <filter-name>ssi</filter-name>
+        <url-pattern>*.shtml</url-pattern>
+    </filter-mapping>
+-->
+
+
+  <!-- ==================== Default Session Configuration ================= -->
+  <!-- You can set the default session timeout (in minutes) for all newly   -->
+  <!-- created sessions by modifying the value below.                       -->
+
+    <session-config>
+        <session-timeout>30</session-timeout>
+    </session-config>
+
+
+  <!-- ===================== Default MIME Type Mappings =================== -->
+  <!-- When serving static resources, Tomcat will automatically generate    -->
+  <!-- a "Content-Type" header based on the resource's filename extension,  -->
+  <!-- based on these mappings.  Additional mappings can be added here (to  -->
+  <!-- apply to all web applications), or in your own application's web.xml -->
+  <!-- deployment descriptor.                                               -->
+
+    <mime-mapping>
+        <extension>123</extension>
+        <mime-type>application/vnd.lotus-1-2-3</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>3dml</extension>
+        <mime-type>text/vnd.in3d.3dml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>3ds</extension>
+        <mime-type>image/x-3ds</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>3g2</extension>
+        <mime-type>video/3gpp2</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>3gp</extension>
+        <mime-type>video/3gpp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>7z</extension>
+        <mime-type>application/x-7z-compressed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aab</extension>
+        <mime-type>application/x-authorware-bin</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aac</extension>
+        <mime-type>audio/x-aac</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aam</extension>
+        <mime-type>application/x-authorware-map</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aas</extension>
+        <mime-type>application/x-authorware-seg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>abs</extension>
+        <mime-type>audio/x-mpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>abw</extension>
+        <mime-type>application/x-abiword</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ac</extension>
+        <mime-type>application/pkix-attr-cert</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>acc</extension>
+        <mime-type>application/vnd.americandynamics.acc</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ace</extension>
+        <mime-type>application/x-ace-compressed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>acu</extension>
+        <mime-type>application/vnd.acucobol</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>acutc</extension>
+        <mime-type>application/vnd.acucorp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>adp</extension>
+        <mime-type>audio/adpcm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aep</extension>
+        <mime-type>application/vnd.audiograph</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>afm</extension>
+        <mime-type>application/x-font-type1</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>afp</extension>
+        <mime-type>application/vnd.ibm.modcap</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ahead</extension>
+        <mime-type>application/vnd.ahead.space</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ai</extension>
+        <mime-type>application/postscript</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aif</extension>
+        <mime-type>audio/x-aiff</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aifc</extension>
+        <mime-type>audio/x-aiff</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aiff</extension>
+        <mime-type>audio/x-aiff</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aim</extension>
+        <mime-type>application/x-aim</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>air</extension>
+        <mime-type>application/vnd.adobe.air-application-installer-package+zip</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ait</extension>
+        <mime-type>application/vnd.dvb.ait</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ami</extension>
+        <mime-type>application/vnd.amiga.ami</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>anx</extension>
+        <mime-type>application/annodex</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>apk</extension>
+        <mime-type>application/vnd.android.package-archive</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>appcache</extension>
+        <mime-type>text/cache-manifest</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>application</extension>
+        <mime-type>application/x-ms-application</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>apr</extension>
+        <mime-type>application/vnd.lotus-approach</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>arc</extension>
+        <mime-type>application/x-freearc</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>art</extension>
+        <mime-type>image/x-jg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>asc</extension>
+        <mime-type>application/pgp-signature</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>asf</extension>
+        <mime-type>video/x-ms-asf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>asm</extension>
+        <mime-type>text/x-asm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aso</extension>
+        <mime-type>application/vnd.accpac.simply.aso</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>asx</extension>
+        <mime-type>video/x-ms-asf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>atc</extension>
+        <mime-type>application/vnd.acucorp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>atom</extension>
+        <mime-type>application/atom+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>atomcat</extension>
+        <mime-type>application/atomcat+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>atomsvc</extension>
+        <mime-type>application/atomsvc+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>atx</extension>
+        <mime-type>application/vnd.antix.game-component</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>au</extension>
+        <mime-type>audio/basic</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>avi</extension>
+        <mime-type>video/x-msvideo</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>avx</extension>
+        <mime-type>video/x-rad-screenplay</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aw</extension>
+        <mime-type>application/applixware</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>axa</extension>
+        <mime-type>audio/annodex</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>axv</extension>
+        <mime-type>video/annodex</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>azf</extension>
+        <mime-type>application/vnd.airzip.filesecure.azf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>azs</extension>
+        <mime-type>application/vnd.airzip.filesecure.azs</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>azw</extension>
+        <mime-type>application/vnd.amazon.ebook</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bat</extension>
+        <mime-type>application/x-msdownload</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bcpio</extension>
+        <mime-type>application/x-bcpio</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bdf</extension>
+        <mime-type>application/x-font-bdf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bdm</extension>
+        <mime-type>application/vnd.syncml.dm+wbxml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bed</extension>
+        <mime-type>application/vnd.realvnc.bed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bh2</extension>
+        <mime-type>application/vnd.fujitsu.oasysprs</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bin</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>blb</extension>
+        <mime-type>application/x-blorb</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>blorb</extension>
+        <mime-type>application/x-blorb</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bmi</extension>
+        <mime-type>application/vnd.bmi</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bmp</extension>
+        <mime-type>image/bmp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>body</extension>
+        <mime-type>text/html</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>book</extension>
+        <mime-type>application/vnd.framemaker</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>box</extension>
+        <mime-type>application/vnd.previewsystems.box</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>boz</extension>
+        <mime-type>application/x-bzip2</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bpk</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>btif</extension>
+        <mime-type>image/prs.btif</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bz</extension>
+        <mime-type>application/x-bzip</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bz2</extension>
+        <mime-type>application/x-bzip2</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>c</extension>
+        <mime-type>text/x-c</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>c11amc</extension>
+        <mime-type>application/vnd.cluetrust.cartomobile-config</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>c11amz</extension>
+        <mime-type>application/vnd.cluetrust.cartomobile-config-pkg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>c4d</extension>
+        <mime-type>application/vnd.clonk.c4group</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>c4f</extension>
+        <mime-type>application/vnd.clonk.c4group</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>c4g</extension>
+        <mime-type>application/vnd.clonk.c4group</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>c4p</extension>
+        <mime-type>application/vnd.clonk.c4group</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>c4u</extension>
+        <mime-type>application/vnd.clonk.c4group</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cab</extension>
+        <mime-type>application/vnd.ms-cab-compressed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>caf</extension>
+        <mime-type>audio/x-caf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cap</extension>
+        <mime-type>application/vnd.tcpdump.pcap</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>car</extension>
+        <mime-type>application/vnd.curl.car</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cat</extension>
+        <mime-type>application/vnd.ms-pki.seccat</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cb7</extension>
+        <mime-type>application/x-cbr</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cba</extension>
+        <mime-type>application/x-cbr</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cbr</extension>
+        <mime-type>application/x-cbr</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cbt</extension>
+        <mime-type>application/x-cbr</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cbz</extension>
+        <mime-type>application/x-cbr</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cc</extension>
+        <mime-type>text/x-c</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cct</extension>
+        <mime-type>application/x-director</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ccxml</extension>
+        <mime-type>application/ccxml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdbcmsg</extension>
+        <mime-type>application/vnd.contact.cmsg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdf</extension>
+        <mime-type>application/x-cdf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdkey</extension>
+        <mime-type>application/vnd.mediastation.cdkey</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdmia</extension>
+        <mime-type>application/cdmi-capability</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdmic</extension>
+        <mime-type>application/cdmi-container</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdmid</extension>
+        <mime-type>application/cdmi-domain</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdmio</extension>
+        <mime-type>application/cdmi-object</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdmiq</extension>
+        <mime-type>application/cdmi-queue</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdx</extension>
+        <mime-type>chemical/x-cdx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdxml</extension>
+        <mime-type>application/vnd.chemdraw+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdy</extension>
+        <mime-type>application/vnd.cinderella</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cer</extension>
+        <mime-type>application/pkix-cert</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cfs</extension>
+        <mime-type>application/x-cfs-compressed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cgm</extension>
+        <mime-type>image/cgm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>chat</extension>
+        <mime-type>application/x-chat</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>chm</extension>
+        <mime-type>application/vnd.ms-htmlhelp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>chrt</extension>
+        <mime-type>application/vnd.kde.kchart</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cif</extension>
+        <mime-type>chemical/x-cif</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cii</extension>
+        <mime-type>application/vnd.anser-web-certificate-issue-initiation</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cil</extension>
+        <mime-type>application/vnd.ms-artgalry</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cla</extension>
+        <mime-type>application/vnd.claymore</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>class</extension>
+        <mime-type>application/java</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>clkk</extension>
+        <mime-type>application/vnd.crick.clicker.keyboard</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>clkp</extension>
+        <mime-type>application/vnd.crick.clicker.palette</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>clkt</extension>
+        <mime-type>application/vnd.crick.clicker.template</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>clkw</extension>
+        <mime-type>application/vnd.crick.clicker.wordbank</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>clkx</extension>
+        <mime-type>application/vnd.crick.clicker</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>clp</extension>
+        <mime-type>application/x-msclip</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cmc</extension>
+        <mime-type>application/vnd.cosmocaller</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cmdf</extension>
+        <mime-type>chemical/x-cmdf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cml</extension>
+        <mime-type>chemical/x-cml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cmp</extension>
+        <mime-type>application/vnd.yellowriver-custom-menu</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cmx</extension>
+        <mime-type>image/x-cmx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cod</extension>
+        <mime-type>application/vnd.rim.cod</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>com</extension>
+        <mime-type>application/x-msdownload</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>conf</extension>
+        <mime-type>text/plain</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cpio</extension>
+        <mime-type>application/x-cpio</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cpp</extension>
+        <mime-type>text/x-c</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cpt</extension>
+        <mime-type>application/mac-compactpro</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>crd</extension>
+        <mime-type>application/x-mscardfile</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>crl</extension>
+        <mime-type>application/pkix-crl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>crt</extension>
+        <mime-type>application/x-x509-ca-cert</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cryptonote</extension>
+        <mime-type>application/vnd.rig.cryptonote</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>csh</extension>
+        <mime-type>application/x-csh</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>csml</extension>
+        <mime-type>chemical/x-csml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>csp</extension>
+        <mime-type>application/vnd.commonspace</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>css</extension>
+        <mime-type>text/css</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cst</extension>
+        <mime-type>application/x-director</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>csv</extension>
+        <mime-type>text/csv</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cu</extension>
+        <mime-type>application/cu-seeme</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>curl</extension>
+        <mime-type>text/vnd.curl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cww</extension>
+        <mime-type>application/prs.cww</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cxt</extension>
+        <mime-type>application/x-director</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cxx</extension>
+        <mime-type>text/x-c</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dae</extension>
+        <mime-type>model/vnd.collada+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>daf</extension>
+        <mime-type>application/vnd.mobius.daf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dart</extension>
+        <mime-type>application/vnd.dart</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dataless</extension>
+        <mime-type>application/vnd.fdsn.seed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>davmount</extension>
+        <mime-type>application/davmount+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dbk</extension>
+        <mime-type>application/docbook+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dcr</extension>
+        <mime-type>application/x-director</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dcurl</extension>
+        <mime-type>text/vnd.curl.dcurl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dd2</extension>
+        <mime-type>application/vnd.oma.dd2+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ddd</extension>
+        <mime-type>application/vnd.fujixerox.ddd</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>deb</extension>
+        <mime-type>application/x-debian-package</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>def</extension>
+        <mime-type>text/plain</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>deploy</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>der</extension>
+        <mime-type>application/x-x509-ca-cert</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dfac</extension>
+        <mime-type>application/vnd.dreamfactory</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dgc</extension>
+        <mime-type>application/x-dgc-compressed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dib</extension>
+        <mime-type>image/bmp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dic</extension>
+        <mime-type>text/x-c</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dir</extension>
+        <mime-type>application/x-director</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dis</extension>
+        <mime-type>application/vnd.mobius.dis</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dist</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>distz</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>djv</extension>
+        <mime-type>image/vnd.djvu</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>djvu</extension>
+        <mime-type>image/vnd.djvu</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dll</extension>
+        <mime-type>application/x-msdownload</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dmg</extension>
+        <mime-type>application/x-apple-diskimage</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dmp</extension>
+        <mime-type>application/vnd.tcpdump.pcap</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dms</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dna</extension>
+        <mime-type>application/vnd.dna</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>doc</extension>
+        <mime-type>application/msword</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>docm</extension>
+        <mime-type>application/vnd.ms-word.document.macroenabled.12</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>docx</extension>
+        <mime-type>application/vnd.openxmlformats-officedocument.wordprocessingml.document</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dot</extension>
+        <mime-type>application/msword</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dotm</extension>
+        <mime-type>application/vnd.ms-word.template.macroenabled.12</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dotx</extension>
+        <mime-type>application/vnd.openxmlformats-officedocument.wordprocessingml.template</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dp</extension>
+        <mime-type>application/vnd.osgi.dp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dpg</extension>
+        <mime-type>application/vnd.dpgraph</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dra</extension>
+        <mime-type>audio/vnd.dra</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dsc</extension>
+        <mime-type>text/prs.lines.tag</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dssc</extension>
+        <mime-type>application/dssc+der</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dtb</extension>
+        <mime-type>application/x-dtbook+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dtd</extension>
+        <mime-type>application/xml-dtd</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dts</extension>
+        <mime-type>audio/vnd.dts</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dtshd</extension>
+        <mime-type>audio/vnd.dts.hd</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dump</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dv</extension>
+        <mime-type>video/x-dv</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dvb</extension>
+        <mime-type>video/vnd.dvb.file</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dvi</extension>
+        <mime-type>application/x-dvi</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dwf</extension>
+        <mime-type>model/vnd.dwf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dwg</extension>
+        <mime-type>image/vnd.dwg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dxf</extension>
+        <mime-type>image/vnd.dxf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dxp</extension>
+        <mime-type>application/vnd.spotfire.dxp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dxr</extension>
+        <mime-type>application/x-director</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ecelp4800</extension>
+        <mime-type>audio/vnd.nuera.ecelp4800</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ecelp7470</extension>
+        <mime-type>audio/vnd.nuera.ecelp7470</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ecelp9600</extension>
+        <mime-type>audio/vnd.nuera.ecelp9600</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ecma</extension>
+        <mime-type>application/ecmascript</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>edm</extension>
+        <mime-type>application/vnd.novadigm.edm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>edx</extension>
+        <mime-type>application/vnd.novadigm.edx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>efif</extension>
+        <mime-type>application/vnd.picsel</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ei6</extension>
+        <mime-type>application/vnd.pg.osasli</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>elc</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>emf</extension>
+        <mime-type>application/x-msmetafile</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>eml</extension>
+        <mime-type>message/rfc822</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>emma</extension>
+        <mime-type>application/emma+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>emz</extension>
+        <mime-type>application/x-msmetafile</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>eol</extension>
+        <mime-type>audio/vnd.digital-winds</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>eot</extension>
+        <mime-type>application/vnd.ms-fontobject</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>eps</extension>
+        <mime-type>application/postscript</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>epub</extension>
+        <mime-type>application/epub+zip</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>es3</extension>
+        <mime-type>application/vnd.eszigno3+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>esa</extension>
+        <mime-type>application/vnd.osgi.subsystem</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>esf</extension>
+        <mime-type>application/vnd.epson.esf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>et3</extension>
+        <mime-type>application/vnd.eszigno3+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>etx</extension>
+        <mime-type>text/x-setext</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>eva</extension>
+        <mime-type>application/x-eva</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>evy</extension>
+        <mime-type>application/x-envoy</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>exe</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>exi</extension>
+        <mime-type>application/exi</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ext</extension>
+        <mime-type>application/vnd.novadigm.ext</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ez</extension>
+        <mime-type>application/andrew-inset</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ez2</extension>
+        <mime-type>application/vnd.ezpix-album</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ez3</extension>
+        <mime-type>application/vnd.ezpix-package</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>f</extension>
+        <mime-type>text/x-fortran</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>f4v</extension>
+        <mime-type>video/x-f4v</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>f77</extension>
+        <mime-type>text/x-fortran</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>f90</extension>
+        <mime-type>text/x-fortran</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fbs</extension>
+        <mime-type>image/vnd.fastbidsheet</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fcdt</extension>
+        <mime-type>application/vnd.adobe.formscentral.fcdt</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fcs</extension>
+        <mime-type>application/vnd.isac.fcs</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fdf</extension>
+        <mime-type>application/vnd.fdf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fe_launch</extension>
+        <mime-type>application/vnd.denovo.fcselayout-link</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fg5</extension>
+        <mime-type>application/vnd.fujitsu.oasysgp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fgd</extension>
+        <mime-type>application/x-director</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fh</extension>
+        <mime-type>image/x-freehand</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fh4</extension>
+        <mime-type>image/x-freehand</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fh5</extension>
+        <mime-type>image/x-freehand</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fh7</extension>
+        <mime-type>image/x-freehand</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fhc</extension>
+        <mime-type>image/x-freehand</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fig</extension>
+        <mime-type>application/x-xfig</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>flac</extension>
+        <mime-type>audio/flac</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fli</extension>
+        <mime-type>video/x-fli</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>flo</extension>
+        <mime-type>application/vnd.micrografx.flo</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>flv</extension>
+        <mime-type>video/x-flv</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>flw</extension>
+        <mime-type>application/vnd.kde.kivio</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>flx</extension>
+        <mime-type>text/vnd.fmi.flexstor</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fly</extension>
+        <mime-type>text/vnd.fly</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fm</extension>
+        <mime-type>application/vnd.framemaker</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fnc</extension>
+        <mime-type>application/vnd.frogans.fnc</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>for</extension>
+        <mime-type>text/x-fortran</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fpx</extension>
+        <mime-type>image/vnd.fpx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>frame</extension>
+        <mime-type>application/vnd.framemaker</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fsc</extension>
+        <mime-type>application/vnd.fsc.weblaunch</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fst</extension>
+        <mime-type>image/vnd.fst</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ftc</extension>
+        <mime-type>application/vnd.fluxtime.clip</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fti</extension>
+        <mime-type>application/vnd.anser-web-funds-transfer-initiation</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fvt</extension>
+        <mime-type>video/vnd.fvt</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fxp</extension>
+        <mime-type>application/vnd.adobe.fxp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fxpl</extension>
+        <mime-type>application/vnd.adobe.fxp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fzs</extension>
+        <mime-type>application/vnd.fuzzysheet</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>g2w</extension>
+        <mime-type>application/vnd.geoplan</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>g3</extension>
+        <mime-type>image/g3fax</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>g3w</extension>
+        <mime-type>application/vnd.geospace</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gac</extension>
+        <mime-type>application/vnd.groove-account</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gam</extension>
+        <mime-type>application/x-tads</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gbr</extension>
+        <mime-type>application/rpki-ghostbusters</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gca</extension>
+        <mime-type>application/x-gca-compressed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gdl</extension>
+        <mime-type>model/vnd.gdl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>geo</extension>
+        <mime-type>application/vnd.dynageo</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gex</extension>
+        <mime-type>application/vnd.geometry-explorer</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ggb</extension>
+        <mime-type>application/vnd.geogebra.file</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ggt</extension>
+        <mime-type>application/vnd.geogebra.tool</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ghf</extension>
+        <mime-type>application/vnd.groove-help</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gif</extension>
+        <mime-type>image/gif</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gim</extension>
+        <mime-type>application/vnd.groove-identity-message</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gml</extension>
+        <mime-type>application/gml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gmx</extension>
+        <mime-type>application/vnd.gmx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gnumeric</extension>
+        <mime-type>application/x-gnumeric</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gph</extension>
+        <mime-type>application/vnd.flographit</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gpx</extension>
+        <mime-type>application/gpx+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gqf</extension>
+        <mime-type>application/vnd.grafeq</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gqs</extension>
+        <mime-type>application/vnd.grafeq</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gram</extension>
+        <mime-type>application/srgs</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gramps</extension>
+        <mime-type>application/x-gramps-xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gre</extension>
+        <mime-type>application/vnd.geometry-explorer</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>grv</extension>
+        <mime-type>application/vnd.groove-injector</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>grxml</extension>
+        <mime-type>application/srgs+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gsf</extension>
+        <mime-type>application/x-font-ghostscript</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gtar</extension>
+        <mime-type>application/x-gtar</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gtm</extension>
+        <mime-type>application/vnd.groove-tool-message</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gtw</extension>
+        <mime-type>model/vnd.gtw</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gv</extension>
+        <mime-type>text/vnd.graphviz</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gxf</extension>
+        <mime-type>application/gxf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gxt</extension>
+        <mime-type>application/vnd.geonext</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gz</extension>
+        <mime-type>application/x-gzip</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>h</extension>
+        <mime-type>text/x-c</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>h261</extension>
+        <mime-type>video/h261</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>h263</extension>
+        <mime-type>video/h263</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>h264</extension>
+        <mime-type>video/h264</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hal</extension>
+        <mime-type>application/vnd.hal+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hbci</extension>
+        <mime-type>application/vnd.hbci</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hdf</extension>
+        <mime-type>application/x-hdf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hh</extension>
+        <mime-type>text/x-c</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hlp</extension>
+        <mime-type>application/winhlp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hpgl</extension>
+        <mime-type>application/vnd.hp-hpgl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hpid</extension>
+        <mime-type>application/vnd.hp-hpid</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hps</extension>
+        <mime-type>application/vnd.hp-hps</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hqx</extension>
+        <mime-type>application/mac-binhex40</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>htc</extension>
+        <mime-type>text/x-component</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>htke</extension>
+        <mime-type>application/vnd.kenameaapp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>htm</extension>
+        <mime-type>text/html</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>html</extension>
+        <mime-type>text/html</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hvd</extension>
+        <mime-type>application/vnd.yamaha.hv-dic</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hvp</extension>
+        <mime-type>application/vnd.yamaha.hv-voice</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hvs</extension>
+        <mime-type>application/vnd.yamaha.hv-script</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>i2g</extension>
+        <mime-type>application/vnd.intergeo</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>icc</extension>
+        <mime-type>application/vnd.iccprofile</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ice</extension>
+        <mime-type>x-conference/x-cooltalk</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>icm</extension>
+        <mime-type>application/vnd.iccprofile</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ico</extension>
+        <mime-type>image/x-icon</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ics</extension>
+        <mime-type>text/calendar</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ief</extension>
+        <mime-type>image/ief</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ifb</extension>
+        <mime-type>text/calendar</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ifm</extension>
+        <mime-type>application/vnd.shana.informed.formdata</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>iges</extension>
+        <mime-type>model/iges</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>igl</extension>
+        <mime-type>application/vnd.igloader</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>igm</extension>
+        <mime-type>application/vnd.insors.igm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>igs</extension>
+        <mime-type>model/iges</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>igx</extension>
+        <mime-type>application/vnd.micrografx.igx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>iif</extension>
+        <mime-type>application/vnd.shana.informed.interchange</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>imp</extension>
+        <mime-type>application/vnd.accpac.simply.imp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ims</extension>
+        <mime-type>application/vnd.ms-ims</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>in</extension>
+        <mime-type>text/plain</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ink</extension>
+        <mime-type>application/inkml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>inkml</extension>
+        <mime-type>application/inkml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>install</extension>
+        <mime-type>application/x-install-instructions</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>iota</extension>
+        <mime-type>application/vnd.astraea-software.iota</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ipfix</extension>
+        <mime-type>application/ipfix</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ipk</extension>
+        <mime-type>application/vnd.shana.informed.package</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>irm</extension>
+        <mime-type>application/vnd.ibm.rights-management</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>irp</extension>
+        <mime-type>application/vnd.irepository.package+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>iso</extension>
+        <mime-type>application/x-iso9660-image</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>itp</extension>
+        <mime-type>application/vnd.shana.informed.formtemplate</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ivp</extension>
+        <mime-type>application/vnd.immervision-ivp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ivu</extension>
+        <mime-type>application/vnd.immervision-ivu</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jad</extension>
+        <mime-type>text/vnd.sun.j2me.app-descriptor</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jam</extension>
+        <mime-type>application/vnd.jam</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jar</extension>
+        <mime-type>application/java-archive</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>java</extension>
+        <mime-type>text/x-java-source</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jisp</extension>
+        <mime-type>application/vnd.jisp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jlt</extension>
+        <mime-type>application/vnd.hp-jlyt</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jnlp</extension>
+        <mime-type>application/x-java-jnlp-file</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>joda</extension>
+        <mime-type>application/vnd.joost.joda-archive</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jpe</extension>
+        <mime-type>image/jpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jpeg</extension>
+        <mime-type>image/jpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jpg</extension>
+        <mime-type>image/jpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jpgm</extension>
+        <mime-type>video/jpm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jpgv</extension>
+        <mime-type>video/jpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jpm</extension>
+        <mime-type>video/jpm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>js</extension>
+        <mime-type>application/javascript</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jsf</extension>
+        <mime-type>text/plain</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>json</extension>
+        <mime-type>application/json</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jsonml</extension>
+        <mime-type>application/jsonml+json</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jspf</extension>
+        <mime-type>text/plain</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kar</extension>
+        <mime-type>audio/midi</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>karbon</extension>
+        <mime-type>application/vnd.kde.karbon</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kfo</extension>
+        <mime-type>application/vnd.kde.kformula</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kia</extension>
+        <mime-type>application/vnd.kidspiration</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kml</extension>
+        <mime-type>application/vnd.google-earth.kml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kmz</extension>
+        <mime-type>application/vnd.google-earth.kmz</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kne</extension>
+        <mime-type>application/vnd.kinar</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>knp</extension>
+        <mime-type>application/vnd.kinar</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kon</extension>
+        <mime-type>application/vnd.kde.kontour</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kpr</extension>
+        <mime-type>application/vnd.kde.kpresenter</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kpt</extension>
+        <mime-type>application/vnd.kde.kpresenter</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kpxx</extension>
+        <mime-type>application/vnd.ds-keypoint</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ksp</extension>
+        <mime-type>application/vnd.kde.kspread</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ktr</extension>
+        <mime-type>application/vnd.kahootz</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ktx</extension>
+        <mime-type>image/ktx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ktz</extension>
+        <mime-type>application/vnd.kahootz</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kwd</extension>
+        <mime-type>application/vnd.kde.kword</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kwt</extension>
+        <mime-type>application/vnd.kde.kword</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lasxml</extension>
+        <mime-type>application/vnd.las.las+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>latex</extension>
+        <mime-type>application/x-latex</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lbd</extension>
+        <mime-type>application/vnd.llamagraphics.life-balance.desktop</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lbe</extension>
+        <mime-type>application/vnd.llamagraphics.life-balance.exchange+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>les</extension>
+        <mime-type>application/vnd.hhe.lesson-player</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lha</extension>
+        <mime-type>application/x-lzh-compressed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>link66</extension>
+        <mime-type>application/vnd.route66.link66+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>list</extension>
+        <mime-type>text/plain</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>list3820</extension>
+        <mime-type>application/vnd.ibm.modcap</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>listafp</extension>
+        <mime-type>application/vnd.ibm.modcap</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lnk</extension>
+        <mime-type>application/x-ms-shortcut</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>log</extension>
+        <mime-type>text/plain</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lostxml</extension>
+        <mime-type>application/lost+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lrf</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lrm</extension>
+        <mime-type>application/vnd.ms-lrm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ltf</extension>
+        <mime-type>application/vnd.frogans.ltf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lvp</extension>
+        <mime-type>audio/vnd.lucent.voice</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lwp</extension>
+        <mime-type>application/vnd.lotus-wordpro</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lzh</extension>
+        <mime-type>application/x-lzh-compressed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m13</extension>
+        <mime-type>application/x-msmediaview</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m14</extension>
+        <mime-type>application/x-msmediaview</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m1v</extension>
+        <mime-type>video/mpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m21</extension>
+        <mime-type>application/mp21</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m2a</extension>
+        <mime-type>audio/mpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m2v</extension>
+        <mime-type>video/mpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m3a</extension>
+        <mime-type>audio/mpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m3u</extension>
+        <mime-type>audio/x-mpegurl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m3u8</extension>
+        <mime-type>application/vnd.apple.mpegurl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m4a</extension>
+        <mime-type>audio/mp4</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m4b</extension>
+        <mime-type>audio/mp4</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m4r</extension>
+        <mime-type>audio/mp4</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m4u</extension>
+        <mime-type>video/vnd.mpegurl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m4v</extension>
+        <mime-type>video/mp4</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ma</extension>
+        <mime-type>application/mathematica</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mac</extension>
+        <mime-type>image/x-macpaint</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mads</extension>
+        <mime-type>application/mads+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mag</extension>
+        <mime-type>application/vnd.ecowin.chart</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>maker</extension>
+        <mime-type>application/vnd.framemaker</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>man</extension>
+        <mime-type>text/troff</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mar</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mathml</extension>
+        <mime-type>application/mathml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mb</extension>
+        <mime-type>application/mathematica</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mbk</extension>
+        <mime-type>application/vnd.mobius.mbk</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mbox</extension>
+        <mime-type>application/mbox</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mc1</extension>
+        <mime-type>application/vnd.medcalcdata</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mcd</extension>
+        <mime-type>application/vnd.mcd</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mcurl</extension>
+        <mime-type>text/vnd.curl.mcurl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mdb</extension>
+        <mime-type>application/x-msproxy</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mdi</extension>
+        <mime-type>image/vnd.ms-modi</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>me</extension>
+        <mime-type>text/troff</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mesh</extension>
+        <mime-type>model/mesh</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>meta4</extension>
+        <mime-type>application/metalink4+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>metalink</extension>
+        <mime-type>application/metalink+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mets</extension>
+        <mime-type>application/mets+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mfm</extension>
+        <mime-type>application/vnd.mfmp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mft</extension>
+        <mime-type>application/rpki-manifest</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mgp</extension>
+        <mime-type>application/vnd.osgeo.mapguide.package</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mgz</extension>
+        <mime-type>application/vnd.proteus.magazine</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mid</extension>
+        <mime-type>audio/midi</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>midi</extension>
+        <mime-type>audio/midi</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mie</extension>
+        <mime-type>application/x-mie</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mif</extension>
+        <mime-type>application/x-mif</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mime</extension>
+        <mime-type>message/rfc822</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mj2</extension>
+        <mime-type>video/mj2</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mjp2</extension>
+        <mime-type>video/mj2</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mk3d</extension>
+        <mime-type>video/x-matroska</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mka</extension>
+        <mime-type>audio/x-matroska</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mks</extension>
+        <mime-type>video/x-matroska</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mkv</extension>
+        <mime-type>video/x-matroska</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mlp</extension>
+        <mime-type>application/vnd.dolby.mlp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mmd</extension>
+        <mime-type>application/vnd.chipnuts.karaoke-mmd</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mmf</extension>
+        <mime-type>application/vnd.smaf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mmr</extension>
+        <mime-type>image/vnd.fujixerox.edmics-mmr</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mng</extension>
+        <mime-type>video/x-mng</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mny</extension>
+        <mime-type>application/x-msmoney</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mobi</extension>
+        <mime-type>application/x-mobipocket-ebook</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mods</extension>
+        <mime-type>application/mods+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mov</extension>
+        <mime-type>video/quicktime</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>movie</extension>
+        <mime-type>video/x-sgi-movie</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mp1</extension>
+        <mime-type>audio/mpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mp2</extension>
+        <mime-type>audio/mpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mp21</extension>
+        <mime-type>application/mp21</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mp2a</extension>
+        <mime-type>audio/mpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mp3</extension>
+        <mime-type>audio/mpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mp4</extension>
+        <mime-type>video/mp4</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mp4a</extension>
+        <mime-type>audio/mp4</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mp4s</extension>
+        <mime-type>application/mp4</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mp4v</extension>
+        <mime-type>video/mp4</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mpa</extension>
+        <mime-type>audio/mpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mpc</extension>
+        <mime-type>application/vnd.mophun.certificate</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mpe</extension>
+        <mime-type>video/mpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mpeg</extension>
+        <mime-type>video/mpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mpega</extension>
+        <mime-type>audio/x-mpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mpg</extension>
+        <mime-type>video/mpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mpg4</extension>
+        <mime-type>video/mp4</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mpga</extension>
+        <mime-type>audio/mpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mpkg</extension>
+        <mime-type>application/vnd.apple.installer+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mpm</extension>
+        <mime-type>application/vnd.blueice.multipass</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mpn</extension>
+        <mime-type>application/vnd.mophun.application</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mpp</extension>
+        <mime-type>application/vnd.ms-project</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mpt</extension>
+        <mime-type>application/vnd.ms-project</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mpv2</extension>
+        <mime-type>video/mpeg2</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mpy</extension>
+        <mime-type>application/vnd.ibm.minipay</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mqy</extension>
+        <mime-type>application/vnd.mobius.mqy</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mrc</extension>
+        <mime-type>application/marc</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mrcx</extension>
+        <mime-type>application/marcxml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ms</extension>
+        <mime-type>text/troff</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mscml</extension>
+        <mime-type>application/mediaservercontrol+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mseed</extension>
+        <mime-type>application/vnd.fdsn.mseed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mseq</extension>
+        <mime-type>application/vnd.mseq</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>msf</extension>
+        <mime-type>application/vnd.epson.msf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>msh</extension>
+        <mime-type>model/mesh</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>msi</extension>
+        <mime-type>application/x-msdownload</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>msl</extension>
+        <mime-type>application/vnd.mobius.msl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>msty</extension>
+        <mime-type>application/vnd.muvee.style</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mts</extension>
+        <mime-type>model/vnd.mts</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mus</extension>
+        <mime-type>application/vnd.musician</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>musicxml</extension>
+        <mime-type>application/vnd.recordare.musicxml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mvb</extension>
+        <mime-type>application/x-msmediaview</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mwf</extension>
+        <mime-type>application/vnd.mfer</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mxf</extension>
+        <mime-type>application/mxf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mxl</extension>
+        <mime-type>application/vnd.recordare.musicxml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mxml</extension>
+        <mime-type>application/xv+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mxs</extension>
+        <mime-type>application/vnd.triscape.mxs</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mxu</extension>
+        <mime-type>video/vnd.mpegurl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>n-gage</extension>
+        <mime-type>application/vnd.nokia.n-gage.symbian.install</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>n3</extension>
+        <mime-type>text/n3</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>nb</extension>
+        <mime-type>application/mathematica</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>nbp</extension>
+        <mime-type>application/vnd.wolfram.player</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>nc</extension>
+        <mime-type>application/x-netcdf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ncx</extension>
+        <mime-type>application/x-dtbncx+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>nfo</extension>
+        <mime-type>text/x-nfo</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ngdat</extension>
+        <mime-type>application/vnd.nokia.n-gage.data</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>nitf</extension>
+        <mime-type>application/vnd.nitf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>nlu</extension>
+        <mime-type>application/vnd.neurolanguage.nlu</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>nml</extension>
+        <mime-type>application/vnd.enliven</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>nnd</extension>
+        <mime-type>application/vnd.noblenet-directory</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>nns</extension>
+        <mime-type>application/vnd.noblenet-sealer</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>nnw</extension>
+        <mime-type>application/vnd.noblenet-web</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>npx</extension>
+        <mime-type>image/vnd.net-fpx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>nsc</extension>
+        <mime-type>application/x-conference</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>nsf</extension>
+        <mime-type>application/vnd.lotus-notes</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ntf</extension>
+        <mime-type>application/vnd.nitf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>nzb</extension>
+        <mime-type>application/x-nzb</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>oa2</extension>
+        <mime-type>application/vnd.fujitsu.oasys2</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>oa3</extension>
+        <mime-type>application/vnd.fujitsu.oasys3</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>oas</extension>
+        <mime-type>application/vnd.fujitsu.oasys</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>obd</extension>
+        <mime-type>application/x-msbinder</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>obj</extension>
+        <mime-type>application/x-tgif</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>oda</extension>
+        <mime-type>application/oda</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <!-- OpenDocument Database -->
+        <extension>odb</extension>
+        <mime-type>application/vnd.oasis.opendocument.database</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <!-- OpenDocument Chart -->
+        <extension>odc</extension>
+        <mime-type>application/vnd.oasis.opendocument.chart</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <!-- OpenDocument Formula -->
+        <extension>odf</extension>
+        <mime-type>application/vnd.oasis.opendocument.formula</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>odft</extension>
+        <mime-type>application/vnd.oasis.opendocument.formula-template</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <!-- OpenDocument Drawing -->
+        <extension>odg</extension>
+        <mime-type>application/vnd.oasis.opendocument.graphics</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <!-- OpenDocument Image -->
+        <extension>odi</extension>
+        <mime-type>application/vnd.oasis.opendocument.image</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <!-- OpenDocument Master Document -->
+        <extension>odm</extension>
+        <mime-type>application/vnd.oasis.opendocument.text-master</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <!-- OpenDocument Presentation -->
+        <extension>odp</extension>
+        <mime-type>application/vnd.oasis.opendocument.presentation</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <!-- OpenDocument Spreadsheet -->
+        <extension>ods</extension>
+        <mime-type>application/vnd.oasis.opendocument.spreadsheet</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <!-- OpenDocument Text -->
+        <extension>odt</extension>
+        <mime-type>application/vnd.oasis.opendocument.text</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>oga</extension>
+        <mime-type>audio/ogg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ogg</extension>
+        <mime-type>audio/ogg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ogv</extension>
+        <mime-type>video/ogg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <!-- xiph mime types -->
+        <extension>ogx</extension>
+        <mime-type>application/ogg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>omdoc</extension>
+        <mime-type>application/omdoc+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>onepkg</extension>
+        <mime-type>application/onenote</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>onetmp</extension>
+        <mime-type>application/onenote</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>onetoc</extension>
+        <mime-type>application/onenote</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>onetoc2</extension>
+        <mime-type>application/onenote</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>opf</extension>
+        <mime-type>application/oebps-package+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>opml</extension>
+        <mime-type>text/x-opml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>oprc</extension>
+        <mime-type>application/vnd.palm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>org</extension>
+        <mime-type>application/vnd.lotus-organizer</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>osf</extension>
+        <mime-type>application/vnd.yamaha.openscoreformat</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>osfpvg</extension>
+        <mime-type>application/vnd.yamaha.openscoreformat.osfpvg+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>otc</extension>
+        <mime-type>application/vnd.oasis.opendocument.chart-template</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>otf</extension>
+        <mime-type>application/x-font-otf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <!-- OpenDocument Drawing Template -->
+        <extension>otg</extension>
+        <mime-type>application/vnd.oasis.opendocument.graphics-template</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <!-- HTML Document Template -->
+        <extension>oth</extension>
+        <mime-type>application/vnd.oasis.opendocument.text-web</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>oti</extension>
+        <mime-type>application/vnd.oasis.opendocument.image-template</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <!-- OpenDocument Presentation Template -->
+        <extension>otp</extension>
+        <mime-type>application/vnd.oasis.opendocument.presentation-template</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <!-- OpenDocument Spreadsheet Template -->
+        <extension>ots</extension>
+        <mime-type>application/vnd.oasis.opendocument.spreadsheet-template</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <!-- OpenDocument Text Template -->
+        <extension>ott</extension>
+        <mime-type>application/vnd.oasis.opendocument.text-template</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>oxps</extension>
+        <mime-type>application/oxps</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>oxt</extension>
+        <mime-type>application/vnd.openofficeorg.extension</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>p</extension>
+        <mime-type>text/x-pascal</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>p10</extension>
+        <mime-type>application/pkcs10</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>p12</extension>
+        <mime-type>application/x-pkcs12</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>p7b</extension>
+        <mime-type>application/x-pkcs7-certificates</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>p7c</extension>
+        <mime-type>application/pkcs7-mime</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>p7m</extension>
+        <mime-type>application/pkcs7-mime</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>p7r</extension>
+        <mime-type>application/x-pkcs7-certreqresp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>p7s</extension>
+        <mime-type>application/pkcs7-signature</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>p8</extension>
+        <mime-type>application/pkcs8</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pas</extension>
+        <mime-type>text/x-pascal</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>paw</extension>
+        <mime-type>application/vnd.pawaafile</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pbd</extension>
+        <mime-type>application/vnd.powerbuilder6</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pbm</extension>
+        <mime-type>image/x-portable-bitmap</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pcap</extension>
+        <mime-type>application/vnd.tcpdump.pcap</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pcf</extension>
+        <mime-type>application/x-font-pcf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pcl</extension>
+        <mime-type>application/vnd.hp-pcl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pclxl</extension>
+        <mime-type>application/vnd.hp-pclxl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pct</extension>
+        <mime-type>image/pict</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pcurl</extension>
+        <mime-type>application/vnd.curl.pcurl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pcx</extension>
+        <mime-type>image/x-pcx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pdb</extension>
+        <mime-type>application/vnd.palm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pdf</extension>
+        <mime-type>application/pdf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pfa</extension>
+        <mime-type>application/x-font-type1</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pfb</extension>
+        <mime-type>application/x-font-type1</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pfm</extension>
+        <mime-type>application/x-font-type1</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pfr</extension>
+        <mime-type>application/font-tdpfr</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pfx</extension>
+        <mime-type>application/x-pkcs12</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pgm</extension>
+        <mime-type>image/x-portable-graymap</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pgn</extension>
+        <mime-type>application/x-chess-pgn</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pgp</extension>
+        <mime-type>application/pgp-encrypted</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pic</extension>
+        <mime-type>image/pict</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pict</extension>
+        <mime-type>image/pict</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pkg</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pki</extension>
+        <mime-type>application/pkixcmp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pkipath</extension>
+        <mime-type>application/pkix-pkipath</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>plb</extension>
+        <mime-type>application/vnd.3gpp.pic-bw-large</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>plc</extension>
+        <mime-type>application/vnd.mobius.plc</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>plf</extension>
+        <mime-type>application/vnd.pocketlearn</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pls</extension>
+        <mime-type>audio/x-scpls</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pml</extension>
+        <mime-type>application/vnd.ctc-posml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>png</extension>
+        <mime-type>image/png</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pnm</extension>
+        <mime-type>image/x-portable-anymap</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pnt</extension>
+        <mime-type>image/x-macpaint</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>portpkg</extension>
+        <mime-type>application/vnd.macports.portpkg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pot</extension>
+        <mime-type>application/vnd.ms-powerpoint</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>potm</extension>
+        <mime-type>application/vnd.ms-powerpoint.template.macroenabled.12</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>potx</extension>
+        <mime-type>application/vnd.openxmlformats-officedocument.presentationml.template</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ppam</extension>
+        <mime-type>application/vnd.ms-powerpoint.addin.macroenabled.12</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ppd</extension>
+        <mime-type>application/vnd.cups-ppd</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ppm</extension>
+        <mime-type>image/x-portable-pixmap</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pps</extension>
+        <mime-type>application/vnd.ms-powerpoint</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ppsm</extension>
+        <mime-type>application/vnd.ms-powerpoint.slideshow.macroenabled.12</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ppsx</extension>
+        <mime-type>application/vnd.openxmlformats-officedocument.presentationml.slideshow</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ppt</extension>
+        <mime-type>application/vnd.ms-powerpoint</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pptm</extension>
+        <mime-type>application/vnd.ms-powerpoint.presentation.macroenabled.12</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pptx</extension>
+        <mime-type>application/vnd.openxmlformats-officedocument.presentationml.presentation</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pqa</extension>
+        <mime-type>application/vnd.palm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>prc</extension>
+        <mime-type>application/x-mobipocket-ebook</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pre</extension>
+        <mime-type>application/vnd.lotus-freelance</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>prf</extension>
+        <mime-type>application/pics-rules</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ps</extension>
+        <mime-type>application/postscript</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>psb</extension>
+        <mime-type>application/vnd.3gpp.pic-bw-small</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>psd</extension>
+        <mime-type>image/vnd.adobe.photoshop</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>psf</extension>
+        <mime-type>application/x-font-linux-psf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pskcxml</extension>
+        <mime-type>application/pskc+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ptid</extension>
+        <mime-type>application/vnd.pvi.ptid1</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pub</extension>
+        <mime-type>application/x-mspublisher</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pvb</extension>
+        <mime-type>application/vnd.3gpp.pic-bw-var</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pwn</extension>
+        <mime-type>application/vnd.3m.post-it-notes</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pya</extension>
+        <mime-type>audio/vnd.ms-playready.media.pya</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>pyv</extension>
+        <mime-type>video/vnd.ms-playready.media.pyv</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>qam</extension>
+        <mime-type>application/vnd.epson.quickanime</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>qbo</extension>
+        <mime-type>application/vnd.intu.qbo</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>qfx</extension>
+        <mime-type>application/vnd.intu.qfx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>qps</extension>
+        <mime-type>application/vnd.publishare-delta-tree</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>qt</extension>
+        <mime-type>video/quicktime</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>qti</extension>
+        <mime-type>image/x-quicktime</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>qtif</extension>
+        <mime-type>image/x-quicktime</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>qwd</extension>
+        <mime-type>application/vnd.quark.quarkxpress</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>qwt</extension>
+        <mime-type>application/vnd.quark.quarkxpress</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>qxb</extension>
+        <mime-type>application/vnd.quark.quarkxpress</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>qxd</extension>
+        <mime-type>application/vnd.quark.quarkxpress</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>qxl</extension>
+        <mime-type>application/vnd.quark.quarkxpress</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>qxt</extension>
+        <mime-type>application/vnd.quark.quarkxpress</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ra</extension>
+        <mime-type>audio/x-pn-realaudio</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ram</extension>
+        <mime-type>audio/x-pn-realaudio</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rar</extension>
+        <mime-type>application/x-rar-compressed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ras</extension>
+        <mime-type>image/x-cmu-raster</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rcprofile</extension>
+        <mime-type>application/vnd.ipunplugged.rcprofile</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rdf</extension>
+        <mime-type>application/rdf+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rdz</extension>
+        <mime-type>application/vnd.data-vision.rdz</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rep</extension>
+        <mime-type>application/vnd.businessobjects</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>res</extension>
+        <mime-type>application/x-dtbresource+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rgb</extension>
+        <mime-type>image/x-rgb</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rif</extension>
+        <mime-type>application/reginfo+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rip</extension>
+        <mime-type>audio/vnd.rip</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ris</extension>
+        <mime-type>application/x-research-info-systems</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rl</extension>
+        <mime-type>application/resource-lists+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rlc</extension>
+        <mime-type>image/vnd.fujixerox.edmics-rlc</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rld</extension>
+        <mime-type>application/resource-lists-diff+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rm</extension>
+        <mime-type>application/vnd.rn-realmedia</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rmi</extension>
+        <mime-type>audio/midi</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rmp</extension>
+        <mime-type>audio/x-pn-realaudio-plugin</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rms</extension>
+        <mime-type>application/vnd.jcp.javame.midlet-rms</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rmvb</extension>
+        <mime-type>application/vnd.rn-realmedia-vbr</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rnc</extension>
+        <mime-type>application/relax-ng-compact-syntax</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>roa</extension>
+        <mime-type>application/rpki-roa</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>roff</extension>
+        <mime-type>text/troff</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rp9</extension>
+        <mime-type>application/vnd.cloanto.rp9</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rpss</extension>
+        <mime-type>application/vnd.nokia.radio-presets</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rpst</extension>
+        <mime-type>application/vnd.nokia.radio-preset</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rq</extension>
+        <mime-type>application/sparql-query</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rs</extension>
+        <mime-type>application/rls-services+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rsd</extension>
+        <mime-type>application/rsd+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rss</extension>
+        <mime-type>application/rss+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rtf</extension>
+        <mime-type>application/rtf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>rtx</extension>
+        <mime-type>text/richtext</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>s</extension>
+        <mime-type>text/x-asm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>s3m</extension>
+        <mime-type>audio/s3m</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>saf</extension>
+        <mime-type>application/vnd.yamaha.smaf-audio</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sbml</extension>
+        <mime-type>application/sbml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sc</extension>
+        <mime-type>application/vnd.ibm.secure-container</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>scd</extension>
+        <mime-type>application/x-msschedule</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>scm</extension>
+        <mime-type>application/vnd.lotus-screencam</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>scq</extension>
+        <mime-type>application/scvp-cv-request</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>scs</extension>
+        <mime-type>application/scvp-cv-response</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>scurl</extension>
+        <mime-type>text/vnd.curl.scurl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sda</extension>
+        <mime-type>application/vnd.stardivision.draw</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sdc</extension>
+        <mime-type>application/vnd.stardivision.calc</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sdd</extension>
+        <mime-type>application/vnd.stardivision.impress</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sdkd</extension>
+        <mime-type>application/vnd.solent.sdkm+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sdkm</extension>
+        <mime-type>application/vnd.solent.sdkm+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sdp</extension>
+        <mime-type>application/sdp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sdw</extension>
+        <mime-type>application/vnd.stardivision.writer</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>see</extension>
+        <mime-type>application/vnd.seemail</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>seed</extension>
+        <mime-type>application/vnd.fdsn.seed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sema</extension>
+        <mime-type>application/vnd.sema</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>semd</extension>
+        <mime-type>application/vnd.semd</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>semf</extension>
+        <mime-type>application/vnd.semf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ser</extension>
+        <mime-type>application/java-serialized-object</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>setpay</extension>
+        <mime-type>application/set-payment-initiation</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>setreg</extension>
+        <mime-type>application/set-registration-initiation</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sfd-hdstx</extension>
+        <mime-type>application/vnd.hydrostatix.sof-data</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sfs</extension>
+        <mime-type>application/vnd.spotfire.sfs</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sfv</extension>
+        <mime-type>text/x-sfv</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sgi</extension>
+        <mime-type>image/sgi</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sgl</extension>
+        <mime-type>application/vnd.stardivision.writer-global</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sgm</extension>
+        <mime-type>text/sgml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sgml</extension>
+        <mime-type>text/sgml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sh</extension>
+        <mime-type>application/x-sh</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>shar</extension>
+        <mime-type>application/x-shar</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>shf</extension>
+        <mime-type>application/shf+xml</mime-type>
+    </mime-mapping>
+    <!--
+    <mime-mapping>
+        <extension>shtml</extension>
+        <mime-type>text/x-server-parsed-html</mime-type>
+    </mime-mapping>
+    -->
+    <mime-mapping>
+        <extension>sid</extension>
+        <mime-type>image/x-mrsid-image</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sig</extension>
+        <mime-type>application/pgp-signature</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sil</extension>
+        <mime-type>audio/silk</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>silo</extension>
+        <mime-type>model/mesh</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sis</extension>
+        <mime-type>application/vnd.symbian.install</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sisx</extension>
+        <mime-type>application/vnd.symbian.install</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sit</extension>
+        <mime-type>application/x-stuffit</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sitx</extension>
+        <mime-type>application/x-stuffitx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>skd</extension>
+        <mime-type>application/vnd.koan</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>skm</extension>
+        <mime-type>application/vnd.koan</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>skp</extension>
+        <mime-type>application/vnd.koan</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>skt</extension>
+        <mime-type>application/vnd.koan</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sldm</extension>
+        <mime-type>application/vnd.ms-powerpoint.slide.macroenabled.12</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sldx</extension>
+        <mime-type>application/vnd.openxmlformats-officedocument.presentationml.slide</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>slt</extension>
+        <mime-type>application/vnd.epson.salt</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sm</extension>
+        <mime-type>application/vnd.stepmania.stepchart</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>smf</extension>
+        <mime-type>application/vnd.stardivision.math</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>smi</extension>
+        <mime-type>application/smil+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>smil</extension>
+        <mime-type>application/smil+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>smv</extension>
+        <mime-type>video/x-smv</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>smzip</extension>
+        <mime-type>application/vnd.stepmania.package</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>snd</extension>
+        <mime-type>audio/basic</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>snf</extension>
+        <mime-type>application/x-font-snf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>so</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>spc</extension>
+        <mime-type>application/x-pkcs7-certificates</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>spf</extension>
+        <mime-type>application/vnd.yamaha.smaf-phrase</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>spl</extension>
+        <mime-type>application/x-futuresplash</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>spot</extension>
+        <mime-type>text/vnd.in3d.spot</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>spp</extension>
+        <mime-type>application/scvp-vp-response</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>spq</extension>
+        <mime-type>application/scvp-vp-request</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>spx</extension>
+        <mime-type>audio/ogg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sql</extension>
+        <mime-type>application/x-sql</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>src</extension>
+        <mime-type>application/x-wais-source</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>srt</extension>
+        <mime-type>application/x-subrip</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sru</extension>
+        <mime-type>application/sru+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>srx</extension>
+        <mime-type>application/sparql-results+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ssdl</extension>
+        <mime-type>application/ssdl+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sse</extension>
+        <mime-type>application/vnd.kodak-descriptor</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ssf</extension>
+        <mime-type>application/vnd.epson.ssf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ssml</extension>
+        <mime-type>application/ssml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>st</extension>
+        <mime-type>application/vnd.sailingtracker.track</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>stc</extension>
+        <mime-type>application/vnd.sun.xml.calc.template</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>std</extension>
+        <mime-type>application/vnd.sun.xml.draw.template</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>stf</extension>
+        <mime-type>application/vnd.wt.stf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sti</extension>
+        <mime-type>application/vnd.sun.xml.impress.template</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>stk</extension>
+        <mime-type>application/hyperstudio</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>stl</extension>
+        <mime-type>application/vnd.ms-pki.stl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>str</extension>
+        <mime-type>application/vnd.pg.format</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>stw</extension>
+        <mime-type>application/vnd.sun.xml.writer.template</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sub</extension>
+        <mime-type>text/vnd.dvb.subtitle</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sus</extension>
+        <mime-type>application/vnd.sus-calendar</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>susp</extension>
+        <mime-type>application/vnd.sus-calendar</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sv4cpio</extension>
+        <mime-type>application/x-sv4cpio</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sv4crc</extension>
+        <mime-type>application/x-sv4crc</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>svc</extension>
+        <mime-type>application/vnd.dvb.service</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>svd</extension>
+        <mime-type>application/vnd.svd</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>svg</extension>
+        <mime-type>image/svg+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>svgz</extension>
+        <mime-type>image/svg+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>swa</extension>
+        <mime-type>application/x-director</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>swf</extension>
+        <mime-type>application/x-shockwave-flash</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>swi</extension>
+        <mime-type>application/vnd.aristanetworks.swi</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sxc</extension>
+        <mime-type>application/vnd.sun.xml.calc</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sxd</extension>
+        <mime-type>application/vnd.sun.xml.draw</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sxg</extension>
+        <mime-type>application/vnd.sun.xml.writer.global</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sxi</extension>
+        <mime-type>application/vnd.sun.xml.impress</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sxm</extension>
+        <mime-type>application/vnd.sun.xml.math</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>sxw</extension>
+        <mime-type>application/vnd.sun.xml.writer</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>t</extension>
+        <mime-type>text/troff</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>t3</extension>
+        <mime-type>application/x-t3vm-image</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>taglet</extension>
+        <mime-type>application/vnd.mynfc</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>tao</extension>
+        <mime-type>application/vnd.tao.intent-module-archive</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>tar</extension>
+        <mime-type>application/x-tar</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>tcap</extension>
+        <mime-type>application/vnd.3gpp2.tcap</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>tcl</extension>
+        <mime-type>application/x-tcl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>teacher</extension>
+        <mime-type>application/vnd.smart.teacher</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>tei</extension>
+        <mime-type>application/tei+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>teicorpus</extension>
+        <mime-type>application/tei+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>tex</extension>
+        <mime-type>application/x-tex</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>texi</extension>
+        <mime-type>application/x-texinfo</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>texinfo</extension>
+        <mime-type>application/x-texinfo</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>text</extension>
+        <mime-type>text/plain</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>tfi</extension>
+        <mime-type>application/thraud+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>tfm</extension>
+        <mime-type>application/x-tex-tfm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>tga</extension>
+        <mime-type>image/x-tga</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>thmx</extension>
+        <mime-type>application/vnd.ms-officetheme</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>tif</extension>
+        <mime-type>image/tiff</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>tiff</extension>
+        <mime-type>image/tiff</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>tmo</extension>
+        <mime-type>application/vnd.tmobile-livetv</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>torrent</extension>
+        <mime-type>application/x-bittorrent</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>tpl</extension>
+        <mime-type>application/vnd.groove-tool-template</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>tpt</extension>
+        <mime-type>application/vnd.trid.tpt</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>tr</extension>
+        <mime-type>text/troff</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>tra</extension>
+        <mime-type>application/vnd.trueapp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>trm</extension>
+        <mime-type>application/x-msterminal</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>tsd</extension>
+        <mime-type>application/timestamped-data</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>tsv</extension>
+        <mime-type>text/tab-separated-values</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ttc</extension>
+        <mime-type>application/x-font-ttf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ttf</extension>
+        <mime-type>application/x-font-ttf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ttl</extension>
+        <mime-type>text/turtle</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>twd</extension>
+        <mime-type>application/vnd.simtech-mindmapper</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>twds</extension>
+        <mime-type>application/vnd.simtech-mindmapper</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>txd</extension>
+        <mime-type>application/vnd.genomatix.tuxedo</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>txf</extension>
+        <mime-type>application/vnd.mobius.txf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>txt</extension>
+        <mime-type>text/plain</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>u32</extension>
+        <mime-type>application/x-authorware-bin</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>udeb</extension>
+        <mime-type>application/x-debian-package</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ufd</extension>
+        <mime-type>application/vnd.ufdl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ufdl</extension>
+        <mime-type>application/vnd.ufdl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ulw</extension>
+        <mime-type>audio/basic</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ulx</extension>
+        <mime-type>application/x-glulx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>umj</extension>
+        <mime-type>application/vnd.umajin</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>unityweb</extension>
+        <mime-type>application/vnd.unity</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uoml</extension>
+        <mime-type>application/vnd.uoml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uri</extension>
+        <mime-type>text/uri-list</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uris</extension>
+        <mime-type>text/uri-list</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>urls</extension>
+        <mime-type>text/uri-list</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ustar</extension>
+        <mime-type>application/x-ustar</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>utz</extension>
+        <mime-type>application/vnd.uiq.theme</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uu</extension>
+        <mime-type>text/x-uuencode</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uva</extension>
+        <mime-type>audio/vnd.dece.audio</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvd</extension>
+        <mime-type>application/vnd.dece.data</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvf</extension>
+        <mime-type>application/vnd.dece.data</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvg</extension>
+        <mime-type>image/vnd.dece.graphic</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvh</extension>
+        <mime-type>video/vnd.dece.hd</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvi</extension>
+        <mime-type>image/vnd.dece.graphic</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvm</extension>
+        <mime-type>video/vnd.dece.mobile</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvp</extension>
+        <mime-type>video/vnd.dece.pd</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvs</extension>
+        <mime-type>video/vnd.dece.sd</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvt</extension>
+        <mime-type>application/vnd.dece.ttml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvu</extension>
+        <mime-type>video/vnd.uvvu.mp4</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvv</extension>
+        <mime-type>video/vnd.dece.video</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvva</extension>
+        <mime-type>audio/vnd.dece.audio</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvvd</extension>
+        <mime-type>application/vnd.dece.data</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvvf</extension>
+        <mime-type>application/vnd.dece.data</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvvg</extension>
+        <mime-type>image/vnd.dece.graphic</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvvh</extension>
+        <mime-type>video/vnd.dece.hd</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvvi</extension>
+        <mime-type>image/vnd.dece.graphic</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvvm</extension>
+        <mime-type>video/vnd.dece.mobile</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvvp</extension>
+        <mime-type>video/vnd.dece.pd</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvvs</extension>
+        <mime-type>video/vnd.dece.sd</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvvt</extension>
+        <mime-type>application/vnd.dece.ttml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvvu</extension>
+        <mime-type>video/vnd.uvvu.mp4</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvvv</extension>
+        <mime-type>video/vnd.dece.video</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvvx</extension>
+        <mime-type>application/vnd.dece.unspecified</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvvz</extension>
+        <mime-type>application/vnd.dece.zip</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvx</extension>
+        <mime-type>application/vnd.dece.unspecified</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>uvz</extension>
+        <mime-type>application/vnd.dece.zip</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>vcard</extension>
+        <mime-type>text/vcard</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>vcd</extension>
+        <mime-type>application/x-cdlink</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>vcf</extension>
+        <mime-type>text/x-vcard</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>vcg</extension>
+        <mime-type>application/vnd.groove-vcard</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>vcs</extension>
+        <mime-type>text/x-vcalendar</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>vcx</extension>
+        <mime-type>application/vnd.vcx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>vis</extension>
+        <mime-type>application/vnd.visionary</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>viv</extension>
+        <mime-type>video/vnd.vivo</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>vob</extension>
+        <mime-type>video/x-ms-vob</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>vor</extension>
+        <mime-type>application/vnd.stardivision.writer</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>vox</extension>
+        <mime-type>application/x-authorware-bin</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>vrml</extension>
+        <mime-type>model/vrml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>vsd</extension>
+        <mime-type>application/vnd.visio</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>vsf</extension>
+        <mime-type>application/vnd.vsf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>vss</extension>
+        <mime-type>application/vnd.visio</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>vst</extension>
+        <mime-type>application/vnd.visio</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>vsw</extension>
+        <mime-type>application/vnd.visio</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>vtu</extension>
+        <mime-type>model/vnd.vtu</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>vxml</extension>
+        <mime-type>application/voicexml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>w3d</extension>
+        <mime-type>application/x-director</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wad</extension>
+        <mime-type>application/x-doom</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wav</extension>
+        <mime-type>audio/x-wav</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wax</extension>
+        <mime-type>audio/x-ms-wax</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <!-- Wireless Bitmap -->
+        <extension>wbmp</extension>
+        <mime-type>image/vnd.wap.wbmp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wbs</extension>
+        <mime-type>application/vnd.criticaltools.wbs+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wbxml</extension>
+        <mime-type>application/vnd.wap.wbxml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wcm</extension>
+        <mime-type>application/vnd.ms-works</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wdb</extension>
+        <mime-type>application/vnd.ms-works</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wdp</extension>
+        <mime-type>image/vnd.ms-photo</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>weba</extension>
+        <mime-type>audio/webm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>webm</extension>
+        <mime-type>video/webm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>webp</extension>
+        <mime-type>image/webp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wg</extension>
+        <mime-type>application/vnd.pmi.widget</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wgt</extension>
+        <mime-type>application/widget</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wks</extension>
+        <mime-type>application/vnd.ms-works</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wm</extension>
+        <mime-type>video/x-ms-wm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wma</extension>
+        <mime-type>audio/x-ms-wma</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wmd</extension>
+        <mime-type>application/x-ms-wmd</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wmf</extension>
+        <mime-type>application/x-msmetafile</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <!-- WML Source -->
+        <extension>wml</extension>
+        <mime-type>text/vnd.wap.wml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <!-- Compiled WML -->
+        <extension>wmlc</extension>
+        <mime-type>application/vnd.wap.wmlc</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <!-- WML Script Source -->
+        <extension>wmls</extension>
+        <mime-type>text/vnd.wap.wmlscript</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <!-- Compiled WML Script -->
+        <extension>wmlsc</extension>
+        <mime-type>application/vnd.wap.wmlscriptc</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wmv</extension>
+        <mime-type>video/x-ms-wmv</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wmx</extension>
+        <mime-type>video/x-ms-wmx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wmz</extension>
+        <mime-type>application/x-msmetafile</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>woff</extension>
+        <mime-type>application/x-font-woff</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wpd</extension>
+        <mime-type>application/vnd.wordperfect</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wpl</extension>
+        <mime-type>application/vnd.ms-wpl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wps</extension>
+        <mime-type>application/vnd.ms-works</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wqd</extension>
+        <mime-type>application/vnd.wqd</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wri</extension>
+        <mime-type>application/x-mswrite</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wrl</extension>
+        <mime-type>model/vrml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wsdl</extension>
+        <mime-type>application/wsdl+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wspolicy</extension>
+        <mime-type>application/wspolicy+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wtb</extension>
+        <mime-type>application/vnd.webturbo</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>wvx</extension>
+        <mime-type>video/x-ms-wvx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>x32</extension>
+        <mime-type>application/x-authorware-bin</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>x3d</extension>
+        <mime-type>model/x3d+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>x3db</extension>
+        <mime-type>model/x3d+binary</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>x3dbz</extension>
+        <mime-type>model/x3d+binary</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>x3dv</extension>
+        <mime-type>model/x3d+vrml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>x3dvz</extension>
+        <mime-type>model/x3d+vrml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>x3dz</extension>
+        <mime-type>model/x3d+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xaml</extension>
+        <mime-type>application/xaml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xap</extension>
+        <mime-type>application/x-silverlight-app</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xar</extension>
+        <mime-type>application/vnd.xara</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xbap</extension>
+        <mime-type>application/x-ms-xbap</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xbd</extension>
+        <mime-type>application/vnd.fujixerox.docuworks.binder</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xbm</extension>
+        <mime-type>image/x-xbitmap</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xdf</extension>
+        <mime-type>application/xcap-diff+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xdm</extension>
+        <mime-type>application/vnd.syncml.dm+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xdp</extension>
+        <mime-type>application/vnd.adobe.xdp+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xdssc</extension>
+        <mime-type>application/dssc+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xdw</extension>
+        <mime-type>application/vnd.fujixerox.docuworks</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xenc</extension>
+        <mime-type>application/xenc+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xer</extension>
+        <mime-type>application/patch-ops-error+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xfdf</extension>
+        <mime-type>application/vnd.adobe.xfdf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xfdl</extension>
+        <mime-type>application/vnd.xfdl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xht</extension>
+        <mime-type>application/xhtml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xhtml</extension>
+        <mime-type>application/xhtml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xhvml</extension>
+        <mime-type>application/xv+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xif</extension>
+        <mime-type>image/vnd.xiff</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xla</extension>
+        <mime-type>application/vnd.ms-excel</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xlam</extension>
+        <mime-type>application/vnd.ms-excel.addin.macroenabled.12</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xlc</extension>
+        <mime-type>application/vnd.ms-excel</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xlf</extension>
+        <mime-type>application/x-xliff+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xlm</extension>
+        <mime-type>application/vnd.ms-excel</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xls</extension>
+        <mime-type>application/vnd.ms-excel</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xlsb</extension>
+        <mime-type>application/vnd.ms-excel.sheet.binary.macroenabled.12</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xlsm</extension>
+        <mime-type>application/vnd.ms-excel.sheet.macroenabled.12</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xlsx</extension>
+        <mime-type>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xlt</extension>
+        <mime-type>application/vnd.ms-excel</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xltm</extension>
+        <mime-type>application/vnd.ms-excel.template.macroenabled.12</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xltx</extension>
+        <mime-type>application/vnd.openxmlformats-officedocument.spreadsheetml.template</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xlw</extension>
+        <mime-type>application/vnd.ms-excel</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xm</extension>
+        <mime-type>audio/xm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xml</extension>
+        <mime-type>application/xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xo</extension>
+        <mime-type>application/vnd.olpc-sugar</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xop</extension>
+        <mime-type>application/xop+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xpi</extension>
+        <mime-type>application/x-xpinstall</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xpl</extension>
+        <mime-type>application/xproc+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xpm</extension>
+        <mime-type>image/x-xpixmap</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xpr</extension>
+        <mime-type>application/vnd.is-xpr</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xps</extension>
+        <mime-type>application/vnd.ms-xpsdocument</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xpw</extension>
+        <mime-type>application/vnd.intercon.formnet</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xpx</extension>
+        <mime-type>application/vnd.intercon.formnet</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xsl</extension>
+        <mime-type>application/xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xslt</extension>
+        <mime-type>application/xslt+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xsm</extension>
+        <mime-type>application/vnd.syncml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xspf</extension>
+        <mime-type>application/xspf+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xul</extension>
+        <mime-type>application/vnd.mozilla.xul+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xvm</extension>
+        <mime-type>application/xv+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xvml</extension>
+        <mime-type>application/xv+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xwd</extension>
+        <mime-type>image/x-xwindowdump</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xyz</extension>
+        <mime-type>chemical/x-xyz</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>xz</extension>
+        <mime-type>application/x-xz</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>yang</extension>
+        <mime-type>application/yang</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>yin</extension>
+        <mime-type>application/yin+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>z</extension>
+        <mime-type>application/x-compress</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>Z</extension>
+        <mime-type>application/x-compress</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>z1</extension>
+        <mime-type>application/x-zmachine</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>z2</extension>
+        <mime-type>application/x-zmachine</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>z3</extension>
+        <mime-type>application/x-zmachine</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>z4</extension>
+        <mime-type>application/x-zmachine</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>z5</extension>
+        <mime-type>application/x-zmachine</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>z6</extension>
+        <mime-type>application/x-zmachine</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>z7</extension>
+        <mime-type>application/x-zmachine</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>z8</extension>
+        <mime-type>application/x-zmachine</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>zaz</extension>
+        <mime-type>application/vnd.zzazz.deck+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>zip</extension>
+        <mime-type>application/zip</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>zir</extension>
+        <mime-type>application/vnd.zul</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>zirz</extension>
+        <mime-type>application/vnd.zul</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>zmm</extension>
+        <mime-type>application/vnd.handheld-entertainment+xml</mime-type>
+    </mime-mapping>
+
+  <!-- ==================== Default Welcome File List ===================== -->
+  <!-- When a request URI refers to a directory, the default servlet looks  -->
+  <!-- for a "welcome file" within that directory and, if present, to the   -->
+  <!-- corresponding resource URI for display.                              -->
+  <!-- If no welcome files are present, the default servlet either serves a -->
+  <!-- directory listing (see default servlet configuration on how to       -->
+  <!-- customize) or returns a 404 status, depending on the value of the    -->
+  <!-- listings setting.                                                    -->
+  <!--                                                                      -->
+  <!-- If you define welcome files in your own application's web.xml        -->
+  <!-- deployment descriptor, that list *replaces* the list configured      -->
+  <!-- here, so be sure to include any of the default values that you wish  -->
+  <!-- to use within your application.                                       -->
+
+    <welcome-file-list>
+        <welcome-file>index.html</welcome-file>
+        <welcome-file>index.htm</welcome-file>
+        <welcome-file>index.jsp</welcome-file>
+    </welcome-file-list>
+       <filter>
+               <filter-name>CorsFilter</filter-name>
+               <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
+               <init-param>
+                       <param-name>cors.allowed.origins</param-name>
+                       <param-value>*</param-value>
+               </init-param>
+               <init-param>
+                       <param-name>cors.allowed.methods</param-name>
+                       <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
+               </init-param>
+       </filter>
+       <filter-mapping>
+               <filter-name>CorsFilter</filter-name>
+               <url-pattern>/*</url-pattern>
+       </filter-mapping>
+</web-app>
diff --git a/vnfmarket-be/deployment/src/main/release/etc/conf/lifeCycleConfig.json b/vnfmarket-be/deployment/src/main/release/etc/conf/lifeCycleConfig.json
new file mode 100644 (file)
index 0000000..f26103f
--- /dev/null
@@ -0,0 +1,6 @@
+{
+    "lab_vim_id":"",
+    "vnf_index":"",
+    "vnfprofileid":"",
+    "ns_instance_id":""
+}
\ No newline at end of file
diff --git a/vnfmarket-be/deployment/src/main/release/etc/conf/restclient.json b/vnfmarket-be/deployment/src/main/release/etc/conf/restclient.json
new file mode 100644 (file)
index 0000000..9f38f6b
--- /dev/null
@@ -0,0 +1,11 @@
+{
+    "defaultServer":
+    {
+        "host":"msb.openo.org",
+        "port":"80"
+    },
+    "ConnectTimeout":"300000",
+    "thread":"10",
+    "idletimeout":"500000",
+    "timeout":"300000"
+}
\ No newline at end of file
diff --git a/vnfmarket-be/deployment/src/main/release/etc/microservice/marketplace_rest.json b/vnfmarket-be/deployment/src/main/release/etc/microservice/marketplace_rest.json
new file mode 100644 (file)
index 0000000..820ea83
--- /dev/null
@@ -0,0 +1,14 @@
+{
+  "serviceName": "vnfsdk-marketplace",
+  "version": "v1",
+  "url": "/openoapi/vnfsdk-marketplace/v1",
+  "protocol": "REST",
+  "visualRange": "0",
+  "nodes": [
+    {
+      "ip": "10.229.47.199",
+      "port": "8702",
+      "ttl": 0
+    }
+  ]
+}
\ No newline at end of file
diff --git a/vnfmarket-be/deployment/src/main/release/init/marketplace_tables_mysql.sql b/vnfmarket-be/deployment/src/main/release/init/marketplace_tables_mysql.sql
new file mode 100644 (file)
index 0000000..6255256
--- /dev/null
@@ -0,0 +1,24 @@
+CREATE DATABASE marketplaceDB;
+
+USE marketplaceDB;
+
+DROP TABLE IF EXISTS CSAR_PACKAGE_TABLE;
+
+CREATE TABLE CSAR_PACKAGE_TABLE (
+       CSARID                   VARCHAR(200)       NOT NULL,
+       DOWNLOADURI              VARCHAR(200)       NULL,
+       REPORT                       VARCHAR(200)       NULL,
+       SIZE                     VARCHAR(100)       NULL,
+       FORMAT                   VARCHAR(100)       NULL,
+       CREATETIME               VARCHAR(100)       NULL,
+       DELETIONPENDING          VARCHAR(100)       NULL,
+       MODIFYTIME               VARCHAR(100)       NULL,
+       SHORTDESC                    TEXT                       NULL,
+       NAME                     VARCHAR(100)       NULL,
+       VERSION                  VARCHAR(20)        NULL,
+       PROVIDER                 VARCHAR(300)       NULL,
+       TYPE                     VARCHAR(300)       NULL,
+       DETAILS                      TEXT                           NULL,
+       REMARKS                      TEXT                           NULL,
+       DOWNLOADCOUNT            INT                NULL
+);
diff --git a/vnfmarket-be/pom.xml b/vnfmarket-be/pom.xml
new file mode 100644 (file)
index 0000000..3200064
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2016-2017 Huawei Technologies Co., Ltd.
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<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">
+   <parent>
+      <groupId>org.openo.oparent</groupId>
+      <artifactId>oparent</artifactId>
+      <version>1.1.0-SNAPSHOT</version>
+      <relativePath>../oparent</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.openo.vnf-sdk.marketplace</groupId>
+    <artifactId>vnf-sdk-marketplace-core-parent</artifactId>
+    <packaging>pom</packaging>
+    <name>vnf-sdk-marketplace-core-parent</name>
+       <scm>
+        <tag>HEAD</tag>
+    </scm>
+      <modules>
+               <module>vnf-sdk-marketplace</module>
+               <module>deployment</module>
+    </modules>
+</project>
diff --git a/vnfmarket-be/portal-marketplace/pom.xml b/vnfmarket-be/portal-marketplace/pom.xml
new file mode 100644 (file)
index 0000000..219e8a5
--- /dev/null
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2016-2017 Huawei Technologies Co., Ltd.
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<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">
+  <parent>
+    <groupId>org.openo.vnf-sdk.marketplace</groupId>
+    <artifactId>vnf-sdk-marketplace-core-parent</artifactId>
+    <version>1.1.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>portal-marketplace</artifactId>
+  <version>1.1.0-SNAPSHOT</version>
+  <packaging>war</packaging>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-war-plugin</artifactId>
+        <configuration>
+          <failOnMissingWebXml>false</failOnMissingWebXml>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+<name>vnf-sdk-marketplace/portal-marketplace</name></project>
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/Gruntfile.js b/vnfmarket-be/portal-marketplace/src/main/webapp/Gruntfile.js
new file mode 100644 (file)
index 0000000..99673b1
--- /dev/null
@@ -0,0 +1,192 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+// Grunt tasks
+
+module.exports = function (grunt) {
+       "use strict";
+
+       // Project configuration.
+       grunt.initConfig({
+
+               pkg: grunt.file.readJSON('package.json'),
+               banner: '/*!\n' +
+               '* <%= pkg.name %> - v<%= pkg.version %> - MIT LICENSE <%= grunt.template.today("yyyy-mm-dd") %>. \n' +
+               '* @author <%= pkg.author %>\n' +
+               '*/\n',
+
+               clean: {
+                       dist: ['src']
+               },
+
+               jshint: {
+                       options: {
+                               jshintrc: '.jshintrc'
+                       },
+                       gruntfile: {
+                               src: 'Gruntfile.js'
+                       },
+                       app: {
+                               src: ['app/modules/**/*.js']
+                       }
+               },
+
+               exec: {
+                       bowerInstaller: 'bower-installer'
+               },
+
+               concat: {
+                       options: {
+                               banner: '<%= banner %>',
+                               stripBanners: false
+                       },
+                       base: {
+                               src: [
+                                       // Angular Project Dependencies,
+                                       'app/app.js',
+                                       'app/app.config.js',
+                                       'app/modules/**/*Module.js',
+                                       'app/modules/**/*Route.js',
+                                       'app/modules/**/*Ctrl.js',
+                                       'app/modules/**/*Service.js',
+                                       'app/modules/**/*Directive.js'
+                               ],
+                               dest: 'app/assets/js/<%= pkg.name %>-appbundle.js'
+                       },
+                       build: {
+                               src: [
+                                       // Angular Project Dependencies,
+                                       'app/assets/libs/angular/angular.js',
+                                       'app/assets/libs/**/*.js'
+
+                               ],
+                               dest: 'app/assets/js/<%= pkg.name %>-angularbundle.js'
+                       }
+               },
+
+               uglify: {
+                       options: {
+                               banner: '<%= banner %>',
+                               report: 'min'
+                       },
+                       base: {
+                               src: ['<%= concat.base.dest %>'],
+                               dest: 'app/assets/js/<%= pkg.name %>-angscript.min.js'
+                       },
+                       basePlugin: {
+                               src: [ 'src/plugins/**/*.js' ],
+                               dest: 'app/assets/js/plugins/',
+                               expand: true,
+                               flatten: true,
+                               ext: '.min.js'
+                       }
+               },
+
+               connect: {
+                       server: {
+                               options: {
+                                       keepalive: true,
+                                       port: 4000,
+                                       base: '.',
+                                       hostname: 'localhost',
+                                       debug: true,
+                                       livereload: true,
+                                       open: true
+                               }
+                       }
+               },
+               concurrent: {
+                       tasks: ['connect', 'watch'],
+                       options: {
+                               logConcurrentOutput: true
+                       }
+               },
+
+               watch: {
+                       app: {
+                               files: '<%= jshint.app.src %>',
+                               tasks: ['jshint:app'],
+                               options: {
+                                       livereload: true
+                               }
+                       }
+               },
+
+               injector: {
+                       options: {},
+                       dev: {
+                               files: {
+                                       'index.html': [
+                                               'bower.json',
+                                               'app/app.js',
+                                               'app/app.config.js',
+                                               'app/**/*Module.js',
+                                               'app/**/*Route.js',
+                                               'app/**/*Ctrl.js',
+                                               'app/**/*Service.js',
+                                               'app/**/*Directive.js'
+                                       ]
+                               }
+                       },
+                       production: {
+                               files: {
+                                       'index.html': [
+                                               'app/assets/css/**/*.css',
+                                               'app/assets/js/*.js'
+                                       ]
+
+                               }
+                       }
+               },
+
+               ngtemplates: {
+                       app: {
+                               src: 'app/modules/**/*.html',
+                               dest: 'app/assets/js/templates.js',
+                               options: {
+                                       module: '<%= pkg.name %>',
+                                       root: 'app/',
+                                       standAlone: false
+                               }
+                       }
+               }
+
+
+
+       });
+
+       require('time-grunt')(grunt);
+       require('load-grunt-tasks')(grunt);
+
+       // Making grunt default to force in order not to break the project if something fail.
+       grunt.option('force', true);
+
+       // Register grunt tasks
+       grunt.registerTask("build", [
+               "jshint",
+               "exec",
+               "concat",
+               "ngtemplates",
+               "injector:production",
+               "concurrent",
+               "clean"
+       ]);
+
+       // Development task(s).
+       grunt.registerTask('dev', ['injector:dev', 'concurrent']);
+
+};
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/README.md b/vnfmarket-be/portal-marketplace/src/main/webapp/README.md
new file mode 100644 (file)
index 0000000..ac0ec86
--- /dev/null
@@ -0,0 +1,28 @@
+# VNF Marketplace.
+
+A GUI to a access and manage the VNF Marketplace.
+
+
+
+## Getting started
+
+Clone project:
+
+    $ git clone https://github.com/
+
+Install dependencies:
+
+    $ cd vnfmarketplace
+    $ npm install
+
+Run development web-server:
+
+    $ grunt dev
+
+## Features
+
+* List features here
+
+## Project structure and credits
+
+* Project credits here
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/bower.json b/vnfmarket-be/portal-marketplace/src/main/webapp/bower.json
new file mode 100644 (file)
index 0000000..4f2d96a
--- /dev/null
@@ -0,0 +1,31 @@
+{
+  "name": "vnfmarket",
+  "description": "Marketplace UI for VNF Services",
+  "version": "0.0.1",
+  "install": {
+    "path": {
+      "js": "app/assets/libs",
+      "css": "app/assets/css"
+    }
+  },
+  "dependencies": {
+    "json3": "3.3.1",
+    "es5-shim": "3.1.0",
+    "angular": ">=1.3.*",
+    "angular-aria": ">=1.3.*",
+    "angular-mocks": ">=1.3.*",
+    "angular-cookies": ">=1.3.*",
+    "angular-animate": ">=1.3.*",
+    "angular-sanitize": ">=1.3.*",
+    "angular-resource": ">=1.3.*",
+    "angular-material-icons": "~0.6.0",
+    "angular-messages": ">=1.3.*",
+    "angular-material": ">=1.0.1",
+    "angular-ui-router": "~0.2.10",
+    "bootstrap": "3.3.7",
+    "components-font-awesome": "^4.7.0"
+  },
+  "resolutions": {
+    "angular": ">=1.3.*"
+  }
+}
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/index.html b/vnfmarket-be/portal-marketplace/src/main/webapp/index.html
new file mode 100644 (file)
index 0000000..9e2cfb6
--- /dev/null
@@ -0,0 +1,210 @@
+<!--
+  Copyright 2016-2017 Huawei Technologies Co., Ltd.
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!DOCTYPE html>
+<html lang="pt" ng-app="vnfmarket">
+<head>
+       <meta charset="utf-8">
+       <meta http-equiv="X-UA-Compatible" content="IE=edge">
+       <base href="/">
+       <title>VNF Marketplace</title>
+       <meta name="description" content="Marketplace UI for VNF Services" />
+       <meta name="author" content="" />
+       <meta name="keywords" content="" />
+       <meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=yes" />
+       <link rel="shortcut icon" href="app/assets/images/favicon.ico" />
+       <link rel="apple-touch-icon" href="app/assets/images/apple-touch-icon.png" />
+       <link rel="apple-touch-icon" sizes="72x72" href="app/assets/images/apple-touch-icon-72x72.png" />
+       <link rel="apple-touch-icon" sizes="114x114" href="app/assets/images/apple-touch-icon-114x114.png" />
+       <!-- injector:css -->
+       <link rel="stylesheet" href="/src/bower_components/angular-material-icons/angular-material-icons.css">
+       <link rel="stylesheet" href="/src/bower_components/angular-material/angular-material.css">
+       <link rel="stylesheet" href="/src/bower_components/components-font-awesome/css/font-awesome.css">
+       <!-- endinjector -->
+    <link rel="stylesheet" href="/src/bower_components/bootstrap/dist/css/bootstrap.min.css">
+    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=RobotoDraft:300,400,500,700,400italic">
+    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
+    <style>
+        body, md-content.md-blue-grey-theme {
+            background-color: #eee;
+        }
+
+        md-toolbar:not(.md-hue-1),
+        .md-fab {
+            fill: #fff;
+        }
+
+        md-sidenav {
+            fill: #737373;
+        }
+
+        .user-avatar {
+            border-radius: 99%;
+        }
+
+        md-toolbar.md-tall {
+            height: 64px;
+            max-height: 64px;
+            min-height: 64px;
+        }
+        code {
+                   color: #4285f4;
+                   -webkit-font-smoothing: auto;
+                   font-weight: 300;
+                   background-color: #F2F2F2;
+                   padding: 10px;
+               }
+               .text-center {
+                   text-align: center!important
+               }
+               ul {
+                   list-style: none
+               }
+    </style>
+
+</head>
+<body ng-cloak>
+
+<!--Beginning-->
+<div ui-view layout="row" layout-fill></div>
+<!--End-->
+
+<!--Templates. Remove then to a better location -->
+
+<script type="text/ng-template" id="tabDialog.tmpl.html">
+    <md-dialog
+    aria-label="Profile">
+    <form>
+        <md-toolbar>
+            <div class="md-toolbar-tools">
+                <h2>Profile Settings</h2>
+                <span flex></span>
+                <md-button class="md-icon-button" ng-click="cancel()">
+                    <md-icon aria-label="Close dialog">close</md-icon>
+                </md-button>
+            </div>
+        </md-toolbar>
+        <md-dialog-content style="max-width:800px;max-height:810px; ">
+            <md-tabs md-dynamic-height md-border-bottom>
+                <md-tab label="one">
+                    <md-content class="md-padding">
+                        <h1 class="md-display-2">Tab One</h1>
+
+                        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla venenatis ante augue.
+                            Phasellus volutpat neque ac dui mattis vulputate. Etiam consequat aliquam cursus. In sodales
+                            pretium ultrices. Maecenas lectus est, sollicitudin consectetur felis nec, feugiat ultricies
+                            mi.</p>
+                    </md-content>
+                </md-tab>
+                <md-tab label="two">
+                    <md-content class="md-padding">
+                        <h1 class="md-display-2">Tab Two</h1>
+
+                        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla venenatis ante augue.
+                            Phasellus volutpat neque ac dui mattis vulputate. Etiam consequat aliquam cursus. In sodales
+                            pretium ultrices. Maecenas lectus est, sollicitudin consectetur felis nec, feugiat ultricies
+                            mi. Aliquam erat volutpat. Nam placerat, tortor in ultrices porttitor, orci enim rutrum
+                            enim, vel tempor sapien arcu a tellus. Vivamus convallis sodales ante varius gravida.
+                            Curabitur a purus vel augue ultrices ultricies id a nisl. Nullam malesuada consequat diam, a
+                            facilisis tortor volutpat et. Sed urna dolor, aliquet vitae posuere vulputate, euismod ac
+                            lorem. Sed felis risus, pulvinar at interdum quis, vehicula sed odio. Phasellus in enim
+                            venenatis, iaculis tortor eu, bibendum ante. Donec ac tellus dictum neque volutpat blandit.
+                            Praesent efficitur faucibus risus, ac auctor purus porttitor vitae. Phasellus ornare dui nec
+                            orci posuere, nec luctus mauris semper.</p>
+
+                        <p>Morbi viverra, ante vel aliquet tincidunt, leo dolor pharetra quam, at semper massa orci nec
+                            magna. Donec posuere nec sapien sed laoreet. Etiam cursus nunc in condimentum facilisis.
+                            Etiam in tempor tortor. Vivamus faucibus egestas enim, at convallis diam pulvinar vel. Cras
+                            ac orci eget nisi maximus cursus. Nunc urna libero, viverra sit amet nisl at, hendrerit
+                            tempor turpis. Maecenas facilisis convallis mi vel tempor. Nullam vitae nunc leo. Cras sed
+                            nisl consectetur, rhoncus sapien sit amet, tempus sapien.</p>
+
+                        <p>Integer turpis erat, porttitor vitae mi faucibus, laoreet interdum tellus. Curabitur posuere
+                            molestie dictum. Morbi eget congue risus, quis rhoncus quam. Suspendisse vitae hendrerit
+                            erat, at posuere mi. Cras eu fermentum nunc. Sed id ante eu orci commodo volutpat non ac
+                            est. Praesent ligula diam, congue eu enim scelerisque, finibus commodo lectus.</p>
+                    </md-content>
+                </md-tab>
+                <md-tab label="three">
+                    <md-content class="md-padding">
+                        <h1 class="md-display-2">Tab Three</h1>
+
+                        <p>Integer turpis erat, porttitor vitae mi faucibus, laoreet interdum tellus. Curabitur posuere
+                            molestie dictum. Morbi eget congue risus, quis rhoncus quam. Suspendisse vitae hendrerit
+                            erat, at posuere mi. Cras eu fermentum nunc. Sed id ante eu orci commodo volutpat non ac
+                            est. Praesent ligula diam, congue eu enim scelerisque, finibus commodo lectus.</p>
+                    </md-content>
+                </md-tab>
+            </md-tabs>
+        </md-dialog-content>
+
+        <md-dialog-actions layout="row">
+            <span flex></span>
+            <md-button ng-click="answer('not useful')">
+                Not Useful
+            </md-button>
+            <md-button ng-click="answer('useful')" style="margin-right:20px;">
+                Useful
+            </md-button>
+        </md-dialog-actions>
+    </form>
+    </md-dialog>
+</script>
+<!-- End templates -->
+
+
+<!-- injector:js -->
+<script src="/src/bower_components/jquery/dist/jquery.js"></script>
+<script src="/src/bower_components/es5-shim/es5-shim.js"></script>
+<script src="/src/bower_components/json3/lib/json3.min.js"></script>
+<script src="/src/bower_components/angular/angular.js"></script>
+<script src="/src/bower_components/angular-aria/angular-aria.js"></script>
+<script src="/src/bower_components/angular-mocks/angular-mocks.js"></script>
+<script src="/src/bower_components/angular-cookies/angular-cookies.js"></script>
+<script src="/src/bower_components/angular-animate/angular-animate.js"></script>
+<script src="/src/bower_components/angular-sanitize/angular-sanitize.js"></script>
+<script src="/src/bower_components/angular-resource/angular-resource.js"></script>
+<script src="/src/bower_components/angular-material-icons/angular-material-icons.min.js"></script>
+<script src="/src/bower_components/angular-messages/angular-messages.js"></script>
+<script src="/src/bower_components/angular-material/angular-material.js"></script>
+<script src="/src/bower_components/angular-ui-router/release/angular-ui-router.js"></script>
+<script src="/src/bower_components/bootstrap/dist/js/bootstrap.js"></script>
+<script src="/app/app.js"></script>
+<script src="/app/app.config.js"></script>
+<script src="/app/modules/about/aboutModule.js"></script>
+<script src="/app/modules/home/homeModule.js"></script>
+<script src="/app/modules/marketplace/marketplaceModule.js"></script>
+<script src="/app/modules/user/userModule.js"></script>
+<script src="/app/modules/about/aboutRoute.js"></script>
+<script src="/app/modules/home/homeRoute.js"></script>
+<script src="/app/modules/marketplace/marketplaceRoute.js"></script>
+<script src="/app/modules/user/userRoute.js"></script>
+<script src="/app/modules/about/aboutCtrl.js"></script>
+<script src="/app/modules/home/homeCtrl.js"></script>
+<script src="/app/modules/layouts/main-page/mainPageCtrl.js"></script>
+<script src="/app/modules/layouts/side-nav/sidenavCtrl.js"></script>
+<script src="/app/modules/marketplace/marketplaceCtrl.js"></script>
+<script src="/app/modules/user/userCtrl.js"></script>
+<script src="/app/modules/about/aboutService.js"></script>
+<script src="/app/modules/home/homeService.js"></script>
+<script src="/app/modules/layouts/nav-bar/navBarService.js"></script>
+<script src="/app/modules/layouts/side-nav/sidenavService.js"></script>
+<script src="/app/modules/marketplace/marketplaceService.js"></script>
+<script src="/app/modules/user/userService.js"></script>
+<!-- endinjector -->
+
+
+</body>
+</html>
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/karma.conf.js b/vnfmarket-be/portal-marketplace/src/main/webapp/karma.conf.js
new file mode 100644 (file)
index 0000000..ee858bb
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+
+
+'use strict';
+
+// Karma configuration
+module.exports = function (config) {
+       config.set({
+               // Frameworks to use
+               frameworks: ['jasmine'],
+
+               // List of files / patterns to load in the browser
+               files: [
+                       'src/bower_components/jquery/dist/jquery.js',
+                       'src/bower_components/es5-shim/es5-shim.js',
+                       'src/bower_components/json3/lib/json3.min.js',
+                       'src/bower_components/angular/angular.js',
+                       'src/bower_components/angular-aria/angular-aria.js',
+                       'src/bower_components/angular-resource/angular-resource.js',
+                       'src/bower_components/angular-mocks/angular-mocks.js',
+                       'src/bower_components/angular-cookies/angular-cookies.js',
+                       'src/bower_components/angular-sanitize/angular-sanitize.js',
+                       'src/bower_components/angular-animate/angular-animate.js',
+                       'src/bower_components/angular-touch/angular-touch.js',
+                       'src/bower_components/angular-ui-router/release/angular-ui-router.js',
+                       'src/bower_components/angular-aria/angular-aria.js',
+                       'src/bower_components/angular-material/angular-material.js',
+                       'src/bower_components/angular-messages/angular-messages.js',
+                       'src/bower_components/angular-material-icons/angular-material-icons.js',
+                       'app/app.js',
+                       'app/modules/home/homeModule.js',
+                       'app/modules/home/homeCtrl.js',
+                       'app/modules/home/homeRoute.js',
+                       'app/modules/home/homeService.js',
+                       'app/modules/home/home-test.js',
+                       'app/modules/user/userModule.js',
+                       'app/modules/user/userCtrl.js',
+                       'app/modules/user/userRoute.js',
+                       'app/modules/user/userService.js',
+                       'app/modules/user/user-test.js',
+                       'app/modules/marketplace/marketplaceModule.js',
+                       'app/modules/marketplace/marketplaceCtrl.js',
+                       'app/modules/marketplace/marketplaceRoute.js',
+                       'app/modules/marketplace/marketplaceService.js',
+                       'app/modules/marketplace/marketplace-test.js',
+                       'app/modules/about/aboutModule.js',
+                       'app/modules/about/aboutCtrl.js',
+                       'app/modules/about/aboutRoute.js',
+                       'app/modules/about/aboutService.js',
+                       'app/modules/about/about-test.js',
+               ],
+
+               // Test results reporter to use
+               // Possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
+               //reporters: ['progress'],
+               reporters: ['spec'],
+
+               plugins : [
+                       'karma-jasmine',
+                       'karma-coverage',
+                       'karma-chrome-launcher',
+                       'karma-firefox-launcher',
+                       'karma-phantomjs-launcher',
+                       'karma-spec-reporter'
+               ],
+
+               // Web server port
+               port: 9876,
+
+               // Enable / disable colors in the output (reporters and logs)
+               colors: true,
+
+               // Level of logging
+               // Possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+               logLevel: config.LOG_INFO,
+
+               // Enable / disable watching file and executing tests whenever any file changes
+               autoWatch: true,
+
+               // Start these browsers, currently available:
+               // - Chrome
+               // - ChromeCanary
+               // - Firefox
+               // - Opera
+               // - Safari (only Mac)
+               // - PhantomJS
+               // - IE (only Windows)
+               browsers: ['PhantomJS'],
+
+               // If browser does not capture in given timeout [ms], kill it
+               captureTimeout: 60000,
+
+               // Continuous Integration mode
+               // If true, it capture browsers, run tests and exit
+               singleRun: true
+       });
+};
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/app.config.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/app.config.js
new file mode 100644 (file)
index 0000000..74f2e7b
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+
+
+
+(function () {
+       'use strict';
+
+       /**
+        * @ngdoc configuration file
+        * @name app.config:config
+        * @description
+        * # Config and run block
+        * Configutation of the app
+        */
+
+
+       angular
+               .module('vnfmarket')
+               .config(configure)
+               .run(runBlock);
+
+       configure.$inject = ['$stateProvider', '$urlRouterProvider', '$locationProvider', '$httpProvider'];
+
+       function configure($stateProvider, $urlRouterProvider, $locationProvider, $httpProvider) {
+
+               $locationProvider.hashPrefix('!');
+
+               // This is required for Browser Sync to work poperly
+               $httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
+
+
+               $urlRouterProvider
+                       .otherwise('/dashboard');
+
+       }
+
+       runBlock.$inject = ['$rootScope'];
+
+       function runBlock($rootScope) {
+               'use strict';
+
+               console.log('AngularJS run() function...');
+       }
+
+
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/app.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/app.js
new file mode 100644 (file)
index 0000000..1b3b63f
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+
+(function() {
+       'use strict';
+
+       /**
+        * @ngdoc index
+        * @name app
+        * @description
+        * # app
+        *
+        * Main modules of the application.
+        */
+
+       angular.module('vnfmarket', [
+               'ngResource',
+               'ngAria',
+                'ngMaterial',
+               'ngMdIcons',
+               'ngCookies',
+               'ngAnimate',
+               'ngSanitize',
+               'ui.router',
+               'home',
+               'user',
+               'marketplace',
+               'about',
+       ]);
+
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/assets/images/open_o_diagram.png b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/assets/images/open_o_diagram.png
new file mode 100644 (file)
index 0000000..676a6bf
Binary files /dev/null and b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/assets/images/open_o_diagram.png differ
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/about/about-test.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/about/about-test.js
new file mode 100644 (file)
index 0000000..04fe198
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+(function () {
+       'use strict';
+
+       /**
+        * @ngdoc function
+        * @name app.test:aboutTest
+        * @description
+        * # aboutTest
+        * Test of the app
+        */
+
+       describe('about test', function () {
+               var controller = null, $scope = null;
+
+               beforeEach(function () {
+                       module('vnfmarket');
+               });
+
+               beforeEach(inject(function ($controller, $rootScope) {
+                       $scope = $rootScope.$new();
+                       controller = $controller('AboutCtrl', {
+                               $scope: $scope
+                       });
+               }));
+
+               it('Should controller must be defined', function () {
+                       expect(controller).toBeDefined();
+               });
+
+       });
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/about/about.html b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/about/about.html
new file mode 100644 (file)
index 0000000..7ee0c1b
--- /dev/null
@@ -0,0 +1,91 @@
+<!--
+  Copyright 2016-2017 Huawei Technologies Co., Ltd.
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<div class="md-padding" flex layout-sm="column">
+    <md-card>
+        <md-card-content>
+            <h2 class="md-title">Welcome to Open-O.</h2>
+        </md-card-content>
+    </md-card>
+    <!-- Start About Page -->
+    <md-card>
+       <md-card-content>
+               <div class="row">
+                <div class="col-md-4">
+                  <a href="#" data-toggle="modal" data-target="#open-o-diagram">
+                    <img class="img-responsive" src="app/assets/images/open_o_diagram.png" alt="open o Architecture">
+                  </a>
+                </div>
+                <div class="col-md-8">
+                  <div class="row">
+                      <div class="col-md-12 content clearfix">
+                        <div class="editContent">
+                          <h1>Open Orchestrator Project (OPEN-O)</h1>
+                          <h3>Any Service Over Any Network</h3>
+                        </div>
+                        <div class="editContent">
+                          <p class="lead">OPEN-O is seeking to offer network operators an incremental path to transform their networks, and OSS/BSS, through adoption of SDN and NFV without scrapping the vast investments in existing equipment and technologies.</p>
+                        </div>
+
+                      </div>
+
+                   </div><!-- /.row-->
+                </div>
+              </div>
+                <div class="col-md-12">
+                  <div class="row pad15">
+                    <div class="col-xs-2">
+                      <span class="fa fa-rocket fa-4x"></span>
+                    </div>
+                    <div class="col-xs-10">
+                      <div class="editContent">
+                        <h3>Mission</h3>
+                      </div>
+                      <div class="editContent">
+                        <p>The mission of the OPEN-Orchestrator Project (OPEN-O) is to: enable end-to-end service agility across SDN, NFV, and legacy networks via a unified orchestration platform supporting NFV orchestration (NFVO and VNFM) and SDN orchestration.</p>
+                      </div>
+                    </div>
+                  </div><!-- /.row -->
+                  <div class="row pad15">
+                    <div class="col-xs-2">
+                      <span class="fa fa-users fa-4x"></span>
+                    </div>
+                    <div class="col-xs-10">
+                      <div class="editContent">
+                        <h3>Target Customers.</h3>
+                      </div>
+                      <div class="editContent">
+                        <p>OPEN-O is targeting the world’s most important and innovative telecommunications and cable operators, and the OEMs, systems integrators, and software firms who support them.</p>
+                      </div>
+                    </div>
+                  </div><!-- /.row -->
+                  <div class="row pad15">
+                    <div class="col-xs-2">
+                      <span class="fa fa-object-group fa-4x"></span>
+                    </div>
+                    <div class="col-xs-10">
+                      <div class="editContent">
+                        <h3>OPEN-O Architecture.</h3>
+                      </div>
+                      <div class="editContent">
+                        <p>The OPEN-O Architecture (shown in the Figure ), enables operators to orchestrate end-to- end composite services, leveraging virtualized (and physical network functions), and SDN and legacy connectivity services. The model-driven service framework uses standard modeling languages including TOSCA and YANG, and a modular approach to integrate with MANO building blocks (such as VIMs and VNFMs), along with Connectivity Services Management, including SDN Controllers, EMS’ and NMS’.</p>
+                      </div>
+                    </div>
+                  </div><!-- /.row -->
+                </div>
+       </md-card-content>
+    </md-card>
+    <!-- End About Page -->
+</div>
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/about/aboutCtrl.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/about/aboutCtrl.js
new file mode 100644 (file)
index 0000000..c2f097e
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+(function() {
+       'use strict';
+
+       /**
+       * @ngdoc function
+       * @name app.controller:aboutCtrl
+       * @description
+       * # aboutCtrl
+       * Controller of the app
+       */
+
+       angular
+               .module('about')
+               .controller('AboutCtrl', About);
+
+               About.$inject = [];
+
+               /*
+               * recommend
+               * Using function declarations
+               * and bindable members up top.
+               */
+
+               function About() {
+                       /*jshint validthis: true */
+                       var vm = this;
+
+               }
+
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/about/aboutModule.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/about/aboutModule.js
new file mode 100644 (file)
index 0000000..be52404
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+(function () {
+       'use strict';
+
+       /**
+        * @ngdoc function
+        * @name app.module:aboutModule
+        * @description
+        * # aboutModule
+        * Module of the app
+        */
+
+       angular.module('about', []);
+
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/about/aboutRoute.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/about/aboutRoute.js
new file mode 100644 (file)
index 0000000..50fb7b2
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+'use strict';
+
+/**
+ * @ngdoc function
+ * @name app.route:aboutRoute
+ * @description
+ * # aboutRoute
+ * Route of the app
+ */
+
+angular.module('about')
+       .config(['$stateProvider', function ($stateProvider) {
+
+               $stateProvider
+                       .state('home.about', {
+                               url:'/about',
+                               templateUrl: 'app/modules/about/about.html',
+                               controller: 'AboutCtrl',
+                               controllerAs: 'vm'
+                       });
+
+
+       }]);
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/about/aboutService.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/about/aboutService.js
new file mode 100644 (file)
index 0000000..fb8770c
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+(function() {
+       'use strict';
+
+       /**
+        * @ngdoc function
+        * @name app.service:aboutService
+        * @description
+        * # aboutService
+        * Service of the app
+        */
+
+       angular
+               .module('about')
+               .factory('AboutService', About);
+               // Inject your dependencies as .$inject = ['$http', 'someSevide'];
+               // function Name ($http, someSevide) {...}
+
+               About.$inject = ['$http'];
+
+               function About ($http) {
+
+               }
+
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/home/dashboard.html b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/home/dashboard.html
new file mode 100644 (file)
index 0000000..b048c38
--- /dev/null
@@ -0,0 +1,100 @@
+<!--
+  Copyright 2016-2017 Huawei Technologies Co., Ltd.
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<div class="md-padding" flex layout-sm="column">
+    <md-card class="text-center">
+        <md-card-content>
+            <h1>{{ vm.title }}</h1>
+            <h3>{{ vm.version }}</h3>
+            <p>An Online MarketPlace (or online e-commerce marketplace) is a type of a e-commarce site where product of service information is proviced by multiple third parties,whereas transactions are processed by the marketplace operator.</p>
+            <br>
+            <md-divider class="margin-top-20"></md-divider>
+            <!-- <h1 class="margin-top-50">Features</h1>
+            <ul>
+                <li class=" text-center" ng-repeat="item in vm.listFeatures">
+                    <p><ng-md-icon icon="check"></ng-md-icon> {{item.feature}}</p>
+                </li>
+            </ul> -->
+        </md-card-content>
+    </md-card>
+    <!-- Start About Page -->
+    <md-card>
+        <md-card-content>
+            <div class="row">
+                <div class="col-md-4">
+                  <a href="#" data-toggle="modal" data-target="#open-o-diagram">
+                    <img class="img-responsive" src="app/assets/images/open_o_diagram.png" alt="open o Architecture">
+                  </a>
+                </div>
+                <div class="col-md-8">
+                  <div class="row">
+                      <div class="col-md-12 content clearfix">
+                        <div class="editContent">
+                          <h1>Open Orchestrator Project (OPEN-O)</h1>
+                          <h3>Any Service Over Any Network</h3>
+                        </div>
+                        <div class="editContent">
+                          <p class="lead">OPEN-O is seeking to offer network operators an incremental path to transform their networks, and OSS/BSS, through adoption of SDN and NFV without scrapping the vast investments in existing equipment and technologies.</p>
+                        </div>
+
+                      </div>
+
+                   </div><!-- /.row-->
+                </div>
+              </div>
+                <div class="col-md-12">
+                  <div class="row pad15">
+                    <div class="col-xs-2">
+                      <span class="fa fa-rocket fa-4x"></span>
+                    </div>
+                    <div class="col-xs-10">
+                      <div class="editContent">
+                        <h3>Mission</h3>
+                      </div>
+                      <div class="editContent">
+                        <p>The mission of the OPEN-Orchestrator Project (OPEN-O) is to: enable end-to-end service agility across SDN, NFV, and legacy networks via a unified orchestration platform supporting NFV orchestration (NFVO and VNFM) and SDN orchestration.</p>
+                      </div>
+                    </div>
+                  </div><!-- /.row -->
+                  <div class="row pad15">
+                    <div class="col-xs-2">
+                      <span class="fa fa-users fa-4x"></span>
+                    </div>
+                    <div class="col-xs-10">
+                      <div class="editContent">
+                        <h3>Target Customers.</h3>
+                      </div>
+                      <div class="editContent">
+                        <p>OPEN-O is targeting the world’s most important and innovative telecommunications and cable operators, and the OEMs, systems integrators, and software firms who support them.</p>
+                      </div>
+                    </div>
+                  </div><!-- /.row -->
+                  <div class="row pad15">
+                    <div class="col-xs-2">
+                      <span class="fa fa-object-group fa-4x"></span>
+                    </div>
+                    <div class="col-xs-10">
+                      <div class="editContent">
+                        <h3>OPEN-O Architecture.</h3>
+                      </div>
+                      <div class="editContent">
+                        <p>The OPEN-O Architecture (shown in the Figure ), enables operators to orchestrate end-to- end composite services, leveraging virtualized (and physical network functions), and SDN and legacy connectivity services. The model-driven service framework uses standard modeling languages including TOSCA and YANG, and a modular approach to integrate with MANO building blocks (such as VIMs and VNFMs), along with Connectivity Services Management, including SDN Controllers, EMS’ and NMS’.</p>
+                      </div>
+                    </div>
+                  </div><!-- /.row -->
+                </div>
+        </md-card-content>
+    </md-card>
+</div>
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/home/home-test.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/home/home-test.js
new file mode 100644 (file)
index 0000000..cc9157f
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+(function () {
+       'use strict';
+
+       /**
+       * @ngdoc function
+       * @name app.test:homeTest
+       * @description
+       * # homeTest
+       * Test of the app
+       */
+
+       describe('homeCtrl', function () {
+               var controller = null, $scope = null, $location;
+
+               beforeEach(function () {
+                       module('vnfmarket');
+               });
+
+               beforeEach(inject(function ($controller, $rootScope, _$location_) {
+                       $scope = $rootScope.$new();
+                       $location = _$location_;
+
+                       controller = $controller('HomeCtrl', {
+                               $scope: $scope
+                       });
+               }));
+
+               it('Should HomeCtrl must be defined', function () {
+                       expect(controller).toBeDefined();
+               });
+
+               it('Should match the path Module name', function () {
+                       $location.path('/home');
+                       expect($location.path()).toBe('/home');
+               });
+
+       });
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/home/home.html b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/home/home.html
new file mode 100644 (file)
index 0000000..2ba4d76
--- /dev/null
@@ -0,0 +1,108 @@
+<!--
+  Copyright 2016-2017 Huawei Technologies Co., Ltd.
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<md-sidenav layout="column" class="md-sidenav-left md-whiteframe-z2" md-component-id="left" md-is-locked-open="$mdMedia('gt-md')">
+    <div ng-controller="SidenavCtrl as vm" ng-cloak>
+        <md-toolbar class="md-tall md-hue-2">
+            <div layout="column" class="md-toolbar-tools-bottom inset">
+                <div layout="row">
+                    <div flex="80" style="margin-top: 10px;">
+                        <div>VNF Marketplace</div>
+                    </div>
+                </div>
+            </div>
+        </md-toolbar>
+        <md-list>
+            <md-list-item ui-sref="home.dashboard">
+                <div class="inset">
+                    <ng-md-icon icon="apps"></ng-md-icon>
+                </div>
+                <p> Dashboard </p>
+            </md-list-item>
+            <md-list-item ng-repeat="item in vm.menu" ng-click="vm.navigateTo('home.' + item.link)">
+                <div class="inset" ng-show="item.icon">
+                    <ng-md-icon icon="{{item.icon}}"></ng-md-icon>
+                </div>
+                <p > {{ item.name }}</p>
+            </md-list-item>
+            <md-divider></md-divider>
+            <md-subheader>Admin</md-subheader>
+            <md-list-item ng-repeat="item in vm.admin" ng-click="vm.showSettingsBottom($event)" >
+                <div class="inset">
+                    <ng-md-icon icon="{{item.icon}}"></ng-md-icon>
+                </div>
+                <p> {{ item.title }}</p>
+            </md-list-item>
+        </md-list>
+    </div>
+</md-sidenav>
+
+<div layout="column" class="relative" layout-fill role="main" ng-controller="LayoutCtrl as layout" ng-cloak>
+    <md-toolbar ng-show="!showSearch">
+        <div class="md-toolbar-tools">
+            <md-button ng-click="layout.toggleSidenav('left')" hide-gt-md aria-label="Menu">
+                <ng-md-icon icon="menu"></ng-md-icon>
+            </md-button>
+            <h3>VNF Marketplace</h3>
+            <span flex></span>
+            <md-button aria-label="Search" ng-click="showSearch = !showSearch">
+                <ng-md-icon icon="search"></ng-md-icon>
+            </md-button>
+            <md-menu>
+                <md-button aria-label="Open Settings" ng-click="layout.openMenu($mdOpenMenu, $event)">
+                    <md-icon> more_vert </md-icon>
+                </md-button>
+                <md-menu-content width="4">
+                    <md-menu-item>
+                        <md-button ng-click="layout.changeProfile($event)">
+                            <md-icon>face</md-icon>
+                            Profile
+                        </md-button>
+                    </md-menu-item>
+                    <md-menu-item>
+                        <md-button ng-click="layout.changePassword()">
+                            <md-icon>lock</md-icon>
+                            Password
+                        </md-button>
+                    </md-menu-item>
+                    <md-menu-divider></md-menu-divider>
+                    <md-menu-item>
+                        <md-button ng-click="layout.logOut()">
+                            <md-icon>power_settings_new</md-icon>
+                            Logout
+                        </md-button>
+                    </md-menu-item>
+                </md-menu-content>
+            </md-menu>
+        </div>
+    </md-toolbar>
+    <md-toolbar class="md-hue-1" ng-show="showSearch">
+        <div class="md-toolbar-tools">
+            <md-button ng-click="showSearch = !showSearch" aria-label="Back">
+                <ng-md-icon icon="arrow_back"></ng-md-icon>
+            </md-button>
+            <h3 flex="10">
+                Back
+            </h3>
+            <md-input-container md-theme="input" flex>
+                <label>&nbsp;</label>
+                <input ng-model="search.who" placeholder="Search ...">
+            </md-input-container>
+        </div>
+    </md-toolbar>
+    <md-content layout="column" flex md-scroll-y style="background-color:#DCDCDC">
+        <div ui-view></div>
+    </md-content>
+</div>
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/home/homeCtrl.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/home/homeCtrl.js
new file mode 100644 (file)
index 0000000..a4b88aa
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+(function () {
+       'use strict';
+
+       /**
+       * @ngdoc function
+       * @name app.controller:HomeCtrl
+       * @description
+       * # HomeCtrl
+       * Controller of the app
+       */
+
+       angular
+               .module('vnfmarket')
+               .controller('HomeCtrl', Home);
+
+       Home.$inject = ['homeService'];
+
+       /*
+       * recommend
+       * Using function declarations
+       * and bindable members up top.
+       */
+
+       function Home(homeService) {
+               /*jshint validthis: true */
+               var vm = this;
+               vm.title = "Welcome to VNF Marketplace!";
+               vm.version = "1.0.0";
+               vm.listFeatures = homeService.getFeaturesList();
+               console.log(vm.listFeatures);
+
+       }
+
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/home/homeModule.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/home/homeModule.js
new file mode 100644 (file)
index 0000000..9362464
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+(function() {
+       'use strict';
+
+       /**
+       * @ngdoc function
+       * @name app.module:homeModule
+       * @description
+       * # homeModule
+       * Module of the app
+       */
+
+       angular.module('home', []);
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/home/homeRoute.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/home/homeRoute.js
new file mode 100644 (file)
index 0000000..286d1ae
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+'use strict';
+
+       /**
+       * @ngdoc function
+       * @name app.route:HomeRoute
+       * @description
+       * # HomeRoute
+       * Route of the app
+       */
+
+angular.module('vnfmarket')
+       .config(['$stateProvider', function ($stateProvider) {
+               $stateProvider
+
+                       .state('home', {
+                               url: '',
+                               abstract: true,
+                               templateUrl: 'app/modules/home/home.html',
+                               controller: 'HomeCtrl',
+                               controllerAs: 'vm'
+                       })
+                       .state('home.dashboard', {
+                               url:'/dashboard',
+                               templateUrl: 'app/modules/home/dashboard.html'
+                       });
+
+       }]);
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/home/homeService.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/home/homeService.js
new file mode 100644 (file)
index 0000000..fb3ea3c
--- /dev/null
@@ -0,0 +1,754 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+(function () {
+       'use strict';
+
+       /**
+       * @ngdoc function
+       * @name app.service:homeService
+       * @description
+       * # homeService
+       * Service of the app
+       */
+
+       angular.module('vnfmarket')
+               .factory('homeService', homeService);
+
+       homeService.$inject = ['$http'];
+
+       function homeService($http) {
+
+               /*var list = [
+                       {"feature": "Implemented Best Practices, following: John Papa's Guide"},
+                       {"feature": "Using Controller AS syntax"},
+                       {"feature": "Wrap Angular components in an Immediately Invoked Function Expression (IIFE)"},
+                       {"feature": "Declare modules without a variable using the setter syntax"},
+                       {"feature": "Using named functions"},
+                       {"feature": "Including Unit test with Karma"},
+                       {"feature": "Including UI options for Bootstrap or Angular-Material"},
+                       {"feature": "Including Angular-Material-Icons for Angular-Material UI"},
+                       {"feature": "Dynamic Menu generator for both themes"},
+                       {"feature": "Grunt task for Production and Development"}
+               ];*/
+               var services = [
+        {
+          "name": "vEPC",
+          "vendor": "Huawei",
+          "date": "2016-11-21 23:06",
+          "desc": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed interdum fringilla laoreet. Nulla facilisi. Maecenas consequat tristique odio, in consectetur leo volutpat vitae. Ut porttitor iaculis metus sed tincidunt. Etiam facilisis nec nisi at tempus. Curabitur ultrices molestie dictum. Integer placerat varius lorem, id cursus augue vulputate quis. Nulla pulvinar vel nunc vel lacinia. Aliquam eleifend, ipsum in sodales dictum, mi risus dictum est, non hendrerit neque elit et turpis. Integer lacus massa, pulvinar eget porttitor vel, ultrices in elit. Ut convallis semper gravida. Sed mollis leo est, eget consectetur dui vestibulum a. Phasellus non augue id diam malesuada ultrices. Praesent id nunc vehicula, dapibus quam in, rhoncus lorem. Praesent mattis elit a ex elementum, vel imperdiet risus tempor. Aliquam laoreet mauris nec egestas eleifend.",
+          "downloads": 20,
+          "type":"gs-o",
+          "size":"204800",
+          "down_history":[
+            {
+              "user":"user_001",
+              "time": "2016-11-30 17:31"
+            },
+            {
+              "user":"user_002",
+              "time": "2016-11-30 14:31"
+            },
+            {
+              "user":"user_003",
+              "time": "2016-11-30 11:01"
+            },
+            {
+              "user":"user_004",
+              "time": "2016-11-30 10:03"
+            },
+            {
+              "user":"user_005",
+              "time": "2016-11-30 00:31"
+            },
+            {
+              "user":"user_006",
+              "time": "2016-11-29 19:32"
+            },
+            {
+              "user":"user_007",
+              "time": "2016-11-28 20:31"
+            },
+            {
+              "user":"user_008",
+              "time": "2016-11-20 09:11"
+            }
+          ],
+          "upl_history":[
+            {
+              "user":"user_001",
+              "time": "2016-11-30 15:31"
+            },
+            {
+              "user":"user_002",
+              "time": "2016-11-30 14:31"
+            },
+            {
+              "user":"user_003",
+              "time": "2016-11-30 11:01"
+            },
+            {
+              "user":"user_004",
+              "time": "2016-11-30 14:03"
+            },
+            {
+              "user":"user_005",
+              "time": "2016-11-30 10:31"
+            },
+            {
+              "user":"user_006",
+              "time": "2016-11-29 19:12"
+            },
+            {
+              "user":"user_007",
+              "time": "2016-11-28 02:31"
+            },
+            {
+              "user":"user_008",
+              "time": "2016-11-20 09:11"
+            }
+          ]
+        },
+        {
+          "name": "vFirewall",
+          "vendor": "Huawei",
+          "date": "2016-11-23 22:09",
+          "desc": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed interdum fringilla laoreet. Nulla facilisi. Maecenas consequat tristique odio, in consectetur leo volutpat vitae. Ut porttitor iaculis metus sed tincidunt. Etiam facilisis nec nisi at tempus. Curabitur ultrices molestie dictum. Integer placerat varius lorem, id cursus augue vulputate quis. Nulla pulvinar vel nunc vel lacinia. Aliquam eleifend, ipsum in sodales dictum, mi risus dictum est, non hendrerit neque elit et turpis. Integer lacus massa, pulvinar eget porttitor vel, ultrices in elit. Ut convallis semper gravida. Sed mollis leo est, eget consectetur dui vestibulum a. Phasellus non augue id diam malesuada ultrices. Praesent id nunc vehicula, dapibus quam in, rhoncus lorem. Praesent mattis elit a ex elementum, vel imperdiet risus tempor. Aliquam laoreet mauris nec egestas eleifend.",
+          "downloads": 25,
+          "type":"gs-o",
+          "size":"204800",
+          "down_history":[
+            {
+              "user":"user_001",
+              "time": "2016-11-30 17:31"
+            },
+            {
+              "user":"user_002",
+              "time": "2016-11-30 14:31"
+            },
+            {
+              "user":"user_003",
+              "time": "2016-11-30 11:01"
+            },
+            {
+              "user":"user_004",
+              "time": "2016-11-30 10:03"
+            },
+            {
+              "user":"user_005",
+              "time": "2016-11-30 00:31"
+            },
+            {
+              "user":"user_006",
+              "time": "2016-11-29 19:32"
+            },
+            {
+              "user":"user_007",
+              "time": "2016-11-28 20:31"
+            },
+            {
+              "user":"user_008",
+              "time": "2016-11-20 09:11"
+            }
+          ],
+          "upl_history":[
+            {
+              "user":"user_001",
+              "time": "2016-11-30 15:31"
+            },
+            {
+              "user":"user_002",
+              "time": "2016-11-30 14:31"
+            },
+            {
+              "user":"user_003",
+              "time": "2016-11-30 11:01"
+            },
+            {
+              "user":"user_004",
+              "time": "2016-11-30 14:03"
+            },
+            {
+              "user":"user_005",
+              "time": "2016-11-30 10:31"
+            },
+            {
+              "user":"user_006",
+              "time": "2016-11-29 19:12"
+            },
+            {
+              "user":"user_007",
+              "time": "2016-11-28 02:31"
+            },
+            {
+              "user":"user_008",
+              "time": "2016-11-20 09:11"
+            }
+          ]
+        },
+        {
+          "name": "vIMS",
+          "vendor": "Huawei",
+          "date": "2016-10-21 12:04",
+          "desc": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed interdum fringilla laoreet. Nulla facilisi. Maecenas consequat tristique odio, in consectetur leo volutpat vitae. Ut porttitor iaculis metus sed tincidunt. Etiam facilisis nec nisi at tempus. Curabitur ultrices molestie dictum. Integer placerat varius lorem, id cursus augue vulputate quis. Nulla pulvinar vel nunc vel lacinia. Aliquam eleifend, ipsum in sodales dictum, mi risus dictum est, non hendrerit neque elit et turpis. Integer lacus massa, pulvinar eget porttitor vel, ultrices in elit. Ut convallis semper gravida. Sed mollis leo est, eget consectetur dui vestibulum a. Phasellus non augue id diam malesuada ultrices. Praesent id nunc vehicula, dapibus quam in, rhoncus lorem. Praesent mattis elit a ex elementum, vel imperdiet risus tempor. Aliquam laoreet mauris nec egestas eleifend.",
+          "downloads": 10,
+          "type":"sdn-o",
+          "size":"104800",
+          "down_history":[
+            {
+              "user":"user_001",
+              "time": "2016-11-30 17:31"
+            },
+            {
+              "user":"user_002",
+              "time": "2016-11-30 14:31"
+            },
+            {
+              "user":"user_003",
+              "time": "2016-11-30 11:01"
+            },
+            {
+              "user":"user_004",
+              "time": "2016-11-30 10:03"
+            },
+            {
+              "user":"user_005",
+              "time": "2016-11-30 00:31"
+            },
+            {
+              "user":"user_006",
+              "time": "2016-11-29 19:32"
+            },
+            {
+              "user":"user_007",
+              "time": "2016-11-28 20:31"
+            },
+            {
+              "user":"user_008",
+              "time": "2016-11-20 09:11"
+            }
+          ],
+          "upl_history":[
+            {
+              "user":"user_001",
+              "time": "2016-11-30 15:31"
+            },
+            {
+              "user":"user_002",
+              "time": "2016-11-30 14:31"
+            },
+            {
+              "user":"user_003",
+              "time": "2016-11-30 11:01"
+            },
+            {
+              "user":"user_004",
+              "time": "2016-11-30 14:03"
+            },
+            {
+              "user":"user_005",
+              "time": "2016-11-30 10:31"
+            },
+            {
+              "user":"user_006",
+              "time": "2016-11-29 19:12"
+            },
+            {
+              "user":"user_007",
+              "time": "2016-11-28 02:31"
+            },
+            {
+              "user":"user_008",
+              "time": "2016-11-20 09:11"
+            }
+          ]
+        },
+        {
+          "name": "vLoadbalance",
+          "vendor": "ZTE",
+          "date": "2016-11-20 05:06",
+          "desc": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed interdum fringilla laoreet. Nulla facilisi. Maecenas consequat tristique odio, in consectetur leo volutpat vitae. Ut porttitor iaculis metus sed tincidunt. Etiam facilisis nec nisi at tempus. Curabitur ultrices molestie dictum. Integer placerat varius lorem, id cursus augue vulputate quis. Nulla pulvinar vel nunc vel lacinia. Aliquam eleifend, ipsum in sodales dictum, mi risus dictum est, non hendrerit neque elit et turpis. Integer lacus massa, pulvinar eget porttitor vel, ultrices in elit. Ut convallis semper gravida. Sed mollis leo est, eget consectetur dui vestibulum a. Phasellus non augue id diam malesuada ultrices. Praesent id nunc vehicula, dapibus quam in, rhoncus lorem. Praesent mattis elit a ex elementum, vel imperdiet risus tempor. Aliquam laoreet mauris nec egestas eleifend.",
+          "downloads": 319,
+          "type":"sdn-o",
+          "size":"204800",
+          "down_history":[
+            {
+              "user":"user_001",
+              "time": "2016-11-30 17:31"
+            },
+            {
+              "user":"user_002",
+              "time": "2016-11-30 14:31"
+            },
+            {
+              "user":"user_003",
+              "time": "2016-11-30 11:01"
+            },
+            {
+              "user":"user_004",
+              "time": "2016-11-30 10:03"
+            },
+            {
+              "user":"user_005",
+              "time": "2016-11-30 00:31"
+            },
+            {
+              "user":"user_006",
+              "time": "2016-11-29 19:32"
+            },
+            {
+              "user":"user_007",
+              "time": "2016-11-28 20:31"
+            },
+            {
+              "user":"user_008",
+              "time": "2016-11-20 09:11"
+            }
+          ],
+          "upl_history":[
+            {
+              "user":"user_001",
+              "time": "2016-11-30 15:31"
+            },
+            {
+              "user":"user_002",
+              "time": "2016-11-30 14:31"
+            },
+            {
+              "user":"user_003",
+              "time": "2016-11-30 11:01"
+            },
+            {
+              "user":"user_004",
+              "time": "2016-11-30 14:03"
+            },
+            {
+              "user":"user_005",
+              "time": "2016-11-30 10:31"
+            },
+            {
+              "user":"user_006",
+              "time": "2016-11-29 19:12"
+            },
+            {
+              "user":"user_007",
+              "time": "2016-11-28 02:31"
+            },
+            {
+              "user":"user_008",
+              "time": "2016-11-20 09:11"
+            }
+          ]
+        },
+        {
+          "name": "vCPE",
+          "vendor": "ZTE",
+          "date": "2016-11-03 23:06",
+          "desc": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed interdum fringilla laoreet. Nulla facilisi. Maecenas consequat tristique odio, in consectetur leo volutpat vitae. Ut porttitor iaculis metus sed tincidunt. Etiam facilisis nec nisi at tempus. Curabitur ultrices molestie dictum. Integer placerat varius lorem, id cursus augue vulputate quis. Nulla pulvinar vel nunc vel lacinia. Aliquam eleifend, ipsum in sodales dictum, mi risus dictum est, non hendrerit neque elit et turpis. Integer lacus massa, pulvinar eget porttitor vel, ultrices in elit. Ut convallis semper gravida. Sed mollis leo est, eget consectetur dui vestibulum a. Phasellus non augue id diam malesuada ultrices. Praesent id nunc vehicula, dapibus quam in, rhoncus lorem. Praesent mattis elit a ex elementum, vel imperdiet risus tempor. Aliquam laoreet mauris nec egestas eleifend.",
+          "downloads": 234,
+          "type":"nfv-o",
+          "size":"204800",
+          "down_history":[
+            {
+              "user":"user_001",
+              "time": "2016-11-30 17:31"
+            },
+            {
+              "user":"user_002",
+              "time": "2016-11-30 14:31"
+            },
+            {
+              "user":"user_003",
+              "time": "2016-11-30 11:01"
+            },
+            {
+              "user":"user_004",
+              "time": "2016-11-30 10:03"
+            },
+            {
+              "user":"user_005",
+              "time": "2016-11-30 00:31"
+            },
+            {
+              "user":"user_006",
+              "time": "2016-11-29 19:32"
+            },
+            {
+              "user":"user_007",
+              "time": "2016-11-28 20:31"
+            },
+            {
+              "user":"user_008",
+              "time": "2016-11-20 09:11"
+            }
+          ],
+          "upl_history":[
+            {
+              "user":"user_001",
+              "time": "2016-11-30 15:31"
+            },
+            {
+              "user":"user_002",
+              "time": "2016-11-30 14:31"
+            },
+            {
+              "user":"user_003",
+              "time": "2016-11-30 11:01"
+            },
+            {
+              "user":"user_004",
+              "time": "2016-11-30 14:03"
+            },
+            {
+              "user":"user_005",
+              "time": "2016-11-30 10:31"
+            },
+            {
+              "user":"user_006",
+              "time": "2016-11-29 19:12"
+            },
+            {
+              "user":"user_007",
+              "time": "2016-11-28 02:31"
+            },
+            {
+              "user":"user_008",
+              "time": "2016-11-20 09:11"
+            }
+          ]
+        },
+        {
+          "name": "openimscore",
+          "vendor": "Intel",
+          "date": "2016-11-20 17:06",
+          "desc": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed interdum fringilla laoreet. Nulla facilisi. Maecenas consequat tristique odio, in consectetur leo volutpat vitae. Ut porttitor iaculis metus sed tincidunt. Etiam facilisis nec nisi at tempus. Curabitur ultrices molestie dictum. Integer placerat varius lorem, id cursus augue vulputate quis. Nulla pulvinar vel nunc vel lacinia. Aliquam eleifend, ipsum in sodales dictum, mi risus dictum est, non hendrerit neque elit et turpis. Integer lacus massa, pulvinar eget porttitor vel, ultrices in elit. Ut convallis semper gravida. Sed mollis leo est, eget consectetur dui vestibulum a. Phasellus non augue id diam malesuada ultrices. Praesent id nunc vehicula, dapibus quam in, rhoncus lorem. Praesent mattis elit a ex elementum, vel imperdiet risus tempor. Aliquam laoreet mauris nec egestas eleifend.",
+          "downloads": 45,
+          "type":"nfv-o",
+          "size":"204800",
+          "down_history":[
+            {
+              "user":"user_001",
+              "time": "2016-11-30 17:31"
+            },
+            {
+              "user":"user_002",
+              "time": "2016-11-30 14:31"
+            },
+            {
+              "user":"user_003",
+              "time": "2016-11-30 11:01"
+            },
+            {
+              "user":"user_004",
+              "time": "2016-11-30 10:03"
+            },
+            {
+              "user":"user_005",
+              "time": "2016-11-30 00:31"
+            },
+            {
+              "user":"user_006",
+              "time": "2016-11-29 19:32"
+            },
+            {
+              "user":"user_007",
+              "time": "2016-11-28 20:31"
+            },
+            {
+              "user":"user_008",
+              "time": "2016-11-20 09:11"
+            }
+          ],
+          "upl_history":[
+            {
+              "user":"user_001",
+              "time": "2016-11-30 15:31"
+            },
+            {
+              "user":"user_002",
+              "time": "2016-11-30 14:31"
+            },
+            {
+              "user":"user_003",
+              "time": "2016-11-30 11:01"
+            },
+            {
+              "user":"user_004",
+              "time": "2016-11-30 14:03"
+            },
+            {
+              "user":"user_005",
+              "time": "2016-11-30 10:31"
+            },
+            {
+              "user":"user_006",
+              "time": "2016-11-29 19:12"
+            },
+            {
+              "user":"user_007",
+              "time": "2016-11-28 02:31"
+            },
+            {
+              "user":"user_008",
+              "time": "2016-11-20 09:11"
+            }
+          ]
+        },
+        {
+          "name": "openims",
+          "vendor": "Intel",
+          "date": "2016-11-20 12:06",
+          "desc": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed interdum fringilla laoreet. Nulla facilisi. Maecenas consequat tristique odio, in consectetur leo volutpat vitae. Ut porttitor iaculis metus sed tincidunt. Etiam facilisis nec nisi at tempus. Curabitur ultrices molestie dictum. Integer placerat varius lorem, id cursus augue vulputate quis. Nulla pulvinar vel nunc vel lacinia. Aliquam eleifend, ipsum in sodales dictum, mi risus dictum est, non hendrerit neque elit et turpis. Integer lacus massa, pulvinar eget porttitor vel, ultrices in elit. Ut convallis semper gravida. Sed mollis leo est, eget consectetur dui vestibulum a. Phasellus non augue id diam malesuada ultrices. Praesent id nunc vehicula, dapibus quam in, rhoncus lorem. Praesent mattis elit a ex elementum, vel imperdiet risus tempor. Aliquam laoreet mauris nec egestas eleifend.",
+          "downloads": 21,
+          "type":"sdn-o",
+          "size":"204800",
+          "down_history":[
+            {
+              "user":"user_001",
+              "time": "2016-11-30 17:31"
+            },
+            {
+              "user":"user_002",
+              "time": "2016-11-30 14:31"
+            },
+            {
+              "user":"user_003",
+              "time": "2016-11-30 11:01"
+            },
+            {
+              "user":"user_004",
+              "time": "2016-11-30 10:03"
+            },
+            {
+              "user":"user_005",
+              "time": "2016-11-30 00:31"
+            },
+            {
+              "user":"user_006",
+              "time": "2016-11-29 19:32"
+            },
+            {
+              "user":"user_007",
+              "time": "2016-11-28 20:31"
+            },
+            {
+              "user":"user_008",
+              "time": "2016-11-20 09:11"
+            }
+          ],
+          "upl_history":[
+            {
+              "user":"user_001",
+              "time": "2016-11-30 15:31"
+            },
+            {
+              "user":"user_002",
+              "time": "2016-11-30 14:31"
+            },
+            {
+              "user":"user_003",
+              "time": "2016-11-30 11:01"
+            },
+            {
+              "user":"user_004",
+              "time": "2016-11-30 14:03"
+            },
+            {
+              "user":"user_005",
+              "time": "2016-11-30 10:31"
+            },
+            {
+              "user":"user_006",
+              "time": "2016-11-29 19:12"
+            },
+            {
+              "user":"user_007",
+              "time": "2016-11-28 02:31"
+            },
+            {
+              "user":"user_008",
+              "time": "2016-11-20 09:11"
+            }
+          ]
+        },
+        {
+          "name": "vCPE",
+          "vendor": "Huawei",
+          "date": "2016-11-19 23:06",
+          "desc": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed interdum fringilla laoreet. Nulla facilisi. Maecenas consequat tristique odio, in consectetur leo volutpat vitae. Ut porttitor iaculis metus sed tincidunt. Etiam facilisis nec nisi at tempus. Curabitur ultrices molestie dictum. Integer placerat varius lorem, id cursus augue vulputate quis. Nulla pulvinar vel nunc vel lacinia. Aliquam eleifend, ipsum in sodales dictum, mi risus dictum est, non hendrerit neque elit et turpis. Integer lacus massa, pulvinar eget porttitor vel, ultrices in elit. Ut convallis semper gravida. Sed mollis leo est, eget consectetur dui vestibulum a. Phasellus non augue id diam malesuada ultrices. Praesent id nunc vehicula, dapibus quam in, rhoncus lorem. Praesent mattis elit a ex elementum, vel imperdiet risus tempor. Aliquam laoreet mauris nec egestas eleifend.",
+          "downloads": 408,
+          "type":"nfv-o",
+          "size":"204800",
+          "down_history":[
+            {
+              "user":"user_001",
+              "time": "2016-11-30 17:31"
+            },
+            {
+              "user":"user_002",
+              "time": "2016-11-30 14:31"
+            },
+            {
+              "user":"user_003",
+              "time": "2016-11-30 11:01"
+            },
+            {
+              "user":"user_004",
+              "time": "2016-11-30 10:03"
+            },
+            {
+              "user":"user_005",
+              "time": "2016-11-30 00:31"
+            },
+            {
+              "user":"user_006",
+              "time": "2016-11-29 19:32"
+            },
+            {
+              "user":"user_007",
+              "time": "2016-11-28 20:31"
+            },
+            {
+              "user":"user_008",
+              "time": "2016-11-20 09:11"
+            }
+          ],
+          "upl_history":[
+            {
+              "user":"user_001",
+              "time": "2016-11-30 15:31"
+            },
+            {
+              "user":"user_002",
+              "time": "2016-11-30 14:31"
+            },
+            {
+              "user":"user_003",
+              "time": "2016-11-30 11:01"
+            },
+            {
+              "user":"user_004",
+              "time": "2016-11-30 14:03"
+            },
+            {
+              "user":"user_005",
+              "time": "2016-11-30 10:31"
+            },
+            {
+              "user":"user_006",
+              "time": "2016-11-29 19:12"
+            },
+            {
+              "user":"user_007",
+              "time": "2016-11-28 02:31"
+            },
+            {
+              "user":"user_008",
+              "time": "2016-11-20 09:11"
+            }
+          ]
+        },
+        {
+          "name": "vCPE",
+          "vendor": "Siemens",
+          "date": "2016-11-20 12:06",
+          "desc": "Dolore ex deserunt aute fugiat aute nulla ea sunt aliqua nisi cupidatat eu. Nostrud in laboris labore nisi amet do dolor eu fugiat consectetur elit cillum esse",
+          "downloads": 120,
+          "type":"sdn-o",
+          "size":"204800",
+          "down_history":[
+            {
+              "user":"user_001",
+              "time": "2016-11-30 17:31"
+            },
+            {
+              "user":"user_002",
+              "time": "2016-11-30 14:31"
+            },
+            {
+              "user":"user_003",
+              "time": "2016-11-30 11:01"
+            },
+            {
+              "user":"user_004",
+              "time": "2016-11-30 10:03"
+            },
+            {
+              "user":"user_005",
+              "time": "2016-11-30 00:31"
+            },
+            {
+              "user":"user_006",
+              "time": "2016-11-29 19:32"
+            },
+            {
+              "user":"user_007",
+              "time": "2016-11-28 20:31"
+            },
+            {
+              "user":"user_008",
+              "time": "2016-11-20 09:11"
+            }
+          ],
+          "upl_history":[
+            {
+              "user":"user_001",
+              "time": "2016-11-30 15:31"
+            },
+            {
+              "user":"user_002",
+              "time": "2016-11-30 14:31"
+            },
+            {
+              "user":"user_003",
+              "time": "2016-11-30 11:01"
+            },
+            {
+              "user":"user_004",
+              "time": "2016-11-30 14:03"
+            },
+            {
+              "user":"user_005",
+              "time": "2016-11-30 10:31"
+            },
+            {
+              "user":"user_006",
+              "time": "2016-11-29 19:12"
+            },
+            {
+              "user":"user_007",
+              "time": "2016-11-28 02:31"
+            },
+            {
+              "user":"user_008",
+              "time": "2016-11-20 09:11"
+            }
+          ]
+        }
+      ];
+
+               return {
+                       getFeaturesList: getFeaturesList
+               };
+
+               function getFeaturesList() {
+                       return services;
+               }
+
+       }
+
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/layouts/main-page/main-page.html b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/layouts/main-page/main-page.html
new file mode 100644 (file)
index 0000000..ec86a64
--- /dev/null
@@ -0,0 +1,76 @@
+<!--
+  Copyright 2016-2017 Huawei Technologies Co., Ltd.
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+    <md-toolbar ng-show="!showSearch">
+        <div class="md-toolbar-tools">
+            <md-button ng-click="layout.toggleSidenav('left')" hide-gt-md aria-label="Menu">
+                <ng-md-icon icon="menu"></ng-md-icon>
+            </md-button>
+            <h3>
+                <a href="/">vnfmarket</a>
+            </h3>
+            <span flex></span>
+            <md-button aria-label="Search" ng-click="showSearch = !showSearch">
+                <ng-md-icon icon="search"></ng-md-icon>
+            </md-button>
+            <md-menu>
+                <md-button aria-label="Open Settings" ng-click="layout.openMenu($mdOpenMenu, $event)">
+                            <md-icon> more_vert </md-icon>
+                </md-button>
+                <md-menu-content width="4">
+                    <md-menu-item>
+                        <md-button ng-click="layout.changeProfile($event)">
+                            <md-icon>face</md-icon>
+                            Profile
+                        </md-button>
+                    </md-menu-item>
+                    <md-menu-item>
+                        <md-button ng-click="layout.changePassword()">
+                            <md-icon>lock</md-icon>
+                            Password
+                        </md-button>
+                    </md-menu-item>
+                    <md-menu-divider></md-menu-divider>
+                    <md-menu-item>
+                        <md-button ng-click="layout.logOut()">
+                            <md-icon>power_settings_new</md-icon>
+                            Logout
+                        </md-button>
+                    </md-menu-item>
+                </md-menu-content>
+            </md-menu>
+        </div>
+    </md-toolbar>
+    <md-toolbar class="md-hue-1" ng-show="showSearch">
+        <div class="md-toolbar-tools">
+            <md-button ng-click="showSearch = !showSearch" aria-label="Back">
+                <ng-md-icon icon="arrow_back"></ng-md-icon>
+            </md-button>
+            <h3 flex="10">
+                Back
+            </h3>
+            <md-input-container md-theme="input" flex>
+                <label>&nbsp;</label>
+                <input ng-model="search.who" placeholder="Search ...">
+            </md-input-container>
+
+        </div>
+    </md-toolbar>
+    <md-content class="md-blue-grey-theme" flex md-scroll-y>
+        <ui-view layout="column" layout-fill layout-padding>
+
+
+        </ui-view>
+    </md-content>
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/layouts/main-page/mainPageCtrl.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/layouts/main-page/mainPageCtrl.js
new file mode 100644 (file)
index 0000000..24ae3ef
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+(function () {
+       'use strict';
+
+       /**
+       * @ngdoc function
+       * @name app.controller:LayoutCtrl
+       * @description
+       * # LayoutCtrl
+       * Controller of the app
+       */
+
+       angular
+               .module('vnfmarket')
+               .controller('LayoutCtrl', Layout);
+
+       Layout.$inject = ['$mdSidenav', '$cookies', '$state', '$mdToast', '$mdDialog'];
+
+       /*
+       * recommend
+       * Using function declarations
+       * and bindable members up top.
+       */
+
+       function Layout($mdSidenav, $cookies, $state, $mdToast, $mdDialog ) {
+               /*jshint validthis: true */
+               var vm = this;
+
+               vm.toggleSidenav = function (menuId) {
+                       $mdSidenav(menuId).toggle();
+               };
+
+               vm.changePassword = function () {
+                       $mdToast.show(
+                               $mdToast.simple()
+                               .content('Password clicked!')
+                               .position('top right')
+                               .hideDelay(2000)
+                       );
+               };
+
+               vm.changeProfile = function (ev) {
+                       $mdDialog.show({
+                               controller: DialogController,
+                               templateUrl: 'tabDialog.tmpl.html',
+                               parent: angular.element(document.body),
+                               targetEvent: ev,
+                               clickOutsideToClose:true
+                       })
+                       .then(function(answer) {
+                               $mdToast.show(
+                                       $mdToast.simple()
+                                       .content('You said the information was "' + answer + '".')
+                                       .position('top right')
+                                       .hideDelay(2000)
+                               );
+
+                       }, function() {
+                               $mdToast.show(
+                                       $mdToast.simple()
+                                       .content('You cancelled the dialog.')
+                                       .position('top right')
+                                       .hideDelay(2000)
+                               );
+                       });
+
+                       function DialogController($scope, $mdDialog) {
+                               $scope.hide = function() {
+                                       $mdDialog.hide();
+                               };
+
+                               $scope.cancel = function() {
+                                       $mdDialog.cancel();
+                               };
+
+                               $scope.answer = function(answer) {
+                                       $mdDialog.hide(answer);
+                               };
+                       }
+               };
+
+
+               vm.logOut = function () {
+
+                       alert('Implement your Function Here');
+                       // $cookies.put('dev_appserver_login', ' ');
+                       //$state.go('out', {}, {reload: true});
+
+               };
+
+               var originatorEv;
+               vm.openMenu = function ($mdOpenMenu, ev) {
+                       originatorEv = ev;
+                       $mdOpenMenu(ev);
+               };
+
+       }
+
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/layouts/nav-bar/navBarService.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/layouts/nav-bar/navBarService.js
new file mode 100644 (file)
index 0000000..4fecf26
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+(function() {
+       'use strict';
+
+       /**
+        * @ngdoc function
+        * @name app.service:menuService
+        * @description
+        * # menuService
+        * Service of the app
+        */
+
+       angular
+               .module('vnfmarket')
+               .factory('MenuService', Menu);
+               // Inject your dependencies as .$inject = ['$http', 'someSevide'];
+               // function Name ($http, someSevide) {...}
+
+               Menu.$inject = ['$http'];
+
+               function Menu ($http) {
+
+                       var menu = [
+
+                                       {
+                                               link: 'user',
+                                                       name: 'User'
+                                       },
+
+                                       {
+                                               link: 'marketplace',
+                                                       name: 'Marketplace'
+                                       },
+
+                                       {
+                                               link: 'about',
+                                                       name: 'About'
+                                       },
+
+                       ];
+
+                       return {
+                               listMenu: function () {
+                                       return menu;
+                               }
+                       }
+
+               }
+
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/layouts/side-nav/sidenav.html b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/layouts/side-nav/sidenav.html
new file mode 100644 (file)
index 0000000..9028bc0
--- /dev/null
@@ -0,0 +1,46 @@
+<!--
+  Copyright 2016-2017 Huawei Technologies Co., Ltd.
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+        <md-toolbar class="md-tall md-hue-2">
+            <div layout="column" class="md-toolbar-tools-bottom inset">
+                <div layout="row">
+                    <div flex="20">
+                        <img style="width: 36px; height: 36px; border-radius: 50%"
+                             actual-src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAUDBAsMBgkICQcJCQgGCQcGBgYFBgcHBQkGBgUHCQcGBgcHChwXBwgaCQcHGCEMGhERHxMfBxciGCIeGBAeHxIBBQUFBwcFDAgIBxIIBQgSHhISEhISHhISEhISHh4SEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEv/AABEIAGAAYAMBIgACEQEDEQH/xAAcAAACAwEBAQEAAAAAAAAAAAAHCAMFBgQCAQD/xAA6EAABAgQDBQYFAQgDAQAAAAACAQMABBESBQYiByExMkETQlFSYWIIcXKBoSMzgpGSorLR8BQk4RX/xAAWAQEBAQAAAAAAAAAAAAAAAAAAAQL/xAAWEQEBAQAAAAAAAAAAAAAAAAAAARH/2gAMAwEAAhEDEQA/AG0WPx9I+RDOPIIqS+F0BVZyx5uUknZpw0RGBU9XTTCJbRs6zGI4icw66pNiRCwBUsFoVXSm7wpBF+JraOr75yDRr2LSkLpCVBMx7q06ekAFmbVCUV7yRETg4pP7y3B+YmfcRw7b6J3fNp7sRYPhrkxMCy2JEpeX/wAg97NdkjQEL02KHuG0D6FAAl3CnFqQtOKgr3RVRX3cIv8AD2Udl1lyAxcG20iFUG4e7SGvYy/Ltgggw2iD3bEivm8uS6uoX/GBFrdcI01faGGFJk5pyVnbhJW3GjuElGhad/VIcfYRtHHEJImjokzLgHaj5htp2iRgtoORWJlg9CA4IkQmA6rresCfY9i7mHZqbaKqC6RSrgFzEJlQa19YqnmU/GPKxzST1wpTjQf7Y6C9YCzJeMYra1mQJbCXSUqOECi343EOn7RsDPSvyhZfivxYhsADWggREIlu1ad6QC05mxHtZpwlJVUjMi+ojVbv49Ipe0W/0H+7uxYtYM8Uq5OtgJtMLa5aVXUu3dpZ4V6xYbOsrnPT7cu3dqISdMR5Wh5oygnfDlhaFMG6o8qW3W8ChjmJe2lOb3cvhGXy3l+Xw+TS3TYn6h8CX3LHO9tPkBPsldVLVISIh4xpWyqq+u/+rhHG/dduHqo/LzRVS2epAhEhnARfKW4rvWJix1shV1sk7MSAbxLStxaoD5ijaoBcV3W28Kwv+0PCSbxmUm03K66PL5rq7oOuPTwqFwEhXd4SSkYvMWFJMnJEttrU2yThdLL0ur9oA/5ecXsGitVFNpkv5mki2UvvEEkgoAiNEQUtbt5bB3D+I9ksBNiszawZr3RUrvaIwnXxD48B313uvl5tKNCX43Q1OfcQskHNNVMCBsB4qRpuhBNoc45/9F4Xq1E1HV0tKgjv9IlSrfIcyIybulVQQUCpyqJFXekEz4ZZFtDmnUFaitt3tMuVIHGxdgXH3mnBq2QFp9x7hgy7DcFclX5wTGjbpj2Hrq6xBqc/TAixruVvvCnFRgF5rxiVSYQBkyRT5SMKcxUhn5uSA+Iou7lIajGAzhk9tzWjQK4K/p6E3fKNKCOHygEe9qlpfLveEEzHHf8Aj5cuCo3qkWGXtnVrvbPnRSW+xOVfcsaTPuBg5hJs7lQQ/Tt8w8v3gFmHM0wswgBMm2hLaQ7zC2CfkybdZk0ecnEdR9wBbAh0jaSKVPWkU2GZaQXUvY1abdPH5+Mdue3OxGQZaoBOvkTg920RgybPBZhClWj43NgX8wJHSZxnsjTF2Fy5cbmw+1ookXarBoP9suYBZJv2XH7VtHm+dYS3PM528469uW8iK63vEVYZTbNid8/MNIKIjTdokZUERMKq4pQrOJLrIbkVLi1D1tKJUqyyDmY5KcR8BQ0pY60Y1EvLT1rDIbN8xI+0L279XVaPdK7lhTz3cPqgqbHMdtBWriuArvndEDRMTKrQkJNSR01HmXup1jL5exds2EqSItLSr0KPmP460AWm+gXppJev5jSu6YxVFNRbbv1W3CXDV0+0RYmikwfRaEP+pAj2g577AbZGZGpJc4Vur6fSKpdtF0kouCqviNpEnKXS6njAELD3hW8TFO0aXmLzf4gRbV8YQceYBa2sANxeBOrzfyxHge0G6a/UFRR1dX1d2MjnvEhexYzTeg2BcXtTV+YjJwdguPo9IKyW8pMrCIeoENwF86UglkaQuXwszSoUySVVugCJeJcF+0MK06hcOEVosnxOOqxihWFaM02gueojTTC9Tn7UqcCXTBo+JTGgfxFRQhPsG7bhKooRU4QF3G06kteYYlSvDqcBi0ydPk3ODQqXrq+mKevjXT4xNhy/9gfaoxEHbCMwUESQ046vWB/tEzI4/iPZNkqgCCIjdpQuscU2+4GneiElzZf4jKuvEjpFdRdRe6Au3cKdLTeirTmujyOX6ftHwH96Kg8UctQUdX/fGIXZkl5iUl90BMqiD9wlWxeaPMsqk7duVSLVd5iWORVrx/ej2waoS0410l4QDX/D480MujQigqQCJW0/aiWr8QYmpi3h4wpuw/GibnGxUuYv4kWlfxDQsPIo7+9qt8NMVSLYtMKRKJEpGXMRFUlisdqhJHTxNYgfSkBG+VY7cCbq+g9SSK5FjswmYQHQNa0FRut8sRBZl8IF2SQTAtCaTQe9GOxrKhXKo/1cywfNm5y78gBt0PSIkBeYh61SJsx4G0WgmkAi73h8oBYHsuOjxIaU/eirfbUVtXu96C/mvBVC4LPpXxGBfjrFrtsBV1j2A6V90fEj2qwF5lDGFYmAO7cC3W/T4QwmW9q0sQiJnYVBu7XoXpCwSyav93RMZrdcm5fNAf/Z"
+                             showloader="" loader-class="preload" loader-src="app/assets/images/loader.gif"
+                             src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAUDBAsMBgkICQcJCQgGCQcGBgYFBgcHBQkGBgUHCQcGBgcHChwXBwgaCQcHGCEMGhERHxMfBxciGCIeGBAeHxIBBQUFBwcFDAgIBxIIBQgSHhISEhISHhISEhISHh4SEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEv/AABEIAGAAYAMBIgACEQEDEQH/xAAcAAACAwEBAQEAAAAAAAAAAAAHCAMFBgQCAQD/xAA6EAABAgQDBQYFAQgDAQAAAAACAQMABBESBQYiByExMkETQlFSYWIIcXKBoSMzgpGSorLR8BQk4RX/xAAWAQEBAQAAAAAAAAAAAAAAAAAAAQL/xAAWEQEBAQAAAAAAAAAAAAAAAAAAARH/2gAMAwEAAhEDEQA/AG0WPx9I+RDOPIIqS+F0BVZyx5uUknZpw0RGBU9XTTCJbRs6zGI4icw66pNiRCwBUsFoVXSm7wpBF+JraOr75yDRr2LSkLpCVBMx7q06ekAFmbVCUV7yRETg4pP7y3B+YmfcRw7b6J3fNp7sRYPhrkxMCy2JEpeX/wAg97NdkjQEL02KHuG0D6FAAl3CnFqQtOKgr3RVRX3cIv8AD2Udl1lyAxcG20iFUG4e7SGvYy/Ltgggw2iD3bEivm8uS6uoX/GBFrdcI01faGGFJk5pyVnbhJW3GjuElGhad/VIcfYRtHHEJImjokzLgHaj5htp2iRgtoORWJlg9CA4IkQmA6rresCfY9i7mHZqbaKqC6RSrgFzEJlQa19YqnmU/GPKxzST1wpTjQf7Y6C9YCzJeMYra1mQJbCXSUqOECi343EOn7RsDPSvyhZfivxYhsADWggREIlu1ad6QC05mxHtZpwlJVUjMi+ojVbv49Ipe0W/0H+7uxYtYM8Uq5OtgJtMLa5aVXUu3dpZ4V6xYbOsrnPT7cu3dqISdMR5Wh5oygnfDlhaFMG6o8qW3W8ChjmJe2lOb3cvhGXy3l+Xw+TS3TYn6h8CX3LHO9tPkBPsldVLVISIh4xpWyqq+u/+rhHG/dduHqo/LzRVS2epAhEhnARfKW4rvWJix1shV1sk7MSAbxLStxaoD5ijaoBcV3W28Kwv+0PCSbxmUm03K66PL5rq7oOuPTwqFwEhXd4SSkYvMWFJMnJEttrU2yThdLL0ur9oA/5ecXsGitVFNpkv5mki2UvvEEkgoAiNEQUtbt5bB3D+I9ksBNiszawZr3RUrvaIwnXxD48B313uvl5tKNCX43Q1OfcQskHNNVMCBsB4qRpuhBNoc45/9F4Xq1E1HV0tKgjv9IlSrfIcyIybulVQQUCpyqJFXekEz4ZZFtDmnUFaitt3tMuVIHGxdgXH3mnBq2QFp9x7hgy7DcFclX5wTGjbpj2Hrq6xBqc/TAixruVvvCnFRgF5rxiVSYQBkyRT5SMKcxUhn5uSA+Iou7lIajGAzhk9tzWjQK4K/p6E3fKNKCOHygEe9qlpfLveEEzHHf8Aj5cuCo3qkWGXtnVrvbPnRSW+xOVfcsaTPuBg5hJs7lQQ/Tt8w8v3gFmHM0wswgBMm2hLaQ7zC2CfkybdZk0ecnEdR9wBbAh0jaSKVPWkU2GZaQXUvY1abdPH5+Mdue3OxGQZaoBOvkTg920RgybPBZhClWj43NgX8wJHSZxnsjTF2Fy5cbmw+1ookXarBoP9suYBZJv2XH7VtHm+dYS3PM528469uW8iK63vEVYZTbNid8/MNIKIjTdokZUERMKq4pQrOJLrIbkVLi1D1tKJUqyyDmY5KcR8BQ0pY60Y1EvLT1rDIbN8xI+0L279XVaPdK7lhTz3cPqgqbHMdtBWriuArvndEDRMTKrQkJNSR01HmXup1jL5exds2EqSItLSr0KPmP460AWm+gXppJev5jSu6YxVFNRbbv1W3CXDV0+0RYmikwfRaEP+pAj2g577AbZGZGpJc4Vur6fSKpdtF0kouCqviNpEnKXS6njAELD3hW8TFO0aXmLzf4gRbV8YQceYBa2sANxeBOrzfyxHge0G6a/UFRR1dX1d2MjnvEhexYzTeg2BcXtTV+YjJwdguPo9IKyW8pMrCIeoENwF86UglkaQuXwszSoUySVVugCJeJcF+0MK06hcOEVosnxOOqxihWFaM02gueojTTC9Tn7UqcCXTBo+JTGgfxFRQhPsG7bhKooRU4QF3G06kteYYlSvDqcBi0ydPk3ODQqXrq+mKevjXT4xNhy/9gfaoxEHbCMwUESQ046vWB/tEzI4/iPZNkqgCCIjdpQuscU2+4GneiElzZf4jKuvEjpFdRdRe6Au3cKdLTeirTmujyOX6ftHwH96Kg8UctQUdX/fGIXZkl5iUl90BMqiD9wlWxeaPMsqk7duVSLVd5iWORVrx/ej2waoS0410l4QDX/D480MujQigqQCJW0/aiWr8QYmpi3h4wpuw/GibnGxUuYv4kWlfxDQsPIo7+9qt8NMVSLYtMKRKJEpGXMRFUlisdqhJHTxNYgfSkBG+VY7cCbq+g9SSK5FjswmYQHQNa0FRut8sRBZl8IF2SQTAtCaTQe9GOxrKhXKo/1cywfNm5y78gBt0PSIkBeYh61SJsx4G0WgmkAi73h8oBYHsuOjxIaU/eirfbUVtXu96C/mvBVC4LPpXxGBfjrFrtsBV1j2A6V90fEj2qwF5lDGFYmAO7cC3W/T4QwmW9q0sQiJnYVBu7XoXpCwSyav93RMZrdcm5fNAf/Z">
+                    </div>
+                    <div flex="80" style="margin-top: 10px;font-size: 1em;">
+                        <div></div>
+                    </div>
+                </div>
+            </div>
+        </md-toolbar>
+        <md-list>
+            <md-list-item ng-repeat="item in vm.menu" ng-click="vm.navigateTo(item.link)" >
+                <div class="inset" ng-show="item.icon">
+                    <ng-md-icon icon="{{item.icon}}"></ng-md-icon>
+                </div>
+                <p> {{ item.name }}</p>
+            </md-list-item>
+            <md-divider></md-divider>
+            <md-subheader>Admin</md-subheader>
+            <md-list-item ng-repeat="item in vm.admin" ng-click="vm.showSettingsBottom($event)" >
+                <div class="inset">
+                    <ng-md-icon icon="{{item.icon}}"></ng-md-icon>
+                </div>
+                <p> {{ item.title }}</p>
+            </md-list-item>
+        </md-list>
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/layouts/side-nav/sidenavCtrl.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/layouts/side-nav/sidenavCtrl.js
new file mode 100644 (file)
index 0000000..4175688
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+(function () {
+       'use strict';
+
+       /**
+       * @ngdoc function
+       * @name app.controller:SidenavCtrl
+       * @description
+       * # SidenavCtrl
+       * Controller of the app
+       */
+       angular
+               .module('vnfmarket')
+               .controller('SidenavCtrl', SidenavCtrl)
+               .controller('SettingsCtrl', SettingsCtrl);
+
+       // Injecting Denpendencies
+
+       SidenavCtrl.$inject = ['$mdSidenav', '$state', '$mdBottomSheet', '$mdToast', 'MenuService', '$scope'];
+       SettingsCtrl.$inject = ['$mdBottomSheet'];
+
+       /*
+       * recommend
+       * Using function declarations
+       * and bindable members up top.
+       */
+
+       function SidenavCtrl($mdSidenav, $state, $mdBottomSheet, $mdToast, MenuService, $scope) {
+               /*jshint validthis: true */
+               var vm = this;
+
+               vm.toggleSidenav = function (menuId) {
+                       $mdSidenav(menuId).toggle();
+               };
+
+               vm.closeSidenav = function() {
+                       $mdSidenav('left').close();
+               };
+
+               // Close menu on small screen after click on menu item.
+               // Only use $scope in controllerAs when necessary; for example, publishing and subscribing events using $emit, $broadcast, $on or $watch.
+               $scope.$on('$stateChangeSuccess', vm.closeSidenav);
+
+               vm.menu = MenuService.listMenu();
+
+               vm.admin = [
+                       {
+                               link: 'showListBottomSheet($event)',
+                               title: 'Settings',
+                               icon: 'settings'
+                       }
+               ];
+
+               vm.navigateTo = function (target) {
+
+                       var page = target;
+
+                       $state.go(page);
+
+               };
+
+               vm.showSettingsBottom = function ($event) {
+                       vm.alert = '';
+                       $mdBottomSheet.show({
+                               template: '<md-bottom-sheet class="md-grid" layout="column" ng-cloak><div layout="row" layout-align="center center"><h4>With clickOutsideToClose option, drag down or press ESC to close</h4></div><md-list flex layout="row" layout-align="center center"><md-list-item ng-repeat="item in vm.items"><md-button class="md-grid-item-content" ng-click="vm.listItemClick($index)"><md-icon class="md-48">{{item.icon}}</md-icon><div class="md-grid-text"> {{ item.name }} </div></md-button></md-list-item></md-list></md-bottom-sheet>',
+                               controller: 'SettingsCtrl',
+                               controllerAs: 'vm',
+                               targetEvent: $event
+                       }).then(function (clickedItem) {
+                               $mdToast.show(
+                                       $mdToast.simple()
+                                       .content(clickedItem.name + ' clicked!')
+                                       .position('top right')
+                                       .hideDelay(2000)
+                               );
+                       });
+               };
+
+       }
+
+       function SettingsCtrl($mdBottomSheet) {
+               /*jshint validthis: true */
+               var vm = this;
+
+               vm.items = [
+                       {name: 'Roles', icon: 'assignment_ind'},
+                       {name: 'Notes', icon: 'speaker_notes'},
+                       {name: 'Tasks', icon: 'view_list'},
+                       {name: 'Inbox', icon: 'inbox'}
+               ];
+
+               vm.listItemClick = function ($index) {
+                       var clickedItem = vm.items[$index];
+                       $mdBottomSheet.hide(clickedItem);
+               };
+       }
+
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/layouts/side-nav/sidenavService.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/layouts/side-nav/sidenavService.js
new file mode 100644 (file)
index 0000000..4fecf26
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+(function() {
+       'use strict';
+
+       /**
+        * @ngdoc function
+        * @name app.service:menuService
+        * @description
+        * # menuService
+        * Service of the app
+        */
+
+       angular
+               .module('vnfmarket')
+               .factory('MenuService', Menu);
+               // Inject your dependencies as .$inject = ['$http', 'someSevide'];
+               // function Name ($http, someSevide) {...}
+
+               Menu.$inject = ['$http'];
+
+               function Menu ($http) {
+
+                       var menu = [
+
+                                       {
+                                               link: 'user',
+                                                       name: 'User'
+                                       },
+
+                                       {
+                                               link: 'marketplace',
+                                                       name: 'Marketplace'
+                                       },
+
+                                       {
+                                               link: 'about',
+                                                       name: 'About'
+                                       },
+
+                       ];
+
+                       return {
+                               listMenu: function () {
+                                       return menu;
+                               }
+                       }
+
+               }
+
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/marketplace/marketplace-test.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/marketplace/marketplace-test.js
new file mode 100644 (file)
index 0000000..1824af3
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+(function () {
+       'use strict';
+
+       /**
+        * @ngdoc function
+        * @name app.test:marketplaceTest
+        * @description
+        * # marketplaceTest
+        * Test of the app
+        */
+
+       describe('marketplace test', function () {
+               var controller = null, $scope = null;
+
+               beforeEach(function () {
+                       module('vnfmarket');
+               });
+
+               beforeEach(inject(function ($controller, $rootScope) {
+                       $scope = $rootScope.$new();
+                       controller = $controller('MarketplaceCtrl', {
+                               $scope: $scope
+                       });
+               }));
+
+               it('Should controller must be defined', function () {
+                       expect(controller).toBeDefined();
+               });
+
+       });
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/marketplace/marketplace.html b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/marketplace/marketplace.html
new file mode 100644 (file)
index 0000000..2f4dc9f
--- /dev/null
@@ -0,0 +1,22 @@
+<!--
+  Copyright 2016-2017 Huawei Technologies Co., Ltd.
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<div class="md-padding" flex layout-sm="column">
+    <md-card>
+        <md-card-content>
+            <h2 class="md-title">Content from: marketplace page</h2>
+        </md-card-content>
+    </md-card>
+</div>
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/marketplace/marketplaceCtrl.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/marketplace/marketplaceCtrl.js
new file mode 100644 (file)
index 0000000..eaca12b
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+(function() {
+       'use strict';
+
+       /**
+       * @ngdoc function
+       * @name app.controller:marketplaceCtrl
+       * @description
+       * # marketplaceCtrl
+       * Controller of the app
+       */
+
+       angular
+               .module('marketplace')
+               .controller('MarketplaceCtrl', Marketplace);
+
+               Marketplace.$inject = [];
+
+               /*
+               * recommend
+               * Using function declarations
+               * and bindable members up top.
+               */
+
+               function Marketplace() {
+                       /*jshint validthis: true */
+                       var vm = this;
+
+               }
+
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/marketplace/marketplaceModule.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/marketplace/marketplaceModule.js
new file mode 100644 (file)
index 0000000..26c5a98
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+(function () {
+       'use strict';
+
+       /**
+        * @ngdoc function
+        * @name app.module:marketplaceModule
+        * @description
+        * # marketplaceModule
+        * Module of the app
+        */
+
+       angular.module('marketplace', []);
+
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/marketplace/marketplaceRoute.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/marketplace/marketplaceRoute.js
new file mode 100644 (file)
index 0000000..a7b1dfe
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+'use strict';
+
+/**
+ * @ngdoc function
+ * @name app.route:marketplaceRoute
+ * @description
+ * # marketplaceRoute
+ * Route of the app
+ */
+
+angular.module('marketplace')
+       .config(['$stateProvider', function ($stateProvider) {
+
+               $stateProvider
+                       .state('home.marketplace', {
+                               url:'/marketplace',
+                               templateUrl: 'app/modules/marketplace/marketplace.html',
+                               controller: 'MarketplaceCtrl',
+                               controllerAs: 'vm'
+                       });
+
+
+       }]);
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/marketplace/marketplaceService.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/marketplace/marketplaceService.js
new file mode 100644 (file)
index 0000000..22fdb7b
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+(function() {
+       'use strict';
+
+       /**
+        * @ngdoc function
+        * @name app.service:marketplaceService
+        * @description
+        * # marketplaceService
+        * Service of the app
+        */
+
+       angular
+               .module('marketplace')
+               .factory('MarketplaceService', Marketplace);
+               // Inject your dependencies as .$inject = ['$http', 'someSevide'];
+               // function Name ($http, someSevide) {...}
+
+               Marketplace.$inject = ['$http'];
+
+               function Marketplace ($http) {
+
+               }
+
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/user/user-test.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/user/user-test.js
new file mode 100644 (file)
index 0000000..20693c1
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+(function () {
+       'use strict';
+
+       /**
+        * @ngdoc function
+        * @name app.test:userTest
+        * @description
+        * # userTest
+        * Test of the app
+        */
+
+       describe('user test', function () {
+               var controller = null, $scope = null;
+
+               beforeEach(function () {
+                       module('vnfmarket');
+               });
+
+               beforeEach(inject(function ($controller, $rootScope) {
+                       $scope = $rootScope.$new();
+                       controller = $controller('UserCtrl', {
+                               $scope: $scope
+                       });
+               }));
+
+               it('Should controller must be defined', function () {
+                       expect(controller).toBeDefined();
+               });
+
+       });
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/user/user.html b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/user/user.html
new file mode 100644 (file)
index 0000000..2fe411b
--- /dev/null
@@ -0,0 +1,74 @@
+<!--
+  Copyright 2016-2017 Huawei Technologies Co., Ltd.
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<div class="md-padding" flex layout-sm="column">
+    <md-card>
+        <md-card-content>
+            <h2 class="md-title">Content from: user page</h2>
+        </md-card-content>
+    </md-card>
+    <md-card>
+       <md-card-content>
+               <div class="row-fluid">
+                <div class="col-md-12">
+                    <!-- Nav tabs -->
+                    <ul class="nav nav-tabs" role="tablist">
+                      <li role="presentation" class="active"><a href="#download-hist-tab" aria-controls="download-hist-tab" role="tab" data-toggle="tab">Downloaded Services</a></li>
+                      <li role="presentation"><a href="#upload-hist-tab" aria-controls="upload-hist-tab" role="tab" data-toggle="tab">Uploaded History</a></li>
+                    </ul>
+                    <!-- Tab panes -->
+                    <div class="tab-content">
+                      <div role="tabpanel" class="tab-pane active" id="download-hist-tab">
+                        <table class="table table-striped">
+                          <thead>
+                            <th>Service Name</th>
+                            <th>Last Updated</th>
+                            <th>Vendor</th>
+                            <th>Type</th>
+                          </thead>
+                          <tbody>
+                            <tr ng-repeat="service in services">
+                              <td>{{service.name}}</td>
+                              <td>{{service.date}}</td>
+                              <td>{{service.vendor}}</td>
+                              <td>{{service.type}}</td>
+                            </tr>
+                          </tbody>
+                        </table>
+                      </div>
+                      <div role="tabpanel" class="tab-pane" id="upload-hist-tab">
+                        <table class="table table-striped">
+                          <thead>
+                            <th>Service Name</th>
+                            <th>Last Updated</th>
+                            <th>Vendor</th>
+                            <th>Type</th>
+                          </thead>
+                          <tbody>
+                            <tr ng-repeat="service in services | limitTo: 6">
+                              <td>{{service.name}}</td>
+                              <td>{{service.date}}</td>
+                              <td>{{service.vendor}}</td>
+                              <td>{{service.type}}</td>
+                            </tr>
+                          </tbody>
+                        </table>
+                        </div>
+                      </div>
+                </div>
+              </div>
+       </md-card-content>
+    </md-card>
+</div>
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/user/userCtrl.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/user/userCtrl.js
new file mode 100644 (file)
index 0000000..81de390
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+(function() {
+       'use strict';
+
+       /**
+       * @ngdoc function
+       * @name app.controller:userCtrl
+       * @description
+       * # userCtrl
+       * Controller of the app
+       */
+
+       angular
+               .module('user')
+               .controller('UserCtrl', User);
+
+               User.$inject = [];
+
+               /*
+               * recommend
+               * Using function declarations
+               * and bindable members up top.
+               */
+
+               function User() {
+                       /*jshint validthis: true */
+                       var vm = this;
+
+               }
+
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/user/userModule.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/user/userModule.js
new file mode 100644 (file)
index 0000000..290c175
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+(function () {
+       'use strict';
+
+       /**
+        * @ngdoc function
+        * @name app.module:userModule
+        * @description
+        * # userModule
+        * Module of the app
+        */
+
+       angular.module('user', []);
+
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/user/userRoute.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/user/userRoute.js
new file mode 100644 (file)
index 0000000..3986c10
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+'use strict';
+
+/**
+ * @ngdoc function
+ * @name app.route:userRoute
+ * @description
+ * # userRoute
+ * Route of the app
+ */
+
+angular.module('user')
+       .config(['$stateProvider', function ($stateProvider) {
+
+               $stateProvider
+                       .state('home.user', {
+                               url:'/user',
+                               templateUrl: 'app/modules/user/user.html',
+                               controller: 'UserCtrl',
+                               controllerAs: 'vm'
+                       });
+
+
+       }]);
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/user/userService.js b/vnfmarket-be/portal-marketplace/src/main/webapp/marketplace/modules/user/userService.js
new file mode 100644 (file)
index 0000000..a3a8f76
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+
+    Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+*/
+(function() {
+       'use strict';
+
+       /**
+        * @ngdoc function
+        * @name app.service:userService
+        * @description
+        * # userService
+        * Service of the app
+        */
+
+       angular
+               .module('user')
+               .factory('UserService', User);
+               // Inject your dependencies as .$inject = ['$http', 'someSevide'];
+               // function Name ($http, someSevide) {...}
+
+               User.$inject = ['$http'];
+
+               function User ($http) {
+
+               }
+
+})();
diff --git a/vnfmarket-be/portal-marketplace/src/main/webapp/package.json b/vnfmarket-be/portal-marketplace/src/main/webapp/package.json
new file mode 100644 (file)
index 0000000..14923af
--- /dev/null
@@ -0,0 +1,44 @@
+{
+  "name": "vnfmarket",
+  "description": "Marketplace UI for VNF Services",
+  "version": "0.0.1",
+  "author": "HTIPL",
+  "engines": {
+    "node": "0.10.x",
+    "npm": "1.4.x"
+  },
+  "scripts": {
+    "start": "grunt",
+    "test": "karma start karma.conf.js",
+    "postinstall": "bower install --config.interactive=false"
+  },
+  "dependencies": {
+    "bower": "~1.3.8",
+    "grunt-cli": "~0.1.13",
+    "glob": "~4.0.5",
+    "async": "~0.9.0",
+    "chalk": "~0.5"
+  },
+  "devDependencies": {
+    "grunt": "~0.4.1",
+    "grunt-contrib-clean": "~0.5.0",
+    "grunt-contrib-concat": "~0.3.0",
+    "grunt-contrib-connect": "~0.5.0",
+    "grunt-concurrent": "^1.0.0",
+    "grunt-contrib-jshint": "~0.6.4",
+    "grunt-contrib-uglify": "~0.2.4",
+    "grunt-contrib-watch": "~0.5.3",
+       "grunt-exec": "^0.4.6",
+    "grunt-injector": "^0.5.4",
+       "grunt-angular-templates": "^1.0.2",
+    "load-grunt-tasks": "^0.5.0",
+    "time-grunt": "^0.3.2",
+    "karma": "~0.12.0",
+    "karma-chrome-launcher": "~0.1.2",
+    "karma-coverage": "~0.2.0",
+    "karma-firefox-launcher": "~0.1.3",
+       "karma-spec-reporter": "0.0.23",
+    "karma-jasmine": "~0.2.1",
+    "karma-phantomjs-launcher": "~0.1.2"
+  }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/pom.xml b/vnfmarket-be/vnf-sdk-marketplace/pom.xml
new file mode 100644 (file)
index 0000000..7712990
--- /dev/null
@@ -0,0 +1,211 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2017 Huawei Technologies Co., Ltd.
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<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">
+    <parent>
+        <groupId>org.openo.vnf-sdk.marketplace</groupId>
+        <artifactId>vnf-sdk-marketplace-core-parent</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>vnf-sdk-marketplace</artifactId>
+    <name>vnf-sdk-marketplace/vnf-sdk-marketplace</name>
+    <packaging>war</packaging>
+    
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <cxf.version>3.1.6</cxf.version>
+        <!-- slf4j.version>1.6.1</slf4j.version> -->
+         <maven.test.skip>false</maven.test.skip>
+         <maven.test.failure.ignore>false</maven.test.failure.ignore>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-rs-client</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-http-hc</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <version>1.2.16</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openo.common-services.common-utilities</groupId>
+            <artifactId>commonlib-cbb</artifactId>
+            <version>1.1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>io.dropwizard</groupId>
+            <artifactId>dropwizard-core</artifactId>
+            <version>0.8.0</version>
+        </dependency>
+        <dependency>
+            <groupId>io.dropwizard</groupId>
+            <artifactId>dropwizard-assets</artifactId>
+            <version>0.8.0</version>
+        </dependency>
+        <dependency>
+            <groupId>io.dropwizard</groupId>
+            <artifactId>dropwizard-hibernate</artifactId>
+            <version>0.8.0</version>
+        </dependency>
+        <!-- lombok -->
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId> 
+            <version>1.16.4</version>           
+        </dependency>
+        <dependency>
+            <groupId>io.swagger</groupId>
+            <artifactId>swagger-jersey2-jaxrs</artifactId>
+            <version>1.5.3</version>
+        </dependency>
+        <!-- jersey -->
+        <dependency>
+            <groupId>org.glassfish.jersey.core</groupId>
+            <artifactId>jersey-server</artifactId>
+            <version>2.16</version>
+        </dependency>
+        <dependency>
+            <groupId>org.glassfish.jersey.media</groupId>
+            <artifactId>jersey-media-multipart</artifactId>
+            <version>2.16</version>
+        </dependency>
+        <dependency>
+            <groupId>org.glassfish.jersey.containers</groupId>
+            <artifactId>jersey-container-servlet-core</artifactId>
+            <version>2.16</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpmime</artifactId>
+            <version>4.5.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openo.common-services.common-utilities</groupId>
+            <artifactId>commonlib-restclient</artifactId>
+            <version>1.1.0-SNAPSHOT</version>
+        </dependency>
+        <!-- consumer -->
+        <dependency>
+            <groupId>com.eclipsesource.jaxrs</groupId>
+            <artifactId>consumer</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.eclipsesource.jaxrs</groupId>
+                    <artifactId>jersey-all</artifactId>
+                </exclusion>
+            </exclusions>
+            <version>5.0</version>
+        </dependency>
+        <!-- gson -->
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.2.4</version>
+        </dependency>
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>5.1.18</version>
+        </dependency>
+         <dependency>
+            <groupId>org.mybatis</groupId>
+            <artifactId>mybatis</artifactId>
+            <version>3.2.7</version>
+        </dependency>
+        <!-- UT -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.powermock</groupId>
+            <artifactId>powermock-module-junit4</artifactId>
+            <version>1.4.10</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.powermock</groupId>
+            <artifactId>powermock-api-mockito</artifactId>
+            <version>1.4.10</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jmockit</groupId>
+            <artifactId>jmockit</artifactId>
+            <version>1.19</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jmockit</groupId>
+            <artifactId>jmockit-coverage</artifactId>
+            <version>1.19</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ant</groupId>
+            <artifactId>ant</artifactId>
+            <version>1.8.2</version>
+            <scope>test</scope>
+        </dependency>
+        <!-- UT end -->
+    </dependencies>
+    <profiles>
+        <profile>
+            <id>all-tests</id>
+            <properties>
+                <build.profile.id>all-tests</build.profile.id>
+                <skip.unit.tests>false</skip.unit.tests>
+            </properties>
+        </profile>
+    </profiles>
+    <build>
+        <finalName>ROOT</finalName>
+        <plugins>
+            <!-- Used for unit tests -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.19.1</version>
+                <configuration>
+                    <forkMode>always</forkMode>
+                    <argLine>${surefireArgLine}</argLine>
+                    <skip>${maven.test.skip}</skip>
+                    <testFailureIgnore>${maven.test.failure.ignore}</testFailureIgnore>
+                    <!-- Excludes integration tests when unit tests are run. -->
+                    <excludes>
+                        <exclude>**/IT*.java</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/CommonConstant.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/CommonConstant.java
new file mode 100644 (file)
index 0000000..7345fac
--- /dev/null
@@ -0,0 +1,121 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.common;
+
+public class CommonConstant {
+  // Package Status
+  public static final String PACKAGE_STATUS_DELETING = "deleting";
+
+  public static final String PACKAGE_STATUS_DELETE_FAIL = "deleteFailed";
+
+  public static final String PACKAGE_XML_FORMAT = "xml";
+
+
+  public static final String PACKAGE_YAML_FORMAT = "yaml";
+
+  // host image progress
+
+  public static final String TOSCA_METADATA = "TOSCA-Metadata";
+
+  public static final String CSAR_VERSION_META = "version";
+
+  public static final String CSAR_TYPE_META = "type";
+
+  public static final String CSAR_PROVIDER_META = "provider";
+
+  public static final String DEFINITIONS = "Definitions";
+
+  public static final String CSAR_META = "csar.meta";
+
+  public static final String CSAR_SUFFIX = ".csar";
+
+  public static final String HTTP_HEADER_CONTENT_RANGE = "Content-Range";
+  
+  public static final  String CATALOG_CSAR_DIR_NAME = "/csar";
+  
+  public static final  String REPORT_CSAR_DIR_NAME = "/reports";
+  
+  public static final String COMETD_CHANNEL_PACKAGE_DELETE = "/package/delete";
+  
+  public static final String SUCCESS_STR = "SUCCESS";
+  
+  public static final int ONBOARDING_THREAD_COUNT = 1;
+  public static final int SUCESS = 0;
+  public static final int FAILED = -1;
+  
+  public static final  String CATALOUGE_UPLOAD_URL = "/openoapi/catalog/v1/csars";
+  
+  public static class functionTest 
+  {    
+      public static final String FUNCTEST_URL = "/openoapi/vnfsdk/v1/functest/";
+      public static final String FUNCTEST_RESULT_URL = "/openoapi/vnfsdk/v1/functest/download/";
+      public static final String FUNCTEST_OPERTYPE_ID = "functiontest";
+      public static final String FUNCTEST_PACKAGE_EXISTS = "packageExists";
+      public static final String FUNCTEST_EXEC = "functestexec";
+      
+      private functionTest() {
+      }
+  }
+    
+  public static class LifeCycleTest 
+  {    
+      public static final String LIFECYCLE_TEST_URL = "/openoapi/nslcm/v1/vnfpackage";
+      public static final String LIFECYCLE_TEST_OPERTYPE_ID = "lifecycletest";
+      public static final String LIFECYCLE_TEST_EXEC = "lifecycleTestexec";
+      private LifeCycleTest() {
+      }
+  }
+    
+  public static class HttpContext {
+
+      public static final String CONTENT_TYPE = "Content-Type";
+
+      public static final String MEDIA_TYPE_JSON = "application/json;charset=UTF-8";
+
+      public static final String URL = "url";
+
+      public static final String METHOD_TYPE = "methodType";
+
+      private HttpContext() {
+      }
+  }
+  
+  public static class MethodType {
+
+      public static final String POST = "post";
+
+      public static final String DELETE = "delete";
+
+      public static final String PUT = "put";
+
+      public static final String GET = "get";
+
+      private MethodType() {
+      }
+  }
+  
+  public static class MsbRegisterCode {
+
+      public static final int MSDB_REGISTER_RETRIES = 12;
+      public static final int MSDB_REGISTER_RETRY_SLEEP = 10000;
+      
+      public static final int MSDB_REGISTER_FILE_NOT_EXISTS = 2;
+      public static final int MSDB_REGISTER_SUCESS = 0;
+      public static final int MSDB_REGISTER_FAILED = -1;
+      private MsbRegisterCode() {
+      }
+  }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/CommonErrorResponse.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/CommonErrorResponse.java
new file mode 100644 (file)
index 0000000..853acea
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.common;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class CommonErrorResponse {
+
+  private String code;
+
+  private String message;
+
+
+  public static Object failure(String message) {
+    return message;
+  }
+
+  public CommonErrorResponse(String message) {
+    super();
+    this.message = message;
+  }
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/FileUtil.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/FileUtil.java
new file mode 100644 (file)
index 0000000..2897af6
--- /dev/null
@@ -0,0 +1,300 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.common;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.io.Resources;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+
+public final class FileUtil {
+
+    public static final Logger logger = LoggerFactory.getLogger(FileUtil.class);
+
+    private static final int BUFFER_SIZE = 2 * 1024 * 1024;
+
+    private static final int TRY_COUNT = 3;
+
+    private FileUtil() {
+
+    }
+
+
+    /**
+     * create dir.
+     * @param dir dir to create
+     * @return boolean
+     */
+    public static boolean createDirectory(String dir) {
+        File folder = new File(dir);
+        int tryCount = 0;
+        while (tryCount < TRY_COUNT) {
+            tryCount++;
+            if (!folder.exists() && !folder.mkdirs()) {
+                continue;
+            } else {
+                return true;
+            }
+        }
+
+        return folder.exists();
+    }
+
+    /**
+     * delete file.
+     * @param file the file to delete
+     * @return boolean
+     */
+    public static boolean deleteFile(File file) {
+        String hintInfo = file.isDirectory() ? "dir " : "file ";
+        boolean isFileDeleted = file.delete();
+        boolean isFileExist = file.exists();
+        if (!isFileExist) {
+            if (isFileDeleted) {
+                logger.info("delete " + hintInfo + file.getAbsolutePath());
+            } else {
+                isFileDeleted = true;
+                logger.info("file not exist. no need delete " + hintInfo + file.getAbsolutePath());
+            }
+        } else {
+            logger.info("fail to delete " + hintInfo + file.getAbsolutePath());
+        }
+        return isFileDeleted;
+    }
+
+
+    /**
+     * unzip zip file.
+     * @param zipFileName file name to zip
+     * @param extPlace extPlace
+     * @return unzip file name
+     * @throws IOException e1
+     */
+    public static ArrayList<String> unzip(String zipFileName, String extPlace) throws IOException {
+        ZipFile zipFile = null;
+        ArrayList<String> unzipFileNams = new ArrayList<String>();
+
+        try {
+            zipFile = new ZipFile(zipFileName);
+            Enumeration<?> fileEn = zipFile.entries();
+            byte[] buffer = new byte[BUFFER_SIZE];
+
+            while (fileEn.hasMoreElements()) {
+                InputStream input = null;
+                BufferedOutputStream bos = null;
+                try {
+                    ZipEntry entry = (ZipEntry) fileEn.nextElement();
+                    if (entry.isDirectory()) {
+                        continue;
+                    }
+
+                    input = zipFile.getInputStream(entry);
+                    File file = new File(extPlace, entry.getName());
+                    if (!file.getParentFile().exists()) {
+                        createDirectory(file.getParentFile().getAbsolutePath());
+                    }
+
+                    bos = new BufferedOutputStream(new FileOutputStream(file));
+                    while (true) {
+                        int length = input.read(buffer);
+                        if (length == -1) {
+                            break;
+                        }
+                        bos.write(buffer, 0, length);
+                    }
+                    unzipFileNams.add(file.getAbsolutePath());
+                } finally {
+                    closeOutputStream(bos);
+                    closeInputStream(input);
+                }
+            }
+        } finally {
+            closeZipFile(zipFile);
+        }
+        return unzipFileNams;
+    }
+
+    /**
+     * close InputStream.
+     * 
+     * @param inputStream the inputstream to close
+     */
+    public static void closeInputStream(InputStream inputStream) {
+        try {
+            if (inputStream != null) {
+                inputStream.close();
+            }
+        } catch (Exception e1) {
+            logger.info("close InputStream error!");
+        }
+    }
+
+    /**
+     * close OutputStream.
+     * 
+     * @param outputStream the output stream to close
+     */
+    public static void closeOutputStream(OutputStream outputStream) {
+        try {
+            if (outputStream != null) {
+                outputStream.close();
+            }
+        } catch (Exception e1) {
+            logger.info("close OutputStream error!");
+        }
+    }
+    
+    public static void closeFileStream(FileInputStream ifs) {
+        try {
+            if (ifs != null) {
+                ifs.close();
+            }
+        } catch (Exception e1) {
+            logger.info("close OutputStream error!");
+        }
+    }
+
+    /**
+     * close zipFile.
+     * 
+     * @param zipFile the zipFile to close
+     */
+    public static void closeZipFile(ZipFile zipFile) {
+        try {
+            if (zipFile != null) {
+                zipFile.close();
+                zipFile = null;
+            }
+        } catch (IOException e1) {
+            logger.info("close ZipFile error!");
+        }
+    }
+
+    public static boolean checkFileExists(String filePath)
+    {
+        File file = new File(filePath);
+        return file.exists();
+    }
+
+    public static boolean deleteFile(String filePath)
+    {
+        File file = new File(filePath);
+        return deleteFile(file);
+    }
+
+    public static boolean writeJsonDatatoFile(String fileAbsPath, Object obj) 
+    {   
+        logger.info("Write JsonData to file :"+fileAbsPath);
+        
+        boolean bResult = false;
+        if(checkFileExists(fileAbsPath))
+        {
+            deleteFile(fileAbsPath);
+        }
+        
+        ObjectMapper mapper = new ObjectMapper();       
+        try 
+        {
+            mapper.writeValue(new File(fileAbsPath), obj);
+            bResult = true;
+        } 
+        catch (JsonGenerationException e) 
+        {
+            logger.info("JsonGenerationException Exception: writeJsonDatatoFile-->"+fileAbsPath);
+        } 
+        catch (JsonMappingException e) 
+        {
+            logger.info("JsonMappingException Exception: writeJsonDatatoFile-->"+fileAbsPath);
+        } 
+        catch (IOException e) 
+        {
+            logger.info("IOException Exception: writeJsonDatatoFile-->"+fileAbsPath);
+        } 
+        return bResult;
+    }
+
+    public static <T> Object readJsonDatafFromFile(String fileAbsPath, Class<T> clazz)
+    {
+        if(!checkFileExists(fileAbsPath))
+        {
+            logger.info("read JsonData from file , file not found :"+fileAbsPath);
+            return null;
+        }
+        
+        logger.info("read JsonData from file :"+fileAbsPath);
+        
+        T obj = null;        
+        ObjectMapper mapper = new ObjectMapper();
+        mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+        try 
+        {
+            obj = mapper.readValue(new File(fileAbsPath), clazz);
+        } 
+        catch (JsonParseException e1) 
+        {
+            logger.info("JsonParseException Exception: writeJsonDatatoFile-->"+fileAbsPath);
+        } 
+        catch (JsonMappingException e1) 
+        {
+            logger.info("JsonMappingException Exception: writeJsonDatatoFile-->"+fileAbsPath);
+        } 
+        catch (IOException e1) 
+        {
+            logger.info("IOException Exception: writeJsonDatatoFile-->"+fileAbsPath);
+        }
+        return obj;
+    }
+    
+    public static boolean  deleteDirectory(String path) 
+    {
+        File file = new File(path);
+        return deleteDirectory(file);
+    }
+    
+    public static boolean  deleteDirectory(File file) 
+    {
+        if (!file.exists())
+        {
+            return true;          
+        }        
+        if (file.isDirectory()) 
+        {
+            for (File f : file.listFiles())
+            {
+                deleteDirectory(f);
+            }
+        }
+        return file.delete();
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/HttpServerAddrConfig.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/HttpServerAddrConfig.java
new file mode 100644 (file)
index 0000000..bb7c804
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.common;
+
+
+public class HttpServerAddrConfig {
+
+  protected static String httpServerAddress;
+
+  public static String getHttpServerAddress() {
+    return httpServerAddress;
+  }
+
+  public static void setHttpServerAddress(String httpServerAddress) {
+    HttpServerAddrConfig.httpServerAddress = httpServerAddress;
+  }
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/HttpServerPathConfig.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/HttpServerPathConfig.java
new file mode 100644 (file)
index 0000000..fab2315
--- /dev/null
@@ -0,0 +1,38 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.common;
+
+public class HttpServerPathConfig {
+  protected static String httpServerPath;
+  
+  static
+  {
+//  CatalogAppConfiguration configuration = new CatalogAppConfiguration();
+//  Config.setConfigration(configuration);
+//  Config.getConfigration().setMsbServerAddr("http://127.0.0.1:80");
+  MsbAddrConfig.setMsbAddress("http://127.0.0.1:8080");
+  HttpServerAddrConfig.setHttpServerAddress("http://127.0.0.1:8080");
+  HttpServerPathConfig.setHttpServerPath("../tomcat/webapps/ROOT/");
+  }
+
+  public static String getHttpServerPath() {
+    return httpServerPath;
+  }
+
+  public static void setHttpServerPath(String httpServerPath) {
+    HttpServerPathConfig.httpServerPath = httpServerPath;
+  }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/JsonUtil.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/JsonUtil.java
new file mode 100644 (file)
index 0000000..ba45699
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openo.vnfsdk.marketplace.common;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.codehaus.jackson.map.DeserializationConfig;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.type.TypeReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Json tools class, packaging a number of commonly used Json methods.<br>
+ * 
+ * @author
+ * @version GSO 0.5 2016-08-26
+ */
+public final class JsonUtil {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(JsonUtil.class);
+
+    private JsonUtil() {
+    }
+
+    /**
+     * Convert object to JSON.<br>
+     * 
+     * @param obj The object to be converted
+     * @return The JSON string
+     * @since GSO 0.5
+     */
+    public static String toJson(Object obj) {
+        try {
+            return new ObjectMapper().writeValueAsString(obj);
+        } catch(IOException ex) {
+            LOGGER.error("Parser to json error.", ex);
+            throw new IllegalArgumentException("Parser obj to json error, obj = " + obj, ex);
+        }
+    }
+
+    /**
+     * Convert JSON to object.<br>
+     * 
+     * @param jsonStr The JSON to be converted
+     * @param objClass The object class
+     * @return The objClass object
+     * @since GSO 0.5
+     */
+    public static <T> T fromJson(String jsonStr, Class<T> objClass) {
+        try {
+            ObjectMapper mapper = new ObjectMapper();
+            mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+            return mapper.readValue(jsonStr, objClass);
+        } catch(IOException ex) {
+            LOGGER.error("Parser to object error.", ex);
+            throw new IllegalArgumentException(
+                    "Parser json to object error, json = " + jsonStr + ", expect class = " + objClass, ex);
+        }
+    }
+
+    /**
+     * Convert JSON to object.<br>
+     * 
+     * @param jsonStr The JSON to be converted
+     * @param typeRef The object type
+     * @return The typeRef object
+     * @since GSO 0.5
+     */
+    public static <T> T fromJson(String jsonStr, TypeReference<T> typeRef) {
+        try {
+            ObjectMapper mapper = new ObjectMapper();
+            mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+            return mapper.readValue(jsonStr, typeRef);
+        } catch(IOException ex) {
+            LOGGER.error("Parser to object by type reference error.", ex);
+            throw new IllegalArgumentException(
+                    "Parser json to object error, json = " + jsonStr + ", expect type = " + typeRef.getType(), ex);
+        }
+    }
+
+    /**
+     * Turn a json file in to a java object. <br>
+     * 
+     * @param file the json file need to change.
+     * @param objClass the java class json string represent.
+     * @return the java object parsed from json string.
+     * @since GSO 0.5
+     */
+    public static <T> T fromJson(File file, Class<T> objClass) {
+        try {
+
+            ObjectMapper mapper = new ObjectMapper();
+
+            mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+            return mapper.readValue(file, objClass);
+        } catch(IOException ex) {
+            LOGGER.error("Parser to object error.", ex);
+            throw new IllegalArgumentException(
+                    "Parser json to object error, file = " + file.getName() + ", expect class = " + objClass, ex);
+        }
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/MsbAddrConfig.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/MsbAddrConfig.java
new file mode 100644 (file)
index 0000000..9d0e5ec
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.common;
+
+public class MsbAddrConfig {
+
+  protected static String msbAddress;
+
+  public static String getMsbAddress() {
+    return msbAddress;
+  }
+
+  public static void setMsbAddress(String msbAddress) {
+    MsbAddrConfig.msbAddress = msbAddress;
+  }
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/RestUtil.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/RestUtil.java
new file mode 100644 (file)
index 0000000..fe3c487
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.common;
+
+import javax.ws.rs.core.Response;
+
+
+public class RestUtil {
+
+  /**
+   * get rest exception.
+   * @param errorMsg error message
+   * @return Response
+   */
+  public static Response getRestException(String errorMsg) {
+    String code = "001";
+    return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
+                .entity(new CommonErrorResponse(errorMsg)).build();
+  }
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/ToolUtil.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/common/ToolUtil.java
new file mode 100644 (file)
index 0000000..d64e064
--- /dev/null
@@ -0,0 +1,369 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.common;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.UUID;
+
+
+
+/**
+ * common utility class.
+ * 
+ */
+public class ToolUtil {
+  private static final Logger LOG = LoggerFactory.getLogger(ToolUtil.class);
+
+  public static final String CATALOGUE_CSAR_DIR_NAME = "csar";
+
+  public static final String CATALOGUE_IMAGE_DIR_NAME = "image";
+
+  public static final int FILE_PERCENT = 1024 * 1024; // 1M
+
+  public static boolean isEmptyString(String val) {
+    return val == null || "".equals(val);
+  }
+
+  public static boolean isTrimedEmptyString(String val) {
+    return val == null || "".equals(val.trim());
+  }
+
+  public static boolean isTrimedEmptyArray(String[] val) {
+    return val == null || val.length == 0;
+  }
+
+  /**
+   * trimed string.
+   * 
+   * @param val string array to trim
+   * @return String[]
+   */
+  public static String[] trimedStringArray(String[] val) {
+    if (isTrimedEmptyArray(val)) {
+      return val;
+    }
+
+    String[] rets = new String[val.length];
+    for (int i = 0; i < val.length; i++) {
+      rets[i] = val[i].trim();
+    }
+    return rets;
+  }
+
+  public static boolean isEmptyCollection(Collection<?> coll) {
+    return null == coll || coll.isEmpty();
+  }
+
+  /**
+   * store chunk file to local temp directory.
+   * 
+   * @param dirName directory name
+   * @param fileName file name
+   * @param uploadedInputStream upload input stream
+   * @return String
+   * @throws IOException e
+   */
+  public static String storeChunkFileInLocal(String dirName, String fileName,
+      InputStream uploadedInputStream) throws IOException {
+    File tmpDir = new File(dirName);
+    LOG.info("tmpdir = " + File.separator + dirName);
+    if (!tmpDir.exists()) {
+      tmpDir.mkdirs();
+    }
+    File file = new File(tmpDir + File.separator + fileName);
+    OutputStream os = null;
+    try {
+      int read = 0;
+      byte[] bytes = new byte[1024];
+      os = new FileOutputStream(file, true);
+      while ((read = uploadedInputStream.read(bytes)) != -1) {
+        os.write(bytes, 0, read);
+      }
+      os.flush();
+      return file.getAbsolutePath();
+    } finally {
+      if (os != null) {
+        os.close();
+      }
+    }
+  }
+
+  /**
+   * get temp dirctory when upload package.
+   * 
+   * @param dirName temp directory name
+   * @param fileName package name
+   * @return String
+   */
+  public static String getTempDir(String dirName, String fileName) {
+    // File tmpDir = new File(File.separator + dirName);
+    return Thread.currentThread().getContextClassLoader().getResource("/").getPath() + dirName + File.separator
+        + fileName.replace(".csar", "");
+  }
+
+  public static String getUnzipDir(String dirName) {
+    File tmpDir = new File(File.separator + dirName);
+    return tmpDir.getAbsolutePath().replace(".csar", "");
+  }
+
+  /**
+   * delete file.
+   * 
+   * @param dirName the directory of file
+   * @param fileName file name
+   * @return boolean
+   */
+  public static boolean deleteFile(String dirName, String fileName) {
+    File tmpDir = new File(getCataloguePath() + File.separator + dirName);
+    if (!tmpDir.exists()) {
+      return true;
+    }
+    File file = new File(tmpDir.getAbsolutePath() + File.separator + fileName);
+    if (file.exists()) {
+      return file.delete();
+    }
+    return true;
+  }
+
+  public static String getCataloguePath() {
+//    return Config.getConfigration().getCataloguePath();
+         return "";
+  }
+
+  public static String getCatalogueCsarPath() {
+    return getCataloguePath() + File.separator + CATALOGUE_CSAR_DIR_NAME;
+  }
+
+  public static String getCatalogueImagePath() {
+    return getCataloguePath() + File.separator + CATALOGUE_IMAGE_DIR_NAME;
+  }
+
+  /**
+   * get file size.
+   * 
+   * @param file file which to get the size
+   * @param fileUnit file unit
+   * @return String file size
+   */
+  public static String getFileSize(File file, int fileUnit) {
+    String fileSize = "";
+    DecimalFormat format = new DecimalFormat("#0.00");
+    if (file.exists()) {
+      fileSize = format.format((double) file.length() / fileUnit) + "M";
+    }
+    return fileSize;
+  }
+
+  public static String formatFileSize(double fileLength, int fileUnit) {
+    DecimalFormat format = new DecimalFormat("#0.00");
+    return format.format(fileLength / fileUnit) + "M";
+  }
+
+  /**
+   * get file size by content.
+   * 
+   * @param contentRange content range
+   * @return String
+   */
+  public static String getFileSizeByContent(String contentRange) {
+    String size =
+        contentRange.substring(contentRange.indexOf("/") + 1, contentRange.length()).trim();
+    return formatFileSize(Double.parseDouble(size), FILE_PERCENT);
+  }
+
+  /**
+   * fix package format.
+   * 
+   * @param csarId package ID
+   * @return String
+   */
+  public static String formatCsar(String csarId) {
+    String result = csarId;
+    if (csarId.indexOf(".csar") < 0) {
+      result += ".csar";
+    }
+    return result;
+  }
+
+
+  /**
+   * delete the file and file directory.
+   * 
+   * @param dir file
+   * @return boolean
+   */
+  public static boolean deleteDir(File dir) {
+    if (dir.isDirectory()) {
+      String[] children = dir.list();
+      for (int i = 0; i < children.length; i++) {
+        boolean success = deleteDir(new File(dir, children[i]));
+        if (!success) {
+          return false;
+        }
+      }
+    }
+    return dir.delete();
+  }
+
+  // public static boolean unZipCsar(String fileLocation) throws IOException {
+  // String tempfolder=System.getProperty("java.io.tmpdir");
+  // ArrayList<String> unzipFiles = FileUtil.unzip(fileLocation, tempfolder);
+  // if(unzipFiles.isEmpty()){
+  // return true;
+  // }
+  // }
+
+  /**
+   * judge the file's format is yaml or not.
+   * 
+   * @param file file to judge
+   * @return boolean
+   */
+  public static boolean isYamlFile(File file) {
+    if (!file.isDirectory() && file.getName().indexOf(".yaml") != -1) {
+      return true;
+    }
+    return false;
+  }
+
+  /**
+   * remove the csar suffix.
+   * 
+   * @param csarName package name
+   * @return String
+   */
+  public static String removeCsarSuffix(String csarName) {
+    return csarName.replaceAll(".csar", "");
+  }
+
+  /**
+   * add the csar fuffix.
+   * 
+   * @param csarName package name
+   * @return String
+   */
+  public static String addCsarSuffix(String csarName) {
+    if (csarName.indexOf(".csar") == -1) {
+      return csarName + ".csar";
+    }
+    return csarName;
+  }
+
+  /**
+   * process file name.
+   * 
+   * @param fileName file's name
+   * @return String
+   */
+  public static String processFileName(String fileName) {
+    int index = fileName.indexOf(".zip");
+    if (index == -1) {
+      return fileName;
+    }
+
+    return addCsarSuffix(fileName.replaceAll(".zip", ""));
+  }
+
+  /**
+   * exchange object to string.
+   * 
+   * @param obj object
+   * @return String
+   */
+  public static String objectToString(Object obj) {
+    if (obj == null) {
+      return "";
+    }
+    Gson gson = new Gson();
+    String str = gson.toJson(obj);
+    return str;
+  }
+
+  public static String generateId() {
+    return UUID.randomUUID().toString();
+  }
+
+  /**
+   * get the size format according file size.
+   * 
+   * @param fileSize file size
+   * @return size format
+   */
+  public static String getFormatFileSize(long fileSize) {
+    long kb = 1024;
+    long mb = kb * 1024;
+    long gb = mb * 1024;
+
+    if (fileSize >= gb) {
+      return String.format("%.1f GB", (float) fileSize / gb);
+    } else if (fileSize >= mb) {
+      float fi = (float) fileSize / mb;
+      return String.format(fi > 100 ? "%.0f MB" : "%.1f MB", fi);
+    } else if (fileSize >= kb) {
+      float fi = (float) fileSize / kb;
+      return String.format(fi > 100 ? "%.0f KB" : "%.1f KB", fi);
+    } else {
+      return String.format("%d B", fileSize);
+    }
+  }
+
+  /**
+   * get gson from json.
+   * @param jsonString json string
+   * @param templateClass template class
+   * @return Template
+   */
+  public static <T> T fromJson(String jsonString, Class<T> templateClass) {
+    Gson gson = new Gson();
+    return gson.fromJson(jsonString, templateClass);
+  }
+
+  /**
+   * gson to json.
+   * @param template class name
+   * @return String
+   */
+  public static <T> String toJson(T template) {
+    Gson gson = new Gson();
+    return gson.toJson(template);
+  }
+  
+  /**
+   * @param value
+   * @return
+   */
+  public static String getAsString(JsonElement value) {
+    if (value.isJsonPrimitive()) {
+      return value.getAsString();
+    }
+
+    return value.toString();
+  }
+  
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/common/MarketplaceResourceType.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/common/MarketplaceResourceType.java
new file mode 100644 (file)
index 0000000..e514091
--- /dev/null
@@ -0,0 +1,25 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.db.common;
+
+
+public enum MarketplaceResourceType {
+  SERVICETEMPLATE, PACKAGE, NODETEMPLATE, TEMPLATE, SERVICETEMPLATEMAPPING;
+
+  public static MarketplaceResourceType getType(String type) {
+    return valueOf(type);
+  }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/common/Parameters.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/common/Parameters.java
new file mode 100644 (file)
index 0000000..89416bf
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.db.common;
+
+public enum Parameters {
+  oid, name, provider, version, deletionPending, 
+  type, status, csarId, vendor, serviceTemplateId, 
+  nodeTemplateId, mappingId, nodeType;
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/connection/ConnectionUtil.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/connection/ConnectionUtil.java
new file mode 100644 (file)
index 0000000..d8c0d3a
--- /dev/null
@@ -0,0 +1,76 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openo.vnfsdk.marketplace.db.connection;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.ibatis.io.Resources;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.apache.ibatis.session.SqlSessionFactoryBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class is the session factory for the database to be used in the Driver Manager.
+ * <br/>
+ * 
+ * @author
+ * @version  
+ */
+public class ConnectionUtil {
+
+    private static SqlSessionFactory sqlSessionFactory;
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(ConnectionUtil.class);
+    
+    /**
+     * Get the DB session for the myBaties.    
+     * Constructor<br/>
+     * <p>
+     * </p>
+     * 
+     * @since   
+     */
+    private ConnectionUtil() {
+        
+    }
+
+    static {
+        InputStream inputStream;
+        try {
+            inputStream = Resources.getResourceAsStream("mybatis/configuration/configuration.xml");
+            if(null == sqlSessionFactory) {
+                LOGGER.error("begin generate");
+                sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
+                LOGGER.error("end generate = " + sqlSessionFactory);
+            }
+        } catch(FileNotFoundException ex) {
+            LOGGER.error("File Not Found Exception caught", ex);
+
+        } catch(IOException ex) {
+            LOGGER.error("IO Exception caught", ex);
+        } catch(Exception ex) {
+            LOGGER.error("some exception", ex);
+        }
+    }
+
+    public static SqlSessionFactory getSession() {
+        return sqlSessionFactory;
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/entity/BaseData.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/entity/BaseData.java
new file mode 100644 (file)
index 0000000..77acf90
--- /dev/null
@@ -0,0 +1,20 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.db.entity;
+
+public class BaseData {
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/entity/PackageData.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/entity/PackageData.java
new file mode 100644 (file)
index 0000000..ed137a3
--- /dev/null
@@ -0,0 +1,196 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.db.entity;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "catalog_package_table")
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class PackageData extends BaseData {
+
+    @Id
+    @Column(name = "CSARID")
+    private String csarId;
+    @Column(name = "DOWNLOADURi")
+    private String downloadUri;
+
+    @Column(name = "NAME")
+    private String name;
+
+    @Column(name = "SIZE")
+    private String size;
+    @Column(name = "VERSION")
+    private String version;
+
+    @Column(name = "PROVIDER")
+    private String provider;
+    @Column(name = "TYPE")
+    private String type;
+    @Column(name = "FORMAT")
+    private String format;
+
+    @Column(name = "DELETIONPENDING")
+    private String deletionPending;
+
+    @Column(name = "MODIFYTIME")
+    private String modifyTime;
+    @Column(name = "SHORTDESC")
+    private String shortDesc;
+    @Column(name = "CREATETIME")
+    private String createTime;
+    @Column(name = "DETAILS")
+    private String details;
+    @Column(name = "REMARKS")
+    private String remarks;
+    @Column(name = "REPORT")
+    private String report;
+    @Column(name = "DOWNLOADCOUNT")
+    private int downloadCount;
+
+    public String getReport() {
+        return report;
+    }
+
+    public void setReport(String report) {
+        this.report = report;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public String getProvider() {
+        return provider;
+    }
+
+    public void setProvider(String provider) {
+        this.provider = provider;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getDownloadUri() {
+        return downloadUri;
+    }
+
+    public void setDownloadUri(String downloadUri) {
+        this.downloadUri = downloadUri;
+    }
+
+    public String getSize() {
+        return size;
+    }
+
+    public void setSize(String size) {
+        this.size = size;
+    }
+
+    public String getFormat() {
+        return format;
+    }
+
+    public void setFormat(String format) {
+        this.format = format;
+    }
+
+    public String getDeletionPending() {
+        return deletionPending;
+    }
+
+    public void setDeletionPending(String deletionPending) {
+        this.deletionPending = deletionPending;
+    }
+
+    public String getModifyTime() {
+        return modifyTime;
+    }
+
+    public String getShortDesc() {
+        return shortDesc;
+    }
+
+    public void setShortDesc(String shortDesc) {
+        this.shortDesc = shortDesc;
+    }
+
+    public String getDetails() {
+        return details;
+    }
+
+    public void setDetails(String details) {
+        this.details = details;
+    }
+
+    public String getRemarks() {
+        return remarks;
+    }
+
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+
+    public void setModifyTime(String modifyTime) {
+        this.modifyTime = modifyTime;
+    }
+
+    public String getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getCsarId() {
+        return csarId;
+    }
+
+    public void setCsarId(String csarId) {
+        this.csarId = csarId;
+    }
+
+    public int getDownloadCount() {
+        return downloadCount;
+    }
+
+    public void setDownloadCount(int downloadCount) {
+        this.downloadCount = downloadCount;
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/exception/ErrorCodeException.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/exception/ErrorCodeException.java
new file mode 100644 (file)
index 0000000..93472b0
--- /dev/null
@@ -0,0 +1,144 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.db.exception;
+
+
+public class ErrorCodeException extends Exception {
+
+  private static final long serialVersionUID = 3220072444842529499L;
+  private int categoryCode = 0;
+  private int errorCode = 1;
+  private String[] arguments = null;
+
+  private static String defaultText = null;
+
+
+  public static void setDefaultText(String text) {
+    defaultText = text;
+  }
+
+
+  public static String getDefaultText() {
+    return defaultText;
+  }
+
+
+  public ErrorCodeException(int code, String debugMessage) {
+    this(code, debugMessage, null);
+  }
+
+  /**
+   * error code exception.
+   * @param code error code
+   * @param debugMessage debug message
+   * @param arguments arguments
+   */
+  public ErrorCodeException(int code, String debugMessage, String[] arguments) {
+    super(debugMessage);
+    this.errorCode = code;
+    this.arguments = arguments;
+  }
+
+
+  public ErrorCodeException(Throwable source, int code) {
+    this(source, code, (String[]) null);
+  }
+
+  /**
+   * error code exception.
+   * @param source Throwable
+   * @param code error code
+   * @param arguments arguments
+   */
+  public ErrorCodeException(Throwable source, int code, String[] arguments) {
+    super(source);
+    this.errorCode = code;
+    this.arguments = arguments;
+  }
+
+
+  public ErrorCodeException(Throwable source, int code, String debugMessage) {
+    this(source, code, debugMessage, null);
+  }
+
+  /**
+   * error code exception.
+   * @param source Throwable
+   * @param code error code
+   * @param debugMessage debug message
+   * @param arguments arguments
+   */
+  public ErrorCodeException(Throwable source, int code, String debugMessage, String[] arguments) {
+    super(debugMessage, source);
+    this.errorCode = code;
+    this.arguments = arguments;
+  }
+
+
+  public ErrorCodeException(int category, int code, String debugMessage) {
+    this(category, code, debugMessage, null);
+  }
+
+
+  public ErrorCodeException(int category, int code, String debugMessage, String[] arguments) {
+    super(debugMessage);
+    this.categoryCode = category;
+    this.errorCode = code;
+    this.arguments = arguments;
+  }
+
+
+  public ErrorCodeException(Throwable source, int category, int code) {
+    this(source, category, code, (String[]) null);
+  }
+
+
+  public ErrorCodeException(Throwable source, int category, int code, String[] arguments) {
+    super(source);
+    this.categoryCode = category;
+    this.errorCode = code;
+    this.arguments = arguments;
+  }
+
+
+  public ErrorCodeException(Throwable source, int category, int code, String debugMessage) {
+    this(source, category, code, debugMessage, null);
+  }
+
+
+  public ErrorCodeException(Throwable source, int category, int code, String debugMessage,
+      String[] arguments) {
+    super(debugMessage, source);
+    this.categoryCode = category;
+    this.errorCode = code;
+    this.arguments = arguments;
+  }
+
+
+  public int getCategory() {
+    return categoryCode;
+  }
+
+  public int getErrorCode() {
+    return errorCode;
+  }
+
+
+  public String[] getArguments() {
+    return arguments;
+  }
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/exception/MarketplaceResourceException.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/exception/MarketplaceResourceException.java
new file mode 100644 (file)
index 0000000..ed9a6ea
--- /dev/null
@@ -0,0 +1,77 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.db.exception;
+
+public class MarketplaceResourceException extends ErrorCodeException {
+  private static final long serialVersionUID = 5699508780537383310L;
+
+
+  public MarketplaceResourceException(int errcode) {
+    super(errcode, "");
+  }
+
+
+  public MarketplaceResourceException(int errcode, Throwable cause) {
+    super(cause, errcode);
+  }
+
+
+  public MarketplaceResourceException(int errcode, String message, Throwable cause) {
+    super(cause, errcode, message);
+  }
+
+
+  public MarketplaceResourceException() {
+    super(9999999, null);
+  }
+
+
+  public MarketplaceResourceException(String message) {
+    super(9999999, message);
+  }
+
+
+  public MarketplaceResourceException(Throwable cause) {
+    super(cause, 9999999);
+  }
+
+
+  public MarketplaceResourceException(String message, Throwable cause) {
+    super(cause, 9999999, message);
+  }
+
+
+  /**
+   * catalog resource exception.
+   * @param source throwable source
+   * @param errId error Id
+   * @param debugMessage debug message
+   * @param arguments arguments
+   */
+  public MarketplaceResourceException(Throwable source, int errId, String debugMessage,
+      String[] arguments) {
+    super(source, errId, debugMessage, arguments);
+  }
+
+  public MarketplaceResourceException(Throwable source, int category, int code, String debugMessage,
+      String[] arguments) {
+    super(source, category, code, debugMessage, arguments);
+  }
+
+  public int getErrcode() {
+    return super.getErrorCode();
+  }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/impl/MarketplaceDaoImpl.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/impl/MarketplaceDaoImpl.java
new file mode 100644 (file)
index 0000000..6f1f330
--- /dev/null
@@ -0,0 +1,150 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openo.vnfsdk.marketplace.db.impl;
+
+import java.util.List;
+
+import javax.persistence.PersistenceException;
+
+import org.apache.ibatis.session.SqlSession;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.openo.vnfsdk.marketplace.db.connection.ConnectionUtil;
+import org.openo.vnfsdk.marketplace.db.entity.PackageData;
+import org.openo.vnfsdk.marketplace.db.inf.IMarketplaceDao;
+import org.openo.vnfsdk.marketplace.db.mapper.IMarketplaceMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class is the implementation for the DAO Layer for Driver Manager.
+ * <br/>
+ * 
+ * @author
+ * @version  
+ */
+public class MarketplaceDaoImpl implements IMarketplaceDao {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(MarketplaceDaoImpl.class);
+
+    private SqlSessionFactory sqlSessionFactory = null;
+
+    /**
+     * 
+     * Constructor<br/>
+     * <p>
+     * </p>
+     * 
+     * @since   
+     */
+    public MarketplaceDaoImpl() {
+        sqlSessionFactory = ConnectionUtil.getSession();
+    }
+
+    /**
+     * get all package data.
+     * <br/>
+     * 
+     * @return
+     * @since    
+     */
+    public List<PackageData> getAllPackageData() {
+        SqlSession session = sqlSessionFactory.openSession();
+        List<PackageData> csars = null; 
+        try {
+            IMarketplaceMapper mapper = session.getMapper(IMarketplaceMapper.class);
+            csars = mapper.getAllPackageData();
+            session.commit();
+        } catch(PersistenceException e) {
+            LOGGER.error("Exception caught {}", e);
+//            throw new DriverManagerException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
+//                    ErrorCode.INVALID_DB);
+        } finally {
+            session.close();
+        }
+        return csars;
+    }
+
+    /**
+     * saving the package data object to the DB using the mybatis.
+     * <br/>
+     * 
+     * @param dirverInstance
+     * @since    
+     */
+       public void savePackageData(PackageData lPackageData) {
+               SqlSession session = sqlSessionFactory.openSession();
+        try {
+            IMarketplaceMapper mapper = session.getMapper(IMarketplaceMapper.class);
+            mapper.savePackageData(lPackageData);
+            session.commit();
+        } catch(PersistenceException e) {
+            LOGGER.error("Exception caught {}", e);
+//            throw new DriverManagerException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
+//                    ErrorCode.INVALID_DB);
+        } finally {
+            session.close();
+        }
+               
+       }
+
+       public List<PackageData> getPackageData(String csarId) {
+        SqlSession session = sqlSessionFactory.openSession();
+        List<PackageData> csars = null; 
+        try {
+            IMarketplaceMapper mapper = session.getMapper(IMarketplaceMapper.class);
+            csars = mapper.getPackageData(csarId);
+            session.commit();
+        } catch(PersistenceException e) {
+            LOGGER.error("Exception caught {}", e);
+//            throw new DriverManagerException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
+//                    ErrorCode.INVALID_DB);
+        } finally {
+            session.close();
+        }
+        return csars;
+       }
+
+       public void deletePackageData(String csarId) {
+        SqlSession session = sqlSessionFactory.openSession();
+        try {
+            IMarketplaceMapper mapper = session.getMapper(IMarketplaceMapper.class);
+            mapper.deletePackageData(csarId);
+            session.commit();
+        } catch(PersistenceException e) {
+            LOGGER.error("Exception caught {}", e);
+//                 throw new DriverManagerException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
+//                         ErrorCode.INVALID_DB);
+        } finally {
+            session.close();
+        }
+               
+       }
+
+    public void updatePackageData(PackageData oPackageData) {
+        SqlSession session = sqlSessionFactory.openSession();
+        try {
+            IMarketplaceMapper mapper = session.getMapper(IMarketplaceMapper.class);
+            mapper.updatePackageData(oPackageData);
+            session.commit();
+        } catch(PersistenceException e) {
+            LOGGER.error("Exception caught {}", e);
+        } finally {
+            session.close();
+        }
+        
+    }    
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/inf/IMarketplaceDao.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/inf/IMarketplaceDao.java
new file mode 100644 (file)
index 0000000..65046e6
--- /dev/null
@@ -0,0 +1,56 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openo.vnfsdk.marketplace.db.inf;
+
+import java.util.List;
+
+import org.openo.vnfsdk.marketplace.db.entity.PackageData;
+
+/**
+ * DAO Layer for the Driver Manager Service.
+ * <br/>
+ * 
+ * @author
+ * @version  
+ */
+public interface IMarketplaceDao {
+
+    /**
+     * get all package instance.
+     * <br/>
+     * 
+     * @return
+     * @since   
+     */
+    List<PackageData> getAllPackageData();
+    
+    /**
+     * saving the package instance object to the DB using the mybaties.
+     * <br/>
+     * 
+     * @param packageInstance
+     * @since   
+     */
+    void savePackageData(PackageData lPackageData);
+
+    List<PackageData> getPackageData(String csarID);
+
+       void deletePackageData(String csarId);  
+          
+       void updatePackageData(PackageData oPackageData);
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/mapper/IMarketplaceMapper.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/mapper/IMarketplaceMapper.java
new file mode 100644 (file)
index 0000000..c0c1b6f
--- /dev/null
@@ -0,0 +1,56 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openo.vnfsdk.marketplace.db.mapper;
+
+import java.util.List;
+
+import org.openo.vnfsdk.marketplace.db.entity.PackageData;
+
+/**
+ * Mapper Interface exposed to perform database operations for Driver Manager.
+ * <br/>
+ * 
+ * @author
+ * @version  
+ */
+public interface IMarketplaceMapper {
+
+    /**
+     * mybaties mapper for getAllDriverInstance
+     * <br/>
+     * 
+     * @return
+     * @since   
+     */
+    List<PackageData> getAllPackageData();
+    
+    /**
+     * saving the driver instance object to the DB using the mybaties.
+     * <br/>
+     * 
+     * @param dirverInstance
+     * @since   
+     */
+    void savePackageData(PackageData lPackageData);
+    
+    List<PackageData> getPackageData(String csarId);
+
+       void deletePackageData(String csarId);
+       
+       void updatePackageData(PackageData oPackageData);
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/resource/PackageManager.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/resource/PackageManager.java
new file mode 100644 (file)
index 0000000..7123b4e
--- /dev/null
@@ -0,0 +1,151 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.db.resource;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openo.vnfsdk.marketplace.db.common.Parameters;
+import org.openo.vnfsdk.marketplace.db.entity.PackageData;
+import org.openo.vnfsdk.marketplace.db.exception.MarketplaceResourceException;
+import org.openo.vnfsdk.marketplace.db.util.MarketplaceDbUtil;
+import org.openo.vnfsdk.marketplace.db.wrapper.PackageHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PackageManager {
+    private static final Logger LOGGER = LoggerFactory.getLogger(PackageManager.class);
+    private static PackageManager manager;
+    PackageHandler handler = new PackageHandler();
+
+    /**
+     * get PackageManager instance.
+     * @return PackageManager instance
+     */
+    public static synchronized PackageManager getInstance() {
+        if (manager == null) {
+            manager = new PackageManager();
+        }
+        return manager;
+    }
+
+    private PackageManager() {}
+
+    /**
+     * add package.
+     * @param packageData package data
+     * @return PackageData
+     * @throws MarketplaceResourceException e
+     */
+    public PackageData addPackage(PackageData packageData) throws MarketplaceResourceException {
+        LOGGER.info("start add package info  to db.info:" + MarketplaceDbUtil.objectToString(packageData));
+        PackageData data = handler.create(packageData);
+        LOGGER.info(" package info  to db end.info:" + MarketplaceDbUtil.objectToString(data));
+        return data;
+    }
+
+    /**
+     * query package by package id.
+     * @param csarId package id
+     * @return package data list
+     * @throws MarketplaceResourceException e
+     */
+    public ArrayList<PackageData> queryPackageByCsarId(String csarId)
+            throws MarketplaceResourceException {
+        LOGGER.info("start query package info by csarid." + csarId);
+        ArrayList<PackageData> data = handler.queryByID(csarId);
+        LOGGER.info("query package info end.size:" + data.size() + "detail:"
+                + MarketplaceDbUtil.objectToString(data));
+        return data;
+    }
+
+    /**
+     * query package by condition.
+     * @param name package name
+     * @param provider package provider
+     * @param version package version
+     * @param deletionPending deletionPending
+     * @param type package type
+     * @return package data list
+     * @throws MarketplaceResourceException e
+     */
+    public ArrayList<PackageData> queryPackage(String name, String provider, String version,
+            String deletionPending, String type) throws MarketplaceResourceException {
+        LOGGER.info("start query package info.name:" + name + " provider:" + provider + " version:"
+                + version + " type:" + type);
+        Map<String, String> queryParam = new HashMap<String, String>();
+        if (MarketplaceDbUtil.isNotEmpty(name)) {
+            queryParam.put(Parameters.name.name(), name);
+        }
+        if (MarketplaceDbUtil.isNotEmpty(version)) {
+            queryParam.put(Parameters.version.name(), version);
+        }
+        if (MarketplaceDbUtil.isNotEmpty(deletionPending)) {
+            queryParam.put(Parameters.deletionPending.name(), deletionPending);
+        }
+        if (MarketplaceDbUtil.isNotEmpty(type)) {
+            queryParam.put(Parameters.type.name(), type);
+        }
+        if (MarketplaceDbUtil.isNotEmpty(provider)) {
+            queryParam.put(Parameters.provider.name(), provider);
+        }
+        ArrayList<PackageData> data = handler.query(queryParam);
+        LOGGER.info("query package info end.size:" + data.size() + "detail:"
+                + MarketplaceDbUtil.objectToString(data));
+        return data;
+    }
+
+    /**
+     * delete package according package id.
+     * @param packageId package id
+     * @throws MarketplaceResourceException e
+     */
+    public void deletePackage(String packageId) throws MarketplaceResourceException {
+        LOGGER.info("start delete package info by id." + packageId);
+        handler.delete(packageId);
+        LOGGER.info(" delete package info end id." + packageId);
+    }
+
+    /**
+     * update download count of package according package id.
+     * @param packageId package id
+     * @throws MarketplaceResourceException e
+     */
+    public void updateDwonloadCount(String packageId) throws MarketplaceResourceException
+    {
+        LOGGER.info("Request received for Updating down load count for ID:" + packageId);
+
+        //STEP 1: Get the Existing download  count from DB
+        //-------------------------------------------------
+        ArrayList<PackageData> data = handler.queryByID(packageId);
+        if(data.isEmpty())
+        {
+            LOGGER.info("Package Info not foun for ID:" + packageId);
+            return;
+        }
+
+        //STEP 2: Increment download Count in DB
+        //--------------------------------------
+        PackageData oPackageData = data.get(0);
+        int idownloadcount = oPackageData.getDownloadCount();
+        oPackageData.setDownloadCount(++idownloadcount);
+
+        handler.update(oPackageData);
+
+        LOGGER.info("Download count updated to :" + idownloadcount);
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/util/MarketplaceDbUtil.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/util/MarketplaceDbUtil.java
new file mode 100644 (file)
index 0000000..f9ec997
--- /dev/null
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.db.util;
+
+
+import com.google.gson.Gson;
+
+import java.util.UUID;
+
+
+public class MarketplaceDbUtil {
+
+  public static String generateId() {
+    return UUID.randomUUID().toString();
+  }
+
+  public static boolean isNotEmpty(String str) {
+    return str != null && !"".equals(str) && str.length() > 0;
+  }
+
+  /**
+   * exchange object to string.
+   * @param obj Object
+   * @return string
+   */
+  public static String objectToString(Object obj) {
+    Gson gson = new Gson();
+    if (obj != null) {
+      return gson.toJson(obj);
+    } else {
+      return null;
+    }
+  }
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/wrapper/BaseHandler.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/wrapper/BaseHandler.java
new file mode 100644 (file)
index 0000000..0b5b285
--- /dev/null
@@ -0,0 +1,163 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.db.wrapper;
+
+import java.util.List;
+import java.util.Map;
+
+import org.openo.vnfsdk.marketplace.db.entity.BaseData;
+import org.openo.vnfsdk.marketplace.db.entity.PackageData;
+import org.openo.vnfsdk.marketplace.db.exception.MarketplaceResourceException;
+import org.openo.vnfsdk.marketplace.db.impl.MarketplaceDaoImpl;
+import org.openo.vnfsdk.marketplace.db.inf.IMarketplaceDao;
+import org.openo.vnfsdk.marketplace.db.util.MarketplaceDbUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.gson.Gson;
+
+
+
+/**
+ * an abstract class for NFV wrapper class.
+ * provide the common methods to process the CRUD rest request.
+ * 
+ */
+public abstract class BaseHandler<T extends BaseData> {
+  private static final Logger logger = LoggerFactory.getLogger(BaseHandler.class);
+
+  public Gson gson = new Gson();
+
+  /**
+   * create date. 
+   * @param data data to create
+   * @param resouceType resouce type
+   * @return T
+   * @throws MarketplaceResourceException e1
+   */
+  @SuppressWarnings({"unchecked", "rawtypes"})
+  public PackageData create(PackageData data, String resouceType) throws MarketplaceResourceException {
+       PackageData rtnData = null;
+    logger.info("BaseHandler:start create data.info:" + MarketplaceDbUtil.objectToString(data));
+    try {
+//      check(data);
+      IMarketplaceDao dao = new MarketplaceDaoImpl();
+      dao.savePackageData(data);
+      rtnData = data;
+    } catch (Exception e1) {
+      logger.error("BaseHandler:error while creating " + resouceType, e1);
+     // throw e1;
+    }
+    logger.info("BaseHandler:create data end.info:" + MarketplaceDbUtil.objectToString(data));
+    return rtnData;
+  }
+
+  /**
+   * delete data.
+   * @param data data to delete
+   * @param resouceType resource type
+   * @throws MarketplaceResourceException e1
+   */
+  @SuppressWarnings({"rawtypes", "unchecked"})
+  public void delete(T data, String resouceType) throws MarketplaceResourceException {
+    logger.info("BaseHandler:start delete data.info:" + MarketplaceDbUtil.objectToString(data));
+    IMarketplaceDao dao = new MarketplaceDaoImpl();
+    dao.deletePackageData(((PackageData)data).getCsarId());
+    logger.info("BaseHandler:delete data end");
+  }
+
+  /**
+   * query data.
+   * @param queryParam query parameter
+   * @param resouceType resource type
+   * @return T list
+   * @throws MarketplaceResourceException e1
+   */
+  @SuppressWarnings({"rawtypes", "unchecked"})
+  public List<PackageData> query(Map<String, String> queryParam, String resouceType)
+      throws MarketplaceResourceException {
+    logger.info("BaseHandler:start query data .info:" + MarketplaceDbUtil.objectToString(queryParam));
+    List<PackageData> datas = null;
+    IMarketplaceDao dao = new MarketplaceDaoImpl();
+    datas = dao.getAllPackageData();
+    logger.info("BaseHandler: query data end .info:" + MarketplaceDbUtil.objectToString(datas));
+    return datas;
+  }
+
+  /**
+   * union query.
+   * @param filter filter
+   * @param resouceType resource type
+   * @return T list
+   * @throws MarketplaceResourceException e1
+   */
+  @SuppressWarnings({"rawtypes", "unchecked"})
+  public List<T> unionQuery(String filter, String resouceType) throws MarketplaceResourceException {
+    logger.info("BaseHandler:start union query data.fliter:" + filter);
+    List<T> datas = null;
+   /* try {
+      BaseDao dao = DaoManager.getInstance().getDao(resouceType);
+      datas = dao.unionQuery(filter);
+
+    } catch (MarketplaceResourceException e1) {
+      logger.error("BaseHandler:error while union querying " + resouceType, e1);
+      throw e1;
+    }*/
+    logger.info("BaseHandler:union query data end .info:" + MarketplaceDbUtil.objectToString(datas));
+    return datas;
+  }
+
+  /**
+   * union delete.
+   * @param filter filter
+   * @param resouceType resource type
+   * @return int
+   * @throws MarketplaceResourceException e1
+   */
+  @SuppressWarnings({"rawtypes", "unchecked"})
+  public int unionDelete(String filter, String resouceType) throws MarketplaceResourceException {
+    logger.info("BaseHandler:start delete query data.fliter:" + filter);
+//    int num;
+    int num=0;
+    /*try {
+      BaseDao dao = DaoManager.getInstance().getDao(resouceType);
+      num = dao.unionDelete(filter);
+
+    } catch (MarketplaceResourceException e1) {
+      logger.error("BaseHandler:error while union delete " + resouceType, e1);
+      throw e1;
+    }*/
+    logger.info("BaseHandler:union delete data end .num:" + num);
+    return num;
+  }
+
+  @SuppressWarnings({"rawtypes", "unchecked"})
+  public void update(T data, String resouceType) throws MarketplaceResourceException {
+    logger.info("BaseHandler:start update data.info:" + MarketplaceDbUtil.objectToString(data));
+    IMarketplaceDao dao = new MarketplaceDaoImpl();
+    dao.updatePackageData((PackageData)data);
+    logger.info("update data end");
+  }
+  
+  /**
+   * check if the related object id exists in the system.
+   * 
+   * @param data data to check
+   * @throws MarketplaceResourceException e
+   */
+  public abstract void check(T data) throws MarketplaceResourceException;
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/wrapper/PackageHandler.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/db/wrapper/PackageHandler.java
new file mode 100644 (file)
index 0000000..a33e80a
--- /dev/null
@@ -0,0 +1,123 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.db.wrapper;
+
+import java.util.ArrayList;
+import java.util.Map;
+
+import org.openo.vnfsdk.marketplace.db.common.MarketplaceResourceType;
+import org.openo.vnfsdk.marketplace.db.common.Parameters;
+import org.openo.vnfsdk.marketplace.db.entity.PackageData;
+import org.openo.vnfsdk.marketplace.db.exception.MarketplaceResourceException;
+import org.openo.vnfsdk.marketplace.db.impl.MarketplaceDaoImpl;
+import org.openo.vnfsdk.marketplace.db.inf.IMarketplaceDao;
+import org.openo.vnfsdk.marketplace.db.util.MarketplaceDbUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PackageHandler extends BaseHandler<PackageData> {
+    private static final Logger logger = LoggerFactory.getLogger(PackageHandler.class);
+
+    /**
+     * create package data.
+     * @param packageData package data to create
+     * @return PackageData
+     * @throws MarketplaceResourceException e1
+     */
+    public PackageData create(PackageData packageData) throws MarketplaceResourceException {
+        logger.info("packageHandler:start create package info.");
+        PackageData data = null;
+        if (!MarketplaceDbUtil.isNotEmpty(packageData.getCsarId())) {
+
+            logger.info("packageHandler:package info does not have csarid,generate UUID.");
+            String id = MarketplaceDbUtil.generateId();
+            packageData.setCsarId(id);
+        }
+        Object result = create(packageData, MarketplaceResourceType.PACKAGE.name());
+        if (result != null) {
+            data = (PackageData) result;
+        } else {
+            logger.info("packageHandler: query package info is null.");
+        }
+        logger.info("packageHandler: create package info end.");
+        return data;
+    }
+
+    /**
+     * delete data.
+     * @param id package id
+     * @throws MarketplaceResourceException e
+     */
+    public void delete(String id) throws MarketplaceResourceException {
+        logger.info("packageHandler:start delete package info.");
+        PackageData packageData = new PackageData();
+        packageData.setCsarId(id);
+        delete(packageData, MarketplaceResourceType.PACKAGE.name());
+        logger.info("packageHandler: delete package info end.");
+    }
+
+    /**
+     * query package data by map.
+     * @param queryParam map data
+     * @return PackageData list
+     * @throws MarketplaceResourceException e
+     */
+    public ArrayList<PackageData> query(Map<String, String> queryParam)
+            throws MarketplaceResourceException {
+        logger.info("packageHandler:start query package info.");
+        ArrayList<PackageData> data = new ArrayList<PackageData>();
+        Object result = query(queryParam, MarketplaceResourceType.PACKAGE.name());
+        if (result != null) {
+            data = (ArrayList<PackageData>) result;
+        } else {
+            logger.info("packageHandler: query package info is null.");
+        }
+        logger.info("packageHandler: query package info end.");
+        return data;
+    }
+
+    /**
+     * query package data by map.
+     * @param queryParam map data
+     * @return PackageData list
+     * @throws MarketplaceResourceException e
+     */
+    public ArrayList<PackageData> queryByID(String csarID)
+            throws MarketplaceResourceException {
+        logger.info("packageHandler:start query package info.");
+        ArrayList<PackageData> data = new ArrayList<PackageData>();
+        logger.info("packageHandler:start query data .info:" + csarID);
+        IMarketplaceDao dao = new MarketplaceDaoImpl();
+        Object result = dao.getPackageData(csarID);
+        if (result != null) {
+            data = (ArrayList<PackageData>) result;
+        } else {
+            logger.info("packageHandler: query package info is null.");
+        }
+        logger.info("packageHandler: query data end .info:" + MarketplaceDbUtil.objectToString(data));
+        return data;
+    }
+
+    public void update(PackageData oPackageData) throws MarketplaceResourceException{
+        update(oPackageData, MarketplaceResourceType.PACKAGE.name());
+        logger.info("packageHandler: update package info end.");
+    }
+
+    @Override
+    public void check(PackageData packageData) throws MarketplaceResourceException {
+
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/CsarPackage.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/CsarPackage.java
new file mode 100644 (file)
index 0000000..8e8d803
--- /dev/null
@@ -0,0 +1,101 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.entity;
+
+public class CsarPackage {
+  private String id;
+  private String name;
+  private String createTime;
+  private String size;
+  private String status;
+  private String deletionPending;
+  private String format;
+  private String url;
+  private String type;
+
+  public String getId() {
+    return id;
+  }
+
+  public void setId(String id) {
+    this.id = id;
+  }
+
+  public String getFormat() {
+    return format;
+  }
+
+  public void setFormat(String format) {
+    this.format = format;
+  }
+
+  public String getUrl() {
+    return url;
+  }
+
+  public void setUrl(String url) {
+    this.url = url;
+  }
+
+  public String getType() {
+    return type;
+  }
+
+  public void setType(String type) {
+    this.type = type;
+  }
+
+  public String getDeletionPending() {
+    return deletionPending;
+  }
+
+  public void setDeletionPending(String deletionPending) {
+    this.deletionPending = deletionPending;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public String getCreateTime() {
+    return createTime;
+  }
+
+  public void setCreateTime(String createTime) {
+    this.createTime = createTime;
+  }
+
+  public String getSize() {
+    return size;
+  }
+
+  public void setSize(String size) {
+    this.size = size;
+  }
+
+  public String getStatus() {
+    return status;
+  }
+
+  public void setStatus(String status) {
+    this.status = status;
+  }
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/CsarQueryCondition.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/CsarQueryCondition.java
new file mode 100644 (file)
index 0000000..b1834f5
--- /dev/null
@@ -0,0 +1,38 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class CsarQueryCondition {
+
+  private String csarId;
+
+  private String name;
+
+  private String provider;
+
+  private String version;
+
+  private Boolean deletionPending;
+
+  private EnumType type;
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/EnumOnboardState.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/EnumOnboardState.java
new file mode 100644 (file)
index 0000000..fb527c8
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.entity;
+
+public enum EnumOnboardState {
+  onBoarded("onBoarded"), nonOnBoarded("non-onBoarded");
+
+  String value;
+
+  EnumOnboardState(String value) {
+    this.value = value;
+  }
+
+  public String getValue() {
+    return value;
+  }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/EnumOperationStatus.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/EnumOperationStatus.java
new file mode 100644 (file)
index 0000000..8a97254
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openo.vnfsdk.marketplace.entity;
+
+public enum EnumOperationStatus {
+
+    SUCCESS("SUCCESS", 0), NOTSTARTED("NOTSTARTED", 1),FAILED("FAILED", -1), INPROGRESS("INPROGRESS", 2);
+
+    private String name;
+
+    private int index;
+
+
+    EnumOperationStatus(final String name, final int index) {
+        this.name = name;
+        this.index = index;
+    }
+
+
+    public int getIndex() {
+        return index;
+    }
+
+
+    public String getName() {
+        return name;
+    }
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/EnumOperationalState.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/EnumOperationalState.java
new file mode 100644 (file)
index 0000000..cd42e72
--- /dev/null
@@ -0,0 +1,20 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.entity;
+
+public enum EnumOperationalState {
+  Enabled, Disabled
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/EnumProcessState.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/EnumProcessState.java
new file mode 100644 (file)
index 0000000..a4c08ab
--- /dev/null
@@ -0,0 +1,20 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.entity;
+
+public enum EnumProcessState {
+  normal, onBoarding, onBoardFailed, deleting, deleteFailed
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/EnumResult.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/EnumResult.java
new file mode 100644 (file)
index 0000000..462e62b
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openo.vnfsdk.marketplace.entity;
+
+/**
+ * enum of the result type
+ * 
+ * @since crossdomain 0.5
+ */
+public enum EnumResult {
+
+    SUCCESS("SUCCESS", 0), FAIL("FAIL", -1);
+
+    private String name;
+
+    private int index;
+
+    /**
+     * constructor
+     * 
+     * @param name name
+     * @param index index
+     * @since crossdomain 0.5
+     */
+    EnumResult(final String name, final int index) {
+        this.name = name;
+        this.index = index;
+    }
+
+    /**
+     * Gets index.
+     * 
+     * @return Value of index.
+     */
+    public int getIndex() {
+        return index;
+    }
+
+    /**
+     * Gets name.
+     * 
+     * @return Value of name.
+     */
+    public String getName() {
+        return name;
+    }
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/EnumType.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/EnumType.java
new file mode 100644 (file)
index 0000000..5d82318
--- /dev/null
@@ -0,0 +1,20 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.entity;
+
+public enum EnumType {
+  GSAR, SSAR, NSAR, NFAR
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/EnumUsageState.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/EnumUsageState.java
new file mode 100644 (file)
index 0000000..91ae00c
--- /dev/null
@@ -0,0 +1,20 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.entity;
+
+public enum EnumUsageState {
+  InUse, NotInUse
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/VnfPackage.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/VnfPackage.java
new file mode 100644 (file)
index 0000000..013946b
--- /dev/null
@@ -0,0 +1,100 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.entity;
+
+public class VnfPackage {
+  private String vnfPackageId;
+  private String name;
+  private String version;
+  private String provider;
+  private String vnfd;
+  private EnumOperationalState operationalState = EnumOperationalState.Disabled;
+  private EnumUsageState usageState = EnumUsageState.InUse;
+  private String deletionPending;
+  private String vnfPackageUrl;
+
+  public String getVnfPackageId() {
+    return vnfPackageId;
+  }
+
+  public void setVnfPackageId(String vnfPackageId) {
+    this.vnfPackageId = vnfPackageId;
+  }
+
+  public String getVersion() {
+    return version;
+  }
+
+  public void setVersion(String version) {
+    this.version = version;
+  }
+
+  public String getProvider() {
+    return provider;
+  }
+
+  public void setProvider(String provider) {
+    this.provider = provider;
+  }
+
+  public String getVnfd() {
+    return vnfd;
+  }
+
+  public void setVnfd(String vnfd) {
+    this.vnfd = vnfd;
+  }
+
+  public EnumOperationalState getOperationalState() {
+    return operationalState;
+  }
+
+  public void setOperationalState(EnumOperationalState operationalState) {
+    this.operationalState = operationalState;
+  }
+
+  public EnumUsageState getUsageState() {
+    return usageState;
+  }
+
+  public void setUsageState(EnumUsageState usageState) {
+    this.usageState = usageState;
+  }
+
+  public String getVnfPackageUrl() {
+    return vnfPackageUrl;
+  }
+
+  public void setVnfPackageUrl(String vnfPackageUrl) {
+    this.vnfPackageUrl = vnfPackageUrl;
+  }
+
+  public String getDeletionPending() {
+    return deletionPending;
+  }
+
+  public void setDeletionPending(String deletionPending) {
+    this.deletionPending = deletionPending;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/request/PackageBasicInfo.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/request/PackageBasicInfo.java
new file mode 100644 (file)
index 0000000..8fce7b8
--- /dev/null
@@ -0,0 +1,70 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.entity.request;
+
+import org.openo.vnfsdk.marketplace.entity.EnumType;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class PackageBasicInfo {
+
+    public String getProvider() {
+        return provider;
+    }
+
+    public void setProvider(String provider) {
+        this.provider = provider;
+    }
+
+    public EnumType getType() {
+        return type;
+    }
+
+    public void setType(EnumType type) {
+        this.type = type;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public String getFormat() {
+        return format;
+    }
+
+    public void setFormat(String format) {
+        this.format = format;
+    }
+
+    private String provider;
+
+    private EnumType type;
+
+    private String version;
+
+    private String format;
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/response/CsarFileUriResponse.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/response/CsarFileUriResponse.java
new file mode 100644 (file)
index 0000000..7b4bfb4
--- /dev/null
@@ -0,0 +1,47 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.entity.response;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class CsarFileUriResponse {
+
+    public String getDownloadUri() {
+        return downloadUri;
+    }
+
+    public void setDownloadUri(String downloadUri) {
+        this.downloadUri = downloadUri;
+    }
+
+    public String getLocalPath() {
+        return localPath;
+    }
+
+    public void setLocalPath(String localPath) {
+        this.localPath = localPath;
+    }
+
+    private String downloadUri;
+
+    private String localPath;
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/response/PackageMeta.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/response/PackageMeta.java
new file mode 100644 (file)
index 0000000..66460f1
--- /dev/null
@@ -0,0 +1,190 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.entity.response;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class PackageMeta {
+
+    private String csarId;
+
+    private String name;
+
+    private String downloadUri;
+
+    private String report;
+
+    private String size;
+
+    private String version;
+
+    private String provider;
+
+    private String type;
+
+    private String format;
+
+    private boolean deletionPending;
+
+    private String createTime;
+
+    private String modifyTime;
+
+    private String shortDesc;
+
+    private int downloadCount;
+
+    private String details;
+
+    private String remarks;
+
+    public String getCsarId() {
+        return csarId;
+    }
+
+    public void setCsarId(String csarId) {
+        this.csarId = csarId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDownloadUri() {
+        return downloadUri;
+    }
+
+    public void setDownloadUri(String downloadUri) {
+        this.downloadUri = downloadUri;
+    }
+
+    public String getSize() {
+        return size;
+    }
+
+    public void setSize(String size) {
+        this.size = size;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public String getProvider() {
+        return provider;
+    }
+
+    public void setProvider(String provider) {
+        this.provider = provider;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getFormat() {
+        return format;
+    }
+
+    public void setFormat(String format) {
+        this.format = format;
+    }
+
+    public boolean isDeletionPending() {
+        return deletionPending;
+    }
+
+    public void setDeletionPending(boolean deletionPending) {
+        this.deletionPending = deletionPending;
+    }
+
+    public String getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getModifyTime() {
+        return modifyTime;
+    }
+
+    public void setModifyTime(String modifyTime) {
+        this.modifyTime = modifyTime;
+    }
+
+
+
+    public String getShortDesc() {
+        return shortDesc;
+    }
+
+    public void setShortDesc(String shortDesc) {
+        this.shortDesc = shortDesc;
+    }
+
+    public String getDetails() {
+        return details;
+    }
+
+    public void setDetails(String details) {
+        this.details = details;
+    }
+
+    public String getRemarks() {
+        return remarks;
+    }
+
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+
+    public String getReport() {
+        return report;
+    }
+
+    public void setReport(String report) {
+        this.report = report;
+    }
+
+
+    public int getDownloadCount() {
+        return downloadCount;
+    }
+
+    public void setDownloadCount(int downloadCount) {
+        this.downloadCount = downloadCount;
+    }
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/response/PackageResponse.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/response/PackageResponse.java
new file mode 100644 (file)
index 0000000..c2ce36d
--- /dev/null
@@ -0,0 +1,57 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.entity.response;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class PackageResponse {
+  private static final int STATUS_SUCCESS = 1;
+
+  private int status;
+  private String message;
+  private String packageName;
+  private String processId;
+  private String exception;
+  private String reportPath;
+
+  public String getReportPath() {
+       return reportPath;
+}
+
+public void setReportPath(String reportPath) {
+       this.reportPath = reportPath;
+}
+
+public boolean isSuccess() {
+    return this.status == STATUS_SUCCESS;
+  }
+
+  @Override
+  public String toString() {
+    return "DeployPackageResponse [status=" + status + ", message=" + message + ", packageName="
+        + packageName + ", processId=" + processId + ", exception=" + exception + "]";
+  }
+  
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/response/UploadPackageResponse.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/entity/response/UploadPackageResponse.java
new file mode 100644 (file)
index 0000000..b681112
--- /dev/null
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.entity.response;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class UploadPackageResponse {
+
+    private String csarId;
+
+    private String functestReport;
+    
+    public String getCsarId() {
+        return csarId;
+    }
+
+    public void setCsarId(String csarId) {
+        this.csarId = csarId;
+    }
+
+    public String getFunctestReport() {
+        return functestReport;
+    }
+
+    public void setFunctestReport(String functestReport) {
+        this.functestReport = functestReport;
+    }
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/filemanage/FileManager.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/filemanage/FileManager.java
new file mode 100644 (file)
index 0000000..8ecd758
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.filemanage;
+
+
+public interface FileManager {
+  
+  /**
+   * package upload api.
+   * @param srcPath source path
+   * @param dstPath/packageType/provider/packageName/version
+   * @return boolean
+   */
+  boolean upload(String srcPath, String dstPath);
+
+  boolean download(String srcPath, String dstPath);
+
+  boolean delete(String srcPath);
+
+  //ArrayList<FileLink> queryWorkFlow(String path);
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/filemanage/FileManagerFactory.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/filemanage/FileManagerFactory.java
new file mode 100644 (file)
index 0000000..036440d
--- /dev/null
@@ -0,0 +1,53 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.filemanage;
+
+import org.openo.vnfsdk.marketplace.filemanage.http.HttpFileManagerImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class FileManagerFactory {
+  private static final Logger logger = LoggerFactory.getLogger(FileManagerFactory.class);
+
+  private static FileManager getHttpFileManager() {
+    return new HttpFileManagerImpl();
+  }
+
+  /**
+   * create file manager.
+   * @return FileManager
+   */
+  public static FileManager createFileManager() {
+    switch (getType()) {
+      case http:
+        return getHttpFileManager();
+      case ftp:
+        return null;
+      default:
+        return getHttpFileManager();
+    }
+  }
+
+  private static FileManagerType getType() {
+    String type = System.getenv("useFtp");
+    logger.info("read environment varibale uesFtp:" + type);
+    if (type != null && "true".equals(type)) {
+      return FileManagerType.ftp;
+    } else {
+      return FileManagerType.http;
+    }
+  }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/filemanage/FileManagerType.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/filemanage/FileManagerType.java
new file mode 100644 (file)
index 0000000..046b6b2
--- /dev/null
@@ -0,0 +1,23 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.filemanage;
+
+public enum FileManagerType {
+  ftp, http;
+  public static FileManagerType getType(String type) {
+    return valueOf(type);
+  }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/filemanage/http/HttpFileManagerImpl.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/filemanage/http/HttpFileManagerImpl.java
new file mode 100644 (file)
index 0000000..b28b5ff
--- /dev/null
@@ -0,0 +1,64 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.filemanage.http;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.openo.vnfsdk.marketplace.filemanage.FileManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class HttpFileManagerImpl implements FileManager {
+  private static final Logger LOGGER = LoggerFactory.getLogger(HttpFileManagerImpl.class);
+
+  public boolean upload(String srcPath, String dstPath) {
+    boolean flag = true;
+    LOGGER.info("start upload file.srcPath:" + srcPath + " dstPath" + dstPath);
+    File srcFile = new File(srcPath);
+    if (!srcFile.exists()) {
+      LOGGER.error("src file not exist!");
+      return false;
+    }
+    // File dstFile = new File(ToolUtil.getHttpServerPath() + dstPath);
+    // LOGGER.info("dstFile AbsolutePath:" + dstFile.getAbsolutePath());
+    String targetDir = ToolUtil.getHttpServerAbsolutePath() + dstPath;
+    try {
+      ToolUtil.copyDirectory(srcPath, targetDir, true);
+    } catch (IOException e1) {
+      flag = false;
+      LOGGER.error("copy file failed.errorMsg:" + e1.getMessage());
+    }
+    LOGGER.info("upload file success!");
+    return flag;
+  }
+
+  public boolean download(String srcPath, String dstPath) {
+    // TODO Auto-generated method stub
+    return false;
+  }
+
+  public boolean delete(String srcPath) {
+    boolean flag = true;
+    LOGGER.info("start delete file from http server.srcPath:" + srcPath);
+    flag = ToolUtil.deleteDir(new File(ToolUtil.getHttpServerAbsolutePath() + srcPath));
+    LOGGER.info("delete file from http server end.flag:" + flag);
+    return flag;
+  }
+
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/filemanage/http/ToolUtil.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/filemanage/http/ToolUtil.java
new file mode 100644 (file)
index 0000000..b4f6388
--- /dev/null
@@ -0,0 +1,198 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.filemanage.http;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.openo.vnfsdk.marketplace.common.HttpServerPathConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class ToolUtil {
+  private static final Logger LOGGER = LoggerFactory.getLogger(ToolUtil.class);
+
+  /**
+   * copy from directory.
+   * @param srcDirName source directory name
+   * @param destDirName destination directory name
+   * @param overlay overwrite or not
+   * @return boolean
+   * @throws IOException e
+   */
+  public static boolean copyDirectory(String srcDirName, String destDirName, boolean overlay)
+      throws IOException {
+    File srcDir = new File(srcDirName);
+    if (!srcDir.exists()) {
+      return false;
+    } else if (!srcDir.isDirectory()) {
+      return false;
+    }
+
+    if (!destDirName.endsWith(File.separator)) {
+      destDirName = destDirName + File.separator;
+    }
+    File destDir = new File(destDirName);
+    if (destDir.exists()) {
+      if (overlay) {
+        new File(destDirName).delete();
+      } else {
+        return false;
+      }
+    } else {
+      if (!destDir.mkdirs()) {
+        return false;
+      }
+    }
+    boolean flag = true;
+    File[] files = srcDir.listFiles();
+    for (int i = 0; i < files.length; i++) {
+      if (files[i].isFile()) {
+        flag = copyFile(files[i].getAbsolutePath(), destDirName + files[i].getName(), true);
+        if (!flag) {
+          break;
+        }
+      } else if (files[i].isDirectory()) {
+        flag = copyDirectory(files[i].getAbsolutePath(), destDirName + files[i].getName(), overlay);
+        if (!flag) {
+          break;
+        }
+      }
+    }
+    if (!flag) {
+      String message = "Copy catagory " + srcDirName + " to " + destDirName + " failed!";
+      LOGGER.error(message);
+      return false;
+    } else {
+      return true;
+    }
+  }
+
+  /**
+   * copy file.
+   * @param srcFileName source file name
+   * @param destFileName target file name
+   * @param overlay overwrite or not
+   * @return boolean
+   */
+  public static boolean copyFile(String srcFileName, String destFileName, boolean overlay) {
+    File srcFile = new File(srcFileName);
+
+    if (!srcFile.exists()) {
+      String message = "Source file : " + srcFileName + " not exist !";
+      LOGGER.error(message);
+      return false;
+    } else if (!srcFile.isFile()) {
+      return false;
+    }
+
+    File destFile = new File(destFileName);
+    if (destFile.exists()) {
+      if (overlay) {
+        new File(destFileName).delete();
+      }
+    } else {
+      if (!destFile.getParentFile().exists()) {
+        if (!destFile.getParentFile().mkdirs()) {
+          return false;
+        }
+      }
+    }
+
+    int byteread = 0;
+    InputStream in = null;
+    OutputStream out = null;
+
+    try {
+      in = new FileInputStream(srcFile);
+      out = new FileOutputStream(destFile);
+      byte[] buffer = new byte[1024];
+
+      while ((byteread = in.read(buffer)) != -1) {
+        out.write(buffer, 0, byteread);
+      }
+      return true;
+    } catch (FileNotFoundException e1) {
+      return false;
+    } catch (IOException e1) {
+      return false;
+    } finally {
+      try {
+        if (out != null) {
+          out.close();
+        }
+        if (in != null) {
+          in.close();
+        }
+      } catch (IOException e1) {
+        e1.printStackTrace();
+      }
+    }
+  }
+
+  /**
+   * create directory.
+   * @param destDirName target directory name
+   * @return boolean
+   */
+  public static boolean createDir(String destDirName) {
+    File dir = new File(destDirName);
+    if (dir.exists()) {
+      dir.delete();
+    }
+    if (!destDirName.endsWith(File.separator)) {
+      destDirName = destDirName + File.separator;
+    }
+    if (dir.mkdirs()) {
+      return true;
+    } else {
+      return false;
+    }
+  }
+
+  public static String getHttpServerAbsolutePath() {
+    return Thread.currentThread().getContextClassLoader().getResource("/").getPath() +  HttpServerPathConfig.getHttpServerPath();
+  }
+
+  /**
+   * delete directory.
+   * @param dir file to delete
+   * @return boolean
+   */
+  public static boolean deleteDir(File dir) {
+    if (dir.isDirectory()) {
+      String[] children = dir.list();
+      for (int i = 0; i < children.length; i++) {
+        boolean success = deleteDir(new File(dir, children[i]));
+        if (!success) {
+          return false;
+        }
+      }
+    }
+    return dir.delete();
+  }
+  
+  public static String getAppDeployPath()
+  {
+      return Thread.currentThread().getContextClassLoader().getResource("/").getPath();
+  }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/model/parser/EnumPackageFormat.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/model/parser/EnumPackageFormat.java
new file mode 100644 (file)
index 0000000..485e15d
--- /dev/null
@@ -0,0 +1,26 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.model.parser;
+
+/**
+ * enum data.
+ * 
+ * @author 10189609
+ * 
+ */
+public enum EnumPackageFormat {
+  TOSCA_XML, TOSCA_YAML
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/model/parser/EnumTemplateType.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/model/parser/EnumTemplateType.java
new file mode 100644 (file)
index 0000000..e634aea
--- /dev/null
@@ -0,0 +1,20 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.model.parser;
+
+public enum EnumTemplateType {
+  NS, VNF
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/msb/AppServletContextListener.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/msb/AppServletContextListener.java
new file mode 100644 (file)
index 0000000..9ea074c
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openo.vnfsdk.marketplace.msb;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+public class AppServletContextListener implements ServletContextListener
+{
+
+    public void contextInitialized(ServletContextEvent eventData) 
+    {
+        MsbRegister.handleMsbRegistration();
+    }
+
+    public void contextDestroyed(ServletContextEvent eventData) 
+    {
+        MsbRegister.handleMsbUnRegistration();
+    }
+}
+
+
+
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/msb/MsbDetails.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/msb/MsbDetails.java
new file mode 100644 (file)
index 0000000..ab4190e
--- /dev/null
@@ -0,0 +1,57 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.msb;
+
+public class MsbDetails 
+{
+    private MsbServer defaultServer;
+    private String ConnectTimeout;
+    private String thread;
+    private String idletimeout;
+    private String timeout;
+    
+    public MsbServer getDefaultServer() {
+        return defaultServer;
+    }
+    public void setDefaultServer(MsbServer defaultServer) {
+        this.defaultServer = defaultServer;
+    }
+    public String getConnectTimeout() {
+        return ConnectTimeout;
+    }
+    public void setConnectTimeout(String connectTimeout) {
+        ConnectTimeout = connectTimeout;
+    }
+    public String getThread() {
+        return thread;
+    }
+    public void setThread(String thread) {
+        this.thread = thread;
+    }
+    public String getIdletimeout() {
+        return idletimeout;
+    }
+    public void setIdletimeout(String idletimeout) {
+        this.idletimeout = idletimeout;
+    }
+    public String getTimeout() {
+        return timeout;
+    }
+    public void setTimeout(String timeout) {
+        this.timeout = timeout;
+    }
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/msb/MsbDetailsHolder.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/msb/MsbDetailsHolder.java
new file mode 100644 (file)
index 0000000..8c1d86a
--- /dev/null
@@ -0,0 +1,49 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.msb;
+
+import org.openo.vnfsdk.marketplace.common.FileUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MsbDetailsHolder 
+{
+    private static final Logger logger = LoggerFactory.getLogger(MsbDetailsHolder.class);
+    private static final String MSB_DETAILS_PATH = "etc/conf/restclient.json";
+    private static MsbDetails msbDetails = null;
+
+    private MsbDetailsHolder(){       
+    }
+    
+    public static synchronized MsbDetails getMsbDetails() 
+    {
+       MsbDetailsHolder.loadMsbDetails();
+       return msbDetails;
+    }
+
+    private static synchronized void loadMsbDetails () 
+    {      
+        if(null != msbDetails) {
+            return;
+        }
+        
+        msbDetails = (MsbDetails)FileUtil.readJsonDatafFromFile(MSB_DETAILS_PATH, MsbDetails.class);
+        if (null == msbDetails) 
+        {
+            logger.error("Failed to Load MSB Details !!!");
+        }
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/msb/MsbRegister.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/msb/MsbRegister.java
new file mode 100644 (file)
index 0000000..6ade141
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openo.vnfsdk.marketplace.msb;
+
+import org.openo.vnfsdk.marketplace.common.CommonConstant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MsbRegister
+{
+    private static final Logger logger = LoggerFactory.getLogger(MsbRegister.class);
+    
+    /**
+     * Interface top handle MSB Registration
+     */
+    public static void handleMsbRegistration() 
+    {
+        logger.info("VNF-SDK Market Place microservice register start.");
+        int retry = 0;
+        while(CommonConstant.MsbRegisterCode.MSDB_REGISTER_RETRIES >= retry) 
+        {                               
+            int retCode = MsbRegistration.getInstance().register();
+            if(CommonConstant.MsbRegisterCode.MSDB_REGISTER_FILE_NOT_EXISTS == retCode)
+            {
+                logger.info("microservice register failed, MSB Register File Not Exists !");
+                break;
+            }
+            
+            if(CommonConstant.MsbRegisterCode.MSDB_REGISTER_SUCESS != retCode) 
+            {
+                logger.warn("microservice register failed, try again after(ms):" + CommonConstant.MsbRegisterCode.MSDB_REGISTER_RETRY_SLEEP);
+                threadSleep(CommonConstant.MsbRegisterCode.MSDB_REGISTER_RETRY_SLEEP);
+            } 
+            else 
+            {
+                logger.info("microservice register success !");
+                break;
+            }    
+            
+            retry++;
+            logger.info("VNF-SDK Market Place microservice register [retry count]:" + retry);
+        }
+        logger.info("VNF-SDK Market Place microservice register end.");
+    }
+    
+    public static void handleMsbUnRegistration() 
+    {
+        logger.info("VNF-SDK Market Place microservice handleMsbUnRegistration Start.");
+        MsbRegistration.getInstance().unRegister();
+        logger.info("VNF-SDK Market Place microservice handleMsbUnRegistration end.");
+    }
+    
+    private static void threadSleep(int second) 
+    {
+        try 
+        {
+            Thread.sleep(second);
+        } 
+        catch(InterruptedException error) 
+        {
+            logger.error("thread sleep error.errorMsg:", error);
+            Thread.currentThread().interrupt();
+        }
+    }
+} 
+
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/msb/MsbRegistration.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/msb/MsbRegistration.java
new file mode 100644 (file)
index 0000000..e1f3908
--- /dev/null
@@ -0,0 +1,217 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openo.vnfsdk.marketplace.msb;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.openo.vnfsdk.marketplace.common.CommonConstant;
+import org.openo.vnfsdk.marketplace.common.JsonUtil;
+import org.openo.vnfsdk.marketplace.rest.RestResponse;
+import org.openo.vnfsdk.marketplace.rest.RestfulClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class MsbRegistration {
+    private static final Logger LOGGER = LoggerFactory.getLogger(MsbRegistration.class);
+    
+    private static MsbRegistration oMsbRegistration = new MsbRegistration();
+    
+    private static final String MSB_REGISTION_FILE = "etc/microservice/marketplace_rest.json";
+    private static final String MSB_REGISTION_URL = "/openoapi/microservices/v1/services?createOrUpdate=false";
+    private static final String MSB_UN_REGISTION_URL = "/openoapi/microservices/v1/services/{0}/version/{1}/nodes/{2}/{3}";
+    private static final String NODES = "nodes";
+    private static final String IP = "ip";
+    private static final String PORT = "port";
+    private static final String SERVICE_NAME = "serviceName";
+    private static final String VERSION = "version";
+   
+    private boolean bRegistrationStatus = false;
+    
+    private MsbRegistration () {
+    }
+    
+    public static MsbRegistration getInstance()
+    {
+        return oMsbRegistration;
+    }
+    /**
+     * Interface to handle MSB Registration
+     * @return
+     */
+    public int register() 
+    {               
+        File file = new File(MSB_REGISTION_FILE);
+        if(!file.exists()) 
+        {
+            LOGGER.info("Stop registering as can't find msb registion file:" + file.getAbsolutePath());          
+            return CommonConstant.MsbRegisterCode.MSDB_REGISTER_FILE_NOT_EXISTS;
+        }
+
+        Map<?, ?> msbRegistionBodyMap = getMsbRegistrationData();
+        if(null == msbRegistionBodyMap)
+        {
+            LOGGER.info("Reading data from msb registion file failed:" + file.getAbsolutePath()); 
+            return CommonConstant.MsbRegisterCode.MSDB_REGISTER_FILE_NOT_EXISTS;
+        }
+
+        LOGGER.info("Registering body: " + JsonUtil.toJson(msbRegistionBodyMap));
+
+        bRegistrationStatus = sendRequest(msbRegistionBodyMap);
+        
+        return bRegistrationStatus 
+                ? CommonConstant.MsbRegisterCode.MSDB_REGISTER_SUCESS 
+                        : CommonConstant.MsbRegisterCode.MSDB_REGISTER_FAILED;
+    }
+
+    private Map<?, ?> getMsbRegistrationData() 
+    {        
+        Map<?, ?> msbRegistionBodyMap = null;
+        try 
+        {
+            ObjectMapper mapper = new ObjectMapper();
+            byte[] bytes = Files.readAllBytes(Paths.get(MSB_REGISTION_FILE));
+            msbRegistionBodyMap = mapper.readValue(bytes, Map.class);
+            
+            replaceLocalIp(msbRegistionBodyMap);
+        } 
+        catch(IOException e) 
+        {
+            LOGGER.error("Failed to get microservice bus registration body, " + e);
+        }
+        return msbRegistionBodyMap;
+    }
+
+    /**
+     * Send MSB Registration request
+     * @param msbRegistionBodyMap
+     * @return
+     */
+    private boolean sendRequest(Map<?, ?> msbRegistionBodyMap)  
+    {
+        LOGGER.info("Start registering to microservice bus");
+        String rawData = JsonUtil.toJson(msbRegistionBodyMap);       
+        MsbDetails oMsbDetails =  MsbDetailsHolder.getMsbDetails();
+        if(null == oMsbDetails) {
+            LOGGER.info("MSB Details is NULL , Registration Failed !!!");
+            return false;
+        }        
+        RestResponse oResponse = RestfulClient.sendPostRequest(oMsbDetails.getDefaultServer().getHost(),
+                                oMsbDetails.getDefaultServer().getPort(),
+                                MSB_REGISTION_URL, rawData);
+        
+        if(null == oResponse){
+            LOGGER.info("Null Unregister Response for  " + MSB_REGISTION_URL);
+            return false;
+        }        
+        LOGGER.info("Response Code Received for MBS Registration:" + oResponse.getStatusCode());        
+        return isSuccess(oResponse.getStatusCode()) ? true : false;
+    }
+    
+    public int unRegister() 
+    {
+        if(!bRegistrationStatus){
+            return CommonConstant.MsbRegisterCode.MSDB_REGISTER_SUCESS; 
+        }
+        
+        MsbDetails oMsbDetails =  MsbDetailsHolder.getMsbDetails();
+        if(null == oMsbDetails){
+            LOGGER.info("MSB Details is NULL , Registration Failed !!!");
+            return CommonConstant.MsbRegisterCode.MSDB_REGISTER_FAILED;
+        }
+        
+        File file = new File(MSB_REGISTION_FILE);
+        if(!file.exists()){
+            LOGGER.info("Stop registering as can't find msb registion file:" + file.getAbsolutePath());          
+            return CommonConstant.MsbRegisterCode.MSDB_REGISTER_FILE_NOT_EXISTS;
+        }
+        
+        Map<?, ?> msbRegistionBodyMap = getMsbRegistrationData();
+        if(null == msbRegistionBodyMap){
+            LOGGER.info("Reading data from msb registion file failed:" + file.getAbsolutePath()); 
+            return CommonConstant.MsbRegisterCode.MSDB_REGISTER_FILE_NOT_EXISTS;
+        }
+        
+        String serviceName = (String)msbRegistionBodyMap.get(SERVICE_NAME);
+        String version = (String)msbRegistionBodyMap.get(VERSION);
+       
+        @SuppressWarnings("unchecked")
+        List<Map<String, String>> nodes = (List<Map<String, String>>)msbRegistionBodyMap.get(NODES);       
+        if((null == serviceName ) || (null == version ) || (null == nodes )) 
+        {
+            LOGGER.info("Readed data is Invalid from msb registion file:" + file.getAbsolutePath()); 
+            return CommonConstant.MsbRegisterCode.MSDB_REGISTER_FILE_NOT_EXISTS;
+        }
+        
+        Map<String, String> node = nodes.get(0);
+        String ip = node.get(IP);
+        String port = node.get(PORT);
+
+        String url = MessageFormat.format(MSB_UN_REGISTION_URL, serviceName, version, ip, port);
+        LOGGER.info("Start Unregister to microservice bus, url: " + url);
+        
+        RestResponse oResponse = RestfulClient.delete(oMsbDetails.getDefaultServer().getHost(),
+                                    Integer.parseInt(oMsbDetails.getDefaultServer().getPort()),url);
+        
+        if(null == oResponse) {
+            LOGGER.info("Null Unregister Response for  " + url);
+            return CommonConstant.MsbRegisterCode.MSDB_REGISTER_FAILED;
+        }        
+        LOGGER.info("Unregister Response " + oResponse.getStatusCode());        
+        return isSuccess(oResponse.getStatusCode()) ? 
+                CommonConstant.MsbRegisterCode.MSDB_REGISTER_SUCESS : 
+                    CommonConstant.MsbRegisterCode.MSDB_REGISTER_FAILED;
+    }
+
+    @SuppressWarnings("unchecked")
+    private void replaceLocalIp(Map<?, ?> msbRegistionBodyMap) 
+    {
+        List<Map<String, String>> nodes = (List<Map<String, String>>)msbRegistionBodyMap.get(NODES);
+        Map<String, String> node = nodes.get(0);
+        if(StringUtils.isNotEmpty(node.get(IP))) {
+            return;
+        }
+
+        try
+        {
+            InetAddress addr = InetAddress.getLocalHost();
+            String ipAddress = addr.getHostAddress();
+            node.put(IP, ipAddress);
+
+            LOGGER.info("Local ip: " + ipAddress);
+        } 
+        catch(UnknownHostException e) 
+        {
+            LOGGER.error("Unable to get IP address, " + e);
+        }
+    }
+
+    private boolean isSuccess(int httpCode) 
+    {
+        return (httpCode == 200 || httpCode == 201) ? true : false;
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/msb/MsbServer.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/msb/MsbServer.java
new file mode 100644 (file)
index 0000000..fa3bcb0
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.msb;
+
+public class MsbServer 
+{
+       private String host;
+    private String port;
+    
+    public String getHost() {
+        return host;
+    }
+    public void setHost(String host) {
+        this.host = host;
+    }
+    public String getPort() {
+        return port;
+    }
+    public void setPort(String port) {
+        this.port = port;
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/OnBoardingOperResult.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/OnBoardingOperResult.java
new file mode 100644 (file)
index 0000000..68d8598
--- /dev/null
@@ -0,0 +1,33 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.onboarding.entity;
+public class OnBoardingOperResult 
+{
+    private String operId;
+    private int status;
+    public String getOperId() {
+        return operId;
+    }
+    public void setOperId(String operId) {
+        this.operId = operId;
+    }
+    public int getStatus() {
+        return status;
+    }
+    public void setStatus(int status) {
+        this.status = status;
+    } 
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/OnBoardingResult.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/OnBoardingResult.java
new file mode 100644 (file)
index 0000000..52bfe10
--- /dev/null
@@ -0,0 +1,60 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.onboarding.entity;
+
+import java.util.List;
+
+public class OnBoardingResult 
+{
+       private String csarId;
+    private String operTypeId;
+    private boolean operFinished;
+    private int operStatus;
+    
+    private List<OnBoardingOperResult> operResult;
+    
+    public String getOperTypeId() {
+        return operTypeId;
+    }
+    public void setOperTypeId(String operTypeId) {
+        this.operTypeId = operTypeId;
+    }
+    public boolean isOperFinished() {
+        return operFinished;
+    }
+    public void setOperFinished(boolean operFinished) {
+        this.operFinished = operFinished;
+    }
+
+    public List<OnBoardingOperResult> getOperResult() {
+        return operResult;
+    }
+    public void setOperResult(List<OnBoardingOperResult> operResult) {
+        this.operResult = operResult;
+    }
+    public int getOperStatus() {
+        return operStatus;
+    }
+    public void setOperStatus(int operStatus) {
+        this.operStatus = operStatus;
+    }
+       public String getCsarId() {
+               return csarId;
+       }
+       public void setCsarId(String csarId) {
+               this.csarId = csarId;
+       }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/OnBoardingStep.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/OnBoardingStep.java
new file mode 100644 (file)
index 0000000..b8a1808
--- /dev/null
@@ -0,0 +1,44 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.onboarding.entity;
+
+import java.util.List;
+
+public class OnBoardingStep 
+{
+    private String operTypeName;
+    private String operTypeId;
+    private List<OperationDetails> oper;
+    
+    public String getOperTypeName() {
+        return operTypeName;
+    }
+    public void setOperTypeName(String operTypeName) {
+        this.operTypeName = operTypeName;
+    }
+    public String getOperTypeId() {
+        return operTypeId;
+    }
+    public void setOperTypeId(String operTypeId) {
+        this.operTypeId = operTypeId;
+    }
+    public List<OperationDetails> getOper() {
+        return oper;
+    }
+    public void setOper(List<OperationDetails> oper) {
+        this.oper = oper;
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/OnBoardingSteps.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/OnBoardingSteps.java
new file mode 100644 (file)
index 0000000..24410e8
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.onboarding.entity;
+
+import java.util.List;
+
+public class OnBoardingSteps 
+{
+    private List<OnBoardingStep> operTypeList;
+
+    public List<OnBoardingStep> getOperTypeList() {
+        return operTypeList;
+    }
+
+    public void setOperTypeList(List<OnBoardingStep> operTypeList) {
+        this.operTypeList = operTypeList;
+    }
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/OnBoradingRequest.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/OnBoradingRequest.java
new file mode 100644 (file)
index 0000000..622c173
--- /dev/null
@@ -0,0 +1,49 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.onboarding.entity;
+
+public class OnBoradingRequest {
+    private String csarId;
+    private String packageName;
+    private String packagePath;
+    private String csarIdCatalouge;
+    
+    public String getPackagePath() {
+        return packagePath;
+    }
+    public void setPackagePath(String packagePath) {
+        this.packagePath = packagePath;
+    }
+    public String getCsarId() {
+        return csarId;
+    }
+    public void setCsarId(String csarId) {
+        this.csarId = csarId;
+    }
+    public String getPackageName() {
+        return packageName;
+    }
+    public void setPackageName(String packageName) {
+        this.packageName = packageName;
+    }
+    public String getCsarIdCatalouge() {
+        return csarIdCatalouge;
+    }
+    public void setCsarIdCatalouge(String csarIdCatalouge) {
+        this.csarIdCatalouge = csarIdCatalouge;
+    }
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/OperationDetails.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/OperationDetails.java
new file mode 100644 (file)
index 0000000..e801732
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.onboarding.entity;
+
+public class OperationDetails 
+{
+    private String operId;
+    private String operName;
+    public String getOperId() {
+        return operId;
+    }
+    public void setOperId(String operId) {
+        this.operId = operId;
+    }
+    public String getOperName() {
+        return operName;
+    }
+    public void setOperName(String operName) {
+        this.operName = operName;
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/OperationResult.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/OperationResult.java
new file mode 100644 (file)
index 0000000..af7a33a
--- /dev/null
@@ -0,0 +1,60 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.onboarding.entity;
+
+import java.util.List;
+
+public class OperationResult 
+{
+       private String csarId;
+    private String operTypeId;
+    private boolean operFinished;
+    private int operStatus;
+    
+    private List<OnBoardingOperResult> operResult;
+    
+    public String getOperTypeId() {
+        return operTypeId;
+    }
+    public void setOperTypeId(String operTypeId) {
+        this.operTypeId = operTypeId;
+    }
+    public boolean isOperFinished() {
+        return operFinished;
+    }
+    public void setOperFinished(boolean operFinished) {
+        this.operFinished = operFinished;
+    }
+
+    public List<OnBoardingOperResult> getOperResult() {
+        return operResult;
+    }
+    public void setOperResult(List<OnBoardingOperResult> operResult) {
+        this.operResult = operResult;
+    }
+    public int getOperStatus() {
+        return operStatus;
+    }
+    public void setOperStatus(int operStatus) {
+        this.operStatus = operStatus;
+    }
+       public String getCsarId() {
+               return csarId;
+       }
+       public void setCsarId(String csarId) {
+               this.csarId = csarId;
+       }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/ResultKey.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/entity/ResultKey.java
new file mode 100644 (file)
index 0000000..117325b
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.onboarding.entity;
+
+public class ResultKey 
+{
+       private String csarId;
+    private String operTypeId;
+    private String key;
+    public String getCsarId() {
+        return csarId;
+    }
+    public void setCsarId(String csarId) {
+        this.csarId = csarId;
+    }
+    public String getOperTypeId() {
+        return operTypeId;
+    }
+    public void setOperTypeId(String operTypeId) {
+        this.operTypeId = operTypeId;
+    }
+    public String getKey() {
+        return key;
+    }
+    public void setKey(String key) {
+        this.key = key;
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutor.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutor.java
new file mode 100644 (file)
index 0000000..336a40f
--- /dev/null
@@ -0,0 +1,220 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.onboarding.hooks.functiontest;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.mime.MultipartEntityBuilder;
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.openo.vnfsdk.marketplace.common.CommonConstant;
+import org.openo.vnfsdk.marketplace.common.FileUtil;
+import org.openo.vnfsdk.marketplace.msb.MsbDetails;
+import org.openo.vnfsdk.marketplace.msb.MsbDetailsHolder;
+import org.openo.vnfsdk.marketplace.onboarding.entity.OnBoradingRequest;
+import org.openo.vnfsdk.marketplace.rest.RestConstant;
+import org.openo.vnfsdk.marketplace.rest.RestResponse;
+import org.openo.vnfsdk.marketplace.rest.RestfulClient;
+import org.openo.vnfsdk.marketplace.rest.RestfulUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class FunctionTestExceutor 
+{
+    private static final Logger logger = LoggerFactory.getLogger(FunctionTestExceutor.class);    
+    
+    private FunctionTestExceutor()
+    {}
+    
+    /**
+     * Interface to Send Request to Start Function test 
+     * @param onBoradFuncTestReq
+     * @return
+     */
+    public static String execFunctionTest(OnBoradingRequest onBoradFuncTestReq)
+    {            
+        String packagePath = onBoradFuncTestReq.getPackagePath() + File.separator + onBoradFuncTestReq.getPackageName();
+        logger.info("Package file path Function test:" + packagePath);
+        
+        String funcTestId = null;       
+        MsbDetails oMsbDetails =  MsbDetailsHolder.getMsbDetails();
+        if(null == oMsbDetails)
+        {
+            logger.error("Failed to get MSB details during execFunctionTest !!!");
+            return funcTestId;
+        }
+             
+        FileInputStream ifs = null;
+        InputStream inStream = null;
+        
+        try
+        {
+            ifs = new FileInputStream(packagePath);
+            inStream  = new BufferedInputStream(ifs);
+            
+            //IP and Port needs to be configured !!!
+            RestResponse rsp = RestfulClient.post(oMsbDetails.getDefaultServer().getHost(), 
+                                                    Integer.parseInt(oMsbDetails.getDefaultServer().getPort()), 
+                                                    CommonConstant.functionTest.FUNCTEST_URL,buildRequest(inStream));
+            if(!checkValidResponse(rsp))
+            {
+                return funcTestId;
+            }
+                       
+            logger.error("Response for Function Test :" , rsp.getResult());
+            funcTestId = rsp.getResult();              
+            return funcTestId.replaceAll("\"", ""); 
+        }
+        catch (FileNotFoundException exp)
+        {
+            logger.error("Fine not fond Exception for file:" , onBoradFuncTestReq.getPackagePath());
+            logger.error("Fine not fond Exception for :" , exp);
+        }      
+        finally
+        {
+            FileUtil.closeInputStream(inStream);
+            FileUtil.closeFileStream(ifs);
+        }      
+        return funcTestId;               
+    }
+       
+    /**
+     * Interface to get Function Test Results
+     * @param key
+     * @return
+     */
+    public static String getTestResultsByFuncTestKey(String key) 
+    {    
+        MsbDetails oMsbDetails =  MsbDetailsHolder.getMsbDetails();
+        if(null == oMsbDetails)
+        {
+            logger.error("Failed to get MSB details during getTestResultsByFuncTestKey !!!");
+            return null;
+        }
+        
+        logger.info("getTestResultsByFuncTestKey for Function Test Results for :" + key);         
+        RestResponse rspGet  = RestfulClient.get(oMsbDetails.getDefaultServer().getHost(), 
+                                Integer.parseInt(oMsbDetails.getDefaultServer().getPort()), 
+                                CommonConstant.functionTest.FUNCTEST_RESULT_URL + key);
+        if(!checkValidResponse(rspGet))
+        {
+            logger.error("Failed to convert String Json Response to TestResults list:" + rspGet.getResult());
+            return null;
+        }
+        logger.info("Function Test Results for Key:" + key + "Response:" + rspGet.getResult());
+        return  rspGet.getResult();
+    }   
+    
+    /**
+     * Interface to get Function Test Results
+     * @param key
+     * @return
+     */
+    public static String executeFunctionTest(String strJsonRequest) 
+    {    
+        logger.info("executeFunctionTest Test request Received:" + strJsonRequest);
+        MsbDetails oMsbDetails =  MsbDetailsHolder.getMsbDetails();
+        if(null == oMsbDetails)
+        {
+            logger.error("Failed to get MSB details during getTestResultsByFuncTestKey !!!");
+            return null;
+        }
+        
+        logger.info("getTestResultsByFuncTestKey for Function Test Results for :" + strJsonRequest);         
+        RestResponse rspGet  = RestfulClient.sendPostRequest(oMsbDetails.getDefaultServer().getHost(), 
+                                                            oMsbDetails.getDefaultServer().getPort(), 
+                                                            CommonConstant.functionTest.FUNCTEST_RESULT_URL,
+                                                            strJsonRequest);
+        if(!checkValidResponse(rspGet))
+        {
+            logger.error("Failed to convert String Json Response to TestResults list:" + rspGet.getResult());
+            return null;
+        }
+        logger.info("executeFunctionTest Function Test Result: " + rspGet.getResult());
+        return  rspGet.getResult();
+    } 
+    
+    /**
+     * Interface to get Function Test Results
+     * @param key
+     * @return
+     */
+    public static String getTestResultsByFuncTestKeyMsb(String key) 
+    {    
+        logger.info("getTestResultsByFuncTestKey for Function Test Results for :" + key);         
+       
+        Map<String, String> paramsMap = new HashMap<String, String>();       
+        paramsMap.put(CommonConstant.HttpContext.URL, CommonConstant.functionTest.FUNCTEST_RESULT_URL + key);  
+        paramsMap.put(CommonConstant.HttpContext.METHOD_TYPE, CommonConstant.MethodType.GET);          
+        
+        RestfulResponse response = RestfulUtil.sendRestRequest(paramsMap, null, null);
+        if(!checkValidRestResponse(response))
+        {
+            logger.error("Respone for getTestResultsByFuncTestKeyMsb is not valid !!!");
+            return null;
+        }
+        
+        if(null != response.getResponseContent())
+        {
+            logger.info("Function Test Results via MSB for Key:" + key + "Response:" + response.getResponseContent());            
+        }
+        else
+        {
+            logger.info("NULL Function Test Results via MSB for Key:" + key);  
+        }   
+        return response.getResponseContent();
+    }  
+        
+    /**
+     * Check Response is Valid
+     * @param rsp
+     * @return
+     */
+    private static boolean checkValidResponse(RestResponse rsp) 
+    {
+        if (rsp.getStatusCode() == null || rsp.getResult() == null 
+                || (RestConstant.RESPONSE_CODE_200 != rsp.getStatusCode() && RestConstant.RESPONSE_CODE_201 != rsp.getStatusCode()))
+        {
+            return false;
+        }
+        return true;
+    }
+
+    private static boolean checkValidRestResponse(RestfulResponse rsp) 
+    {
+        if ((rsp == null) || (RestConstant.RESPONSE_CODE_200 != rsp.getStatus() && RestConstant.RESPONSE_CODE_201 != rsp.getStatus()))
+        {
+            return false;
+        }
+        return true;
+    }
+    
+    @SuppressWarnings("deprecation")
+    private static HttpEntity buildRequest(InputStream inputStream)
+            throws FileNotFoundException {
+          MultipartEntityBuilder builder = MultipartEntityBuilder.create();
+          builder.seContentType(ContentType.MULTIPART_FORM_DATA);
+          builder.addBinaryBody("file", inputStream);
+          return builder.build();
+        }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestHook.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestHook.java
new file mode 100644 (file)
index 0000000..f15d379
--- /dev/null
@@ -0,0 +1,217 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.onboarding.hooks.functiontest;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import org.openo.vnfsdk.marketplace.common.CommonConstant;
+import org.openo.vnfsdk.marketplace.common.FileUtil;
+import org.openo.vnfsdk.marketplace.common.ToolUtil;
+import org.openo.vnfsdk.marketplace.db.entity.PackageData;
+import org.openo.vnfsdk.marketplace.entity.EnumOperationStatus;
+import org.openo.vnfsdk.marketplace.entity.EnumResult;
+import org.openo.vnfsdk.marketplace.onboarding.entity.OnBoardingOperResult;
+import org.openo.vnfsdk.marketplace.onboarding.entity.OnBoardingResult;
+import org.openo.vnfsdk.marketplace.onboarding.entity.OnBoradingRequest;
+import org.openo.vnfsdk.marketplace.onboarding.entity.ResultKey;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class FunctionTestHook 
+{
+    private static final Logger logger = LoggerFactory.getLogger(FunctionTestHook.class);
+
+    /**
+     * Start Executing Function test
+     * @param onBoradingReq
+     * @return
+     */
+    public int exec(OnBoradingRequest onBoradingReq)
+    {       
+        logger.info("OnboradingRequest received for Package:" + onBoradingReq.getCsarId() + " Path:"+ onBoradingReq.getPackagePath());
+
+        buildResultPath(onBoradingReq);
+        
+        OnBoardingResult oFuncTestResult = new OnBoardingResult();
+        buildFunctResponse(onBoradingReq,oFuncTestResult);
+        updateResult(oFuncTestResult);
+
+        //STEP 1:Check Package Exists
+        //---------------------------      
+        if(!FileUtil.checkFileExists(onBoradingReq.getPackagePath()))
+        {
+            logger.info("Package Not Found at Path:" + onBoradingReq.getPackagePath() + ", Package Id:" + onBoradingReq.getCsarId());                      
+            oFuncTestResult.setOperFinished(true);
+            oFuncTestResult.setOperStatus(EnumResult.FAIL.getIndex());
+            buildFuncTestResponse(oFuncTestResult,CommonConstant.functionTest.FUNCTEST_PACKAGE_EXISTS,EnumOperationStatus.FAILED.getIndex());
+            updateResult(oFuncTestResult);            
+            return EnumResult.FAIL.getIndex();
+        }       
+
+        buildFuncTestResponse(oFuncTestResult,CommonConstant.functionTest.FUNCTEST_PACKAGE_EXISTS,EnumOperationStatus.SUCCESS.getIndex());
+        updateResult(oFuncTestResult);
+
+        //STEP 2:Handle function test for Package
+        //---------------------------------------
+        String functestResultKey = FunctionTestExceutor.execFunctionTest(onBoradingReq);
+        if(null == functestResultKey)
+        {          
+            oFuncTestResult.setOperFinished(true);
+            oFuncTestResult.setOperStatus(EnumResult.FAIL.getIndex());            
+            buildFuncTestResponse(oFuncTestResult,CommonConstant.functionTest.FUNCTEST_EXEC,EnumOperationStatus.FAILED.getIndex());
+            updateResult(oFuncTestResult);           
+            return EnumResult.FAIL.getIndex();
+        }       
+
+        oFuncTestResult.setOperFinished(true);
+        oFuncTestResult.setOperStatus(EnumResult.SUCCESS.getIndex());
+        buildFuncTestResponse(oFuncTestResult,CommonConstant.functionTest.FUNCTEST_EXEC,EnumOperationStatus.SUCCESS.getIndex());
+        updateResult(oFuncTestResult);
+
+        //STEP 3:Store FuncTest key to get FuncTest Results
+        //-------------------------------------------------
+        storeFuncTestResultKey(onBoradingReq,functestResultKey);
+
+        return (oFuncTestResult.getOperStatus() == EnumResult.SUCCESS.getIndex()) 
+                ? EnumResult.SUCCESS.getIndex() : EnumResult.FAIL.getIndex();
+    }
+
+    /**
+     * 
+     * @param onBoradingReq
+     */
+    private void buildResultPath(OnBoradingRequest onBoradingReq) 
+    {
+        String filePath = getResultStorePath() + File.separator + onBoradingReq.getCsarId();
+        if(!FileUtil.checkFileExists(filePath))
+        {
+            FileUtil.createDirectory(filePath);
+        }
+    }
+
+    /**
+     * 
+     * @param packageData
+     * @return
+     */
+    public static String getFuncTestResults(PackageData packageData) 
+    {
+        logger.info("Function Test results request for Package:" + packageData.getCsarId());
+        ResultKey keydata = getFuncTestResultKey(packageData);
+        if(null == keydata || keydata.getKey().isEmpty())
+        {
+            logger.info("Function Test key Not Found for Package Id:",packageData.getCsarId());
+            return null;
+        }        
+        return  FunctionTestExceutor.getTestResultsByFuncTestKey(keydata.getKey());
+    }
+
+    /**
+     * Store Function Test Result key
+     * @param onBoradingReq
+     * @param resultKey
+     */
+    private void storeFuncTestResultKey(OnBoradingRequest onBoradingReq,String resultKey) 
+    {
+        //Currently we will make JSON and Store JSON to Package Path)
+        //-------------------------------------------------------------------------------
+        String filePath = getResultStorePath() + File.separator + onBoradingReq.getCsarId() + File.separator + "functestResultKey.json";        
+
+        logger.info("Function test Results Key for Package Id:" + onBoradingReq.getCsarId() + ", Key:" + resultKey + " Path" + filePath);
+        
+        ResultKey oResultKey = new ResultKey();
+        oResultKey.setCsarId(onBoradingReq.getCsarId());
+        oResultKey.setOperTypeId(CommonConstant.functionTest.FUNCTEST_OPERTYPE_ID);
+        oResultKey.setKey(resultKey);
+
+        FileUtil.writeJsonDatatoFile(filePath,oResultKey);
+    }
+
+    /**
+     * Store Function test Execution Results
+     * @param oFuncTestResult
+     */
+    private void updateResult(OnBoardingResult oFuncTestResult) 
+    {   
+        //STore Results to DB(Currently we will make JSON and Store JSON to Package Path)
+        //-------------------------------------------------------------------------------
+        logger.info("Function test Status for Package Id:" + oFuncTestResult.getCsarId() + ", Result:" + ToolUtil.objectToString(oFuncTestResult));
+        String filePath = getResultStorePath()  + File.separator  + oFuncTestResult.getCsarId() + File.separator + "functionTest.json";        
+        FileUtil.writeJsonDatatoFile(filePath,oFuncTestResult);
+    }
+
+    /**
+     * Build Function Test Response
+     * @param onBoradingReq
+     * @param oFuncTestResult
+     */
+    private void buildFunctResponse(OnBoradingRequest onBoradingReq, OnBoardingResult oFuncTestResult) 
+    {
+        oFuncTestResult.setOperFinished(false);
+        oFuncTestResult.setCsarId(onBoradingReq.getCsarId());
+        oFuncTestResult.setOperTypeId(CommonConstant.functionTest.FUNCTEST_OPERTYPE_ID);
+
+        OnBoardingOperResult oPackageExists = new OnBoardingOperResult();
+        oPackageExists.setOperId(CommonConstant.functionTest.FUNCTEST_PACKAGE_EXISTS);
+        oPackageExists.setStatus(EnumOperationStatus.NOTSTARTED.getIndex());
+
+        OnBoardingOperResult functTesExec = new OnBoardingOperResult();
+        functTesExec.setOperId(CommonConstant.functionTest.FUNCTEST_EXEC);
+        functTesExec.setStatus(EnumOperationStatus.NOTSTARTED.getIndex());
+
+        List<OnBoardingOperResult> operResult = new ArrayList<OnBoardingOperResult>();
+        operResult.add(oPackageExists);
+        operResult.add(functTesExec); 
+
+        oFuncTestResult.setOperResult(operResult);
+    }
+
+    public static OnBoardingResult getOnBoardingResult(PackageData packageData) 
+    {
+        String filePath = getResultStorePath()  + File.separator + packageData.getCsarId() +File.separator + "functionTest.json"; 
+        logger.info("On Boarding Status for Package Id:" + packageData.getCsarId() + ", Result Path:" + filePath);
+
+        return (OnBoardingResult)FileUtil.readJsonDatafFromFile(filePath,OnBoardingResult.class);
+    }
+
+    private static ResultKey getFuncTestResultKey(PackageData packageData) 
+    {
+        String fileName = getResultStorePath() + File.separator + packageData.getCsarId() + File.separator + "functestResultKey.json";
+        
+        logger.info("Func Test Result key for Package Id:" + packageData.getCsarId() + ", Result Path:" + fileName);
+        return (ResultKey) FileUtil.readJsonDatafFromFile(fileName,ResultKey.class);       
+    }
+    
+    private static String getResultStorePath() 
+    {
+        return org.openo.vnfsdk.marketplace.filemanage.http.ToolUtil.getHttpServerAbsolutePath();
+    }
+
+    private void buildFuncTestResponse(OnBoardingResult oFuncTestResult, String opreKey, int operStatusVal) 
+    {        
+        List<OnBoardingOperResult>  operStatusList = oFuncTestResult.getOperResult();
+        for(OnBoardingOperResult operObj: operStatusList)
+        {
+            if(operObj.getOperId().equalsIgnoreCase(opreKey))
+            {
+                operObj.setStatus(operStatusVal);
+                break;
+            }
+        }
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifeCycleTestReq.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifeCycleTestReq.java
new file mode 100644 (file)
index 0000000..5a5db23
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.onboarding.hooks.validatelifecycle;
+
+import java.util.List;
+
+public class LifeCycleTestReq 
+{
+    private String csarId;
+    private String labVimId;
+    private List<String> vimIds;
+    public String getCsarId() {
+        return csarId;
+    }
+    public void setCsarId(String csarId) {
+        this.csarId = csarId;
+    }
+    public String getLabVimId() {
+        return labVimId;
+    }
+    public void setLabVimId(String labVimId) {
+        this.labVimId = labVimId;
+    }
+    public List<String> getVimIds() {
+        return vimIds;
+    }
+    public void setVimIds(List<String> vimIds) {
+        this.vimIds = vimIds;
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutor.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutor.java
new file mode 100644 (file)
index 0000000..982b214
--- /dev/null
@@ -0,0 +1,156 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.onboarding.hooks.validatelifecycle;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.mime.MultipartEntityBuilder;
+import org.openo.vnfsdk.marketplace.common.CommonConstant;
+import org.openo.vnfsdk.marketplace.common.JsonUtil;
+import org.openo.vnfsdk.marketplace.msb.MsbDetails;
+import org.openo.vnfsdk.marketplace.msb.MsbDetailsHolder;
+import org.openo.vnfsdk.marketplace.onboarding.entity.OnBoradingRequest;
+import org.openo.vnfsdk.marketplace.rest.RestConstant;
+import org.openo.vnfsdk.marketplace.rest.RestResponse;
+import org.openo.vnfsdk.marketplace.rest.RestfulClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class LifecycleTestExceutor 
+{
+    private static final Logger logger = LoggerFactory.getLogger(LifecycleTestExceutor.class);    
+    public static final String CATALOUGE_UPLOAD_URL_IN = "{0}:{1}/openoapi/catalog/v1/csars";
+
+    private LifecycleTestExceutor()
+    {}
+
+    /**
+     * Interface to Send Request to Start Function test 
+     * @param onBoradFuncTestReq
+     * @return
+     */
+    @SuppressWarnings("unchecked")
+    public static String uploadPackageToCatalouge(OnBoradingRequest onBoradFuncTestReq)
+    {            
+        String packagePath = onBoradFuncTestReq.getPackagePath() + File.separator + onBoradFuncTestReq.getPackageName();
+        logger.info("Package file path uploadPackageToCatalouge:" + packagePath);
+
+        String catalougeCsarId = null;       
+        MsbDetails oMsbDetails =  MsbDetailsHolder.getMsbDetails();
+        if(null == oMsbDetails)
+        {
+            logger.error("Failed to get MSB details during uploadPackageToCatalouge !!!");
+            return catalougeCsarId;
+        }
+        
+        File fileData = new File (packagePath);
+        
+        MultipartEntityBuilder builder = MultipartEntityBuilder.create();            
+        builder.addBinaryBody("file", fileData, ContentType.MULTIPART_FORM_DATA, onBoradFuncTestReq.getPackageName());
+            
+        //IP and Port needs to be configured !!!
+        RestResponse rsp = RestfulClient.post(oMsbDetails.getDefaultServer().getHost(),Integer.parseInt(oMsbDetails.getDefaultServer().getPort()),CommonConstant.CATALOUGE_UPLOAD_URL,builder.build());
+        if(!checkValidResponse(rsp))
+        {
+            logger.error("Failed to upload package to catalouge:" + rsp.getStatusCode());
+            return catalougeCsarId;
+        }
+
+        logger.info("Response for uploadPackageToCatalouge :" +  rsp.getResult());
+        catalougeCsarId = getCsarIdValue(rsp.getResult());
+        
+        logger.info("CSARID for uploadPackageToCatalouge :" + catalougeCsarId);
+        return catalougeCsarId;               
+    }
+
+
+
+
+    public static String execlifecycleTest(OnBoradingRequest onBoradFuncTestReq, LifeCycleTestReq oLifeCycleTestReq)
+    {            
+        String packagePath = onBoradFuncTestReq.getPackagePath() + File.separator + onBoradFuncTestReq.getPackageName();
+        logger.info("Package file path Function test:" + packagePath);
+
+        MsbDetails oMsbDetails =  MsbDetailsHolder.getMsbDetails();
+        if(null == oMsbDetails) {
+            logger.error("Failed to get MSB details during execlifecycleTest !!!");
+            return null;
+        }
+
+        String rawDataJson = JsonUtil.toJson(oLifeCycleTestReq);
+        if(null == rawDataJson) {
+            logger.error("Failed to convert LifeCycleTestReq object to Json String !!!");
+            return null;
+        }
+
+        RestResponse oResponse = RestfulClient.sendPostRequest(oMsbDetails.getDefaultServer().getHost(),
+                oMsbDetails.getDefaultServer().getPort(),
+                CommonConstant.LifeCycleTest.LIFECYCLE_TEST_URL, rawDataJson);
+
+        if(!checkValidResponse(oResponse)) { 
+            logger.error("execlifecycleTest response is faliure :"+ oResponse.getStatusCode());
+            return null;
+        }
+        logger.info("Response execlifecycleTest :"+ oResponse.getResult());
+        return oResponse.getResult();               
+    }
+
+    /**
+     * Check Response is Valid
+     * @param rsp
+     * @return
+     */
+    private static boolean checkValidResponse(RestResponse rsp) 
+    {
+        if (rsp.getStatusCode() == null || rsp.getResult() == null 
+                || (RestConstant.RESPONSE_CODE_200 != rsp.getStatusCode() && RestConstant.RESPONSE_CODE_201 != rsp.getStatusCode()))
+        {
+            return false;
+        }
+        return true;
+    }    
+    
+    /**
+     * 
+     * @param strJsonData
+     * @return
+     */
+    private static String getCsarIdValue(String strJsonData) 
+    {
+        ObjectMapper mapper = new ObjectMapper();
+        mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+        Map<String, String> dataMap = null;
+        try 
+        {
+            dataMap = (Map<String, String>)mapper.readValue(strJsonData, Map.class);
+        } catch(JsonParseException e) {
+            logger.error("JsonParseException:Failed to upload package to catalouge:");
+        } catch(JsonMappingException e) {
+            logger.error("JsonMappingException:Failed to upload package to catalouge:");
+        } catch(IOException e) {
+            logger.error("IOException:Failed to upload package to catalouge:");
+        }
+        return dataMap.get("csarId");
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestHook.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestHook.java
new file mode 100644 (file)
index 0000000..29710df
--- /dev/null
@@ -0,0 +1,193 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.onboarding.hooks.validatelifecycle;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openo.vnfsdk.marketplace.common.CommonConstant;
+import org.openo.vnfsdk.marketplace.common.FileUtil;
+import org.openo.vnfsdk.marketplace.common.ToolUtil;
+import org.openo.vnfsdk.marketplace.db.entity.PackageData;
+import org.openo.vnfsdk.marketplace.entity.EnumOperationStatus;
+import org.openo.vnfsdk.marketplace.entity.EnumResult;
+import org.openo.vnfsdk.marketplace.onboarding.entity.OnBoardingOperResult;
+import org.openo.vnfsdk.marketplace.onboarding.entity.OnBoardingResult;
+import org.openo.vnfsdk.marketplace.onboarding.entity.OnBoradingRequest;
+import org.openo.vnfsdk.marketplace.onboarding.entity.ResultKey;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LifecycleTestHook 
+{
+    private static final Logger logger = LoggerFactory.getLogger(LifecycleTestHook.class);
+
+    /**
+     * Start Executing Function test
+     * @param onBoradingReq
+     * @return
+     */
+    public int exec(OnBoradingRequest onBoradingReq)
+    {       
+        logger.info("OnboradingRequest Lifecycle Request received for Package:" + onBoradingReq.getCsarId() + " Path:"+ onBoradingReq.getPackagePath());
+
+        buildResultPath(onBoradingReq);
+        
+        OnBoardingResult olifecycleTestResult = new OnBoardingResult();
+        buildlifecycleTestResponse(onBoradingReq,olifecycleTestResult);
+        updateResult(olifecycleTestResult);
+        
+        if(null == onBoradingReq.getCsarIdCatalouge() || onBoradingReq.getCsarIdCatalouge().isEmpty())
+        {          
+            olifecycleTestResult.setOperFinished(true);
+            olifecycleTestResult.setOperStatus(EnumResult.FAIL.getIndex());            
+            buildFuncTestResponse(olifecycleTestResult,CommonConstant.LifeCycleTest.LIFECYCLE_TEST_EXEC,EnumOperationStatus.FAILED.getIndex());
+            updateResult(olifecycleTestResult);           
+            return EnumResult.FAIL.getIndex();
+        }
+      
+        LifeCycleTestReq oLifeCycleTestReq = new LifeCycleTestReq();
+        populateLifeCycleReq(onBoradingReq,oLifeCycleTestReq);
+
+        
+        //STEP 2: Execute Life Cycle Test and Get Result Back !!!!
+        //---------------------------------------------------------
+        String lifecycleTestResultKey = LifecycleTestExceutor.execlifecycleTest(onBoradingReq,oLifeCycleTestReq);
+        if(null == lifecycleTestResultKey)
+        {          
+            olifecycleTestResult.setOperFinished(true);
+            olifecycleTestResult.setOperStatus(EnumResult.FAIL.getIndex());            
+            buildFuncTestResponse(olifecycleTestResult,CommonConstant.LifeCycleTest.LIFECYCLE_TEST_EXEC,EnumOperationStatus.FAILED.getIndex());
+            updateResult(olifecycleTestResult);           
+            return EnumResult.FAIL.getIndex();
+        }
+
+        olifecycleTestResult.setOperFinished(true);
+        olifecycleTestResult.setOperStatus(EnumResult.SUCCESS.getIndex());
+        buildFuncTestResponse(olifecycleTestResult,CommonConstant.LifeCycleTest.LIFECYCLE_TEST_EXEC,EnumOperationStatus.SUCCESS.getIndex());
+        updateResult(olifecycleTestResult);
+
+        //STEP 3: Store FuncTest key to get FuncTest Results
+        //-------------------------------------------------
+        storelifecycleResultKey(onBoradingReq,lifecycleTestResultKey);
+
+        return (olifecycleTestResult.getOperStatus() == EnumResult.SUCCESS.getIndex()) 
+                ? EnumResult.SUCCESS.getIndex() : EnumResult.FAIL.getIndex();
+    }
+
+    private void populateLifeCycleReq(OnBoradingRequest onBoradingReq, LifeCycleTestReq oLifeCycleTestReq) 
+    {            
+        oLifeCycleTestReq.setCsarId(onBoradingReq.getCsarId());
+        oLifeCycleTestReq.setLabVimId(oLifeCycleTestReq.getLabVimId());
+        
+        List<String> vimIds = new ArrayList<String>();
+        oLifeCycleTestReq.setVimIds(vimIds);
+    }
+
+    /**
+     * 
+     * @param onBoradingReq
+     */
+    private void buildResultPath(OnBoradingRequest onBoradingReq) 
+    {
+        String filePath = getResultStorePath() + File.separator + onBoradingReq.getCsarId();
+        if(!FileUtil.checkFileExists(filePath))
+        {
+            FileUtil.createDirectory(filePath);
+        }
+    }
+
+    /**
+     * Store Function test Execution Results
+     * @param oFuncTestResult
+     */
+    private void updateResult(OnBoardingResult oFuncTestResult) 
+    {   
+        //STore Results to DB(Currently we will make JSON and Store JSON to Package Path)
+        //-------------------------------------------------------------------------------
+        logger.info("Lifecycle test Status for Package Id:" + oFuncTestResult.getCsarId() + ", Result:" + ToolUtil.objectToString(oFuncTestResult));
+        String filePath = getResultStorePath()  + File.separator  + oFuncTestResult.getCsarId() + File.separator + "lifecycleTest.json";        
+        FileUtil.writeJsonDatatoFile(filePath,oFuncTestResult);
+    }
+
+    /**
+     * Build Function Test Response
+     * @param onBoradingReq
+     * @param oFuncTestResult
+     */
+    private void buildlifecycleTestResponse(OnBoradingRequest onBoradingReq, OnBoardingResult oTestResult) 
+    {
+        oTestResult.setOperFinished(false);
+        oTestResult.setCsarId(onBoradingReq.getCsarId());
+        oTestResult.setOperTypeId(CommonConstant.LifeCycleTest.LIFECYCLE_TEST_OPERTYPE_ID);
+
+        OnBoardingOperResult lifecycleTestExec = new OnBoardingOperResult();
+        lifecycleTestExec.setOperId(CommonConstant.LifeCycleTest.LIFECYCLE_TEST_EXEC);
+        lifecycleTestExec.setStatus(EnumOperationStatus.NOTSTARTED.getIndex());
+
+        List<OnBoardingOperResult> operResult = new ArrayList<OnBoardingOperResult>();
+        operResult.add(lifecycleTestExec); 
+        oTestResult.setOperResult(operResult);
+    }
+
+    public static OnBoardingResult getOnBoardingResult(PackageData packageData) 
+    {
+        String filePath = getResultStorePath()  + File.separator + packageData.getCsarId() +File.separator + "lifecycleTest.json"; 
+        logger.info("On Boarding Status for Package Id:" + packageData.getCsarId() + ", Result Path:" + filePath);
+
+        return (OnBoardingResult)FileUtil.readJsonDatafFromFile(filePath,OnBoardingResult.class);
+    }
+
+    /**
+     * Store Function Test Result key
+     * @param onBoradingReq
+     * @param resultKey
+     */
+    private void storelifecycleResultKey(OnBoradingRequest onBoradingReq,String resultKey) 
+    {
+        //Currently we will make JSON and Store JSON to Package Path)
+        //-------------------------------------------------------------------------------
+        String filePath = getResultStorePath() + File.separator + onBoradingReq.getCsarId() + File.separator + "lifecycleTestResultKey.json";        
+
+        logger.info("Function test Results Key for Package Id:" + onBoradingReq.getCsarId() + ", Key:" + resultKey + " Path" + filePath);
+        
+        ResultKey oResultKey = new ResultKey();
+        oResultKey.setCsarId(onBoradingReq.getCsarId());
+        oResultKey.setOperTypeId(CommonConstant.LifeCycleTest.LIFECYCLE_TEST_OPERTYPE_ID);
+        oResultKey.setKey(resultKey);
+
+        FileUtil.writeJsonDatatoFile(filePath,oResultKey);
+    }
+    
+    private static String getResultStorePath() 
+    {
+        return org.openo.vnfsdk.marketplace.filemanage.http.ToolUtil.getHttpServerAbsolutePath();
+    }
+
+    private void buildFuncTestResponse(OnBoardingResult oFuncTestResult, String opreKey, int operStatusVal) 
+    {        
+        List<OnBoardingOperResult>  operStatusList = oFuncTestResult.getOperResult();
+        for(OnBoardingOperResult operObj: operStatusList)
+        {
+            if(operObj.getOperId().equalsIgnoreCase(opreKey))
+            {
+                operObj.setStatus(operStatusVal);
+                break;
+            }
+        }
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/ValidateLifecycleTestResponse.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/ValidateLifecycleTestResponse.java
new file mode 100644 (file)
index 0000000..4bec21b
--- /dev/null
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.onboarding.hooks.validatelifecycle;
+
+public class ValidateLifecycleTestResponse 
+{
+    private String jobId;
+    private String validate_status;
+    private String lifecycle_status;
+    private VnfInfo vnf_info;
+    public String getJobId() {
+        return jobId;
+    }
+    public void setJobId(String jobId) {
+        this.jobId = jobId;
+    }
+    public String getValidate_status() {
+        return validate_status;
+    }
+    public void setValidate_status(String validate_status) {
+        this.validate_status = validate_status;
+    }
+    public String getLifecycle_status() {
+        return lifecycle_status;
+    }
+    public void setLifecycle_status(String lifecycle_status) {
+        this.lifecycle_status = lifecycle_status;
+    }
+    public VnfInfo getVnf_info() {
+        return vnf_info;
+    }
+    public void setVnf_info(VnfInfo vnf_info) {
+        this.vnf_info = vnf_info;
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/VmsInfo.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/VmsInfo.java
new file mode 100644 (file)
index 0000000..f45a2ee
--- /dev/null
@@ -0,0 +1,42 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.onboarding.hooks.validatelifecycle;
+
+
+public class VmsInfo 
+{
+    private String ip;
+    private String username;
+    private String password;
+    public String getIp() {
+        return ip;
+    }
+    public void setIp(String ip) {
+        this.ip = ip;
+    }
+    public String getUsername() {
+        return username;
+    }
+    public void setUsername(String username) {
+        this.username = username;
+    }
+    public String getPassword() {
+        return password;
+    }
+    public void setPassword(String password) {
+        this.password = password;
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/VnfInfo.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/VnfInfo.java
new file mode 100644 (file)
index 0000000..1afd625
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.onboarding.hooks.validatelifecycle;
+
+import java.util.List;
+
+public class VnfInfo 
+{
+    private List<VmsInfo> vms;
+
+    public List<VmsInfo> getVms() {
+        return vms;
+    }
+
+    public void setVms(List<VmsInfo> vms) {
+        this.vms = vms;
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/onboardmanager/OnBoardingHandler.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/onboarding/onboardmanager/OnBoardingHandler.java
new file mode 100644 (file)
index 0000000..7656932
--- /dev/null
@@ -0,0 +1,63 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.onboarding.onboardmanager;
+
+import org.openo.vnfsdk.marketplace.common.FileUtil;
+import org.openo.vnfsdk.marketplace.db.resource.PackageManager;
+import org.openo.vnfsdk.marketplace.entity.EnumResult;
+import org.openo.vnfsdk.marketplace.onboarding.entity.OnBoradingRequest;
+import org.openo.vnfsdk.marketplace.onboarding.hooks.functiontest.FunctionTestHook;
+import org.openo.vnfsdk.marketplace.onboarding.hooks.validatelifecycle.LifecycleTestHook;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public final class OnBoardingHandler
+{
+    private static final Logger logger = LoggerFactory.getLogger(OnBoardingHandler.class);
+
+    public void handleOnBoardingReq(OnBoradingRequest onBoradingReq) 
+    {               
+        //Handle Package Life cycle/Validation
+        //------------------------------------
+        LifecycleTestHook oLifecycleTestHook = new LifecycleTestHook();
+        int iLifeCycleResponse = oLifecycleTestHook.exec(onBoradingReq);        
+        if(EnumResult.SUCCESS.getIndex() != iLifeCycleResponse)
+        {
+            logger.error("Onboarding falied for Package Id during Lifecycle Test:" + onBoradingReq.getCsarId());
+        } 
+        
+        //Handle Package FunctionTest
+        //-------------------------
+        FunctionTestHook oFunctionTestHook = new FunctionTestHook();
+        int iFuncTestResponse = oFunctionTestHook.exec(onBoradingReq);          
+        if(EnumResult.SUCCESS.getIndex() != iFuncTestResponse)
+        {
+            logger.error("Onboarding falied for Package Id during Function Test:" + onBoradingReq.getCsarId());
+            return;
+        }      
+        
+        FileUtil.deleteDirectory(onBoradingReq.getPackagePath());    
+        try 
+        {
+            PackageManager.getInstance().updateDwonloadCount(onBoradingReq.getCsarId());
+        } 
+        catch (Exception e) 
+        {
+            logger.error("Download count udate failed for Package:" + onBoradingReq.getPackagePath() ,e);
+        }
+    }
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/resource/PackageResource.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/resource/PackageResource.java
new file mode 100644 (file)
index 0000000..e043ea5
--- /dev/null
@@ -0,0 +1,227 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.resource;
+
+import java.io.InputStream;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.eclipse.jetty.http.HttpStatus;
+import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
+import org.glassfish.jersey.media.multipart.FormDataParam;
+import org.openo.vnfsdk.marketplace.entity.response.CsarFileUriResponse;
+import org.openo.vnfsdk.marketplace.entity.response.PackageMeta;
+import org.openo.vnfsdk.marketplace.entity.response.UploadPackageResponse;
+import org.openo.vnfsdk.marketplace.onboarding.entity.OnBoardingResult;
+import org.openo.vnfsdk.marketplace.wrapper.PackageWrapper;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+
+/**
+ * csar package service.
+ * 
+ * @author 10189609
+ * 
+ */
+@Path("/PackageResource")
+@Api(tags = {"Package Resource"})
+public class PackageResource {
+
+    @Path("/updatestatus")
+    @POST
+    @ApiOperation(value = "update validate and lifecycle test status", response = UploadPackageResponse.class)
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    @ApiResponses(value = {
+            @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found",
+                    response = String.class),
+            @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415,
+                    message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
+            @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "update  error",
+                    response = String.class)})
+    public Response updateValidateStatus(
+            @ApiParam(value = "http request body") @Context HttpServletRequest request,
+            @ApiParam(value = "http header") @Context HttpHeaders head
+    ) throws Exception {
+        InputStream input = request.getInputStream();
+        return PackageWrapper.getInstance().updateValidateStatus(input, head);
+
+    }
+
+
+    @Path("/csars")
+    @GET
+    @ApiOperation(value = "get csar package list by condition", response = PackageMeta.class,
+    responseContainer = "List")
+    @Produces(MediaType.APPLICATION_JSON)
+    @ApiResponses(value = {
+            @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found",
+                    response = String.class),
+            @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415,
+            message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
+            @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "resource grant error",
+            response = String.class)})
+    public Response queryPackageListByCond(
+            @ApiParam(value = "csar name") @QueryParam("name") String name, @ApiParam(
+                    value = "csar provider") @QueryParam("provider") String provider, @ApiParam(
+                            value = "csar version") @QueryParam("version") String version, @ApiParam(
+                                    value = "delay to delete") @QueryParam("deletionPending") String deletionPending,
+            @ApiParam(value = "csar type") @QueryParam("type") String type) {
+        return PackageWrapper.getInstance().queryPackageListByCond(name, provider, version,
+                deletionPending, type);
+    }
+
+    @Path("/csars/{csarId}")
+    @GET
+    @ApiOperation(value = "get csar package list", response = PackageMeta.class,
+    responseContainer = "List")
+    @Produces(MediaType.APPLICATION_JSON)
+    @ApiResponses(value = {
+            @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found",
+                    response = String.class),
+            @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415,
+            message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
+            @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "resource grant error",
+            response = String.class)})
+    public Response queryPackageById(
+            @ApiParam(value = "csar id") @PathParam("csarId") String csarId) {
+        return PackageWrapper.getInstance().queryPackageById(csarId);
+    }
+    @Path("/csars")
+    @POST
+    @ApiOperation(value = "upload csar package", response = UploadPackageResponse.class)
+    @Consumes(MediaType.MULTIPART_FORM_DATA)
+    @Produces(MediaType.APPLICATION_JSON)
+    @ApiResponses(value = {
+            @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found",
+                    response = String.class),
+            @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415,
+            message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
+            @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "resource grant error",
+            response = String.class)})
+    public Response uploadPackage(
+            @ApiParam(value = "file inputstream",
+            required = true) @FormDataParam("file") InputStream uploadedInputStream,@FormDataParam("params") String details,
+            @ApiParam(value = "file detail",
+            required = false) @FormDataParam("file") FormDataContentDisposition fileDetail,
+            @ApiParam(value = "http header") @Context HttpHeaders head) throws Exception {
+        return PackageWrapper.getInstance().uploadPackage(uploadedInputStream, fileDetail, details, head);
+    }
+
+    @Path("/csars/{csarId}")
+    @DELETE
+    @ApiOperation(value = "delete a package")
+    @ApiResponses(value = {
+            @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found",
+                    response = String.class),
+            @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415,
+            message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
+            @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "resource grant error",
+            response = String.class)})
+    public Response delPackage(@ApiParam(value = "csar Id") @PathParam("csarId") String csarId) {
+        return PackageWrapper.getInstance().delPackage(csarId);
+    }
+
+    @Path("/csars/{csarId}/files")
+    @GET
+    @ApiOperation(value = "get csar file uri by csarId", response = CsarFileUriResponse.class)
+    @Produces(MediaType.APPLICATION_JSON)
+    @ApiResponses(value = {
+            @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found",
+                    response = String.class),
+            @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415,
+            message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
+            @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "resource grant error",
+            response = String.class)})
+    public Response getCsarFileUri(
+            @ApiParam(value = "csar Id", required = true) @PathParam("csarId") String csarId) {
+        return PackageWrapper.getInstance().getCsarFileUri(csarId);
+    }
+
+    @Path("/csars/{csarId}/downloaded")
+    @GET
+    @ApiOperation(value = "update download count for a package",response = Response.class)
+    public Response updateDwonloadCount(@ApiParam(value = "csar Id") @PathParam("csarId") String csarId) {
+        return PackageWrapper.getInstance().updateDwonloadCount(csarId);
+    }
+
+    @Path("/csars/{csarId}/reupload")
+    @POST
+    @ApiOperation(value = "re-upload csar package", response = UploadPackageResponse.class)
+    @Consumes(MediaType.MULTIPART_FORM_DATA)
+    @Produces(MediaType.APPLICATION_JSON)
+    @ApiResponses(value = {
+            @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found",
+                    response = String.class),
+            @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415,
+            message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
+            @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "resource grant error",
+            response = String.class)})
+    public Response reUploadPackage(
+            @ApiParam(value = "csar Id") @PathParam("csarId") String csarId,
+            @ApiParam(value = "file inputstream",
+            required = true) @FormDataParam("file") InputStream uploadedInputStream,@FormDataParam("params") String details,
+            @ApiParam(value = "file detail",
+            required = false) @FormDataParam("file") FormDataContentDisposition fileDetail,
+            @ApiParam(value = "http header") @Context HttpHeaders head) throws Exception {
+        return PackageWrapper.getInstance().reUploadPackage(csarId,uploadedInputStream, fileDetail, details, head);
+    } 
+
+    @Path("/csars/{csarId}/onboardstatus")
+    @GET
+    @ApiOperation(value="Get VNF OnBoarding Result", response=OnBoardingResult.class)
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response getOnBoardingResult(@ApiParam("csar Id") @PathParam("csarId") String csarId, 
+            @ApiParam("operation type") @QueryParam("operTypeId") String operTypeId, 
+            @ApiParam("operation id") @QueryParam("operId") String operId)
+    {
+        return PackageWrapper.getInstance().getOnBoardingResult(csarId, operTypeId, operId);
+    }
+
+    @Path("/csars/{csarId}/operresult")
+    @GET
+    @ApiOperation(value = "Get VNF OnBoarded Opeartion Result", response = Response.class)
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response getOperStatus(@ApiParam(value = "csar Id") @PathParam("csarId") String csarId,
+            @ApiParam(value = "operation type") @QueryParam("operTypeId") String operTypeId) {
+        return PackageWrapper.getInstance().getOperResultByOperTypeId(csarId,operTypeId);
+    }
+
+    @Path("/csars/onboardsteps")
+    @GET
+    @ApiOperation(value="Get VNF OnBoarded Steps", response=Response.class)
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response getOnBoardingSteps()
+    {
+        return PackageWrapper.getInstance().getOnBoardingSteps();
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/rest/RestConstant.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/rest/RestConstant.java
new file mode 100644 (file)
index 0000000..4617a27
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openo.vnfsdk.marketplace.rest;
+
+
+public class RestConstant {
+
+    public static final String UNAME_KEY = "UNAME_KEY";
+
+    public static final String PWD_KEY = "PWD_KEY";
+
+    public static final String NETCONF = "NETCONF";
+
+    public static final String ASYNC = "ASYNC";
+
+    public static final String SYNC = "SYNC";
+
+    public static final String HEADERMAP_TYPE = "HEADERMAP_TYPE";
+
+    public static final String HEADERMAP_VALUE = "HEADERMAP_VALUE";
+
+    public static final String AUTH_TOKEN = "AUTH_TOKEN";
+
+    public static final String DEFAULT_HOST_ADDRESS = "localhost";
+
+    public static final int DEFAULT_PORT = 8080;
+
+    public static final int DEFAULT_MAX_CONNECTION_PER_CONTROLLER = 10;
+
+    public static final int DEFAULT_STRING_LENGTH_64 = 64;
+
+    public static final int DEFAULT_STRING_LENGTH_128 = 128;
+    
+    public static final int RESPONSE_CODE_200 = 200;
+    
+    public static final int RESPONSE_CODE_201 = 201;
+
+    public static class HttpContext {
+
+        public static final String CONTENT_TYPE = "Content-Type";
+
+        public static final String MEDIA_TYPE_JSON = "application/json;charset=UTF-8";
+
+        public static final String URL = "url";
+
+        public static final String METHOD_TYPE = "methodType";
+
+        private HttpContext() {
+        }
+    }
+
+
+    public static class MethodType {
+
+        public static final String POST = "post";
+
+        public static final String DELETE = "delete";
+
+        public static final String PUT = "put";
+
+        public static final String GET = "get";
+
+        private MethodType() {
+        }
+    }
+
+    private RestConstant() {
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/rest/RestResponse.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/rest/RestResponse.java
new file mode 100644 (file)
index 0000000..8ed1553
--- /dev/null
@@ -0,0 +1,49 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.rest;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class RestResponse {
+
+    public Integer getStatusCode() {
+        return statusCode;
+    }
+
+    public void setStatusCode(Integer statusCode) {
+        this.statusCode = statusCode;
+    }
+
+    public String getResult() {
+        return result;
+    }
+
+    public void setResult(String result) {
+        this.result = result;
+    }
+
+    private Integer statusCode;
+
+    private String result;
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/rest/RestfulClient.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/rest/RestfulClient.java
new file mode 100644 (file)
index 0000000..78be465
--- /dev/null
@@ -0,0 +1,168 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.rest;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpHost;
+import org.apache.http.HttpRequest;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.ResponseHandler;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.BasicResponseHandler;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RestfulClient {
+    private static final String HTTP = "http";
+    private static final Logger logger = LoggerFactory.getLogger(RestfulClient.class);
+
+    enum HttpMethod {
+        GET, POST, PUT, DELETE
+    }
+
+    /**
+     * execute http.
+     * @param method http method
+     * @param ip ip
+     * @param port port
+     * @param url url
+     * @param body http body
+     * @return RestResponse
+     */
+    public static RestResponse executeHttp(HttpMethod method, String ip, int port, String url,
+            HttpEntity body) {
+        CloseableHttpClient httpclient = HttpClients.createDefault();
+        HttpResponse httpResponse = null;
+        RestResponse result = new RestResponse();
+        try {
+            // specify the host, protocol, and port
+            HttpHost target = new HttpHost(ip, port, HTTP);
+            // specify the get request
+            HttpRequest request = getRequest(method, url, body);
+            httpResponse = httpclient.execute(target, request);
+            HttpEntity entity = httpResponse.getEntity();
+            if (entity != null) {
+                result.setStatusCode(httpResponse.getStatusLine().getStatusCode());
+                result.setResult(EntityUtils.toString(entity));
+            }
+        } catch (Exception e1) {
+            logger.error("send get rest request error:", e1.getMessage());
+        } finally {
+            if (httpclient != null) {
+                try {
+                    httpclient.close();
+                } catch (IOException e2) {
+                    logger.error("close httpclient error:", e2.getMessage());
+                }
+            }
+        }
+        return result;
+    }
+
+    private static HttpRequest getRequest(HttpMethod method, String url, HttpEntity body) {
+        HttpRequest request = null;
+        switch (method) {
+            case GET:
+                request = new HttpGet(url);
+                break;
+            case POST:
+                request = new HttpPost(url);
+                ((HttpPost) request).setEntity(body);
+                break;
+            case PUT:
+                request = new HttpPut(url);
+                ((HttpPut) request).setEntity(body);
+                break;
+            case DELETE:
+                request = new HttpDelete(url);
+                break;
+            default:
+                break;
+        }
+        return request;
+    }
+
+    public static RestResponse get(String ip, int port, String url) {
+        return executeHttp(HttpMethod.GET, ip, port, url, null);
+    }
+
+    public static RestResponse delete(String ip, int port, String url) {
+        return executeHttp(HttpMethod.DELETE, ip, port, url, null);
+    }
+
+    public static RestResponse post(String ip, int port, String url, HttpEntity requestBody) {
+        return executeHttp(HttpMethod.POST, ip, port, url, requestBody);
+    }
+
+    public static RestResponse sendPostRequest(String ip, String  port, String url, String strJson) 
+    {
+        RestResponse result = new RestResponse();
+        CloseableHttpClient httpClient = HttpClientBuilder.create().build();
+        HttpResponse httpResponse = null;
+        try 
+        {            
+            String urlPost =  "http://" + ip + ":" + port + url;
+            logger.info("URL formed for Post, URL :" + urlPost);
+            logger.info("URL formed for Post, JSON :" + strJson);
+            
+            HttpPost request = new HttpPost(urlPost);
+            
+            StringEntity params = new StringEntity(strJson);
+            request.addHeader("content-type", "application/json");
+            request.setEntity(params);
+
+            httpResponse = httpClient.execute(request);
+            HttpEntity entity = httpResponse.getEntity();
+            if (entity != null) 
+            {
+                result.setStatusCode(httpResponse.getStatusLine().getStatusCode());
+                result.setResult(EntityUtils.toString(entity));
+            }
+        } 
+        catch (Exception ex) 
+        {
+            logger.error("Send Post request error:", ex.getMessage());
+        } 
+        finally 
+        {
+            try {
+                if(null != httpClient) {
+                    httpClient.close();   
+                }
+            } 
+            catch(IOException e){
+                logger.error("IOException :Send Post request error:", e.getMessage());
+            }
+        }
+        return result;
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/rest/RestfulUtil.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/rest/RestfulUtil.java
new file mode 100644 (file)
index 0000000..0391264
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openo.vnfsdk.marketplace.rest;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.baseservice.roa.util.restclient.Restful;
+import org.openo.baseservice.roa.util.restclient.RestfulFactory;
+import org.openo.baseservice.roa.util.restclient.RestfulParametes;
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RestfulUtil {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(RestfulUtil.class);
+
+    private RestfulUtil() {
+    }
+
+    /**
+     * Interface for Sending Request via REST
+     * @param paramsMap
+     * @param params
+     * @param queryParam
+     * @return
+     */
+    public static RestfulResponse sendRestRequest(Map<String, String> paramsMap, String params,Map<String, String> queryParam)  
+    {
+        if(null == paramsMap) 
+        {
+            LOGGER.error("sendRestResponse : Input validation failed !");
+            return null;
+        }
+        
+        String url = paramsMap.get(RestConstant.HttpContext.URL);
+        String methodType = paramsMap.get(RestConstant.HttpContext.METHOD_TYPE);
+
+        RestfulResponse rsp = null;
+        Restful rest = RestfulFactory.getRestInstance(RestfulFactory.PROTO_HTTP);
+        
+        try 
+        {
+            RestfulParametes restfulParametes = new RestfulParametes();
+            Map<String, String> headerMap = new HashMap<String, String>(3);
+            headerMap.put(RestConstant.HttpContext.CONTENT_TYPE, RestConstant.HttpContext.MEDIA_TYPE_JSON);
+            restfulParametes.setHeaderMap(headerMap);
+
+            if(null != params) 
+            {
+                restfulParametes.setRawData(params);
+            }
+
+            if(null != queryParam) 
+            {
+                for(Map.Entry<String, String> curEntity : queryParam.entrySet()) 
+                {
+                    restfulParametes.putHttpContextHeader(curEntity.getKey(), curEntity.getValue());
+                }
+            }          
+            if(rest != null) 
+            {
+                if(RestConstant.MethodType.GET.equalsIgnoreCase(methodType)) 
+                {
+                    rsp = rest.get(url, restfulParametes, null);
+                } 
+                else if(RestConstant.MethodType.POST.equalsIgnoreCase(methodType)) 
+                {
+                    rsp = rest.post(url, restfulParametes, null);
+                } 
+                else if(RestConstant.MethodType.PUT.equalsIgnoreCase(methodType)) 
+                {
+                    rsp = rest.put(url, restfulParametes, null);
+                } 
+                else if(RestConstant.MethodType.DELETE.equalsIgnoreCase(methodType))
+                {
+                    rsp = rest.delete(url, restfulParametes, null);
+                }
+            }
+        } 
+        catch(ServiceException  e) 
+        {
+            LOGGER.error("sendRestResponse, get restful response catch exception {}", e);
+        }
+        return rsp;
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/wrapper/PackageWrapper.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/wrapper/PackageWrapper.java
new file mode 100644 (file)
index 0000000..f42ac63
--- /dev/null
@@ -0,0 +1,596 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.wrapper;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+
+import net.sf.json.JSONObject;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
+import org.openo.vnfsdk.marketplace.common.CommonConstant;
+import org.openo.vnfsdk.marketplace.common.FileUtil;
+import org.openo.vnfsdk.marketplace.common.JsonUtil;
+import org.openo.vnfsdk.marketplace.common.RestUtil;
+import org.openo.vnfsdk.marketplace.common.ToolUtil;
+import org.openo.vnfsdk.marketplace.db.entity.PackageData;
+import org.openo.vnfsdk.marketplace.db.exception.MarketplaceResourceException;
+import org.openo.vnfsdk.marketplace.db.resource.PackageManager;
+import org.openo.vnfsdk.marketplace.db.util.MarketplaceDbUtil;
+import org.openo.vnfsdk.marketplace.entity.request.PackageBasicInfo;
+import org.openo.vnfsdk.marketplace.entity.response.PackageMeta;
+import org.openo.vnfsdk.marketplace.entity.response.UploadPackageResponse;
+import org.openo.vnfsdk.marketplace.filemanage.FileManagerFactory;
+import org.openo.vnfsdk.marketplace.onboarding.entity.OnBoardingOperResult;
+import org.openo.vnfsdk.marketplace.onboarding.entity.OnBoardingResult;
+import org.openo.vnfsdk.marketplace.onboarding.entity.OnBoardingSteps;
+import org.openo.vnfsdk.marketplace.onboarding.entity.OnBoradingRequest;
+import org.openo.vnfsdk.marketplace.onboarding.hooks.functiontest.FunctionTestExceutor;
+import org.openo.vnfsdk.marketplace.onboarding.hooks.functiontest.FunctionTestHook;
+import org.openo.vnfsdk.marketplace.onboarding.hooks.validatelifecycle.LifecycleTestExceutor;
+import org.openo.vnfsdk.marketplace.onboarding.hooks.validatelifecycle.ValidateLifecycleTestResponse;
+import org.openo.vnfsdk.marketplace.onboarding.onboardmanager.OnBoardingHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PackageWrapper {
+    private static PackageWrapper packageWrapper;
+    private static final Logger LOG = LoggerFactory.getLogger(PackageWrapper.class);
+
+    /**
+     * get PackageWrapper instance.
+     * @return package wrapper instance
+     */
+    public static PackageWrapper getInstance() {
+        if (packageWrapper == null) {
+            packageWrapper = new PackageWrapper();
+        }
+        return packageWrapper;
+    }
+
+    public Response updateValidateStatus(InputStream inputStream, HttpHeaders head) throws Exception
+    {
+        String reqParam = IOUtils.toString(inputStream);
+        LOG.info("updateValidateStatus request param:"+reqParam);
+        if(StringUtils.isBlank(reqParam)) {
+            LOG.error("The updateValidateStatus request params can't be null");
+            return Response.status(Status.EXPECTATION_FAILED).build();
+        }
+        
+        ValidateLifecycleTestResponse lyfValidateResp = JsonUtil.fromJson(reqParam, ValidateLifecycleTestResponse.class);
+        if(!checkOperationSucess(lyfValidateResp))
+        {
+            return Response.status(Status.EXPECTATION_FAILED).build();
+        }
+        
+        String funcTestResponse = FunctionTestExceutor.executeFunctionTest(reqParam);
+        if(null == funcTestResponse)
+        {
+            return Response.status(Status.EXPECTATION_FAILED).build();
+        }
+        
+        JSONObject funcTestRspObject = JSONObject.fromObject(funcTestResponse);   
+        if(!funcTestRspObject.get("status").equals(CommonConstant.SUCCESS_STR))
+        {
+            return Response.status(Status.EXPECTATION_FAILED).build();
+        }
+                
+        JSONObject result = new JSONObject(); 
+        result.put("msg","SUCCESS");
+        return Response.ok(ToolUtil.objectToString(result), MediaType.APPLICATION_JSON).build();
+    }
+    
+    private boolean checkOperationSucess(ValidateLifecycleTestResponse lyfValidateResp) 
+    {
+        boolean bOperStatus = false;
+        if(null == lyfValidateResp) 
+        {
+            LOG.error("ValidateLifecycleTestResponse  is NUll !!!");
+            return bOperStatus;
+        }
+        if(lyfValidateResp.getLifecycle_status().equalsIgnoreCase(CommonConstant.SUCCESS_STR) 
+                && lyfValidateResp.getValidate_status().equalsIgnoreCase(CommonConstant.SUCCESS_STR))
+        {
+            LOG.error("Lifecycle/Validation Response failed :" + lyfValidateResp.getLifecycle_status() + File.separator + lyfValidateResp.getValidate_status());
+            bOperStatus =  true;
+        }
+        return bOperStatus;
+    }
+
+    /**
+     * query package list by condition.
+     * @param name package name
+     * @param provider package provider
+     * @param version package version
+     * @param deletionPending package deletionPending
+     * @param type package type
+     * @return Response
+     */
+    public Response queryPackageListByCond(String name, String provider, String version,
+            String deletionPending, String type) {
+        ArrayList<PackageData> dbresult = new ArrayList<PackageData>();
+        ArrayList<PackageMeta> result = new ArrayList<PackageMeta>();
+        LOG.info("query package info.name:" + name + " provider:" + provider + " version" + version
+                + " deletionPending" + deletionPending + " type:" + type);
+        try {
+            dbresult =
+                    PackageManager.getInstance().queryPackage(name, provider, version, deletionPending, type);
+            result = PackageWrapperUtil.packageDataList2PackageMetaList(dbresult);
+            return Response.ok(ToolUtil.objectToString(result)).build();
+        } catch (MarketplaceResourceException e1) {
+            LOG.error("query package by csarId from db error ! " + e1.getMessage());
+            return RestUtil.getRestException(e1.getMessage());
+        }
+    }
+
+    /**
+     * query package by id.
+     * @param csarId package id
+     * @return Response
+     */
+    public Response queryPackageById(String csarId) {
+        PackageData dbResult = new PackageData();
+        PackageMeta result = new PackageMeta();
+        dbResult = PackageWrapperUtil.getPackageInfoById(csarId);
+        result = PackageWrapperUtil.packageData2PackageMeta(dbResult);
+        return Response.ok(ToolUtil.objectToString(result)).build();
+    }
+
+    /**
+     * upload package.
+     * @param uploadedInputStream inputStream
+     * @param fileDetail package detail
+     * @param head http header
+     * @return Response
+     * @throws Exception e
+     */
+    public Response uploadPackage(InputStream uploadedInputStream,
+            FormDataContentDisposition fileDetail, String details, HttpHeaders head) throws Exception 
+    {
+        LOG.info("Upload/Reupload request Received !!!!");
+        
+        String packageId = MarketplaceDbUtil.generateId();
+        return handlePackageUpload(packageId,uploadedInputStream, fileDetail, details, head);
+    }
+
+    /**
+     * Interface for Uploading package
+     * @param packageId
+     * @param uploadedInputStream
+     * @param fileDetail
+     * @param details
+     * @param head
+     * @return
+     * @throws IOException
+     * @throws MarketplaceResourceException
+     */
+    private Response handlePackageUpload(String packageId,InputStream uploadedInputStream, FormDataContentDisposition fileDetail,
+            String details, HttpHeaders head) throws IOException, MarketplaceResourceException 
+    {     
+        boolean bResult = handleDataValidate(packageId,uploadedInputStream,fileDetail);
+        if(!bResult)
+        {
+            LOG.error("Validation of Input received for Package Upload failed !!!");
+            return Response.status(Status.EXPECTATION_FAILED).build();
+        }
+
+        LOG.info("the fileDetail = " + ToolUtil.objectToString(fileDetail));
+
+        String fileName = ToolUtil.processFileName(fileDetail.getFileName());
+        String localDirName = ToolUtil.getTempDir(CommonConstant.CATALOG_CSAR_DIR_NAME, fileName);
+
+        String contentRange = null;
+        if (head != null) 
+        {
+            contentRange = head.getHeaderString(CommonConstant.HTTP_HEADER_CONTENT_RANGE);
+        }
+        LOG.info("store package chunk file, fileName:" + fileName + ",contentRange:" + contentRange);
+        if (ToolUtil.isEmptyString(contentRange))
+        {
+            int fileSize = uploadedInputStream.available();
+            contentRange = "0-" + fileSize + "/" + fileSize;
+        }
+
+        String fileLocation = ToolUtil.storeChunkFileInLocal(localDirName, fileName, uploadedInputStream);
+        LOG.info("the fileLocation when upload package is :" + fileLocation);
+
+        uploadedInputStream.close();
+
+        PackageBasicInfo basicInfo = PackageWrapperUtil.getPacageBasicInfo(fileLocation);          
+        if (null == basicInfo.getType() || null == basicInfo.getProvider() || null == basicInfo.getVersion()) 
+        {
+            LOG.error("Package basicInfo is incorrect ! basicIonfo = " + ToolUtil.objectToString(basicInfo));
+            return Response.serverError().build();
+        }
+
+        UploadPackageResponse result = new UploadPackageResponse();      
+        Boolean isEnd = PackageWrapperUtil.isUploadEnd(contentRange, fileName);
+        if (isEnd) 
+        {
+            PackageMeta packageMeta = PackageWrapperUtil.getPackageMeta(packageId,fileName, fileLocation, basicInfo, details);
+            
+            String path =  basicInfo.getType().toString() + File.separator + basicInfo.getProvider() + File.separator +  packageMeta.getCsarId() + File.separator + fileName.replace(".csar", "") + File.separator + basicInfo.getVersion();
+            String dowloadUri = File.separator + path + File.separator;
+            packageMeta.setDownloadUri(dowloadUri);
+            
+            LOG.info("dest path is : " + path);
+            LOG.info("packageMeta = " + ToolUtil.objectToString(packageMeta));
+
+            PackageData packageData = PackageWrapperUtil.getPackageData(packageMeta);
+            
+            String destPath = File.separator + path + File.separator + File.separator;
+            boolean uploadResult = FileManagerFactory.createFileManager().upload(localDirName, destPath);
+            if (uploadResult) 
+            {
+                //Create OnBoarding Request 
+                //--------------------------
+                OnBoradingRequest oOnboradingRequest = new OnBoradingRequest();
+                oOnboradingRequest.setCsarId(packageId);
+                oOnboradingRequest.setPackageName(fileName);
+                oOnboradingRequest.setPackagePath(localDirName);
+                
+                //Upload the Package to CATALOUGE and get CSARID
+                //---------------------------------------------
+                String catalougeCsarId = LifecycleTestExceutor.uploadPackageToCatalouge(oOnboradingRequest);
+                if((null == catalougeCsarId) || catalougeCsarId.isEmpty())
+                {
+                    LOG.error("Failed to Upload Package to catalougeCsarId " + ToolUtil.objectToString(basicInfo));
+                    return Response.status(Status.INTERNAL_SERVER_ERROR).build();
+                }
+                oOnboradingRequest.setCsarIdCatalouge(catalougeCsarId);
+                LOG.info("catalougeCsarId :" + catalougeCsarId);
+
+                
+                //Update Default download count to -1
+                packageData.setCsarId(packageId);
+                packageData.setDownloadCount(-1);
+                PackageData packateDbData = PackageManager.getInstance().addPackage(packageData);
+
+                LOG.info("Store package data to database succed ! packateDbData = "  + ToolUtil.objectToString(packateDbData));
+                LOG.info("upload package file end, fileName:" + fileName);
+
+                result.setCsarId(packateDbData.getCsarId());
+
+                //Assign  OnBoarding Request to OnBoarding Handler
+                //------------------------------------------------
+                addOnBoardingRequest(oOnboradingRequest);
+
+                LOG.info("OnboradingRequest Data : "  + ToolUtil.objectToString(oOnboradingRequest));
+            }
+        }
+        return Response.ok(ToolUtil.objectToString(result), MediaType.APPLICATION_JSON).build();
+    }
+
+    /**
+     * Execute OnBarding request
+     * @param oOnboradingRequest
+     */
+    private void addOnBoardingRequest(final OnBoradingRequest oOnboradingRequest) 
+    {
+        ExecutorService es = Executors.newFixedThreadPool(CommonConstant.ONBOARDING_THREAD_COUNT);
+        es.submit(new Callable<Integer>()
+        {
+            public Integer call() throws Exception 
+            {
+                new OnBoardingHandler().handleOnBoardingReq(oOnboradingRequest);
+                return CommonConstant.SUCESS;
+            }
+        });
+    }
+
+    /**
+     * delete package by package id.
+     * @param csarId package id
+     * @return Response
+     */
+    public Response delPackage(String csarId) {
+        LOG.info("delete package  info.csarId:" + csarId);
+        if (ToolUtil.isEmptyString(csarId)) {
+            LOG.error("delete package  fail, csarid is null");
+            return Response.serverError().build();
+        }
+        deletePackageDataById(csarId);
+        return Response.ok().build();
+    }
+
+    /**
+     * Delete Package by CSAR ID
+     * @param csarId
+     */
+    private void  deletePackageDataById(String csarId) {
+        String packagePath = PackageWrapperUtil.getPackagePath(csarId);
+        if (packagePath == null) {
+            LOG.error("package path is null! ");
+        }
+        
+        //Delete Package
+        FileManagerFactory.createFileManager().delete(packagePath);
+        //Delete Results Data
+        FileManagerFactory.createFileManager().delete(File.separator + csarId);
+
+        
+        //delete package data from database
+        try {
+            PackageManager.getInstance().deletePackage(csarId);
+        } catch (MarketplaceResourceException e1) {
+            LOG.error("delete package  by csarId from db error ! " + e1.getMessage(), e1);
+        }
+    }
+
+    /**
+     * download package by package id.
+     * @param csarId package id
+     * @return Response
+     */
+    public Response downloadCsarPackagesById(String csarId) {
+        PackageData packageData = PackageWrapperUtil.getPackageInfoById(csarId);
+        
+        String packageName = packageData.getName();
+        String path = org.openo.vnfsdk.marketplace.filemanage.http.ToolUtil.getHttpServerAbsolutePath() +File.separatorChar+packageData.getType()+File.separatorChar+
+                packageData.getProvider()+File.separatorChar+ packageData.getCsarId() +File.separator +packageName+File.separatorChar+packageData.getVersion() 
+                +File.separator + packageName + ".csar";
+        
+        LOG.info("downloadCsarPackagesById path is :  " + path);
+        
+        File csarFile = new File(path);
+        if (!csarFile.exists()) {
+            return Response.status(Status.INTERNAL_SERVER_ERROR).build();
+        }
+
+        LOG.info("downloadCsarPackagesById ABS path is :  " + csarFile.getAbsolutePath());
+        
+        try 
+        {
+            InputStream fis = new BufferedInputStream(new FileInputStream(csarFile.getAbsolutePath()));
+            return Response.ok(fis)
+                    .header("Content-Disposition", "attachment; filename=\"" + csarFile.getName() + "\"")
+                    .build();
+        } 
+        catch (Exception e1) 
+        {
+            LOG.error("download vnf package fail.", e1);
+            return RestUtil.getRestException(e1.getMessage());
+        }
+    }
+
+    /**
+     * get package file uri.
+     * @param csarId package id
+     * @param relativePath file relative path
+     * @return Response
+     */
+    public Response getCsarFileUri(String csarId) {
+        return downloadCsarPackagesById(csarId);
+    }
+
+    /**
+     * Interface to Update Download count for CSAR ID
+     * @param csarId
+     * @return
+     */
+    public Response updateDwonloadCount(String csarId) {
+        return handleDownladCountUpdate(csarId) ?  
+                Response.ok().build() : 
+                    Response.status(Status.EXPECTATION_FAILED).build();
+    }
+
+    /**
+     * Handle downlowa count update
+     * @param csarId
+     * @return
+     */
+    private boolean handleDownladCountUpdate(String csarId) {
+        boolean bupdateSucess = false;
+        try 
+        {
+            PackageManager.getInstance().updateDwonloadCount(csarId);
+            bupdateSucess = true;
+        } 
+        catch (Exception exp) 
+        {
+            LOG.error("Updating Donwload count failed for Package with ID !!! : " + exp.getMessage(), exp);
+        }
+        return bupdateSucess;
+    }
+
+    /**
+     * Interface to Re upload Package 
+     * @param csarId
+     * @param uploadedInputStream
+     * @param fileDetail
+     * @param details
+     * @param head
+     * @return
+     * @throws Exception
+     */
+    public Response reUploadPackage(String csarId,
+            InputStream uploadedInputStream, 
+            FormDataContentDisposition fileDetail,
+            String details, 
+            HttpHeaders head) throws Exception
+    {
+        LOG.info("Reupload request Received !!!!");
+        
+        //STEP 1: Validate Input Data  
+        //----------------------------
+        boolean bResult = handleDataValidate(csarId,uploadedInputStream,fileDetail);
+        if(!bResult)
+        {
+            LOG.error("Validation of Input received for Package Upload failed during Reload!!!");
+            return Response.status(Status.EXPECTATION_FAILED).build();
+        }
+
+        //STEP 2: Delete All Package Data based on package id
+        //----------------------------------------------------
+        deletePackageDataById(csarId);
+
+        //STEP 3: upload package with same package id
+        //-------------------------------------------
+        return handlePackageUpload(csarId,uploadedInputStream, fileDetail, details, head);
+    }
+
+    /**
+     * Interface to get OnBoarding Result by Operation Type
+     * @param csarId
+     * @param operTypeId
+     * @param operId
+     * @return
+     */
+    public Response getOnBoardingResult(String csarId, String operTypeId, String operId)
+    {
+        LOG.info("getOnBoardingResult request : csarId:" + csarId + " operTypeId:" + operTypeId + " operId:" + operId);
+        if ((null == csarId) || (null == operTypeId) || (null == operId)) {
+            return Response.status(Response.Status.BAD_REQUEST).build();
+        }
+        if ((csarId.isEmpty()) || (operTypeId.isEmpty()) || (operId.isEmpty())) {
+            return Response.status(Response.Status.BAD_REQUEST).build();
+        }
+        PackageData packageData = PackageWrapperUtil.getPackageInfoById(csarId);
+        if (null == packageData) {
+            return Response.status(Response.Status.PRECONDITION_FAILED).build();
+        }
+        
+        handleDelayExec(operId);
+        
+        OnBoardingResult oOnBoardingResult = FunctionTestHook.getOnBoardingResult(packageData);
+        if (null == oOnBoardingResult) {
+            return Response.status(Response.Status.PRECONDITION_FAILED).build();
+        }
+        filterOnBoardingResultByOperId(oOnBoardingResult, operId);
+
+        String strResult = ToolUtil.objectToString(oOnBoardingResult);
+        LOG.info("getOnBoardingResult response : " + strResult);
+        return Response.ok(strResult, "application/json").build();
+    }
+
+    
+    private void filterOnBoardingResultByOperId(OnBoardingResult oOnBoardingResult, String operId)
+    {
+        if (0 == operId.compareToIgnoreCase("all")) {
+            return;
+        }
+        if (0 == operId.compareToIgnoreCase("download"))
+        {
+            List<OnBoardingOperResult> operResultListTemp = new ArrayList<OnBoardingOperResult>();
+            OnBoardingOperResult operResultListTmp = new OnBoardingOperResult();
+            operResultListTmp.setOperId("download");
+            operResultListTmp.setStatus(0);
+            operResultListTemp.add(operResultListTmp);
+            oOnBoardingResult.setOperResult(operResultListTemp);
+            return;
+        }
+        List<OnBoardingOperResult> operResultListOut = new ArrayList<OnBoardingOperResult>();
+        List<OnBoardingOperResult> operResultList = oOnBoardingResult.getOperResult();
+        for (OnBoardingOperResult operResult : operResultList) {
+            if (0 == operResult.getOperId().compareToIgnoreCase(operId)) {
+                operResultListOut.add(operResult);
+            }
+        }
+        oOnBoardingResult.setOperResult(operResultListOut);
+    }
+
+    /**
+     * Interface to get OnBoarding Status by Operation ID
+     * @param csarId
+     * @param operTypeId
+     * @return
+     */
+    public Response getOperResultByOperTypeId(String csarId, String operTypeId) 
+    {
+        LOG.error("getOnBoardingResult request : csarId:"+ csarId + " operTypeId:"+operTypeId);    
+        if(null == csarId || null == operTypeId || csarId.isEmpty()  || operTypeId.isEmpty())
+        {
+            return Response.status(Status.BAD_REQUEST).build(); 
+        }
+
+        PackageData packageData = PackageWrapperUtil.getPackageInfoById(csarId);
+        if(null == packageData)
+        {
+            LOG.error("Failed to find package for PackageID:"+ csarId); 
+            return Response.status(Status.PRECONDITION_FAILED).build(); 
+        } 
+
+        //Get result key to fetch Function Test Results
+        //---------------------------------------------
+        String strResult = FunctionTestHook.getFuncTestResults(packageData);
+        if(null == strResult)
+        {
+            LOG.error("NULL reponse for getOperResultByOperTypeId response :"+ strResult); 
+            return Response.status(Status.INTERNAL_SERVER_ERROR).build(); 
+        }   
+        LOG.info("getOperResultByOperTypeId response :"+ strResult);    
+        return Response.ok(strResult, MediaType.APPLICATION_JSON).build();
+    }
+
+    private boolean handleDataValidate(String packageId,InputStream uploadedInputStream, FormDataContentDisposition fileDetail) 
+    {
+        boolean bvalidateOk = false;
+        if ((null != uploadedInputStream) && (fileDetail != null) && !ToolUtil.isEmptyString(packageId)) 
+        {
+            bvalidateOk = true;
+        }
+        return bvalidateOk;
+    }
+
+    /**
+     * Interface to get OnBoarding Steps
+     * @return
+     */
+    public Response getOnBoardingSteps()
+    {
+        LOG.info("Get OnBoarding Steps request Received !!!");
+
+        String filePath = org.openo.vnfsdk.marketplace.filemanage.http.ToolUtil.getAppDeployPath() + File.separator +"generalconfig/OnBoardingSteps.json";            
+        LOG.info("Onboarding Steps Json file Path  :" + filePath);
+
+        OnBoardingSteps oOnBoardingSteps = (OnBoardingSteps)FileUtil.readJsonDatafFromFile(filePath, OnBoardingSteps.class);
+        if (null == oOnBoardingSteps) {
+            return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
+        }
+        String strResult = ToolUtil.objectToString(oOnBoardingSteps);
+        LOG.info("getOnBoardingSteps response :" + strResult);
+        return Response.ok(strResult, MediaType.APPLICATION_JSON).build();
+    }
+    
+    private void handleDelayExec(String operId) 
+    {
+        if (0 == operId.compareToIgnoreCase(CommonConstant.functionTest.FUNCTEST_EXEC)) 
+        {
+            try 
+            {
+                Thread.sleep(8000);
+            } 
+            catch (InterruptedException e) 
+            {
+                LOG.info("handleDelayExex response : " + e.getMessage());
+            }
+        }
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/openo/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java
new file mode 100644 (file)
index 0000000..02cf567
--- /dev/null
@@ -0,0 +1,356 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.vnfsdk.marketplace.wrapper;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+
+import org.openo.vnfsdk.marketplace.common.CommonConstant;
+import org.openo.vnfsdk.marketplace.common.FileUtil;
+import org.openo.vnfsdk.marketplace.common.MsbAddrConfig;
+import org.openo.vnfsdk.marketplace.common.ToolUtil;
+import org.openo.vnfsdk.marketplace.db.entity.PackageData;
+import org.openo.vnfsdk.marketplace.db.exception.MarketplaceResourceException;
+import org.openo.vnfsdk.marketplace.db.resource.PackageManager;
+import org.openo.vnfsdk.marketplace.entity.EnumType;
+import org.openo.vnfsdk.marketplace.entity.request.PackageBasicInfo;
+import org.openo.vnfsdk.marketplace.entity.response.PackageMeta;
+import org.openo.vnfsdk.marketplace.model.parser.EnumPackageFormat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.gson.internal.LinkedTreeMap;
+
+
+public class PackageWrapperUtil {
+  private static final Logger LOG = LoggerFactory.getLogger(PackageWrapperUtil.class);
+
+  public static long getPacakgeSize(String fileLocation) {
+    File file = new File(fileLocation);
+    return file.length();
+  }
+
+  /**
+   * change package metadata to fix database.
+   * @param meta package metadata
+ * @param details 
+   * @return package data in database 
+   */
+  public static PackageData getPackageData(PackageMeta meta) {
+    PackageData packageData = new PackageData();
+    packageData.setCreateTime(meta.getCreateTime());
+    packageData.setDeletionPending(String.valueOf(meta.isDeletionPending()));
+    packageData.setDownloadUri(meta.getDownloadUri());
+    packageData.setFormat(meta.getFormat());
+    packageData.setModifyTime(meta.getModifyTime());
+    packageData.setName(meta.getName());
+    packageData.setCsarId(meta.getCsarId());
+    packageData.setProvider(meta.getProvider());
+    String fileSize = meta.getSize();
+    packageData.setSize(fileSize);
+    packageData.setType(meta.getType());
+    packageData.setVersion(meta.getVersion());
+       packageData.setDetails(meta.getDetails());
+       packageData.setShortDesc(meta.getShortDesc());
+       packageData.setRemarks(meta.getRemarks());
+    return packageData;
+  }
+
+  /**
+   * judge wether is the end of upload package.
+   * @param contentRange package sise range
+   * @param csarName package name
+   * @return boolean
+   */
+  public static boolean isUploadEnd(String contentRange, String csarName) {
+    String range = contentRange;
+    range = range.replace("bytes", "").trim();
+    range = range.substring(0, range.indexOf("/"));
+    String size =
+        contentRange.substring(contentRange.indexOf("/") + 1, contentRange.length()).trim();
+    int fileSize = Integer.parseInt(size);
+    String[] ranges = range.split("-");
+    int startPosition = Integer.parseInt(ranges[0]);
+    if (startPosition == 0) {
+      // delPackageBySync(csarName);
+    }
+    // index start from 0
+    int endPosition = Integer.parseInt(ranges[1]) + 1;
+    if (endPosition >= fileSize) {
+      return true;
+    }
+    return false;
+  }
+
+  /**
+   * get package detail by package id.
+   * @param csarId package id
+   * @return package detail
+   */
+  public static PackageData getPackageInfoById(String csarId) {
+    PackageData result = new PackageData();
+    ArrayList<PackageData> packageDataList = new ArrayList<PackageData>();
+    try {
+      packageDataList = PackageManager.getInstance().queryPackageByCsarId(csarId);
+      if (packageDataList != null && packageDataList.size() > 0) {
+        result = PackageManager.getInstance().queryPackageByCsarId(csarId).get(0);
+      }
+    } catch (MarketplaceResourceException e1) {
+      LOG.error("query package by csarId from db error ! " + e1.getMessage());
+    }
+    return result;
+  }
+
+  /**
+   * get package metadata from basic info.
+   * @param fileName package name
+   * @param fileLocation the location of package
+   * @param basic basic infomation of package. include version, type and provider
+   * @return package metadata
+   */
+  public static PackageMeta getPackageMeta(String packageId,String fileName, String fileLocation,
+    PackageBasicInfo basic, String details) {
+    PackageMeta packageMeta = new PackageMeta();
+    long size = getPacakgeSize(fileLocation);
+    packageMeta.setFormat(basic.getFormat());
+    
+    if(null == packageId)
+    {
+        packageId = ToolUtil.generateId();
+    }
+    packageMeta.setCsarId(packageId);
+    
+    packageMeta.setName(fileName.replace(CommonConstant.CSAR_SUFFIX, ""));
+    packageMeta.setType(basic.getType().toString());
+    packageMeta.setVersion(basic.getVersion());
+    packageMeta.setProvider(basic.getProvider());
+    packageMeta.setDeletionPending(false);
+    String sizeStr = ToolUtil.getFormatFileSize(size);
+    packageMeta.setSize(sizeStr);
+    SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+    String currentTime = sdf1.format(new Date());
+    packageMeta.setCreateTime(currentTime);
+    packageMeta.setModifyTime(currentTime);
+    if(null != details)
+    {
+       LinkedTreeMap<String,String> csarDetails = ToolUtil.fromJson(details, LinkedTreeMap.class);
+       packageMeta.setDetails(csarDetails.get("details"));
+       packageMeta.setShortDesc(csarDetails.get("shortDesc"));
+       packageMeta.setRemarks(csarDetails.get("remarks"));
+    }
+    return packageMeta;
+  }
+
+  /**
+   * get downloadUri from package metadata.
+   * @param csarId package id
+   * @return download uri
+   */
+  public static String getPackagePath(String csarId) {
+    ArrayList<PackageData> packageList = new ArrayList<PackageData>();
+    String downloadUri = null;
+    try {
+      packageList = PackageManager.getInstance().queryPackageByCsarId(csarId);
+      downloadUri = packageList.get(0).getDownloadUri();
+    } catch (MarketplaceResourceException e1) {
+      LOG.error("Query CSAR package by ID failed ! csarId = " + csarId);
+    }
+    return downloadUri;
+  }
+
+
+  /**
+   * get package name from ftpUrl.
+   * @param ftpUrl ftp url
+   * @return package name
+   */
+  public static String getPackageName(String ftpUrl) {
+    int index = ftpUrl.lastIndexOf("/");
+    String packageName = ftpUrl.substring(index);
+    return packageName;
+  }
+
+  /**
+   * translate package data from database to package metadata.
+   * @param dbResult data from database
+   * @return package metadata list
+   */
+  public static ArrayList<PackageMeta> packageDataList2PackageMetaList(
+      ArrayList<PackageData> dbResult) {
+    ArrayList<PackageMeta> metas = new ArrayList<PackageMeta>();
+    PackageMeta meta = new PackageMeta();
+    if (dbResult.size() > 0) {
+      for (int i = 0; i < dbResult.size(); i++) {
+        PackageData data = dbResult.get(i);
+        meta = packageData2PackageMeta(data);
+        metas.add(meta);
+      }
+    }
+    return metas;
+  }
+
+  public static PackageMeta packageData2PackageMeta(PackageData packageData) {
+    PackageMeta meta = new PackageMeta();
+    meta.setCsarId(packageData.getCsarId());
+    meta.setCreateTime(packageData.getCreateTime());
+    meta.setDeletionPending(Boolean.getBoolean(packageData.getDeletionPending()));
+    String packageUri =
+        packageData.getDownloadUri() + packageData.getName() + CommonConstant.CSAR_SUFFIX;
+    String packageUrl = getUrl(packageUri);
+    meta.setDownloadUri(packageUrl);
+    meta.setReport(packageData.getReport());
+    meta.setFormat(packageData.getFormat());
+    meta.setModifyTime(packageData.getModifyTime());
+    meta.setName(packageData.getName());
+    meta.setDetails(packageData.getDetails());
+    meta.setProvider(packageData.getProvider());
+    meta.setSize(packageData.getSize());
+    meta.setType(packageData.getType());
+    meta.setShortDesc(packageData.getShortDesc());
+    meta.setVersion(packageData.getVersion());
+    meta.setRemarks(packageData.getRemarks());
+    meta.setDownloadCount(packageData.getDownloadCount());
+    return meta;
+  }
+
+  /**
+   * add msb address as prefix to uri.
+   * @param uri uri
+   * @return url
+   */
+  public static String getUrl(String uri) {
+    String url = null;
+//    if ((MsbAddrConfig.getMsbAddress().endsWith("/")) && uri.startsWith("/")) {
+//      url = MsbAddrConfig.getMsbAddress() + uri.substring(1);
+//    }
+//    url = MsbAddrConfig.getMsbAddress() + uri;
+    if ((getDownloadUriHead().endsWith("/")) && uri.startsWith("/")) {
+      url = getDownloadUriHead() + uri.substring(1);
+    }
+    url = getDownloadUriHead() + uri;
+    String urlresult = url.replace("\\", "/");
+    return urlresult;
+  }
+  
+  public static String getDownloadUriHead() {
+    return MsbAddrConfig.getMsbAddress() + "/files/catalog-http";
+  }
+
+  /**
+   * get local path.
+   * @param uri uri
+   * @return local path
+   */
+  public static String getLocalPath(String uri) {
+    File srcDir = new File(uri);
+    String localPath = srcDir.getAbsolutePath();
+    return localPath.replace("\\", "/");
+  }
+
+  /**
+   * get package basic information.
+   * @param fileLocation package location
+   * @return package basic information
+   */
+  public static PackageBasicInfo getPacageBasicInfo(String fileLocation) {
+    PackageBasicInfo basicInfo = new PackageBasicInfo();
+    String unzipDir = ToolUtil.getUnzipDir(fileLocation);
+    boolean isXmlCsar = false;
+    try {
+      String tempfolder = unzipDir;
+      ArrayList<String> unzipFiles = FileUtil.unzip(fileLocation, tempfolder);
+      if (unzipFiles.isEmpty()) {
+        isXmlCsar = true;
+      }
+      for (String unzipFile : unzipFiles) {
+        if (unzipFile.endsWith(CommonConstant.CSAR_META)) {
+          basicInfo = readCsarMeta(unzipFile);
+        }
+        if (ToolUtil.isYamlFile(new File(unzipFile))) {
+          isXmlCsar = false;
+        }
+      }
+    } catch (IOException e1) {
+      LOG.error("judge package type error ! " + e1.getMessage());
+    }
+    if (isXmlCsar) {
+      basicInfo.setFormat(CommonConstant.PACKAGE_XML_FORMAT);
+    } else {
+      basicInfo.setFormat(CommonConstant.PACKAGE_YAML_FORMAT);
+    }
+    return basicInfo;
+  }
+
+  private static PackageBasicInfo readCsarMeta(String unzipFile) {
+    PackageBasicInfo basicInfo = new PackageBasicInfo();
+    File file = new File(unzipFile);
+    BufferedReader reader = null;
+    try {
+      reader = new BufferedReader(new FileReader(file));
+      String tempString = null;
+      while ((tempString = reader.readLine()) != null) {
+        if (!tempString.equals("")) {
+          int count1 = tempString.indexOf(":");
+          String meta = tempString.substring(0, count1).trim();
+          if (meta.equalsIgnoreCase(CommonConstant.CSAR_TYPE_META)) {
+            int count = tempString.indexOf(":") + 1;
+            basicInfo.setType(EnumType.valueOf(tempString.substring(count).trim()));
+          }
+          if (meta.equalsIgnoreCase(CommonConstant.CSAR_PROVIDER_META)) {
+            int count = tempString.indexOf(":") + 1;
+            basicInfo.setProvider(tempString.substring(count).trim());
+          }
+          if (meta.equalsIgnoreCase(CommonConstant.CSAR_VERSION_META)) {
+            int count = tempString.indexOf(":") + 1;
+            basicInfo.setVersion(tempString.substring(count).trim());
+          }
+        }
+      }
+      reader.close();
+    } catch (IOException e2) {
+      e2.printStackTrace();
+    } finally {
+      if (reader != null) {
+        try {
+          reader.close();
+        } catch (IOException e1) {
+          LOG.error("close reader failed ! " + e1.getMessage());
+        }
+      }
+    }
+    return basicInfo;
+  }
+  
+  /**
+   * get package format enum.
+   * @param format package format
+   * @return package format enum
+   */
+  public static EnumPackageFormat getPackageFormat(String format) {
+    if (format.equals("xml")) {
+      return EnumPackageFormat.TOSCA_XML;
+    } else if (format.equals("yml") || format.equals("yaml")) {
+      return EnumPackageFormat.TOSCA_YAML;
+    } else {
+      return null;
+    }
+  }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/resources/generalconfig/OnBoardingSteps.json b/vnfmarket-be/vnf-sdk-marketplace/src/main/resources/generalconfig/OnBoardingSteps.json
new file mode 100644 (file)
index 0000000..ca69f28
--- /dev/null
@@ -0,0 +1,54 @@
+{  
+   "operTypeList":[  
+      {  
+         "operTypeName":"Validation",
+         "operTypeId":"validation",
+         "oper":[  
+            {  
+               "operId":"upload_id_1",
+               "operName":"Validation Step 1 Execute"
+            },
+            {  
+               "operId":"upload_id_2",
+               "operName":"Validation Step 2 Execute"
+            },
+                       {  
+               "operId":"upload_id_3",
+               "operName":"Validation Step 3 Execute"
+            },
+            {  
+               "operId":"upload_id_4",
+               "operName":"Validation Step 4 Execute"
+            }
+         ]
+      },
+      {  
+         "operTypeName":"LifeCycle",
+         "operTypeId":"lifecycletest",
+         "oper":[  
+            {  
+               "operId":"lifecycleTestexec",
+               "operName":"LifeCycle Test Execute"
+            }
+         ]
+      },
+      {  
+         "operTypeName":"Function Test",
+         "operTypeId":"functiontest",
+         "oper":[  
+            {  
+               "operId":"packageExists",
+               "operName":"Check Package exists"
+            },
+            {  
+               "operId":"download",
+               "operName":"Download Package from Repository"
+            },
+            {  
+               "operId":"functestexec",
+               "operName":"Execute Function Testing"
+            }
+         ]
+      }
+   ]
+}
\ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/resources/log4j.properties b/vnfmarket-be/vnf-sdk-marketplace/src/main/resources/log4j.properties
new file mode 100644 (file)
index 0000000..f1a00ee
--- /dev/null
@@ -0,0 +1,8 @@
+log4j.rootLogger=INFO,root
+log4j.appender.root.Append=true
+log4j.appender.root.File=${catalina.base}/logs/vnfsdkmarketplace.log
+log4j.appender.root.layout.ConversionPattern=%d %-5p [%t][%X{moduleID}][%C %L] %m%n
+log4j.appender.root.layout=org.apache.log4j.PatternLayout
+log4j.appender.root.MaxBackupIndex=50
+log4j.appender.root.MaxFileSize=20MB
+log4j.appender.root=org.apache.log4j.RollingFileAppender
\ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/resources/marketplace.properties b/vnfmarket-be/vnf-sdk-marketplace/src/main/resources/marketplace.properties
new file mode 100644 (file)
index 0000000..6bf7345
--- /dev/null
@@ -0,0 +1,15 @@
+# Copyright 2017 Huawei Technologies Co., Ltd.
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+#     http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+IP=msb.openo.org
+PORT=80
\ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/resources/mybatis/configuration/configuration.xml b/vnfmarket-be/vnf-sdk-marketplace/src/main/resources/mybatis/configuration/configuration.xml
new file mode 100644 (file)
index 0000000..76da57c
--- /dev/null
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2017 Huawei Technologies Co., Ltd.
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!DOCTYPE configuration
+PUBLIC "//mybatis.org//DTD Config 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-config.dtd">
+<configuration>
+    <environments default="development">
+        <environment id="development">
+            <transactionManager type="JDBC" />
+            <dataSource type="POOLED">
+                <property name="driver" value="com.mysql.jdbc.Driver" />
+                <property name="url" value="jdbc:mysql://127.0.0.1:3306/marketplaceDB" />
+                <property name="username" value="root" />
+                <property name="password" value="Changeme_123" />
+            </dataSource>
+        </environment>
+    </environments>
+    <mappers>
+        <mapper resource="mybatis/sql/MarketplaceMapper.xml" />
+    </mappers>
+</configuration>
\ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/resources/mybatis/sql/MarketplaceMapper.xml b/vnfmarket-be/vnf-sdk-marketplace/src/main/resources/mybatis/sql/MarketplaceMapper.xml
new file mode 100644 (file)
index 0000000..27801ae
--- /dev/null
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2017 Huawei Technologies Co., Ltd.
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.openo.vnfsdk.marketplace.db.mapper.IMarketplaceMapper">
+
+    <select id="getAllPackageData" resultType="org.openo.vnfsdk.marketplace.db.entity.PackageData">
+        SELECT 
+        *
+        FROM
+        CSAR_PACKAGE_TABLE
+    </select>
+       
+       <select id="getPackageData" resultType="org.openo.vnfsdk.marketplace.db.entity.PackageData">
+       SELECT 
+       *
+       FROM
+       CSAR_PACKAGE_TABLE 
+       WHERE 
+       CSARID=#{csarId}
+    </select>
+       
+       <insert id="savePackageData" parameterType="org.openo.vnfsdk.marketplace.db.entity.PackageData">
+        INSERT INTO
+        CSAR_PACKAGE_TABLE
+        (CSARID, DOWNLOADURI, REPORT, SIZE, FORMAT, CREATETIME, DELETIONPENDING, MODIFYTIME, SHORTDESC, NAME, VERSION, PROVIDER, TYPE, DETAILS, REMARKS,DOWNLOADCOUNT)
+        VALUES
+        (#{csarId}, #{downloadUri}, #{report}, #{size}, #{format},#{createTime}, #{deletionPending}, #{modifyTime}, #{shortDesc}, #{name}, #{version}, #{provider},#{type}, #{details}, #{remarks}, #{downloadCount})
+    </insert>
+    
+    <delete id="deletePackageData" parameterType="String">
+        DELETE FROM 
+        CSAR_PACKAGE_TABLE
+        WHERE
+        CSARID=#{csarId}
+    </delete>
+       
+       <delete id="updatePackageData" parameterType="org.openo.vnfsdk.marketplace.db.entity.PackageData">
+        UPDATE CSAR_PACKAGE_TABLE SET  DOWNLOADCOUNT=#{downloadCount}
+        WHERE
+        CSARID=#{csarId}
+    </delete>
+       
+</mapper>
\ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/webapp/WEB-INF/web.xml b/vnfmarket-be/vnf-sdk-marketplace/src/main/webapp/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..c7480d0
--- /dev/null
@@ -0,0 +1,43 @@
+<?xml version = "1.0" encoding = "UTF-8"?> 
+<web-app xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"  
+   xmlns = "http://java.sun.com/xml/ns/javaee"  
+   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee  
+   http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"  
+   id = "WebApp_ID" version = "3.0"> 
+    <listener>
+        <listener-class>org.openo.vnfsdk.marketplace.msb.AppServletContextListener</listener-class>
+   </listener>
+   <servlet> 
+      <servlet-name>Jersey RESTful Application</servlet-name> 
+      <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class> 
+      <init-param> 
+         <param-name>jersey.config.server.provider.packages</param-name> 
+         <param-value>org.openo.vnfsdk.marketplace.resource</param-value> 
+      </init-param> 
+      <init-param>
+          <param-name>jersey.config.server.provider.classnames</param-name>
+      <param-value>org.glassfish.jersey.media.multipart.MultiPartFeature</param-value>
+      </init-param>
+   </servlet> 
+   <servlet-mapping> 
+      <servlet-name>Jersey RESTful Application</servlet-name> 
+      <url-pattern>/openoapi/vnfsdk-marketplace/v1/*</url-pattern> 
+   </servlet-mapping>  
+
+    <filter>
+        <filter-name>CorsFilter</filter-name>
+        <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
+        <init-param>
+            <param-name>cors.allowed.origins</param-name>
+            <param-value>*</param-value>
+        </init-param>
+        <init-param>
+            <param-name>cors.allowed.methods</param-name>
+            <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
+        </init-param>
+    </filter>
+    <filter-mapping>
+        <filter-name>CorsFilter</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+</web-app>
\ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/openo/vnfsdk/marketplace/VnfSdkMarketplaceAppTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/openo/vnfsdk/marketplace/VnfSdkMarketplaceAppTest.java
new file mode 100644 (file)
index 0000000..739e5a2
--- /dev/null
@@ -0,0 +1,23 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openo.vnfsdk.marketplace;
+
+
+public class VnfSdkMarketplaceAppTest {
+
+
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/openo/vnfsdk/marketplace/resource/PackageResourceTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/openo/vnfsdk/marketplace/resource/PackageResourceTest.java
new file mode 100644 (file)
index 0000000..3305e5a
--- /dev/null
@@ -0,0 +1,1208 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openo.vnfsdk.marketplace.resource;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import javax.ws.rs.core.Response;
+
+import org.codehaus.jackson.JsonNode;
+import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
+import org.junit.Before;
+import org.junit.Test;
+import org.openo.vnfsdk.marketplace.common.FileUtil;
+import org.openo.vnfsdk.marketplace.common.JsonUtil;
+import org.openo.vnfsdk.marketplace.common.ToolUtil;
+import org.openo.vnfsdk.marketplace.db.connection.ConnectionUtil;
+import org.openo.vnfsdk.marketplace.db.entity.PackageData;
+import org.openo.vnfsdk.marketplace.db.impl.MarketplaceDaoImpl;
+import org.openo.vnfsdk.marketplace.db.resource.PackageManager;
+import org.openo.vnfsdk.marketplace.db.util.MarketplaceDbUtil;
+import org.openo.vnfsdk.marketplace.db.wrapper.PackageHandler;
+import org.openo.vnfsdk.marketplace.entity.CsarPackage;
+import org.openo.vnfsdk.marketplace.entity.EnumOperationalState;
+import org.openo.vnfsdk.marketplace.entity.EnumType;
+import org.openo.vnfsdk.marketplace.entity.EnumUsageState;
+import org.openo.vnfsdk.marketplace.entity.VnfPackage;
+import org.openo.vnfsdk.marketplace.entity.request.PackageBasicInfo;
+import org.openo.vnfsdk.marketplace.entity.response.CsarFileUriResponse;
+import org.openo.vnfsdk.marketplace.entity.response.PackageMeta;
+import org.openo.vnfsdk.marketplace.entity.response.PackageResponse;
+import org.openo.vnfsdk.marketplace.filemanage.http.HttpFileManagerImpl;
+import org.openo.vnfsdk.marketplace.onboarding.entity.OnBoardingResult;
+import org.openo.vnfsdk.marketplace.onboarding.entity.OnBoradingRequest;
+import org.openo.vnfsdk.marketplace.onboarding.entity.ResultKey;
+import org.openo.vnfsdk.marketplace.onboarding.hooks.functiontest.FunctionTestExceutor;
+import org.openo.vnfsdk.marketplace.onboarding.hooks.functiontest.FunctionTestHook;
+import org.openo.vnfsdk.marketplace.rest.RestResponse;
+import org.openo.vnfsdk.marketplace.rest.RestfulClient;
+import org.openo.vnfsdk.marketplace.wrapper.PackageWrapper;
+import org.openo.vnfsdk.marketplace.wrapper.PackageWrapperUtil;
+
+import mockit.MockUp;
+import mockit.Mock;
+
+public class PackageResourceTest {
+
+    private PackageResource packageResource = null;
+    private Response response = null;
+    private String csarID =  "csarid";
+    private List<PackageData> packageDataList = null;
+    private PackageData packageData = null;
+    private FormDataContentDisposition fileDetail = null;
+    private InputStream inputStream = null;
+    private String operTypeId = "opertype";
+    private VnfPackage vnfPackageObj = null;
+    private CsarPackage csarPackageObj = null;
+    private PackageBasicInfo pkgBasicInfoObj = null;
+    private PackageMeta pkgMetaObj = null;
+    private PackageResponse pkgResponseObj = null;
+    private CsarFileUriResponse csarFileUriResObj = null;
+    @Before
+    public void setUp() {
+        packageResource = new PackageResource();
+        vnfPackageObj = new VnfPackage();
+        csarPackageObj = new CsarPackage();
+        pkgBasicInfoObj = new PackageBasicInfo();
+        pkgMetaObj = new PackageMeta();
+        pkgResponseObj = new PackageResponse();
+        csarFileUriResObj = new CsarFileUriResponse();
+    }
+
+    @Before
+    public void createTestFile()
+    {
+        String filePath = "src" + File.separator + "test" + File.separator + "resources" + File.separator + "Test.txt";
+        File file = new File(filePath);
+        try {
+            file.createNewFile();
+            FileWriter writer = new FileWriter(file);
+            writer.write("This is test file.");
+            writer.close();
+        }
+        catch(Exception e) {
+            e.printStackTrace();
+        }
+        
+        filePath = "src" + File.separator + "test" + File.separator + "resources" + File.separator + "testfolder";
+        file = new File(filePath);
+        if(!file.exists()) {
+            file.mkdirs();
+        }
+
+        StringBuilder sb = new StringBuilder();
+        sb.append("test data");
+        
+        filePath = "src" + File.separator + "test" + File.separator + "resources" + File.separator + "temp.zip";
+        file = new File(filePath);
+        try {
+            ZipOutputStream out = new ZipOutputStream(new FileOutputStream(file));
+            ZipEntry e = new ZipEntry("temp.txt");
+            out.putNextEntry(e);
+            byte[] data = sb.toString().getBytes();
+            out.write(data, 0, data.length);
+            out.closeEntry();
+            out.close();
+        }
+        catch(Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testQueryPackageListByCond() throws Exception{
+        new MockUp<MarketplaceDaoImpl>() {
+            @Mock
+            public List<PackageData> getAllPackageData() {              
+                return new ArrayList<PackageData>();            
+            }
+        };
+        try {
+            response = PackageWrapper.getInstance().queryPackageListByCond( null, null, null, null, null);
+        } catch( Exception e ) {
+            e.printStackTrace();
+        }      
+
+        assertNotNull( response );
+        assertEquals( 200, response.getStatus());
+        //assertNull(res5);
+        // assertEquals(00,res5.getStatus());
+    }
+
+    @Test
+    public void testQueryPackageById() throws Exception {
+        new MockUp<MarketplaceDaoImpl>() {
+            @Mock
+            public List<PackageData> getPackageData(String csarId) {
+                return null;
+            }
+
+        }; 
+        new MockUp<MarketplaceDaoImpl>() {
+            @Mock
+            public List<PackageData> getPackageData( String csarId ) {  
+                packageDataList = new ArrayList<PackageData>();   
+                packageData = new PackageData();
+                packageData.setCsarId( csarId );
+                packageData.setDownloadUri( "src\\test\\resources\\clearwater_ns.csar" );
+                packageData.setName( "clearwater_ns.csar" );
+                packageData.setSize( "59,854  bytes" );
+                packageData.setVersion( "v1.0" );
+                packageData.setProvider( "Huawei" );
+                packageDataList.add( packageData );
+                return packageDataList;             
+            }
+        }; 
+
+        try {
+            response = PackageWrapper.getInstance().queryPackageById( csarID );
+        } catch ( Exception e ) {
+            e.printStackTrace();
+        }
+        assertNotNull( response );
+        assertEquals( 200, response.getStatus());           
+    }   
+
+    @Test
+    public void testDelPackageFaiure() {
+        new MockUp<MarketplaceDaoImpl>() {
+            @Mock
+            public List<PackageData> getAllPackageData() { 
+                return new ArrayList<PackageData>(); 
+            }
+        };
+
+        new MockUp<MarketplaceDaoImpl>() {
+            @Mock
+            public void deletePackageData( String csarId ) {            
+                return;             
+            }
+        };
+
+        new MockUp<MarketplaceDaoImpl>() {
+            @Mock
+            public List<PackageData> getPackageData( String csarId ) {              
+                return new ArrayList<PackageData>();            
+            }
+        };       
+
+        try {
+            response = PackageWrapper.getInstance().delPackage( "" );
+        } catch ( Exception e5 ) {
+            e5.printStackTrace();
+        }       
+        assertEquals( 500, response.getStatus());
+
+        try {
+            response = PackageWrapper.getInstance().delPackage( null );
+        } catch ( Exception e5 ) {
+            e5.printStackTrace();
+        } 
+        assertEquals( 500, response.getStatus());        
+    }
+
+    @Test
+    public void testDelPackageSuccess() {
+        new MockUp<MarketplaceDaoImpl>() {
+            @Mock
+            public List<PackageData> getAllPackageData() { 
+                packageDataList = new ArrayList<PackageData>();   
+                packageData = new PackageData();
+                packageData.setCsarId( csarID );
+                packageData.setDownloadUri( "src\\test\\resources\\clearwater_ns.csar" );
+                packageData.setName( "clearwater_ns.csar" );
+                packageData.setSize( "59,854  bytes" );
+                packageData.setVersion( "v1.0" );
+                packageData.setProvider( "Huawei" );
+                packageDataList.add( packageData );
+                return packageDataList;             
+            }
+        };
+
+        new MockUp<PackageManager>() {
+            @Mock
+            public void deletePackage( String csarId ) {            
+                return;             
+            }
+        };
+
+        new MockUp<HttpFileManagerImpl>() {
+            @Mock
+            public boolean delete( String srcPath ) {           
+                return true;            
+            }
+        };
+
+        new MockUp<MarketplaceDaoImpl>() {
+            @Mock
+            public List<PackageData> getPackageData( String csarId ) {              
+                packageDataList = new ArrayList<PackageData>();   
+                packageData = new PackageData();
+                packageData.setCsarId( csarID );
+                packageData.setDownloadUri( "src\\test\\resources\\" );
+                packageData.setName( "clearwater_ns.csar" );
+                packageData.setSize( "59,854  bytes" );
+                packageData.setVersion( "v1.0" );
+                packageData.setProvider( "Huawei" );
+                packageDataList.add( packageData );
+                return packageDataList;             
+            }
+        };        
+
+        try {
+            response = PackageWrapper.getInstance().delPackage( "csarid" );
+        } catch ( Exception e ) {
+            e.printStackTrace();
+        }   
+
+        assertNotNull( response );
+        assertEquals( 200, response.getStatus());             
+    }
+
+    @Test
+    public void testGetCsarFileUri() {      
+        new MockUp<MarketplaceDaoImpl>() {
+            @Mock
+            public List<PackageData> getPackageData( String csarId ) {  
+                packageDataList = new ArrayList<PackageData>();   
+                packageData = new PackageData();
+                packageData.setCsarId( csarId );
+                packageData.setDownloadUri( "src\\test\\resources\\" );
+                packageData.setName( "clearwater_ns.csar" );
+                packageData.setSize( "59,854  bytes" );
+                packageData.setVersion( "v1.0" );
+                packageData.setProvider( "Huawei" );
+                packageDataList.add( packageData );
+                return packageDataList;             
+            }
+        }; 
+
+        new MockUp<PackageWrapper>() {      
+            @Mock
+            Response downloadCsarPackagesById(String csarId) throws FileNotFoundException
+            {                
+                String fileName="src" + File.separator + "test" + File.separator + "resources" + File.separator + "Test.txt";
+                InputStream fis = new BufferedInputStream(new FileInputStream(fileName));
+                return Response.ok(fis).header("Content-Disposition", "attachment; filename=\"" + fileName + "\"").build();
+            }   
+        }; 
+        response = PackageWrapper.getInstance().getCsarFileUri("csarId");
+        assertEquals( 200, response.getStatus() );      
+
+    } 
+
+    @Test    
+    public void testupdateDwonloadCountSuccess() throws Exception
+    {
+        final List<PackageData> pkgList = new ArrayList<PackageData>();
+        PackageData pkgDataObj = new PackageData();
+        pkgDataObj.setDownloadCount( 1 );
+        pkgList.add(pkgDataObj);
+        new  MockUp<MarketplaceDaoImpl>() {
+            @Mock
+            public List<PackageData> getPackageData(String csarId) {                
+                return pkgList;
+                //return new ArrayList<PackageData>();
+            }
+        };
+        new  MockUp<MarketplaceDaoImpl>() {
+            @Mock
+            public void updatePackageData(PackageData oPackageData){                
+                return ;
+
+            }
+        };
+        try {
+            response = PackageWrapper.getInstance().updateDwonloadCount( csarID );
+        } catch ( Exception e5 ) {
+            e5.printStackTrace();
+        }
+        assertNotNull( response );
+        assertEquals( 200,response.getStatus() );
+    }
+
+    @Test
+    public void testReUploadPackage() {
+        new MockUp<MarketplaceDaoImpl>() {
+            @Mock
+            public List<PackageData> getPackageData( String csarId ) {   
+                List<PackageData> packageDataList = new ArrayList<PackageData>();
+                PackageData packageData = new PackageData();
+                packageData = new PackageData();
+                packageData.setCsarId( csarId );
+                packageData.setDownloadUri( "src\\test\\resources\\clearwater_ns.csar" );
+                packageData.setName( "clearwater_ns.csar" );
+                packageData.setSize( "59,854  bytes" );
+                packageData.setVersion( "v1.0" );
+                packageData.setProvider( "Huawei" );
+                packageDataList.add( packageData );
+                return packageDataList;                         
+            }           
+        }; 
+
+        new MockUp<HttpFileManagerImpl>() {
+            @Mock
+            public boolean delete(String srcPath) {
+                return true;
+            }
+        };        
+
+        new MockUp<MarketplaceDaoImpl>() {
+            @Mock
+            public void deletePackageData(String csarId) {
+                return;
+            }
+        };
+
+        new MockUp<ToolUtil>() {
+            @Mock
+            public String getTempDir(String dirName, String fileName) {
+                String fileN = "src" + File.separator + "test" + File.separator + "resources" + File.separator + "testfolder";
+                return fileN;
+            }
+        };
+
+        new MockUp<HttpFileManagerImpl>() {
+            @Mock
+            public boolean upload(String srcPath, String dstPath) {
+                return true;
+            }
+        };
+
+        new MockUp<PackageWrapperUtil>() {
+            @Mock
+            public PackageData getPackageData(PackageMeta meta) {
+                PackageData packageData = new PackageData();
+                packageData.setCreateTime( "25-3-2017 15:26:00" );
+                packageData.setDeletionPending( "deletion" );
+                packageData.setDownloadUri( "downloaduri" );
+                packageData.setFormat( "format" );
+                packageData.setModifyTime( "time" );
+                packageData.setName( "name" );
+                packageData.setCsarId( "csarid" );
+                packageData.setProvider( "huawei" );
+                String fileSize = "10 mb";
+                packageData.setSize(fileSize);
+                packageData.setType( "type" );
+                packageData.setVersion( "v2.0" );
+                packageData.setDetails( "details" );
+                packageData.setShortDesc( "description" );
+                packageData.setRemarks( "remarks" );
+                return packageData;
+            }
+        };
+
+        new MockUp<PackageHandler>() {
+            @Mock
+            public PackageData create(PackageData packageData) {
+                PackageData packageDataObj = new PackageData();
+                packageDataObj.setCreateTime( "25-3-2017 15:26:00" );
+                packageDataObj.setDeletionPending( "deletion" );
+                packageDataObj.setDownloadUri( "downloaduri" );
+                packageDataObj.setFormat( "format" );
+                packageDataObj.setModifyTime( "modifytime" );
+                packageDataObj.setName( "name" );
+                packageDataObj.setCsarId( "csarid" );
+                packageDataObj.setProvider( "huawei" );
+                String fileSize = "10 mb";
+                packageDataObj.setSize(fileSize);
+                packageDataObj.setType( "type" );
+                packageDataObj.setVersion( "v2.0" );
+                packageDataObj.setDetails( "details" );
+                packageDataObj.setShortDesc( "description" );
+                packageDataObj.setRemarks( "remarks" );
+                return packageDataObj;
+            }
+        };
+
+        try {
+            response = PackageWrapper.getInstance().reUploadPackage( null, null, null,null, null );
+        } catch( Exception e ) {
+            e.printStackTrace();
+        }
+        assertEquals( 417, response.getStatus() );
+
+        try {
+            fileDetail = FormDataContentDisposition.name( "fileName" ).fileName( "clearwater_ns.csar" ).build(); 
+            String fileName = "src" + File.separator + "test" + File.separator + "resources" + File.separator + "clearwater_ns.csar";
+            inputStream = new FileInputStream(fileName);
+            response = PackageWrapper.getInstance().reUploadPackage( "csarID", inputStream, fileDetail, null, null );
+            //assertEquals( 200, response.getStatus() );
+        } catch( Exception e ) {
+            e.printStackTrace();
+        }
+    }   
+
+    @Test
+    public void testgetOperResultByOperTypeIdFailure() throws Exception
+    {
+        final ResultKey resultKeyObj = new ResultKey();
+
+        new  MockUp<FunctionTestHook>() {
+            @Mock
+            ResultKey getFuncTestResultKey(PackageData packageData) {
+                resultKeyObj.setKey("key");
+                return resultKeyObj;
+            }
+        };
+        new MockUp<FunctionTestExceutor>(){
+            @Mock
+            String getTestResultsByFuncTestKey(String key) 
+            {           
+                return null;
+            }
+        };  
+
+        new MockUp<MarketplaceDaoImpl>() {
+            @Mock
+            public List<PackageData> getPackageData( String csarId ) {   
+                List<PackageData> packageDataList = new ArrayList<PackageData>();
+                PackageData packageData = new PackageData();
+                packageData = new PackageData();
+                packageData.setCsarId( csarId );
+                packageData.setDownloadUri( "src\\test\\resources\\learwater_ns.csar" );
+                packageData.setName( "clearwater_ns.csar" );
+                packageData.setSize( "59,854  bytes" );
+                packageData.setVersion( "v1.0" );
+                packageData.setProvider( "Airtel" );
+                packageDataList.add( packageData );
+                return packageDataList;                         
+            }           
+        };
+
+
+        try {
+            response = PackageWrapper.getInstance().getOperResultByOperTypeId( csarID,operTypeId );
+        } catch ( Exception e5 ) {
+            e5.printStackTrace();
+        }       
+        assertEquals(500,response.getStatus());
+
+        try {
+            response = PackageWrapper.getInstance().getOperResultByOperTypeId( "", "" );
+        } catch( Exception e ) {
+            e.printStackTrace();
+        }
+        assertEquals( 400,response.getStatus() );
+    }
+
+    @Test
+    public void testgetOperResultByOperTypeIdSuccess() {        
+        new MockUp<MarketplaceDaoImpl>() {
+            @Mock
+            public List<PackageData> getPackageData( String csarId ) {   
+                List<PackageData> packageDataList = new ArrayList<PackageData>();
+                PackageData packageData = new PackageData();
+                packageData = new PackageData();
+                packageData.setCsarId( csarId );
+                packageData.setDownloadUri( "src\\test\\resources\\learwater_ns.csar" );
+                packageData.setName( "clearwater_ns.csar" );
+                packageData.setSize( "59,854  bytes" );
+                packageData.setVersion( "v1.0" );
+                packageData.setProvider( "Airtel" );
+                packageDataList.add( packageData );
+                return packageDataList;                         
+            }           
+        }; 
+
+        new MockUp<ToolUtil>() {
+            @Mock
+            public String getTempDir(String dirName, String fileName) {
+                String filena = "src" + File.separator + "test" + File.separator + "resources" + File.separator + "testfolder";
+                return filena;
+            }
+        };
+        new MockUp<PackageWrapper>() {     
+            @Mock
+            Response downloadCsarPackagesById(String csarId) throws FileNotFoundException
+            {
+                String fileName = "src" + File.separator + "test" + File.separator + "resources" + File.separator + "Test.txt";
+                InputStream fis = new BufferedInputStream(new FileInputStream(fileName));
+                return Response.ok(fis).header("Content-Disposition", "attachment; filename=\"" + fileName + "\"").build();
+            }   
+        }; 
+
+        new  MockUp<FunctionTestHook>() {
+            @Mock
+            ResultKey getFuncTestResultKey(PackageData packageData) {
+                ResultKey resultKey = new ResultKey();
+                resultKey.setKey( "key" );
+                return resultKey;
+            }
+        };
+        new MockUp<FunctionTestExceutor>(){
+            @Mock
+            String getTestResultsByFuncTestKey(String key) { 
+                return "key";       
+            }
+        };
+
+        try {
+            response = PackageWrapper.getInstance().getOperResultByOperTypeId( csarID, operTypeId );                        
+        } catch( Exception e ) {
+            e.printStackTrace();
+        }       
+    }   
+
+    //@Ignore
+    @Test
+    public void testUploadPackage() throws Exception {
+        InputStream ins = null;
+        Response result = null;
+        /*Response result1 = null;
+      Response result2 = null;
+      PackageData packageData = new PackageData();
+      packageData = getPackageData();*/
+
+        new MockUp<MarketplaceDaoImpl>() {
+            @Mock
+            public List<PackageData> getPackageData( String csarId ) {   
+                List<PackageData> packageDataList = new ArrayList<PackageData>();
+                PackageData packageData = new PackageData();
+                packageData = new PackageData();
+                packageData.setCsarId( csarId );
+                packageData.setDownloadUri( "src\\test\\resources\\" );
+                packageData.setName( "clearwater_ns.csar" );
+                packageData.setSize( "59,854  bytes" );
+                packageData.setVersion( "v1.0" );
+                packageData.setProvider( "Airtel" );
+                packageDataList.add( packageData );
+                return packageDataList;                         
+            }           
+        }; 
+
+        new MockUp<HttpFileManagerImpl>() {
+            @Mock
+            public boolean delete(String srcPath) {
+                return true;
+            }
+        };        
+
+        new MockUp<MarketplaceDaoImpl>() {
+            @Mock
+            public void deletePackageData(String csarId) {
+                return;
+            }
+        };
+
+        new MockUp<ToolUtil>() {
+            @Mock
+            public String getTempDir(String dirName, String fileName) {
+                String filena = "src" + File.separator + "test" + File.separator + "resources" + File.separator + "testfolder";
+                return filena;
+            }
+        };
+
+        new MockUp<HttpFileManagerImpl>() {
+            @Mock
+            public boolean upload(String srcPath, String dstPath) {
+                return false;
+            }
+        };
+
+        new MockUp<PackageWrapperUtil>() {
+            @Mock
+            public PackageData getPackageData(PackageMeta meta) {
+                PackageData packageData = new PackageData();
+                packageData.setCreateTime( "25-3-2017 15:26:00" );
+                packageData.setDeletionPending( "deletion" );
+                packageData.setDownloadUri( "downloaduri" );
+                packageData.setFormat( "format" );
+                packageData.setModifyTime( "time" );
+                packageData.setName( "name" );
+                packageData.setCsarId( "csarid" );
+                packageData.setProvider( "huawei" );
+                String fileSize = "10 mb";
+                packageData.setSize(fileSize);
+                packageData.setType( "type" );
+                packageData.setVersion( "v2.0" );
+                packageData.setDetails( "details" );
+                packageData.setShortDesc( "description" );
+                packageData.setRemarks( "remarks" );
+                return packageData;
+            }
+        };
+
+        new MockUp<PackageHandler>() {
+            @Mock
+            public PackageData create(PackageData packageData) {
+                PackageData packageDataObj = new PackageData();
+                packageDataObj.setCreateTime( "25-3-2017 15:26:00" );
+                packageDataObj.setDeletionPending( "deletion" );
+                packageDataObj.setDownloadUri( "downloaduri" );
+                packageDataObj.setFormat( "format" );
+                packageDataObj.setModifyTime( "modifytime" );
+                packageDataObj.setName( "name" );
+                packageDataObj.setCsarId( "csarid" );
+                packageDataObj.setProvider( "huawei" );
+                String fileSize = "10 mb";
+                packageDataObj.setSize(fileSize);
+                packageDataObj.setType( "type" );
+                packageDataObj.setVersion( "v2.0" );
+                packageDataObj.setDetails( "details" );
+                packageDataObj.setShortDesc( "description" );
+                packageDataObj.setRemarks( "remarks" );
+                return packageDataObj;
+            }
+        };
+
+
+        FormDataContentDisposition fileDetail =
+                FormDataContentDisposition.name("fileName").fileName("clearwater_ns.csar").build();
+
+        String filenama = "src" + File.separator + "test" + File.separator + "resources" + File.separator + "clearwater_ns.csar";
+        File packageFile = new File(filenama);
+
+
+        try {
+            ins = new FileInputStream(packageFile);
+        } catch (FileNotFoundException e2) {
+            e2.printStackTrace();
+        }
+        if (ins != null) {
+            try {
+                result = PackageWrapper.getInstance().uploadPackage(ins, fileDetail, null,null);
+            } catch (Exception e3) {
+                e3.printStackTrace();
+            }
+        }
+
+        assertNotNull( result );
+        assertEquals( 200, result.getStatus() );
+
+        try {
+            result = PackageWrapper.getInstance().uploadPackage(null, null, null,null);
+        } catch (Exception e4) {
+            e4.printStackTrace();
+        }
+
+        assertEquals(417, result.getStatus());}
+
+
+    @Test
+    public void testGetOnBoardingStepsSuccess() {       
+        new MockUp<org.openo.vnfsdk.marketplace.filemanage.http.ToolUtil>() {
+            @Mock
+            String getAppDeployPath() {
+                String path = "src" + File.separator + "main" + File.separator + "resources";
+                return path;
+            }
+        };     
+
+        try {
+            response = PackageWrapper.getInstance().getOnBoardingSteps();
+        } catch( Exception e ) {
+            e.printStackTrace();
+        }
+
+        assertNotNull( response );
+    }
+
+    @Test
+    public void testGetOnBoardingStepsFailure() {       
+        new MockUp<org.openo.vnfsdk.marketplace.filemanage.http.ToolUtil>() {
+            @Mock
+            String getAppDeployPath() {
+                String path = "src" + File.separator + "main" + File.separator + "resources"+ File.separator + "generalconfig";               
+                return path;
+            }
+        };     
+
+        try {
+            response = PackageWrapper.getInstance().getOnBoardingSteps();
+        } catch( Exception e ) {
+            e.printStackTrace();
+        }           
+        assertEquals( 500, response.getStatus() );
+    }
+
+    @Test     
+    public void testRestGetClient() {
+        FunctionTestExceutor.getTestResultsByFuncTestKey("GET");
+
+
+    }
+
+    @Test
+    public void testRestPostClient() {
+
+        OnBoradingRequest onBoradFuncTestReq = new OnBoradingRequest();
+        onBoradFuncTestReq.setPackagePath("src/test/resources/clearwater_ns.csar");
+        onBoradFuncTestReq.setPackageName("clearwater_ns.csar");
+        String result =     FunctionTestExceutor.execFunctionTest( onBoradFuncTestReq);
+        assertNull(result);
+        //assertEquals(200,result);
+
+    }
+
+    @Test
+    public void testRestDeleteClient() {
+        RestResponse rsp = RestfulClient.delete("127.0.0.1",8987,"TestURL");
+        assertNotNull(rsp);
+        if(rsp.getStatusCode() != null)
+            assertEquals(200,rsp.getStatusCode().intValue());
+
+    }
+
+    @Test
+    public void testExec() {
+
+        new  MockUp<FunctionTestHook>() {
+            @Mock
+            String getResultStorePath(){                   
+                return "src/test/resources";
+
+            }
+        };
+        FunctionTestHook testHookObj = new FunctionTestHook();
+        OnBoradingRequest onBoradFuncTestReq = new OnBoradingRequest();
+        onBoradFuncTestReq.setPackagePath("src/test/resources/clearwater_ns.csar");
+        int res=testHookObj.exec(onBoradFuncTestReq);
+
+        assertEquals(res,-1);
+    }
+
+    @Test
+
+    public void testwriteJsonDatatoFile(){
+
+        String filePath="src//test//resources//functionTest.json";
+        OnBoardingResult onBoardResultObj = new OnBoardingResult();
+        onBoardResultObj.setCsarId("csrId");
+        onBoardResultObj.setOperStatus(1);
+        boolean res = FileUtil.writeJsonDatatoFile(filePath,onBoardResultObj);
+        assertEquals(res,true);
+
+    }
+
+    @Test
+
+    public void testCreateDirectory()
+    {
+        String dirPath = "src//test//resources//TestDirectory";
+        boolean res = FileUtil.createDirectory(dirPath);
+        assertEquals(res,true);
+    }
+
+    @Test
+
+    public void testDeleteDirectory()
+    {
+        String dirPath = "src//test//resources//TestDirectory";
+        boolean res = FileUtil.deleteFile(dirPath);
+        assertEquals(res,true);
+    }
+
+    @Test
+
+    public void testGenerateId()
+    {
+        String id= MarketplaceDbUtil.generateId();
+        assertNotNull(id);
+    }
+
+    @Test
+    public void testisNotEmpty()
+    {
+        boolean res = MarketplaceDbUtil.isNotEmpty(null);
+        assertEquals(res,false);
+        res = MarketplaceDbUtil.isNotEmpty("test");
+        assertEquals(res,true);
+    }
+
+    @Test
+    public void testobjectToString()
+    {
+        Object obj="testexa";
+        String res = MarketplaceDbUtil.objectToString(obj);
+        assertNotNull(res);
+        res = MarketplaceDbUtil.objectToString(null);
+        assertNull(res);
+    }
+    @Test
+    public void testisEmptyString()
+    {
+        boolean res = ToolUtil.isEmptyString(null);
+        assertEquals(res,true);
+        res = ToolUtil.isEmptyString("huawei");
+        assertEquals(res,false);
+    }
+
+    @Test
+    public void testisTrimedEmptyString()
+    {
+        boolean res = ToolUtil.isTrimedEmptyString(null);
+        assertEquals(res,true);
+        res = ToolUtil.isTrimedEmptyString("    ");
+        assertEquals(res,true);
+    }
+
+    @Test
+    public void testisEmptyCollection() {
+
+        boolean res = ToolUtil.isEmptyCollection(new ArrayList());
+        assertEquals(res,true);
+    }
+
+    @Test
+    public void testisYamlFile()
+    {
+        File fileObj = new File("test.txt");
+        boolean res = ToolUtil.isYamlFile(fileObj);
+        assertEquals(res,false);
+    }
+
+    @Test
+    public void testgenerateID()
+    {
+        String id= ToolUtil.generateId();
+        assertNotNull(id);
+    }
+    @Test
+    public void testgetFormatFileSize()
+    {
+        String res = ToolUtil.getFormatFileSize(10000000);
+        assertNotNull(res);
+        res = ToolUtil.getFormatFileSize(10000);
+        assertNotNull(res);
+        res = ToolUtil.getFormatFileSize(100);
+        assertNotNull(res);
+    }
+
+    @Test
+    public void testObjectToString()
+    {
+        Object obj="testexa";
+        String res = ToolUtil.objectToString(obj);
+        assertNotNull(res);
+        res = ToolUtil.objectToString(null);
+        assertNotNull(res);
+    }
+
+    @Test
+    public void testprocessFileName()
+    {
+        String res = ToolUtil.processFileName("abc.txt");
+        assertNotNull(res);
+        res = ToolUtil.processFileName("abc.zip");
+        assertNotNull(res);
+    }
+    @Test
+    public void testremoveCsarSuffix()
+    {
+        String res = ToolUtil.removeCsarSuffix("abc.csar");
+        assertEquals(res,"abc");
+    }
+    @Test
+    public void testformatCsar()
+    {
+        String res = ToolUtil.formatCsar("abc");
+        assertEquals(res,"abc.csar");
+    }
+    @Test
+    public void testformatFileSize()
+    {
+        String res = ToolUtil.formatFileSize(10000.0,10);
+        assertEquals(res,"1000.00M");
+    }
+
+    @Test
+    public void testgetFileSize()
+    {
+        File fileObj = new File("example.txt");
+        String res = ToolUtil.getFileSize(fileObj,10);
+        assertNotNull(res);
+    }
+
+    @Test
+    public void testgetCataloguePath()
+    {
+        String res = ToolUtil.getCataloguePath();
+        assertEquals(res,"");
+    }
+
+    @Test
+    public void testgetCatalogueCsarPath()
+    {
+        String res = ToolUtil.getCatalogueCsarPath();
+        assertEquals(res,File.separator + "csar");
+    }
+
+    @Test
+    public void testgetCatalogueImagePath()
+    {
+        String res = ToolUtil.getCatalogueImagePath();
+        assertEquals(res,File.separator + "image");
+    }
+
+    @Test
+    public void testdeleteFile()
+    {
+        boolean res = ToolUtil.deleteFile("src//test//resources", "test1.txt");
+        assertEquals(res,true);
+    }
+
+    @Test
+    public void teststoreChunkFileInLocal()
+    { 
+        try {
+            inputStream = new FileInputStream("src//test//resources//Test.txt");
+            String res = ToolUtil.storeChunkFileInLocal("src//test//resources","TestOut.txt",inputStream);
+            File file = new File(res);
+            String fileName = file.getName();
+            assertEquals(fileName,"TestOut.txt");
+
+        }
+        catch(Exception ex)
+        {
+            ex.printStackTrace();
+        }
+    }
+    @Test
+    public void testToolUtildeleteFile()
+    {
+        boolean res = ToolUtil.deleteFile("src/test/resources","TestOut.txt");
+        assertEquals(res,true);
+    }
+
+    @Test
+    public void testGetSession() {
+        try {
+            assertNotNull( ConnectionUtil.getSession() );
+        } catch( Exception e ) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testToJson() {
+        List<String> listObj = new ArrayList<String>();
+        listObj.add("test");
+        String res = JsonUtil.toJson(listObj);
+        assertNotNull(res);
+    }
+
+    @Test
+    public void testfromJson() {
+
+        String carJson = "{ \"brand\" : \"Mercedes\", \"doors\" : 5 }";
+        JsonNode res = JsonUtil.fromJson(carJson,JsonNode.class);
+        assertNotNull(res);
+    }
+
+    @Test
+    public void testUnzip() {
+
+        List<String> listObj = new ArrayList<String>();
+        try {
+            listObj=FileUtil.unzip("src/test/resources/temp.zip", "src/test/resources/testfolder");
+        }
+        catch(Exception ex)
+        {
+            ex.printStackTrace();
+        }
+        assertNotNull(listObj);
+    }
+
+    @Test
+    public void testreadJsonDatafFromFile() {
+
+        Object obj = FileUtil.readJsonDatafFromFile("src/main/resources/generalconfig/OnBoardingSteps.json",Object.class);
+        assertNotNull(obj);
+    }
+
+    @Test
+    public void testGetPkgSize() {
+        long pkgSize = PackageWrapperUtil.getPacakgeSize("src/test/resources/Test.txt");
+        assertNotNull(pkgSize);
+    }
+
+    @Test
+    public void testPkgFormat() {
+        assertNotNull(PackageWrapperUtil.getPackageFormat("xml"));
+        assertNotNull(PackageWrapperUtil.getPackageFormat("yml"));
+        assertNull(PackageWrapperUtil.getPackageFormat("pdf"));
+
+    }
+    @Test
+    public void testVnfPackageSetter() {
+
+        vnfPackageObj.setVnfPackageId("vnfpackageId");
+        vnfPackageObj.setVnfPackageUrl("vnfPackageUrl");
+        vnfPackageObj.setVnfd("vnfd");
+        vnfPackageObj.setVersion("1");
+        vnfPackageObj.setUsageState(EnumUsageState.NotInUse);
+        vnfPackageObj.setProvider("huawei");
+        vnfPackageObj.setOperationalState(EnumOperationalState.Enabled);
+        vnfPackageObj.setName("vnf");
+        vnfPackageObj.setDeletionPending("pending");
+
+        String res = vnfPackageObj.getVnfPackageId();
+        assertEquals(res,"vnfpackageId");
+        res = vnfPackageObj.getVnfPackageUrl();
+        assertEquals(res,"vnfPackageUrl");
+        res = vnfPackageObj.getVnfd();
+        assertEquals(res,"vnfd");
+        res = vnfPackageObj.getVersion();
+        assertEquals(res,"1");
+        EnumUsageState state = vnfPackageObj.getUsageState();
+        assertEquals(state,EnumUsageState.NotInUse);
+        res = vnfPackageObj.getProvider();
+        assertEquals(res,"huawei");
+        EnumOperationalState operState = vnfPackageObj.getOperationalState();
+        assertEquals(operState,EnumOperationalState.Enabled);
+        res = vnfPackageObj.getName();
+        assertEquals(res,"vnf");
+        res = vnfPackageObj.getDeletionPending();
+        assertEquals(res,"pending");
+    }
+
+    @Test
+    public void testCsarPackageSetter() {
+        csarPackageObj.setCreateTime("04052017");
+        csarPackageObj.setDeletionPending("pending");
+        csarPackageObj.setFormat("format");
+        csarPackageObj.setId("12");
+        csarPackageObj.setName("csartest");
+        csarPackageObj.setSize("10");
+        csarPackageObj.setStatus("done");
+        csarPackageObj.setType("type");
+        csarPackageObj.setUrl("//network");
+
+        String res = csarPackageObj.getCreateTime();
+        assertEquals(res,"04052017");
+        res = csarPackageObj.getDeletionPending();
+        assertEquals(res,"pending");
+        res = csarPackageObj.getFormat();
+        assertEquals(res,"format");
+        res = csarPackageObj.getId();
+        assertEquals(res,"12");
+        res = csarPackageObj.getName();
+        assertEquals(res,"csartest");
+        res = csarPackageObj.getSize();
+        assertEquals(res,"10");
+        res = csarPackageObj.getStatus();
+        assertEquals(res,"done");
+        res = csarPackageObj.getType();
+        assertEquals(res,"type");
+        res = csarPackageObj.getUrl();
+        assertEquals(res,"//network");
+
+    }
+
+    @Test
+    public void testPackageBasicInfoSetter() {
+        pkgBasicInfoObj.setFormat("pdf");
+        pkgBasicInfoObj.setProvider("huawei");
+        pkgBasicInfoObj.setType(EnumType.GSAR);
+        pkgBasicInfoObj.setVersion("1");
+        String res = pkgBasicInfoObj.getFormat();
+        assertEquals(res,"pdf");
+        res = pkgBasicInfoObj.getProvider();
+        assertEquals(res,"huawei");
+        EnumType type = pkgBasicInfoObj.getType();
+        assertEquals(type,EnumType.GSAR);
+        res = pkgBasicInfoObj.getVersion();
+        assertEquals(res,"1");
+    }
+
+    @Test
+    public void testPackageMetaSetter() {
+        pkgMetaObj.setCreateTime("05042017");
+        pkgMetaObj.setCsarId("csarid");
+        pkgMetaObj.setDeletionPending(true);
+        pkgMetaObj.setDetails("details");
+        pkgMetaObj.setDownloadCount(10);
+        pkgMetaObj.setDownloadUri("//network");
+        pkgMetaObj.setFormat("pdf");
+        pkgMetaObj.setModifyTime("05042017");
+        pkgMetaObj.setName("huawei");
+        pkgMetaObj.setProvider("huawei");
+        pkgMetaObj.setRemarks("tested");
+        pkgMetaObj.setReport("done");
+        pkgMetaObj.setShortDesc("done");
+        pkgMetaObj.setSize("1000");
+        pkgMetaObj.setType("type");
+        pkgMetaObj.setVersion("1");
+
+        String res = pkgMetaObj.getCreateTime();
+        assertEquals(res,"05042017");
+        res = pkgMetaObj.getCsarId();
+        assertEquals(res,"csarid"); 
+        res = pkgMetaObj.getDetails();
+        assertEquals(res,"details");        
+        res = pkgMetaObj.getDownloadCount()+"";
+        assertEquals(res,"10");
+        res = pkgMetaObj.getDownloadUri();
+        assertEquals(res,"//network");
+        res = pkgMetaObj.getFormat();
+        assertEquals(res,"pdf");
+        res = pkgMetaObj.getModifyTime();
+        assertEquals(res,"05042017");
+        res = pkgMetaObj.getName();
+        assertEquals(res,"huawei");
+        res = pkgMetaObj.getProvider();
+        assertEquals(res,"huawei");
+        res = pkgMetaObj.getRemarks();
+        assertEquals(res,"tested");
+        res = pkgMetaObj.getReport();
+        assertEquals(res,"done");
+        res = pkgMetaObj.getShortDesc();
+        assertEquals(res,"done");
+        res = pkgMetaObj.getSize();
+        assertEquals(res,"1000");
+        res = pkgMetaObj.getType();
+        assertEquals(res,"type");
+        res = pkgMetaObj.getVersion();          
+        assertEquals(res,"1");
+    }
+
+
+    @Test
+    public void testPackageResponseSetter() {
+        pkgResponseObj.setReportPath("localpath");
+        String res = pkgResponseObj.getReportPath();
+        assertEquals(res,"localpath");
+
+    }
+
+    @Test
+    public void testCsarFileUriResSetter() {
+        csarFileUriResObj.setDownloadUri("downloaduri");
+        csarFileUriResObj.setLocalPath("localpath");
+        String res = csarFileUriResObj.getDownloadUri();
+        assertEquals(res,"downloaduri");
+        res = csarFileUriResObj.getLocalPath();
+        assertEquals(res,"localpath");
+
+    }
+}