From 0e18f306907678491738c7e4590c32e1d81bddcc Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Wed, 15 Jan 2014 11:45:36 +0000
Subject: [PATCH] Remove DynamicConstants from opendj-config and replace it with resource based ProductInformation in opendj-server module.

---
 opendj-server/pom.xml                                                                       |   62 ++++++
 /dev/null                                                                                   |  182 ------------------
 opendj-config/src/main/java/org/forgerock/opendj/config/server/ServerManagementContext.java |    3 
 opendj-config/src/main/java/org/forgerock/opendj/config/server/ConfigExceptionFactory.java  |    9 
 opendj-config/src/main/java/org/forgerock/opendj/config/ClassLoaderProvider.java            |   13 
 opendj-server/src/test/java/org/forgerock/opendj/server/core/ProductInformationTest.java    |   47 ++++
 opendj-config/pom.xml                                                                       |  122 ------------
 opendj-server/src/main/java/org/forgerock/opendj/server/core/ProductInformation.java        |   88 ++++++++
 opendj-server/src/main/resources/META-INF/product/opendj.properties                         |   43 ++++
 pom.xml                                                                                     |   29 ++
 10 files changed, 279 insertions(+), 319 deletions(-)

diff --git a/opendj-config/pom.xml b/opendj-config/pom.xml
index 688320b..9971684 100644
--- a/opendj-config/pom.xml
+++ b/opendj-config/pom.xml
@@ -64,99 +64,10 @@
       com.sun.security.auth*;resolution:=optional,
       *
     </opendj.osgi.import>
-
-    <!-- properties used to generate DynamicConstant class -->
-    <serverProductName>OpenDJ</serverProductName>
-    <serverShortProductName>OpenDJ</serverShortProductName>
-    <issuesFixIds></issuesFixIds>
-    <isDebugBuild>false</isDebugBuild>
-    <docReferenceHome>http://opendj.forgerock.org/</docReferenceHome>
-    <docReferenceWiki>http://opendj.forgerock.org/docs.html</docReferenceWiki>
-    <docQuickRefGuide>http://opendj.forgerock.org/doc/admin-guide/index.html</docQuickRefGuide>
-    <adminGuideUrl>http://opendj.forgerock.org/doc/admin-guide/index.html</adminGuideUrl>
   </properties>
   <build>
     <plugins>
       <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>build-helper-maven-plugin</artifactId>
-        <version>1.8</version>
-        <executions>
-          <!-- Parse the maven version to get version parts (major, minor, ...) -->
-          <execution>
-            <id>parse-version</id>
-            <goals>
-              <goal>parse-version</goal>
-            </goals>
-          </execution>
-          <!-- Add generated source directories to build -->
-          <execution>
-            <id>add-source</id>
-            <phase>process-sources</phase>
-            <goals>
-              <goal>add-source</goal>
-            </goals>
-            <configuration>
-              <sources>
-                <source>${project.build.directory}/generated-sources/java</source>
-              </sources>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <!-- Retrieve the SVN revision number and the build timestamp -->
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>buildnumber-maven-plugin</artifactId>
-        <version>1.2</version>
-        <executions>
-          <execution>
-            <id>generate-buildnumber</id>
-            <goals>
-              <goal>create</goal>
-            </goals>
-            <configuration>
-              <useLastCommittedRevision>true</useLastCommittedRevision>
-              <buildNumberPropertyName>buildRevision</buildNumberPropertyName>
-            </configuration>
-          </execution>
-          <execution>
-            <id>generate-timestamp</id>
-            <goals>
-              <goal>create</goal>
-            </goals>
-            <configuration>
-              <format>{0,date,yyyyMMddHHmmss}</format>
-              <items>
-                <item>timestamp</item>
-              </items>
-              <buildNumberPropertyName>buildDateTime</buildNumberPropertyName>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <artifactId>maven-resources-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>copy-resources</id>
-            <phase>generate-sources</phase>
-            <goals>
-              <goal>copy-resources</goal>
-            </goals>
-            <configuration>
-              <outputDirectory>${project.build.directory}/generated-sources/java</outputDirectory>
-              <resources>
-                <resource>
-                  <directory>src/main/java-templates</directory>
-                  <filtering>true</filtering>
-                </resource>
-              </resources>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
         <groupId>org.forgerock.commons</groupId>
         <artifactId>i18n-maven-plugin</artifactId>
         <executions>
