From f9c82988a7f3deb4351309aabda5d1ba8d391e76 Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Wed, 18 Feb 2015 18:42:53 +0000
Subject: [PATCH] OPENDJ-1813: Add ant task to concat snmp config

---
 opendj-server-legacy/pom.xml                                        |   38 ++++++++++++++++++++++++++++++++++++--
 opendj-server-legacy/src/main/assembly/opendj-archive-component.xml |   13 ++++++++++---
 2 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/opendj-server-legacy/pom.xml b/opendj-server-legacy/pom.xml
index 9d75e2e..d56b9f1 100644
--- a/opendj-server-legacy/pom.xml
+++ b/opendj-server-legacy/pom.xml
@@ -1013,6 +1013,21 @@
               <goal>run</goal>
             </goals>
           </execution>
+          
+          <execution>
+            <!-- Copy config.ldif in build dir (needed if snmp config merge is needed) -->
+            <id>copy-config-ldif</id>
+            <phase>generate-resources</phase>
+            <configuration>
+              <target>
+                <copy todir="${project.build.directory}/template/config" file="${basedir}/resource/config/config.ldif"/>
+              </target>
+            </configuration>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+          
           <!-- Generate final zip and attach artefact -->
           <execution>
             <id>attach-artifact</id>
@@ -1325,8 +1340,9 @@
       </activation>
 
       <properties>
-        <snmp.gen.dir>${basedir}/src/snmp/generated</snmp.gen.dir>
-        <snmp.mib.dir>${basedir}/src/snmp/resource/mib</snmp.mib.dir>
+        <snmp.dir>${basedir}/src/snmp</snmp.dir>
+        <snmp.gen.dir>${snmp.dir}/generated</snmp.gen.dir>
+        <snmp.mib.dir>${snmp.dir}/resource/mib</snmp.mib.dir>
       </properties>
 
       <dependencies>
@@ -1394,8 +1410,24 @@
                   <goal>run</goal>
                 </goals>
               </execution>
+              <execution>
+                <!-- Append snmp config to the config.ldif -->
+                <id>generate-config-ldif</id>
+                <phase>prepare-package</phase>
+                <configuration>
+                  <target>
+                    <concat destfile="${project.build.directory}/template/config/config.ldif" append="true">
+                      <filelist dir="${snmp.dir}/resource/config" files="config.snmp.ldif"/>
+                    </concat>
+                  </target>
+                </configuration>
+                <goals>
+                  <goal>run</goal>
+                </goals>
+              </execution>
             </executions>
           </plugin>
+          
           <!-- MIB generation -->
           <plugin>
             <groupId>org.codehaus.mojo</groupId>
@@ -1462,6 +1494,7 @@
               </execution>
             </executions>
           </plugin>
+          
           <!-- Package the final zip -->
           <plugin>
             <artifactId>maven-assembly-plugin</artifactId>
@@ -1489,6 +1522,7 @@
               </execution>
             </executions>
           </plugin>
+
         </plugins>
       </build>
     </profile>
diff --git a/opendj-server-legacy/src/main/assembly/opendj-archive-component.xml b/opendj-server-legacy/src/main/assembly/opendj-archive-component.xml
index 164cd3c..f16dcfa 100644
--- a/opendj-server-legacy/src/main/assembly/opendj-archive-component.xml
+++ b/opendj-server-legacy/src/main/assembly/opendj-archive-component.xml
@@ -195,9 +195,9 @@
     <fileSet>
       <directory>${basedir}/resource/config</directory>
       <outputDirectory>template/config</outputDirectory>
-      <includes>
-        <include>*.*</include>
-      </includes>
+      <excludes>
+        <exclude>config.ldif</exclude>
+      </excludes>
     </fileSet>
 
     <!-- Adds MakeLDIF configuration template resources -->
@@ -282,6 +282,13 @@
     </fileSet>
   </fileSets>
   <files>
+  
+    <!-- Adds Generated config.ldif file -->
+    <file>
+      <source>${project.build.directory}/template/config/config.ldif</source>
+      <outputDirectory>template/config</outputDirectory>
+    </file>
+    
     <!-- Adds logo png to root directory -->
     <file>
       <source>${basedir}/resource/images/opendj_logo.png</source>

--
Gitblit v1.10.0