summaryrefslogtreecommitdiffstats
path: root/services/activity-spec/activity-spec-web/activity-spec-war
diff options
context:
space:
mode:
authorsheetalm <sheetal.mudholkar@amdocs.com>2018-02-20 19:06:27 +0530
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2018-03-08 08:50:18 +0000
commit297209b45b403e9b314ebeb1140886e00ffd3f6d (patch)
treea8ba88380016fed0d1f28fbddfc4d4909ca22165 /services/activity-spec/activity-spec-web/activity-spec-war
parent2b60bd08c6b209c0817fac84970c35df4abca6ed (diff)
Activity Spec Service - Implementation
Correcting error message. InternalEmptyObject not required to be serializable. Fixed review comments on Patch Set 10. Not all fixed Adding services profile in main sdc pom.Moving Static imports at end. Patch Set 7 changes Patch Set 6 - Removing javax.inject. Remove user from interface and Changing scope to be singleton. Correcting error message Patch Set 4 Not fixing Spring related review comments in this patch set Patch Set 4 Fixed review comments related to unused dependency Fixed review comments for plugin version. Corrected License Adding Activity Spec Service Implementation Not adding to main sdc pom as of now Change-Id: I5285c0ab3b71b492d18ca442ebd52b59ab0eabdc Issue-ID: SDC-1048 Signed-off-by: sheetalm <sheetal.mudholkar@amdocs.com>
Diffstat (limited to 'services/activity-spec/activity-spec-web/activity-spec-war')
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-war/pom.xml78
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/beans-services.xml46
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/jetty-web.xml8
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/spring-mapper-servlet.xml13
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/web.xml77
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-war/templates/markdown.hbs105
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-war/templates/operation.hbs73
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-war/templates/security.hbs88
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-war/templates/strapdown.html.hbs11
9 files changed, 499 insertions, 0 deletions
diff --git a/services/activity-spec/activity-spec-web/activity-spec-war/pom.xml b/services/activity-spec/activity-spec-web/activity-spec-war/pom.xml
new file mode 100644
index 0000000000..dba32097a8
--- /dev/null
+++ b/services/activity-spec/activity-spec-web/activity-spec-war/pom.xml
@@ -0,0 +1,78 @@
+<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>
+
+ <artifactId>activityspec-war</artifactId>
+ <name>activityspec-war</name>
+ <packaging>war</packaging>
+
+ <parent>
+ <groupId>org.openecomp.activityspec</groupId>
+ <artifactId>activity-spec-web</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ <relativePath>../</relativePath>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.activityspec</groupId>
+ <artifactId>activity-spec-service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>${mvn.war.version}</version>
+ <configuration>
+ <attachClasses>true</attachClasses>
+ <webResources>
+ <resource>
+ <!-- this is relative to the pom.xml directory -->
+ <directory>${basedir}/target/generated/swagger-ui</directory>
+ </resource>
+ </webResources>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>com.github.kongchen</groupId>
+ <artifactId>swagger-maven-plugin</artifactId>
+ <version>${mvn.swagger.version}</version>
+ <configuration>
+ <apiSources>
+ <apiSource>
+ <springmvc>false</springmvc>
+ <locations>org.openecomp.activityspec</locations>
+ <schemes>http</schemes>
+ <basePath>/activityspec-api</basePath>
+ <info>
+ <title>Rest API</title>
+ <version>v1.0, build #${buildNumber}</version>
+ <description>Rest API Documentation</description>
+ <termsOfService>
+ http://www.github.com/kongchen/swagger-maven-plugin
+ </termsOfService>
+ </info>
+ <templatePath>${basedir}/templates/strapdown.html.hbs</templatePath>
+ <outputPath>${basedir}/target/generated/api.html</outputPath>
+ <swaggerDirectory>${basedir}/target/generated/swagger-ui
+ </swaggerDirectory>
+ </apiSource>
+ </apiSources>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project> \ No newline at end of file
diff --git a/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/beans-services.xml b/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/beans-services.xml
new file mode 100644
index 0000000000..3d79d1e305
--- /dev/null
+++ b/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/beans-services.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
+
+
+ <import resource="classpath:META-INF/cxf/cxf.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
+
+ <!-- Needed for JSR-303 validations. May be removed when moving to JAX-RS 2.0 -->
+ <bean class="org.springframework.validation.beanvalidation.MethodValidationPostProcessor"/>
+
+ <bean id="jacksonObjectMapper" class="org.codehaus.jackson.map.ObjectMapper">
+ <property name="serializationInclusion" value="NON_NULL"/>
+ </bean>
+
+ <bean id="jsonProvider" class="org.codehaus.jackson.jaxrs.JacksonJsonProvider">
+ <property name="mapper" ref="jacksonObjectMapper"/>
+ </bean>
+
+ <!-- ASDC -->
+
+ <!-- aspect beans -->
+ <bean id = "activitySpecs"
+ class="org.openecomp.activityspec.api.rest.services.ActivitySpecsImpl"/>
+
+ <!-- RESTful Services -->
+ <jaxrs:server id="restContainer" address="/">
+
+ <jaxrs:serviceBeans>
+ <ref bean="activitySpecs"/>
+ </jaxrs:serviceBeans>
+
+ <jaxrs:providers>
+ <ref bean="jsonProvider"/>
+ <bean class="org.openecomp.sdcrests.errors.DefaultExceptionMapper"/>
+ </jaxrs:providers>
+
+ </jaxrs:server>
+
+</beans> \ No newline at end of file
diff --git a/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/jetty-web.xml b/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/jetty-web.xml
new file mode 100644
index 0000000000..9426b13ccc
--- /dev/null
+++ b/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/jetty-web.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE Configure PUBLIC
+ "-//Mort Bay Consulting//DTD Configure//EN"
+ "http://www.eclipse.org/jetty/configure_9_0.dtd">
+
+<Configure class="org.eclipse.jetty.webapp.WebAppContext">
+ <Set name="contextPath">/activityspec-api</Set>
+</Configure>
diff --git a/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/spring-mapper-servlet.xml b/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/spring-mapper-servlet.xml
new file mode 100644
index 0000000000..5a32dd432a
--- /dev/null
+++ b/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/spring-mapper-servlet.xml
@@ -0,0 +1,13 @@
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+
+ <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
+ <property name="mappings">
+ <props/>
+ </property>
+ </bean>
+
+</beans> \ No newline at end of file
diff --git a/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/web.xml b/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..e6be3b0a11
--- /dev/null
+++ b/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,77 @@
+<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">
+
+
+ <!-- Spring -->
+ <context-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>WEB-INF/beans-services.xml</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>org.openecomp.activityspec.api.server.listeners.ActivitySpecAppStartupListener</listener-class>
+ </listener>
+
+
+ <filter>
+ <filter-name>LoggingServletFilter</filter-name>
+ <filter-class>org.openecomp.sdc.logging.servlet.LoggingFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>LoggingServletFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+ <filter>
+ <filter-name>SessionContextFilter</filter-name>
+ <filter-class>org.openecomp.activityspec.api.server.filters.ActivitySpecSessionContextFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>SessionContextFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+ <!-- Spring WS Mapping -->
+ <servlet>
+ <servlet-name>spring-mapper</servlet-name>
+ <servlet-class>
+ org.springframework.web.servlet.DispatcherServlet
+ </servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <!-- CXF -->
+ <servlet>
+ <servlet-name>CXFServlet</servlet-name>
+ <display-name>CXF Servlet</display-name>
+ <servlet-class>
+ org.apache.cxf.transport.servlet.CXFServlet
+ </servlet-class>
+ <init-param>
+ <param-name>redirects-list</param-name>
+ <param-value>
+ /docs/(\S)+\.json
+ </param-value>
+ </init-param>
+ <init-param>
+ <param-name>redirect-attributes</param-name>
+ <param-value>
+ javax.servlet.include.request_uri
+ </param-value>
+ </init-param>
+ <init-param>
+ <param-name>redirect-servlet-name</param-name>
+ <param-value>default</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>spring-mapper</servlet-name>
+ <url-pattern>/ws/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>CXFServlet</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+</web-app>
diff --git a/services/activity-spec/activity-spec-web/activity-spec-war/templates/markdown.hbs b/services/activity-spec/activity-spec-web/activity-spec-war/templates/markdown.hbs
new file mode 100644
index 0000000000..cc87c38244
--- /dev/null
+++ b/services/activity-spec/activity-spec-web/activity-spec-war/templates/markdown.hbs
@@ -0,0 +1,105 @@
+#{{#info}}{{title}}
+
+
+## {{join schemes " | "}}://{{host}}{{basePath}}
+
+
+{{description}}
+
+{{#contact}}
+[**Contact the developer**](mailto:{{email}})
+{{/contact}}
+
+**Version** {{version}}
+
+{{#license}}[**{{name}}**]({{url}}){{/license}}
+
+{{/info}}
+
+{{#if consumes}}**Consumes:** {{join consumes ", "}}{{/if}}
+
+{{#if produces}}**Produces:** {{join produces ", "}}{{/if}}
+
+{{#if securityDefinitions}}
+# Security Definitions
+{{/if}}
+{{> security}}
+
+# APIs
+
+{{#each paths}}
+## {{@key}}
+{{#this}}
+{{#get}}
+### GET
+{{> operation}}
+{{/get}}
+
+{{#put}}
+### PUT
+{{> operation}}
+{{/put}}
+
+{{#post}}
+### POST
+
+{{> operation}}
+
+{{/post}}
+
+{{#delete}}
+### DELETE
+{{> operation}}
+{{/delete}}
+
+{{#option}}
+### OPTION
+{{> operation}}
+{{/option}}
+
+{{#patch}}
+### PATCH
+{{> operation}}
+{{/patch}}
+
+{{#head}}
+### HEAD
+{{> operation}}
+{{/head}}
+
+{{/this}}
+{{/each}}
+
+# Definitions
+{{#each definitions}}
+## <a name="/definitions/{{key}}">{{@key}}</a>
+
+<table border="1">
+ <tr>
+ <th>name</th>
+ <th>type</th>
+ <th>required</th>
+ <th>description</th>
+ <th>example</th>
+ </tr>
+ {{#each this.properties}}
+ <tr>
+ <td>{{@key}}</td>
+ <td>
+ {{#ifeq type "array"}}
+ {{#items.$ref}}
+ {{type}}[<a href="{{items.$ref}}">{{basename items.$ref}}</a>]
+ {{/items.$ref}}
+ {{^items.$ref}}{{type}}[{{items.type}}]{{/items.$ref}}
+ {{else}}
+ {{#$ref}}<a href="{{$ref}}">{{basename $ref}}</a>{{/$ref}}
+ {{^$ref}}{{type}}{{#format}} ({{format}}){{/format}}{{/$ref}}
+ {{/ifeq}}
+ </td>
+ <td>{{#required}}required{{/required}}{{^required}}optional{{/required}}</td>
+ <td>{{#description}}{{{description}}}{{/description}}{{^description}}-{{/description}}</td>
+ <td>{{example}}</td>
+ </tr>
+ {{/each}}
+</table>
+{{/each}} \ No newline at end of file
diff --git a/services/activity-spec/activity-spec-web/activity-spec-war/templates/operation.hbs b/services/activity-spec/activity-spec-web/activity-spec-war/templates/operation.hbs
new file mode 100644
index 0000000000..375d4f7701
--- /dev/null
+++ b/services/activity-spec/activity-spec-web/activity-spec-war/templates/operation.hbs
@@ -0,0 +1,73 @@
+{{#deprecated}}-deprecated-{{/deprecated}}
+<a id="{{operationId}}">{{summary}}</a>
+
+{{description}}
+
+{{#if externalDocs.url}}{{externalDocs.description}}. [See external documents for more details]({{externalDocs.url}})
+{{/if}}
+
+{{#if security}}
+#### Security
+{{/if}}
+
+{{#security}}
+{{#each this}}
+* {{@key}}
+{{#this}} * {{this}}
+{{/this}}
+{{/each}}
+{{/security}}
+
+#### Request
+
+{{#if consumes}}
+**Content-Type: ** {{join consumes ", "}}{{/if}}
+
+##### Parameters
+{{#if parameters}}
+<table border="1">
+ <tr>
+ <th>Name</th>
+ <th>Located in</th>
+ <th>Required</th>
+ <th>Description</th>
+ <th>Default</th>
+ <th>Schema</th>
+ </tr>
+{{/if}}
+
+{{#parameters}}
+<tr>
+ <th>{{name}}</th>
+ <td>{{in}}</td>
+ <td>{{#if required}}yes{{else}}no{{/if}}</td>
+ <td>{{description}}{{#if pattern}} (**Pattern**: `{{pattern}}`){{/if}}</td>
+ <td>{{#if defaultValue}}{{defaultValue}}{{else}} - {{/if}}</td>
+{{#ifeq in "body"}}
+ <td>
+ {{#ifeq schema.type "array"}}Array[<a href="{{schema.items.$ref}}">{{basename schema.items.$ref}}</a>]{{/ifeq}}
+ {{#schema.$ref}}<a href="{{schema.$ref}}">{{basename schema.$ref}}</a> {{/schema.$ref}}
+ </td>
+{{else}}
+ {{#ifeq type "array"}}
+ <td>Array[{{items.type}}] ({{collectionFormat}})</td>
+ {{else}}
+ <td>{{type}} {{#format}}({{format}}){{/format}}</td>
+ {{/ifeq}}
+{{/ifeq}}
+</tr>
+{{/parameters}}
+{{#if parameters}}
+</table>
+{{/if}}
+
+
+#### Response
+
+{{#if produces}}**Content-Type: ** {{join produces ", "}}{{/if}}
+
+
+| Status Code | Reason | Response Model |
+|-------------|-------------|----------------|
+{{#each responses}}| {{@key}} | {{description}} | {{#schema.$ref}}<a href="{{schema.$ref}}">{{basename schema.$ref}}</a>{{/schema.$ref}}{{#ifeq schema.type "array"}}Array[<a href="{{schema.items.$ref}}">{{basename schema.items.$ref}}</a>]{{/ifeq}}{{^schema}} - {{/schema}}|
+{{/each}} \ No newline at end of file
diff --git a/services/activity-spec/activity-spec-web/activity-spec-war/templates/security.hbs b/services/activity-spec/activity-spec-web/activity-spec-war/templates/security.hbs
new file mode 100644
index 0000000000..04f86e8380
--- /dev/null
+++ b/services/activity-spec/activity-spec-web/activity-spec-war/templates/security.hbs
@@ -0,0 +1,88 @@
+{{#each securityDefinitions}}
+### {{@key}}
+{{#this}}
+{{#ifeq type "oauth2"}}
+<table>
+ <tr>
+ <th>type</th>
+ <th colspan="2">{{type}}</th>
+ </tr>
+{{#if description}}
+ <tr>
+ <th>description</th>
+ <th colspan="2">{{description}}</th>
+ </tr>
+{{/if}}
+{{#if authorizationUrl}}
+ <tr>
+ <th>authorizationUrl</th>
+ <th colspan="2">{{authorizationUrl}}</th>
+ </tr>
+{{/if}}
+{{#if flow}}
+ <tr>
+ <th>flow</th>
+ <th colspan="2">{{flow}}</th>
+ </tr>
+{{/if}}
+{{#if tokenUrl}}
+ <tr>
+ <th>tokenUrl</th>
+ <th colspan="2">{{tokenUrl}}</th>
+ </tr>
+{{/if}}
+{{#if scopes}}
+ <tr>
+ <td rowspan="3">scopes</td>
+{{#each scopes}}
+ <td>{{@key}}</td>
+ <td>{{this}}</td>
+ </tr>
+ <tr>
+{{/each}}
+ </tr>
+{{/if}}
+</table>
+{{/ifeq}}
+{{#ifeq type "apiKey"}}
+<table>
+ <tr>
+ <th>type</th>
+ <th colspan="2">{{type}}</th>
+ </tr>
+{{#if description}}
+ <tr>
+ <th>description</th>
+ <th colspan="2">{{description}}</th>
+ </tr>
+{{/if}}
+{{#if name}}
+ <tr>
+ <th>name</th>
+ <th colspan="2">{{name}}</th>
+ </tr>
+{{/if}}
+{{#if in}}
+ <tr>
+ <th>in</th>
+ <th colspan="2">{{in}}</th>
+ </tr>
+{{/if}}
+</table>
+{{/ifeq}}
+{{#ifeq type "basic"}}
+<table>
+ <tr>
+ <th>type</th>
+ <th colspan="2">{{type}}</th>
+ </tr>
+{{#if description}}
+ <tr>
+ <th>description</th>
+ <th colspan="2">{{description}}</th>
+ </tr>
+{{/if}}
+</table>
+{{/ifeq}}
+{{/this}}
+{{/each}} \ No newline at end of file
diff --git a/services/activity-spec/activity-spec-web/activity-spec-war/templates/strapdown.html.hbs b/services/activity-spec/activity-spec-web/activity-spec-war/templates/strapdown.html.hbs
new file mode 100644
index 0000000000..fe722ab6f1
--- /dev/null
+++ b/services/activity-spec/activity-spec-web/activity-spec-war/templates/strapdown.html.hbs
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<title>API Document</title>
+
+<!--xmp theme="united" style="display:none;"-->
+<xmp theme="united" style="display:none;">
+{{>markdown}}
+</xmp>
+
+<script src="http://strapdownjs.com/v/0.2/strapdown.js"></script>
+</html> \ No newline at end of file