@@ -200,39 +111,6 @@
         <artifactId>maven-surefire-plugin</artifactId>
       </plugin>
     </plugins>
-    <pluginManagement>
-      <plugins>
-        <!--This plugin's configuration is used to store Eclipse m2e settings only.
-            It has no influence on the Maven build itself.-->
-        <plugin>
-          <groupId>org.eclipse.m2e</groupId>
-          <artifactId>lifecycle-mapping</artifactId>
-          <version>1.0.0</version>
-          <configuration>
-            <lifecycleMappingMetadata>
-              <pluginExecutions>
-                <pluginExecution>
-                  <pluginExecutionFilter>
-                    <groupId>org.forgerock.opendj</groupId>
-                    <artifactId>opendj-config-maven-plugin</artifactId>
-                    <versionRange>[3.0.0-SNAPSHOT,)</versionRange>
-                    <goals>
-                      <goal>generate</goal>
-                    </goals>
-                  </pluginExecutionFilter>
-                  <action>
-                    <execute>
-                        <runOnIncremental>true</runOnIncremental>
-                        <runOnConfiguration>true</runOnConfiguration>
-                    </execute>
-                  </action>
-                </pluginExecution>
-              </pluginExecutions>
-            </lifecycleMappingMetadata>
-          </configuration>
-        </plugin>
-      </plugins>
-    </pluginManagement>
   </build>
   <reporting>
     <plugins>
