001/*
002 * (c) Copyright 2009 University of Bristol
003 * All rights reserved.
004 * [See end of file]
005 */
006package net.rootdev.javardfa;
007
008import java.io.IOException;
009import java.util.Properties;
010import org.slf4j.Logger;
011import org.slf4j.LoggerFactory;
012
013/**
014 *
015 * @author pldms
016 */
017public class Version {
018    private final static Logger log = LoggerFactory.getLogger(Version.class);
019    private final static Version i = new Version();
020
021    private final String name;
022    private final String version;
023
024    public static Version get() { return i; }
025
026    public Version() {
027        Properties props = new Properties();
028        String _name, _version;
029        try {
030            props.load(Version.class.getResourceAsStream("/library.properties"));
031            _name = props.getProperty("library.name");
032            _version = props.getProperty("library.version");
033        } catch (IOException ex) {
034            log.error("Error loading version info from library.properties", ex);
035            _name = "Unknown";
036            _version = "Unknown";
037        }
038        this.name = _name;
039        this.version = _version;
040    }
041
042    public String getName() { return this.name; }
043    public String getVersion() { return this.version; }
044    public String toString() { return getName() + " " + getVersion(); }
045}
046
047/*
048 * (c) Copyright 2009 University of Bristol
049 * All rights reserved.
050 *
051 * Redistribution and use in source and binary forms, with or without
052 * modification, are permitted provided that the following conditions
053 * are met:
054 * 1. Redistributions of source code must retain the above copyright
055 *    notice, this list of conditions and the following disclaimer.
056 * 2. Redistributions in binary form must reproduce the above copyright
057 *    notice, this list of conditions and the following disclaimer in the
058 *    documentation and/or other materials provided with the distribution.
059 * 3. The name of the author may not be used to endorse or promote products
060 *    derived from this software without specific prior written permission.
061 *
062 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
063 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
064 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
065 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
066 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
067 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
068 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
069 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
070 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
071 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
072 */