// Path: src/main/java/com/tomtom/services/configuration/ConfigurationServiceProperties.java
// @SuppressWarnings("squid:S2637")
// public class ConfigurationServiceProperties implements HasProperties {
// 
//     @Nonnull
//     private final String startupConfigurationURI;
// 
//     @Inject
//     public ConfigurationServiceProperties(
//             @Named("ConfigurationService.startupConfigurationURI") @Nonnull final String startupConfigurationURI) {
//         this.startupConfigurationURI = startupConfigurationURI.trim();
//     }
// 
//     @Nonnull
//     public String getStartupConfigurationURI() {
//         return startupConfigurationURI;
//     }
// }
// 
// Path: src/main/java/com/tomtom/services/configuration/HelperResource.java
// @Path("/")
// public interface HelperResource {
// 
//     /**
//      * This method provides help info.
//      *
//      * @return Returns help text as HTML.
//      */
//     @GET
//     @Produces(MediaType.TEXT_HTML)
//     @Nonnull
//     String getHelpHTML();
// 
//     /**
//      * Additional method: this method returns the current version of the application.
//      * <p>
//      * Return HTTP status 200.
//      *
//      * @param response Version, {@link com.tomtom.services.configuration.dto.VersionDTO}.
//      */
//     @GET
//     @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
//     @Path("version")
//     void getVersion(@Suspended @Nonnull AsyncResponse response);
// 
//     /**
//      * This method returns whether the service is operational or not (status code 200 is OK).
//      *
//      * @param response Returns a version number as JSON.
//      */
//     @GET
//     @Path("status")
//     @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
//     void getStatus(@Suspended @Nonnull AsyncResponse response);
// }
// 
// Path: src/main/java/com/tomtom/services/configuration/dto/VersionDTO.java
// @SuppressWarnings({"EqualsWhichDoesntCheckParameterClass", "squid:S2160"})
// @JsonInclude(Include.NON_EMPTY)
// @XmlRootElement(name = "version")
// @XmlAccessorType(XmlAccessType.FIELD)
// public final class VersionDTO extends ApiDTO {
//     public static final int API_VERSION_MAX_LENGTH = 25;
//     public static final int API_VERSION_MIN_LENGTH = 0;
// 
//     /**
//      * Version string of service. No assumptions can be made on its format.
//      */
//     @JsonProperty("version")
//     @XmlElement(name = "version")
//     @Nullable
//     private String version;
// 
//     /**
//      * The URI of the startup configuration, which was read during startup of the service.
//      * If not start configuration was specified, this element is empty.
//      */
//     @XmlElement(name = "startupConfigurationURI")
//     @Nullable
//     private String startupConfigurationURI;
// 
//     public VersionDTO(
//             @Nonnull final String version,
//             @Nullable final String startupConfigurationURI) {
//         super();
//         setVersion(version);
//         setStartupConfigurationURI(startupConfigurationURI);
//     }
// 
//     @SuppressWarnings({"UnusedDeclaration", "squid:MissingDeprecatedCheck", "squid:S1133"})
//     @Deprecated
//     VersionDTO() {
//         // Default constructor required by JAX-B.
//         super();
//     }
// 
//     /**
//      * For an explanation of validate(), see {@link NodeDTO}.
//      */
//     @Override
//     public void validate() {
//         validator().start();
//         validator().checkString(true, "version", version,
//                 API_VERSION_MIN_LENGTH, API_VERSION_MAX_LENGTH);
//         validator().checkString(false, "startupConfigurationURI", startupConfigurationURI,
//                 0, Integer.MAX_VALUE);
//         validator().done();
//     }
// 
//     @Nonnull
//     public String getVersion() {
//         beforeGet();
//         //noinspection ConstantConditions
//         return version;                             // Cannot be null after validation.
//     }
// 
//     public void setVersion(@Nonnull final String version) {
//         beforeSet();
//         this.version = StringUtils.trim(version);
//     }
// 
//     @Nullable
//     public String getStartupConfigurationURI() {
//         beforeGet();
//         return startupConfigurationURI;
//     }
// 
//     public void setStartupConfigurationURI(@Nullable final String startupConfigurationURI) {
//         beforeSet();
//         this.startupConfigurationURI = StringUtils.emptyToNull(StringUtils.trim(startupConfigurationURI));
//     }
// }


import com.google.common.base.Joiner;
import com.tomtom.services.configuration.ConfigurationServiceProperties;
import com.tomtom.services.configuration.HelperResource;
import com.tomtom.services.configuration.dto.VersionDTO;
import com.tomtom.speedtools.maven.MavenProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
import javax.inject.Inject;
import javax.ws.rs.container.AsyncResponse;
import javax.ws.rs.container.Suspended;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
            @Nonnull final ConfigurationServiceProperties configurationServiceProperties,
            @Nonnull final MavenProperties mavenProperties) {

        // Store the injected values.
        this.configuration = configuration;
        this.configurationServiceProperties = configurationServiceProperties;
        this.mavenProperties = mavenProperties;
    }

    @Override
    @Nonnull
    public String getHelpHTML() {
        LOG.info("getHelpHTML: show help page", mavenProperties.getPomVersion());
        return "<html><pre>\n" +
                "CONFIGURATION SERVICE (" + mavenProperties.getPomVersion() + ")\n" +
                "---------------------\n\n" +
                HELP_TEXT + '\n' +
                (configuration.getRoot().getLevels() == null ? "" :
                        "CURRENT CONFIGURATION\n\n" +
                                "The current configuration used by the service is:\n" +
                                "  URI=" + configuration.getStartupConfigurationURI() + '\n' +
                                "  levels=" + Joiner.on("/").join(configuration.getRoot().getLevels())) +
                "\n</pre></html>\n";
    }

    @Override
    public void getVersion(@Suspended @Nonnull final AsyncResponse response) {

        // No input validation required. Just return version number.
        final String pomVersion = mavenProperties.getPomVersion();
// Path: src/main/java/com/tomtom/services/configuration/ConfigurationServiceProperties.java
// @SuppressWarnings("squid:S2637")
// public class ConfigurationServiceProperties implements HasProperties {
// 
//     @Nonnull
//     private final String startupConfigurationURI;
// 
//     @Inject
//     public ConfigurationServiceProperties(
//             @Named("ConfigurationService.startupConfigurationURI") @Nonnull final String startupConfigurationURI) {
//         this.startupConfigurationURI = startupConfigurationURI.trim();
//     }
// 
//     @Nonnull
//     public String getStartupConfigurationURI() {
//         return startupConfigurationURI;
//     }
// }
// 
// Path: src/main/java/com/tomtom/services/configuration/HelperResource.java
// @Path("/")
// public interface HelperResource {
// 
//     /**
//      * This method provides help info.
//      *
//      * @return Returns help text as HTML.
//      */
//     @GET
//     @Produces(MediaType.TEXT_HTML)
//     @Nonnull
//     String getHelpHTML();
// 
//     /**
//      * Additional method: this method returns the current version of the application.
//      * <p>
//      * Return HTTP status 200.
//      *
//      * @param response Version, {@link com.tomtom.services.configuration.dto.VersionDTO}.
//      */
//     @GET
//     @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
//     @Path("version")
//     void getVersion(@Suspended @Nonnull AsyncResponse response);
// 
//     /**
//      * This method returns whether the service is operational or not (status code 200 is OK).
//      *
//      * @param response Returns a version number as JSON.
//      */
//     @GET
//     @Path("status")
//     @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
//     void getStatus(@Suspended @Nonnull AsyncResponse response);
// }
// 
// Path: src/main/java/com/tomtom/services/configuration/dto/VersionDTO.java
// @SuppressWarnings({"EqualsWhichDoesntCheckParameterClass", "squid:S2160"})
// @JsonInclude(Include.NON_EMPTY)
// @XmlRootElement(name = "version")
// @XmlAccessorType(XmlAccessType.FIELD)
// public final class VersionDTO extends ApiDTO {
//     public static final int API_VERSION_MAX_LENGTH = 25;
//     public static final int API_VERSION_MIN_LENGTH = 0;
// 
//     /**
//      * Version string of service. No assumptions can be made on its format.
//      */
//     @JsonProperty("version")
//     @XmlElement(name = "version")
//     @Nullable
//     private String version;
// 
//     /**
//      * The URI of the startup configuration, which was read during startup of the service.
//      * If not start configuration was specified, this element is empty.
//      */
//     @XmlElement(name = "startupConfigurationURI")
//     @Nullable
//     private String startupConfigurationURI;
// 
//     public VersionDTO(
//             @Nonnull final String version,
//             @Nullable final String startupConfigurationURI) {
//         super();
//         setVersion(version);
//         setStartupConfigurationURI(startupConfigurationURI);
//     }
// 
//     @SuppressWarnings({"UnusedDeclaration", "squid:MissingDeprecatedCheck", "squid:S1133"})
//     @Deprecated
//     VersionDTO() {
//         // Default constructor required by JAX-B.
//         super();
//     }
// 
//     /**
//      * For an explanation of validate(), see {@link NodeDTO}.
//      */
//     @Override
//     public void validate() {
//         validator().start();
//         validator().checkString(true, "version", version,
//                 API_VERSION_MIN_LENGTH, API_VERSION_MAX_LENGTH);
//         validator().checkString(false, "startupConfigurationURI", startupConfigurationURI,
//                 0, Integer.MAX_VALUE);
//         validator().done();
//     }
// 
//     @Nonnull
//     public String getVersion() {
//         beforeGet();
//         //noinspection ConstantConditions
//         return version;                             // Cannot be null after validation.
//     }
// 
//     public void setVersion(@Nonnull final String version) {
//         beforeSet();
//         this.version = StringUtils.trim(version);
//     }
// 
//     @Nullable
//     public String getStartupConfigurationURI() {
//         beforeGet();
//         return startupConfigurationURI;
//     }
// 
//     public void setStartupConfigurationURI(@Nullable final String startupConfigurationURI) {
//         beforeSet();
//         this.startupConfigurationURI = StringUtils.emptyToNull(StringUtils.trim(startupConfigurationURI));
//     }
// }


// Path: src/main/java/com/tomtom/services/configuration/implementation/HelperResourceImpl.java
import com.google.common.base.Joiner;
import com.tomtom.services.configuration.ConfigurationServiceProperties;
import com.tomtom.services.configuration.HelperResource;
import com.tomtom.services.configuration.dto.VersionDTO;
import com.tomtom.speedtools.maven.MavenProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
import javax.inject.Inject;
import javax.ws.rs.container.AsyncResponse;
import javax.ws.rs.container.Suspended;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;

            @Nonnull final ConfigurationServiceProperties configurationServiceProperties,
            @Nonnull final MavenProperties mavenProperties) {

        // Store the injected values.
        this.configuration = configuration;
        this.configurationServiceProperties = configurationServiceProperties;
        this.mavenProperties = mavenProperties;
    }

    @Override
    @Nonnull
    public String getHelpHTML() {
        LOG.info("getHelpHTML: show help page", mavenProperties.getPomVersion());
        return "<html><pre>\n" +
                "CONFIGURATION SERVICE (" + mavenProperties.getPomVersion() + ")\n" +
                "---------------------\n\n" +
                HELP_TEXT + '\n' +
                (configuration.getRoot().getLevels() == null ? "" :
                        "CURRENT CONFIGURATION\n\n" +
                                "The current configuration used by the service is:\n" +
                                "  URI=" + configuration.getStartupConfigurationURI() + '\n' +
                                "  levels=" + Joiner.on("/").join(configuration.getRoot().getLevels())) +
                "\n</pre></html>\n";
    }

    @Override
    public void getVersion(@Suspended @Nonnull final AsyncResponse response) {

        // No input validation required. Just return version number.
        final String pomVersion = mavenProperties.getPomVersion();
        final String startupConfigurationURI = configurationServiceProperties.getStartupConfigurationURI();