Remove DynamicConstants from opendj-config and replace it with resource based ProductInformation in opendj-server module.
1 files deleted
3 files added
6 files modified
| | |
| | | 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> |
| | |
| | | <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> |
| | |
| | | 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; |
| | | |
| | |
| | | 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); |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | 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 { |
| | |
| | | |
| | | 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; |
| | |
| | | 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; |
| | | |
| | |
| | | */ |
| | | 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); |
| | | } |
| | | |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | <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> |
| | |
| | | </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> |
| New file |
| | |
| | | /* |
| | | * 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"); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | # 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} |
| New file |
| | |
| | | /* |
| | | * 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"); |
| | | } |
| | | } |
| | |
| | | <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> |