BUG-2506: split out maven binding 90/13590/2
authorRobert Varga <rovarga@cisco.com>
Fri, 12 Dec 2014 11:07:45 +0000 (12:07 +0100)
committerRobert Varga <rovarga@cisco.com>
Fri, 12 Dec 2014 11:23:16 +0000 (12:23 +0100)
Maven integration needs to be split out of the runtime implementation,
simply because we do not want to pull the requisite runtime into our
containers. It would never be used there anyway.

Change-Id: Ided36e3b06316739a3829d758889ba523e7e19ad
Signed-off-by: Robert Varga <rovarga@cisco.com>
features/mdsal/pom.xml
opendaylight/md-sal/mdsal-artifacts/pom.xml
opendaylight/md-sal/pom.xml
opendaylight/md-sal/sal-rest-docgen-maven/pom.xml [new file with mode: 0644]
opendaylight/md-sal/sal-rest-docgen-maven/src/main/java/org/opendaylight/controller/sal/rest/doc/maven/StaticDocGenerator.java [moved from opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/StaticDocGenerator.java with 86% similarity]
opendaylight/md-sal/sal-rest-docgen/pom.xml

index 371d1675df016872e649ee9756a7c9b35cbd3e6c..d81da186b9490b4038f42fe668cca5a397dd03d3 100644 (file)
           </dependency>
           <dependency>
             <groupId>org.opendaylight.controller</groupId>
           </dependency>
           <dependency>
             <groupId>org.opendaylight.controller</groupId>
-            <artifactId>sal-rest-docgen</artifactId>
+            <artifactId>sal-rest-docgen-maven</artifactId>
             <version>${mdsal.version}</version>
             <type>jar</type>
           </dependency>
             <version>${mdsal.version}</version>
             <type>jar</type>
           </dependency>
               <yangFilesRootDir>src</yangFilesRootDir>
               <codeGenerators>
                 <generator>
               <yangFilesRootDir>src</yangFilesRootDir>
               <codeGenerators>
                 <generator>
-                  <codeGeneratorClass>org.opendaylight.controller.sal.rest.doc.impl.StaticDocGenerator</codeGeneratorClass>
+                  <codeGeneratorClass>org.opendaylight.controller.sal.rest.doc.maven.StaticDocGenerator</codeGeneratorClass>
                   <outputBaseDir>${project.build.directory}/generated-resources/swagger-api-documentation/explorer/static</outputBaseDir>
                 </generator>
               </codeGenerators>
                   <outputBaseDir>${project.build.directory}/generated-resources/swagger-api-documentation/explorer/static</outputBaseDir>
                 </generator>
               </codeGenerators>
index c765aa87a83faf022de247a74fc55994ac9077fd..01a55e883eaf88622f65d6fbda74b7c89d020e78 100644 (file)
                 <artifactId>sal-rest-docgen</artifactId>
                 <version>${project.version}</version>
             </dependency>
                 <artifactId>sal-rest-docgen</artifactId>
                 <version>${project.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller</groupId>
+                <artifactId>sal-rest-docgen-maven</artifactId>
+                <version>${project.version}</version>
+            </dependency>
 
             <!-- Toaster -->
             <dependency>
 
             <!-- Toaster -->
             <dependency>
index 6c87899eea5d1d401dface6628fa3f6921385091..9f342b88e80466ad27ab7c338ad9d80c73abf48c 100644 (file)
@@ -63,6 +63,7 @@
 
     <!-- Documentation -->
     <module>sal-rest-docgen</module>
 
     <!-- Documentation -->
     <module>sal-rest-docgen</module>
+    <module>sal-rest-docgen-maven</module>
 
     <module>sal-akka-raft</module>
 
 
     <module>sal-akka-raft</module>
 
diff --git a/opendaylight/md-sal/sal-rest-docgen-maven/pom.xml b/opendaylight/md-sal/sal-rest-docgen-maven/pom.xml
new file mode 100644 (file)
index 0000000..80e43d6
--- /dev/null
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>sal-parent</artifactId>
+        <version>1.2.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>sal-rest-docgen-maven</artifactId>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-rest-docgen</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-maven-plugin-spi</artifactId>
+        </dependency>
+    </dependencies>
+</project>
@@ -5,33 +5,31 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.sal.rest.doc.impl;
+package org.opendaylight.controller.sal.rest.doc.maven;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.SerializationFeature;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.SerializationFeature;
-
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.project.MavenProject;
-import org.opendaylight.controller.sal.rest.doc.swagger.ApiDeclaration;
-import org.opendaylight.controller.sal.rest.doc.swagger.Resource;
-import org.opendaylight.controller.sal.rest.doc.swagger.ResourceList;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.opendaylight.yangtools.yang2sources.spi.CodeGenerator;
-
-import javax.ws.rs.core.UriInfo;
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import javax.ws.rs.core.UriInfo;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.project.MavenProject;
+import org.opendaylight.controller.sal.rest.doc.impl.ApiDocGenerator;
+import org.opendaylight.controller.sal.rest.doc.swagger.ApiDeclaration;
+import org.opendaylight.controller.sal.rest.doc.swagger.Resource;
+import org.opendaylight.controller.sal.rest.doc.swagger.ResourceList;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang2sources.spi.CodeGenerator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * This class gathers all yang defined {@link Module}s and generates Swagger compliant documentation.
 
 /**
  * This class gathers all yang defined {@link Module}s and generates Swagger compliant documentation.
@@ -41,13 +39,12 @@ public class StaticDocGenerator extends ApiDocGenerator implements CodeGenerator
     private static final String DEFAULT_OUTPUT_BASE_DIR_PATH = "target" + File.separator + "generated-resources"
         + File.separator + "swagger-api-documentation";
 
     private static final String DEFAULT_OUTPUT_BASE_DIR_PATH = "target" + File.separator + "generated-resources"
         + File.separator + "swagger-api-documentation";
 
-    private static Logger _logger = LoggerFactory.getLogger(ApiDocGenerator.class);
+    private static final Logger _logger = LoggerFactory.getLogger(ApiDocGenerator.class);
 
     private MavenProject mavenProject;
     private File projectBaseDir;
     private Map<String, String> additionalConfig;
     private File resourceBaseDir;
 
     private MavenProject mavenProject;
     private File projectBaseDir;
     private Map<String, String> additionalConfig;
     private File resourceBaseDir;
-    private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
 
     /**
      *
 
     /**
      *
@@ -58,15 +55,16 @@ public class StaticDocGenerator extends ApiDocGenerator implements CodeGenerator
      * @throws IOException
      */
     @Override
      * @throws IOException
      */
     @Override
-    public Collection<File> generateSources(SchemaContext context, File outputDir, Set<Module> yangModules) throws IOException {
+    public Collection<File> generateSources(final SchemaContext context, final File outputDir, final Set<Module> yangModules) throws IOException {
         List<File> result = new ArrayList<>();
 
         // Create Base Directory
         final File outputBaseDir;
         if (outputDir == null) {
             outputBaseDir = new File(DEFAULT_OUTPUT_BASE_DIR_PATH);
         List<File> result = new ArrayList<>();
 
         // Create Base Directory
         final File outputBaseDir;
         if (outputDir == null) {
             outputBaseDir = new File(DEFAULT_OUTPUT_BASE_DIR_PATH);
+        } else {
+            outputBaseDir = outputDir;
         }
         }
-        else outputBaseDir = outputDir;
         outputBaseDir.mkdirs();
 
         // Create Resources directory
         outputBaseDir.mkdirs();
 
         // Create Resources directory
@@ -114,7 +112,7 @@ public class StaticDocGenerator extends ApiDocGenerator implements CodeGenerator
     }
 
     @Override
     }
 
     @Override
-    protected String generatePath(UriInfo uriInfo, String name, String revision) {
+    protected String generatePath(final UriInfo uriInfo, final String name, final String revision) {
         if (uriInfo == null) {
             return name + "(" + revision + ")";
         }
         if (uriInfo == null) {
             return name + "(" + revision + ")";
         }
@@ -122,7 +120,7 @@ public class StaticDocGenerator extends ApiDocGenerator implements CodeGenerator
     }
 
     @Override
     }
 
     @Override
-    protected String createBasePathFromUriInfo(UriInfo uriInfo) {
+    protected String createBasePathFromUriInfo(final UriInfo uriInfo) {
         if (uriInfo == null) {
             return RESTCONF_CONTEXT_ROOT;
         }
         if (uriInfo == null) {
             return RESTCONF_CONTEXT_ROOT;
         }
@@ -130,21 +128,21 @@ public class StaticDocGenerator extends ApiDocGenerator implements CodeGenerator
     }
 
     @Override
     }
 
     @Override
-    public void setLog(Log log) {
+    public void setLog(final Log log) {
     }
 
     @Override
     }
 
     @Override
-    public void setAdditionalConfig(Map<String, String> additionalConfig) {
+    public void setAdditionalConfig(final Map<String, String> additionalConfig) {
         this.additionalConfig = additionalConfig;
     }
 
     @Override
         this.additionalConfig = additionalConfig;
     }
 
     @Override
-    public void setResourceBaseDir(File resourceBaseDir) {
+    public void setResourceBaseDir(final File resourceBaseDir) {
         this.resourceBaseDir = resourceBaseDir;
     }
 
     @Override
         this.resourceBaseDir = resourceBaseDir;
     }
 
     @Override
-    public void setMavenProject(MavenProject mavenProject) {
+    public void setMavenProject(final MavenProject mavenProject) {
         this.mavenProject = mavenProject;
         this.projectBaseDir = mavenProject.getBasedir();
     }
         this.mavenProject = mavenProject;
         this.projectBaseDir = mavenProject.getBasedir();
     }
index 53f1b2e69274465a01dc6d34000eafe446b3bdb0..22a128c1b7d5dd06fe1e444051057e69d5888aca 100644 (file)
       <artifactId>yang-parser-impl</artifactId>
     </dependency>
 
       <artifactId>yang-parser-impl</artifactId>
     </dependency>
 
-    <dependency>
-      <groupId>org.opendaylight.yangtools</groupId>
-      <artifactId>yang-maven-plugin-spi</artifactId>
-    </dependency>
-
     <dependency>
       <groupId>org.osgi</groupId>
       <artifactId>org.osgi.core</artifactId>
     <dependency>
       <groupId>org.osgi</groupId>
       <artifactId>org.osgi.core</artifactId>