carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zzcclp <...@git.apache.org>
Subject [GitHub] carbondata pull request #1738: [CARBONDATA-1932]Add version info for CarbonD...
Date Fri, 29 Dec 2017 16:34:47 GMT
Github user zzcclp commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1738#discussion_r159080288
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/constants/CarbonVersionConstants.java
---
    @@ -0,0 +1,84 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You 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 org.apache.carbondata.core.constants;
    +
    +import java.io.IOException;
    +import java.io.InputStream;
    +import java.util.Properties;
    +
    +import org.apache.carbondata.common.logging.LogService;
    +import org.apache.carbondata.common.logging.LogServiceFactory;
    +
    +public final class CarbonVersionConstants {
    +
    +  private static final LogService LOGGER =
    +      LogServiceFactory.getLogService(CarbonVersionConstants.class.getName());
    +  /**
    +   * the file name of CarbonData version info
    +   */
    +  private static final String CARBONDATA_VERSION_INFO_FILE =
    +      "carbondata-version-info.properties";
    +  /**
    +   * current CarbonData version
    +   */
    +  public static final String CARBONDATA_VERSION;
    +  /**
    +   * which branch current version build from
    +   */
    +  public static final String CARBONDATA_BRANCH;
    +  /**
    +   * the latest commit revision which current branch point to
    +   */
    +  public static final String CARBONDATA_REVISION;
    +  /**
    +   * the date of building current version
    +   */
    +  public static final String CARBONDATA_BUILD_DATE;
    +
    +  static {
    +    // create input stream for CARBONDATA_VERSION_INFO_FILE
    +    InputStream resourceStream = Thread.currentThread().getContextClassLoader()
    +        .getResourceAsStream(CARBONDATA_VERSION_INFO_FILE);
    +    Properties props = new Properties();
    +    try {
    +      // read CARBONDATA_VERSION_INFO_FILE into props
    +      props.load(resourceStream);
    +    }
    +    catch (IOException ioe) {
    +      LOGGER.error(ioe, "Error while reading file " + CARBONDATA_VERSION_INFO_FILE);
    +    }
    +    catch (Exception e) {
    +      LOGGER.error(e, "Error loading properties from " + CARBONDATA_VERSION_INFO_FILE);
    +    }
    +    finally {
    --- End diff --
    
    done


---

Mime
View raw message