Move adsal into its own subdirectory.
[controller.git] / opendaylight / adsal / northbound / swagger-ui / pom.xml
diff --git a/opendaylight/adsal/northbound/swagger-ui/pom.xml b/opendaylight/adsal/northbound/swagger-ui/pom.xml
new file mode 100644 (file)
index 0000000..ba1e5c0
--- /dev/null
@@ -0,0 +1,235 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.opendaylight.controller</groupId>
+    <artifactId>commons.opendaylight</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../../../commons/opendaylight</relativePath>
+  </parent>
+
+  <artifactId>swagger-ui</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+
+  <properties>
+    <api.dir>${resource.dir}/apis</api.dir>
+    <resource.dir>${project.build.directory}/classes</resource.dir>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>com.google.code.gson</groupId>
+      <artifactId>gson</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>javax.servlet</artifactId>
+    </dependency>
+    <!-- add dependency on all northbound bundles -->
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>connectionmanager.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>controllermanager.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>flowprogrammer.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>forwarding.staticrouting.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>hosttracker.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>networkconfig.bridgedomain.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>statistics.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>subnets.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>switchmanager.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>topology.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>usermanager.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>networkconfig.neutron.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Export-Package></Export-Package>
+            <Import-Package>org.slf4j,
+              javax.annotation,
+              javax.naming,
+              javax.servlet,
+              javax.servlet.annotation,
+              javax.servlet.http,
+              com.google.gson,</Import-Package>
+            <Export-Package></Export-Package>
+            <Include-Resource>apis=target/classes/apis,
+                index.html=target/classes/index.html,
+                apilist.json=target/classes/apilist.json,
+                css=target/classes/css,
+                lib=target/classes/lib,
+                swagger-ui.min.js=target/classes/swagger-ui.min.js,
+                swagger-ui.js=target/classes/swagger-ui.js,
+                images=target/classes/images,
+                WEB-INF/web.xml=target/classes/WEB-INF/web.xml</Include-Resource>
+            <Web-ContextPath>/swagger</Web-ContextPath>
+          </instructions>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <version>1.7</version>
+        <dependencies>
+          <dependency>
+            <groupId>ant-contrib</groupId>
+            <artifactId>ant-contrib</artifactId>
+            <version>1.0b3</version>
+            <exclusions>
+              <exclusion>
+                <groupId>ant</groupId>
+                <artifactId>ant</artifactId>
+              </exclusion>
+            </exclusions>
+          </dependency>
+        </dependencies>
+        <executions>
+          <execution>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <phase>generate-sources</phase>
+            <configuration>
+              <target>
+                <taskdef classpathref="maven.plugin.classpath" resource="net/sf/antcontrib/antlib.xml"></taskdef>
+                <patternset id="rest.paths">
+                  <include name="**/enunciate/generate/swagger/ui/*.json"></include>
+                  <exclude name="**/java-client/**"></exclude>
+                  <exclude name="**/swagger-ui/**"></exclude>
+                </patternset>
+
+                <echo message="======== Assembling swagger docs ========"></echo>
+                <!-- make api directory -->
+                <mkdir dir="${api.dir}"></mkdir>
+                <!--  copy swagger libs -->
+                <copy todir="${resource.dir}">
+                  <fileset dir="../subnets/target/enunciate/generate/swagger/ui">
+                    <exclude name="**/*.json"></exclude>
+                    <exclude name="**/*.png"></exclude>
+                    <exclude name="**/index.html"></exclude>
+                  </fileset>
+                </copy>
+                <!--  Copy NorthBound json files into ui directory-->
+                <copy todir="${api.dir}">
+                  <fileset dir="${basedir}/../../..">
+                    <patternset refid="rest.paths"></patternset>
+                  </fileset>
+                  <mapper>
+                    <regexpmapper from="^(.*)/([^/]+)/*/target/enunciate/generate/swagger/ui/(.*Northbound).*$$" to="\3"></regexpmapper>
+                    <regexpmapper from="^(.*)/neutron/([^/]+)/*/target/enunciate/generate/swagger/ui/(.*resource-list.json)$$" to="neutron-\3"></regexpmapper>
+                    <regexpmapper from="^(.*)/([^/]+)/*/target/enunciate/generate/swagger/ui/(.*resource-list.json)$$" to="\2-\3"></regexpmapper>
+                  </mapper>
+                </copy>
+
+                <!--  Correct base path -->
+                <replaceregexp match="/full" replace="">
+                  <fileset dir="${api.dir}">
+                    <include name="**/*Northbound"></include>
+                  </fileset>
+                </replaceregexp>
+                <!--  Merge Resource list -->
+                <echo append="false" file="${resource.dir}/apilist.json">{
+  "swaggerVersion": "1.1",
+  "basePath": "http://localhost:8080/swagger/apis",
+  "apis": [</echo>
+                <for param="file">
+                  <path>
+                    <fileset dir="${api.dir}">
+                      <include name="**/*resource-list.json"></include>
+                      <exclude name="**/neutron*"></exclude>
+                    </fileset>
+                  </path>
+                  <sequential>
+                    <echo message="Processing json resource @{file}"></echo>
+                    <loadfile property="jsoncontent" srcfile="@{file}">
+                      <filterchain>
+                        <headfilter lines="10"></headfilter>
+                        <tailfilter lines="6"></tailfilter>
+                      </filterchain>
+                    </loadfile>
+                    <echo append="true" file="${resource.dir}/apilist.json" message="${jsoncontent},"></echo>
+                    <var name="jsoncontent" unset="true"></var>
+                  </sequential>
+                </for>
+                <sequential>
+                  <loadfile property="jsoncontent" srcfile="${api.dir}/neutron-resource-list.json">
+                    <filterchain>
+                      <headfilter lines="46"></headfilter>
+                      <tailfilter lines="42"></tailfilter>
+                    </filterchain>
+                  </loadfile>
+                  <echo append="true" file="${resource.dir}/apilist.json" message="${jsoncontent},"></echo>
+                  <var name="jsoncontent" unset="true"></var>
+                </sequential>
+                <echo append="true" file="${resource.dir}/apilist.json">{ }
+  ]
+}</echo>
+
+                <!-- Remove .json from api paths -->
+                <replaceregexp file="${resource.dir}/apilist.json" flags="g" match=".json" replace=""></replaceregexp>
+                <replaceregexp file="${resource.dir}/apilist.json" flags="g" match="JAXRS" replace=""></replaceregexp>
+
+                <!-- cleanup resource files as we don't need them -->
+                <delete>
+                  <fileset dir="${api.dir}" includes="**/*resource-list.json"></fileset>
+                </delete>
+                <echo message="======== Build successful ========"></echo>
+              </target>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <scm>
+    <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
+    <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
+    <tag>HEAD</tag>
+    <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:Main</url>
+  </scm>
+</project>