diff --git a/opendj-config/src/main/java-templates/org/forgerock/opendj/server/util/DynamicConstants.java b/opendj-config/src/main/java-templates/org/forgerock/opendj/server/util/DynamicConstants.java
deleted file mode 100644
index 177330d..0000000
--- a/opendj-config/src/main/java-templates/org/forgerock/opendj/server/util/DynamicConstants.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2006-2009 Sun Microsystems, Inc.
- *      Portions Copyright 2011-2013 ForgeRock AS
- */
-package org.forgerock.opendj.server.util;
-
-/**
- * This file contains a number of constants that are used throughout the
- * Directory Server source. It was dynamically generated as part of the
- * build process and should not be edited directly.
- */
-public final class DynamicConstants {
-
-    /**
-     * The official full product name for the Directory Server.
-     */
-    public static String PRODUCT_NAME = "${serverProductName}";
-
-    /**
-     * The short product name for the Directory Server.
-     */
-    public static String SHORT_NAME = "${serverShortProductName}";
-
-    /**
-     * The major version number for the Directory Server.
-     */
-    public static int MAJOR_VERSION = ${parsedVersion.majorVersion};
-
-    /**
-     * The minor version number for the Directory Server.
-     */
-    public static int MINOR_VERSION = ${parsedVersion.minorVersion};
-
-    /**
-     * The point version number for the Directory Server.
-     */
-    public static int POINT_VERSION = ${parsedVersion.incrementalVersion};
-
-    /**
-     * The official build number for the Directory Server.
-     */
-    public static int BUILD_NUMBER = ${parsedVersion.buildNumber};
-
-    /**
-     * The version qualifier string for the Directory Server.
-     */
-    public static String VERSION_QUALIFIER = "${parsedVersion.qualifier}";
-
-    /**
-     * The set of bug IDs for fixes included in this build of the Directory
-     * Server.
-     */
-    public static String FIX_IDS = "${issuesFixIds}";
-
-    /**
-     * The build ID for the generated build of the Directory Server.
-     */
-    public static String BUILD_ID = "${buildDateTime}";
-
-    /**
-     * The username of the user that created this build.
-     */
-    public static String BUILD_USER = "${user.name}";
-
-    /**
-     * The Java version used to generate this build.
-     */
-    public static String BUILD_JAVA_VERSION = "${java.version}";
-
-    /**
-     * The vendor for the Java version used to generate this build.
-     */
-    public static String BUILD_JAVA_VENDOR = "${java.vendor}";
-
-    /**
-     * The JVM version used to generate this build.
-     */
-    public static String BUILD_JVM_VERSION = "${java.vm.version}";
-
-    /**
-     * The vendor for the JVM used to generate this build.
-     */
-    public static String BUILD_JVM_VENDOR = "${java.vm.vendor}";
-
-    /**
-     * The operating system on which this build was generated.
-     */
-    public static String BUILD_OS = "${os.name} ${os.version} ${os.arch}"; 
-
-    /**
-     * Indicates whether this is a debug build of the Directory Server that may
-     * include additional debugging facilities not available in standard release
-     * versions.
-     */
-    public static boolean DEBUG_BUILD = ${isDebugBuild};
-
-    /**
-     * The Subversion revision number on which this build is based.
-     */
-    public static long REVISION_NUMBER = ${buildRevision};
-
-    /**
-     * The Subversion url repository location on which this build is based.
-     */
-    public static String URL_REPOSITORY = "${scm.url}";
-
-    /**
-     * The documentation home.
-     */
-    public static String DOC_REFERENCE_HOME = "${docReferenceHome}";
-
-    /**
-     * The documentation url.
-     */
-    public static String DOC_REFERENCE_WIKI = "${docReferenceWiki}";
-
-    /**
-     * The documentation url.
-     */
-    public static String DOC_QUICK_REFERENCE_GUIDE = "${docQuickRefGuide}";
-
-    /**
-     * The administration guide.
-     */
-    public static String ADMINISTRATION_GUIDE_URL = "${adminGuideUrl}";
-
-    /**
-     * A string representation of the version number.
-     */
-    public static String VERSION_NUMBER_STRING = "${project.version}";
-
-    /**
-     * A string representation of the version number.
-     */
-    public static String OPENDJ_NUMBER_STRING = "${project.version}";
-
-    /**
-     * A string representation of the release version.
-     */
-    public static String RELEASE_VERSION_STRING = OPENDJ_NUMBER_STRING;
-
-    /**
-     * A compact version string for this product, suitable for use in path names
-     * and similar cases.
-     */
-    public static String COMPACT_VERSION_STRING = SHORT_NAME + "-" + VERSION_NUMBER_STRING;
-
-    /**
-     * A full version string for this product.
-     */
-    public static String FULL_VERSION_STRING = PRODUCT_NAME + " " + RELEASE_VERSION_STRING
-            + (((FIX_IDS != null) && (FIX_IDS.length() > 0)) ? "+" + FIX_IDS : "");
-
-    /**
-     * A printable version string for this product.
-     */
-    public static final String PRINTABLE_VERSION_STRING = FULL_VERSION_STRING + System.getProperty("line.separator")
-            + "Build " + BUILD_ID + System.getProperty("line.separator");
-
-}
diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/ClassLoaderProvider.java b/opendj-config/src/main/java/org/forgerock/opendj/config/ClassLoaderProvider.java
index 34ac3cb..a7d9b54 100644
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/ClassLoaderProvider.java
+++ b/opendj-config/src/main/java/org/forgerock/opendj/config/ClassLoaderProvider.java
@@ -59,7 +59,6 @@
 import org.forgerock.opendj.server.config.meta.RootCfgDefn;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.types.InitializationException;
