Strabon

changeset 1313:3f3fc8237460

Added a new boolean variable named loadFromFile that allows to store from file (changed line 351).
author George Stamoulis <gstam@di.uoa.gr>
date Wed Feb 26 16:31:08 2014 +0200 (2014-02-26)
parents 2e139f2f93a7
children 3e3fe6213ac1
files endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StrabonBeanWrapper.java
line diff
     1.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StrabonBeanWrapper.java	Wed Feb 26 16:29:24 2014 +0200
     1.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StrabonBeanWrapper.java	Wed Feb 26 16:31:08 2014 +0200
     1.3 @@ -49,6 +49,7 @@
     1.4  	private String password;
     1.5  	private String dbBackend;
     1.6  	private int maxLimit;
     1.7 +	private boolean loadFromFile;
     1.8  	private String prefixes;
     1.9  	
    1.10  	private Strabon strabon = null;
    1.11 @@ -60,7 +61,7 @@
    1.12  
    1.13  	public StrabonBeanWrapper(String databaseName, String user, String password, 
    1.14  			int port, String serverName, boolean checkForLockTable, String dbBackend, 
    1.15 -			int maxLimit, String prefixes, 	List<List<String>> args) {
    1.16 +			int maxLimit, boolean loadFromFile,String prefixes, 	List<List<String>> args) {
    1.17  		this.serverName = serverName;
    1.18  		this.port = port;
    1.19  		this.databaseName = databaseName;
    1.20 @@ -68,7 +69,8 @@
    1.21  		this.password = password;
    1.22  		this.checkForLockTable = checkForLockTable;
    1.23  		this.dbBackend = dbBackend;
    1.24 -		this.maxLimit = maxLimit;		
    1.25 +		this.maxLimit = maxLimit;	
    1.26 +		this.loadFromFile = loadFromFile;
    1.27  		this.prefixes = prefixes;
    1.28  		this.entries = new ArrayList<StrabonBeanWrapperConfiguration>(args.size());
    1.29  		
    1.30 @@ -346,10 +348,11 @@
    1.31  
    1.32  		if (url) {
    1.33  			URL source = new URL(src);
    1.34 -			if (source.getProtocol().equalsIgnoreCase(FILE_PROTOCOL)) {
    1.35 +			if (source.getProtocol().equalsIgnoreCase(FILE_PROTOCOL) && !loadFromFile) {
    1.36  				// it would be a security issue if we read from the server's filesystem
    1.37  				throw new IllegalArgumentException("The protocol of the URL should be one of http or ftp.");
    1.38  			}
    1.39 +			
    1.40  		}
    1.41  
    1.42  		strabon.storeInRepo(src, null, context, format, inference);