001/*
002 * Logback: the reliable, generic, fast and flexible logging framework.
003 * Copyright (C) 1999-2026, QOS.ch. All rights reserved.
004 *
005 * This program and the accompanying materials are dual-licensed under
006 * either the terms of the Eclipse Public License v2.0 as published by
007 * the Eclipse Foundation
008 *
009 *   or (per the licensee's choosing)
010 *
011 * under the terms of the GNU Lesser General Public License version 2.1
012 * as published by the Free Software Foundation.
013 */
014
015package ch.qos.logback.access.jetty;
016
017import java.io.IOException;
018import java.io.InputStream;
019import java.util.Properties;
020
021import static ch.qos.logback.access.jetty.Jetty12Constants.LOGBACK_ACCESS_JETTY12_MODULE_NAME;
022
023public class Jetty12VersionUtil {
024
025    static String LOGBACK_ACCESS_JETTY12_MODULE_VERSION_PROPERTIES_FILE = LOGBACK_ACCESS_JETTY12_MODULE_NAME + "-version.properties";
026    static String LOGBACK_ACCESS_JETTY12_MODULE_VERSION_PROPERTY_KEY = LOGBACK_ACCESS_JETTY12_MODULE_NAME + "-version";
027
028    static public String getAccessJetty12VersionBySelfDeclaredProperties() {
029        Properties props = new Properties();
030
031        try (InputStream is = Jetty12Constants.class.getResourceAsStream(LOGBACK_ACCESS_JETTY12_MODULE_VERSION_PROPERTIES_FILE)) {
032            if (is != null) {
033                props.load(is);
034                return props.getProperty(LOGBACK_ACCESS_JETTY12_MODULE_VERSION_PROPERTY_KEY);
035            } else {
036                return null;
037            }
038        } catch (IOException e) {
039            return null;
040        }
041    }
042
043}