-import org.forgerock.opendj.server.util.DynamicConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -358,7 +357,7 @@
                 debugLogger.trace("Unable to register the jar file with the class loader", e);
                 LocalizableMessage message =
                     ERR_ADMIN_CANNOT_OPEN_JAR_FILE.get(extension.getName(), extension.getParent(),
-                        stackTraceToSingleLineString(e, DynamicConstants.DEBUG_BUILD));
+                        stackTraceToSingleLineString(e, true));
                 throw new InitializationException(message);
             }
             jarFiles.add(extension);
@@ -527,7 +526,7 @@
             debugLogger.trace("Unable to initialize all extensions", e);
             LocalizableMessage message =
                 ERR_ADMIN_EXTENSIONS_CANNOT_LIST_FILES.get(String.valueOf(extensionsPath),
-                    stackTraceToSingleLineString(e, DynamicConstants.DEBUG_BUILD));
+                    stackTraceToSingleLineString(e, true));
             throw new InitializationException(message, e);
         }
     }
@@ -551,7 +550,7 @@
             debugLogger.trace("Unable to initialize core components", e);
             LocalizableMessage message =
                 ERR_CLASS_LOADER_CANNOT_LOAD_CORE.get(MANIFEST,
-                    stackTraceToSingleLineString(e, DynamicConstants.DEBUG_BUILD));
+                    stackTraceToSingleLineString(e, true));
             throw new InitializationException(message);
         }
     }
@@ -577,7 +576,7 @@
                 debugLogger.trace("Unable to get input stream from jar", e);
                 LocalizableMessage message =
                     ERR_ADMIN_CANNOT_READ_EXTENSION_MANIFEST.get(MANIFEST, jarFile.getName(),
-                        stackTraceToSingleLineString(e, DynamicConstants.DEBUG_BUILD));
+                        stackTraceToSingleLineString(e, true));
                 throw new InitializationException(message);
             }
 
@@ -587,7 +586,7 @@
                 debugLogger.trace("Unable to load classes from input stream", e);
                 LocalizableMessage message =
                     ERR_CLASS_LOADER_CANNOT_LOAD_EXTENSION.get(jarFile.getName(), MANIFEST,
-                        stackTraceToSingleLineString(e, DynamicConstants.DEBUG_BUILD));
+                        stackTraceToSingleLineString(e, true));
                 throw new InitializationException(message);
             }
             try {
@@ -713,7 +712,7 @@
 
             LocalizableMessage message =
                 ERR_ADMIN_CANNOT_OPEN_JAR_FILE.get(jar.getName(), jar.getParent(),
-                    stackTraceToSingleLineString(e, DynamicConstants.DEBUG_BUILD));
+                    stackTraceToSingleLineString(e, true));
             throw new InitializationException(message);
         }
         return jarFile;
diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/server/ConfigExceptionFactory.java b/opendj-config/src/main/java/org/forgerock/opendj/config/server/ConfigExceptionFactory.java
index ab93f0f..17b6624 100644
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/server/ConfigExceptionFactory.java
+++ b/opendj-config/src/main/java/org/forgerock/opendj/config/server/ConfigExceptionFactory.java
@@ -30,7 +30,6 @@
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.config.DefinitionDecodingException;
 import org.forgerock.opendj.ldap.DN;
-import org.forgerock.opendj.server.util.DynamicConstants;
 
 import com.forgerock.opendj.ldap.AdminMessages;
 
@@ -67,7 +66,7 @@
      */
     public ConfigException createDecodingExceptionAdaptor(DN dn, DefinitionDecodingException e) {
         LocalizableMessage message = AdminMessages.ERR_ADMIN_MANAGED_OBJECT_DECODING_PROBLEM.get(String.valueOf(dn),
-                stackTraceToSingleLineString(e, DynamicConstants.DEBUG_BUILD));
+                stackTraceToSingleLineString(e, true));
         return new ConfigException(message, e);
     }
 
