Strabon

changeset 963:bfb42acb9ba3

made EndpointCapabilities read the version file to get the version of Strabon
author Babis Nikolaou <charnik@di.uoa.gr>
date Tue Apr 02 12:37:12 2013 +0300 (2013-04-02)
parents 1f7216ab63ee
children 4ec1afc91a19
files endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/CapabilitiesBean.java endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/EndpointCapabilities.java
line diff
     1.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/CapabilitiesBean.java	Tue Apr 02 12:09:10 2013 +0300
     1.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/CapabilitiesBean.java	Tue Apr 02 12:37:12 2013 +0300
     1.3 @@ -146,6 +146,8 @@
     1.4  			}
     1.5  		}
     1.6  		
     1.7 +		out.println();
     1.8 +		
     1.9  		// print supported spatial extension functions for GeoSPARQL
    1.10  		if (caps.getGeoSPARQLSpatialExtensionFunctions() != null) {
    1.11  			out.println("GeoSPARQL Extension Functions");
     2.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/EndpointCapabilities.java	Tue Apr 02 12:09:10 2013 +0300
     2.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/EndpointCapabilities.java	Tue Apr 02 12:37:12 2013 +0300
     2.3 @@ -9,9 +9,14 @@
     2.4   */
     2.5  package eu.earthobservatory.org.StrabonEndpoint.capabilities;
     2.6  
     2.7 +import java.io.IOException;
     2.8 +import java.io.InputStream;
     2.9  import java.util.List;
    2.10 +import java.util.Properties;
    2.11  
    2.12  import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants;
    2.13 +import org.slf4j.Logger;
    2.14 +import org.slf4j.LoggerFactory;
    2.15  
    2.16  
    2.17  /**
    2.18 @@ -23,9 +28,34 @@
    2.19   */
    2.20  public class EndpointCapabilities implements Capabilities {
    2.21  
    2.22 +	private static Logger logger = LoggerFactory.getLogger(eu.earthobservatory.org.StrabonEndpoint.capabilities.EndpointCapabilities.class);
    2.23 +	
    2.24 +	private static final String VERSION_PROPERTIES_FILE = "/version.properties";
    2.25 +	private static final Properties PROPERTIES = new Properties();
    2.26 +
    2.27 +	private static String VERSION;
    2.28 +	
    2.29 +	// load the properties file to get the version
    2.30 +	static {
    2.31 +		InputStream vin = Capabilities.class.getResourceAsStream(VERSION_PROPERTIES_FILE);
    2.32 +		if (vin != null) {
    2.33 +			try {
    2.34 +				PROPERTIES.load(vin);
    2.35 +				vin.close();
    2.36 +				
    2.37 +			} catch (IOException e) {
    2.38 +				logger.error("[StrabonEndpoint.EndpointCapabilities] Error during reading of {} file.", VERSION_PROPERTIES_FILE, e);
    2.39 +			}
    2.40 +		} else {
    2.41 +			logger.warn("[StrabonEndpoint.EndpointCapabilities] Could not read version file.");
    2.42 +		}
    2.43 +		
    2.44 +		VERSION = PROPERTIES.getProperty("version");
    2.45 +	}
    2.46 +	
    2.47  	@Override
    2.48  	public String getVersion() {
    2.49 -		return "3.2.9-SNAPSHOT";
    2.50 +		return VERSION;
    2.51  	}
    2.52  	
    2.53  	@Override