All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.openraven.magpie.plugins.gcp.discovery.VersionProvider Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2021 Open Raven Inc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.openraven.magpie.plugins.gcp.discovery;

import io.openraven.magpie.plugins.gcp.discovery.exception.GcpDiscoveryException;

import java.io.IOException;
import java.util.Properties;

public class VersionProvider {
  private static final String RESOURCE = "version.properties";
  private final String projectVersion;

  public VersionProvider() {

    Properties properties = new Properties();
    try {
      properties.load(getClass().getClassLoader().getResourceAsStream(RESOURCE));
    } catch (IOException ex) {
      throw new GcpDiscoveryException(String.format("Unable to load: %s from resources", RESOURCE), ex);
    }

    projectVersion = properties.getProperty("project.version");
  }

  public String getProjectVersion() {
    return projectVersion;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy