package org.apache.hadoop.fs.glusterfs;

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

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Version extends Properties{
    final static Logger lg = LoggerFactory.getLogger(Version.class);
    public Version() {
        super();
        try{
            load(this.getClass().getClassLoader().getResourceAsStream("git.properties"));
        }
        catch(Throwable t){
            lg.error("Couldn't find git properties for version info " + t.getMessage());
        }
    }
    public String getTag(){
        return this.getProperty("git.commit.id.describe").split("-")[0];
    }
}

@@ -62,16 +62,17 @@
 eption;%0A
+%0A
 import j
@@ -97,175 +97,259 @@
 s;%0A%0A
-import org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0Apublic class Version extends Properties%7B%0A    final static Logger lg = LoggerFactory.getLogger(Version.class);
+/**%0A * Versioning stuff for the shim.  This class is not tested since there is no %0A * deterministic behaviour (i.e. it might not work if not building from binary), %0A * and the effects are pure side effects.%0A */%0Apublic class Version extends Properties%7B
 %0A   
@@ -542,16 +542,34 @@
     
-lg.error
+throw new RuntimeException
 (%22Co
@@ -756,10 +756,948 @@
 ;%0A    %7D%0A
+    %0A    /**%0A     * For use with terminal version checking. %0A       %0A       Example, run with an argument to get single property:%0A             java -cp /home/Development/hadoop-glusterfs/glusterfs-2.0-SNAPSHOT.jar %5C%0A                 org.apache.hadoop.fs.glusterfs.Version git.commit.id.describe %7C cut -d'-' -f 1     %0A%0A       Or just run (no args, prints all properties)%0A             java -cp /home/Development/hadoop-glusterfs/glusterfs-2.0-SNAPSHOT.jar %5C%0A    */%0A    public static void main(String%5B%5D args)%7B%0A        Version v = new Version();%0A        //Dump the whole version info if no arg%0A        if(args.length==0)%7B%0A            System.out.println(v);%0A        %7D%0A        //if specific arg given, print just that.%0A        else%7B%0A            String prop = v.get(args%5B0%5D)+%22%22;%0A            System.out.println(%0A                    prop!=null?%0A                        prop%0A                        :%22Couldnt find property %22+prop);%0A        %7D%0A    %7D%0A
 %7D%0A

version properties , args, see main() comments for example usage.