@@ -83,7 +82,7 @@
     public ConfigException createDecodingExceptionAdaptor(ServerManagedObjectDecodingException e) {
         DN dn = e.getPartialManagedObject().getDN();
         LocalizableMessage message = AdminMessages.ERR_ADMIN_MANAGED_OBJECT_DECODING_PROBLEM.get(String.valueOf(dn),
-                stackTraceToSingleLineString(e, DynamicConstants.DEBUG_BUILD));
+                stackTraceToSingleLineString(e, true));
         return new ConfigException(message, e);
     }
 
@@ -98,7 +97,7 @@
     public ConfigException createDecodingExceptionAdaptor(ConstraintViolationException e) {
         DN dn = e.getManagedObject().getDN();
         LocalizableMessage message = AdminMessages.ERR_ADMIN_MANAGED_OBJECT_DECODING_PROBLEM.get(String.valueOf(dn),
-                stackTraceToSingleLineString(e, DynamicConstants.DEBUG_BUILD));
+                stackTraceToSingleLineString(e, true));
         return new ConfigException(message, e);
     }
 
@@ -118,7 +117,7 @@
 
     public ConfigException createClassLoadingExceptionAdaptor(DN dn, String className, Exception e) {
         LocalizableMessage message = AdminMessages.ERR_ADMIN_CANNOT_INSTANTIATE_CLASS.get(String.valueOf(className),
-                String.valueOf(dn), stackTraceToSingleLineString(e, DynamicConstants.DEBUG_BUILD));
+                String.valueOf(dn), stackTraceToSingleLineString(e, true));
         return new ConfigException(message, e);
     }
 }
diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/server/ServerManagementContext.java b/opendj-config/src/main/java/org/forgerock/opendj/config/server/ServerManagementContext.java
index 0a06d11..e6fab0f 100644
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/server/ServerManagementContext.java
+++ b/opendj-config/src/main/java/org/forgerock/opendj/config/server/ServerManagementContext.java
@@ -80,7 +80,6 @@
 import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldap.Entry;
 import org.forgerock.opendj.ldap.schema.AttributeType;
-import org.forgerock.opendj.server.util.DynamicConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -819,7 +818,7 @@
             debugLogger.trace("Unable to perform post add", e);
 
             LocalizableMessage message = ERR_ADMIN_CANNOT_GET_MANAGED_OBJECT.get(String.valueOf(dn),
-                    stackTraceToSingleLineString(e, DynamicConstants.DEBUG_BUILD));
+                    stackTraceToSingleLineString(e, true));
             throw new ConfigException(message, e);
         }
 
diff --git a/opendj-server/pom.xml b/opendj-server/pom.xml
index 281dce6..5acd4e1 100644
--- a/opendj-server/pom.xml
+++ b/opendj-server/pom.xml
@@ -35,9 +35,19 @@
   <artifactId>opendj-server</artifactId>
   <name>OpenDJ Server</name>
   <description> 
-    This module includes the core functionality of the OpenDJ LDAP Directory Server.
+    OpenDJ LDAP embedded directory server.
   </description>
   <packaging>jar</packaging>
+  <properties>
+    <!-- Product properties -->
+    <shortProductName>OpenDJ</shortProductName>
+    <issuesFixIds></issuesFixIds>
+    <isDebugBuild>false</isDebugBuild>
+    <docReferenceHome>http://opendj.forgerock.org/</docReferenceHome>
+    <docReferenceWiki>http://opendj.forgerock.org/docs.html</docReferenceWiki>
+    <docQuickRefGuide>http://opendj.forgerock.org/doc/admin-guide/index.html</docQuickRefGuide>
+    <adminGuideUrl>http://opendj.forgerock.org/doc/admin-guide/index.html</adminGuideUrl>
+  </properties>
   <dependencies>
     <dependency>
       <groupId>org.forgerock.opendj</groupId>
@@ -81,8 +91,58 @@
     </dependency>
   </dependencies>
   <build>
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
     <plugins>
       <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <version>1.8</version>
+        <executions>
+          <execution>
+            <id>parse-version</id>
+            <goals>
+              <goal>parse-version</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <!-- Retrieve the SVN revision number and the build timestamp -->
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>buildnumber-maven-plugin</artifactId>
+        <version>1.2</version>
+        <executions>
+          <execution>
+            <id>generate-buildnumber</id>
+            <goals>
+              <goal>create</goal>
+            </goals>
+            <configuration>
+              <useLastCommittedRevision>true</useLastCommittedRevision>
+              <buildNumberPropertyName>buildRevision</buildNumberPropertyName>
+            </configuration>
+          </execution>
+          <execution>
+            <id>generate-timestamp</id>
+            <goals>
+              <goal>create</goal>
+            </goals>
+            <configuration>
+              <format>{0,date,yyyyMMddHHmmss}</format>
+              <items>
+                <item>timestamp</item>
+              </items>
+              <buildNumberPropertyName>buildDateTime</buildNumberPropertyName>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
         <groupId>org.forgerock.commons</groupId>
         <artifactId>i18n-maven-plugin</artifactId>
         <executions>
diff --git a/opendj-server/src/main/java/org/forgerock/opendj/server/core/ProductInformation.java b/opendj-server/src/main/java/org/forgerock/opendj/server/core/ProductInformation.java
new file mode 100644
index 0000000..31ba691
--- /dev/null
+++ b/opendj-server/src/main/java/org/forgerock/opendj/server/core/ProductInformation.java
@@ -0,0 +1,88 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *       Copyright 2014 ForgeRock AS.
+ */
+
+package org.forgerock.opendj.server.core;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.MissingResourceException;
+import java.util.Properties;
+
+/**
+ * Product information, including version information.
+ */
+public final class ProductInformation {
+    private static final ProductInformation DEFAULT = new ProductInformation("opendj");
+    private final Properties properties;
+
+    /**
+     * Returns the singleton product information instance.
+     *
+     * @return The singleton product information instance.
+     */
+    public static ProductInformation getInstance() {
+        return DEFAULT;
+    }
+
+    private ProductInformation(String productName) {
+        // Load the resource file.
+        String resourceName = "/META-INF/product/" + productName + ".properties";
+        InputStream stream = getClass().getResourceAsStream(resourceName);
+
+        if (stream == null) {
+            throw new MissingResourceException("Can't find product information " + resourceName,
+                    productName, "");
+        }
+
+        properties = new Properties();
+        try {
+            properties.load(new BufferedInputStream(stream));
+        } catch (IOException e) {
+            throw new MissingResourceException("Can't load product information " + resourceName
+                    + " due to IO exception: " + e.getMessage(), productName, "");
+        }
+    }
+
+    /**
+     * Returns the short product name for the Directory Server.
+     *
+     * @return The short product name for the Directory Server.
+     */
+    public String productShortName() {
+        return properties.getProperty("product.name.short");
+    }
+
+    /**
+     * Returns the official full product name for the Directory Server.
+     *
+     * @return The official full product name for the Directory Server.
+     */
+    public String productName() {
+        return properties.getProperty("product.name");
+    }
+
+}
diff --git a/opendj-server/src/main/resources/META-INF/product/opendj.properties b/opendj-server/src/main/resources/META-INF/product/opendj.properties
new file mode 100644
index 0000000..b47d130
--- /dev/null
+++ b/opendj-server/src/main/resources/META-INF/product/opendj.properties
@@ -0,0 +1,43 @@
+# This file contains product information. It was dynamically generated
+# as part of the build process and should not be edited directly.
+
+# Product name.
+product.name=${project.name}
+product.name.short=${shortProductName}
+product.release.date=${softwareReleaseDate}
+product.publication.date=${publicationDate}
+
+# Version.
+version=${project.version}
+version.compact=${shortProductName}-${project.version}
+version.full=${project.name} ${project.version} ${issuesFixIds}
+version.printable=${project.name} ${project.version} ${issuesFixIds}\nBuild ${buildDateTime}\n
+version.major=${parsedVersion.majorVersion}
+version.minor=${parsedVersion.minorVersion}
+version.point=${parsedVersion.incrementalVersion}
+version.qualifier=${parsedVersion.qualifier}
+version.build=${parsedVersion.buildNumber}
+version.revision=${buildRevision}
+
+# Additional build information.
+build.id=${buildDateTime}
+build.user=${user.name}
+build.java.version=${java.version}
+build.java.vendor=${java.vendor}
+build.jvm.version=${java.vm.version}
+build.jvm.vendor=${java.vm.vendor}
+build.os=${os.name} ${os.version} ${os.arch}
+build.isDebug=${isDebugBuild}
+
+# Patch bug fix IDs for this build.
+patch.fix.ids=${issuesFixIds}
+
+# Source version.
+scm.url=${scm.url}
+scm.revision=${buildRevision}
+
+# Documentation.
+doc.home=${docReferenceHome}
+doc.wiki=${docReferenceWiki}
+doc.guide.ref=${docQuickRefGuide}
+doc.guide.admin=${adminGuideUrl}
diff --git a/opendj-server/src/test/java/org/forgerock/opendj/server/core/ProductInformationTest.java b/opendj-server/src/test/java/org/forgerock/opendj/server/core/ProductInformationTest.java
new file mode 100644
index 0000000..4db953f
--- /dev/null
+++ b/opendj-server/src/test/java/org/forgerock/opendj/server/core/ProductInformationTest.java
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2014 ForgeRock AS.
+ */
+
+package org.forgerock.opendj.server.core;
+
+import static org.fest.assertions.Assertions.assertThat;
+
+import org.forgerock.testng.ForgeRockTestCase;
+import org.testng.annotations.Test;
+
+@SuppressWarnings("javadoc")
+@Test
+public class ProductInformationTest extends ForgeRockTestCase {
+
+    @Test
+    public void testGetName() {
+        assertThat(ProductInformation.getInstance().productName()).isNotNull();
+    }
+
+    @Test
+    public void testGetShortName() {
+        assertThat(ProductInformation.getInstance().productShortName()).isEqualTo("OpenDJ");
+    }
+}
diff --git a/pom.xml b/pom.xml
index 3ef852d..9cf2686 100644
--- a/pom.xml
+++ b/pom.xml
@@ -323,6 +323,35 @@
             <tagNameFormat>@{project.version}-sdk</tagNameFormat>
           </configuration>
         </plugin>
+        <!--This plugin's configuration is used to store Eclipse m2e settings only.
+            It has no influence on the Maven build itself.-->
+        <plugin>
+          <groupId>org.eclipse.m2e</groupId>
+          <artifactId>lifecycle-mapping</artifactId>
+          <version>1.0.0</version>
+          <configuration>
+            <lifecycleMappingMetadata>
+              <pluginExecutions>
+                <pluginExecution>
+                  <pluginExecutionFilter>
+                    <groupId>org.forgerock.opendj</groupId>
+                    <artifactId>opendj-config-maven-plugin</artifactId>
+                    <versionRange>[3.0.0-SNAPSHOT,)</versionRange>
+                    <goals>
+                      <goal>generate</goal>
+                    </goals>
+                  </pluginExecutionFilter>
+                  <action>
+                    <execute>
+                        <!-- <runOnIncremental>true</runOnIncremental> -->
+                        <runOnConfiguration>true</runOnConfiguration>
+                    </execute>
+                  </action>
+                </pluginExecution>
+              </pluginExecutions>
+            </lifecycleMappingMetadata>
+          </configuration>
+        </plugin>
       </plugins>
     </pluginManagement>
   </build>

--
Gitblit v1.10.0