Strabon

changeset 899:c5b23c70b6c1

added extra argument after query string in QueryOp (both in postgis and monetdb) for forcing deletion of \"locked\" table
author Babis Nikolaou <charnik@di.uoa.gr>
date Wed Mar 20 18:28:58 2013 +0200 (2013-03-20)
parents 3d61f42a4b6f
children 5a82ff362b8d
files runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java runtime/src/main/java/eu/earthobservatory/runtime/monetdb/QueryOp.java runtime/src/main/java/eu/earthobservatory/runtime/postgis/QueryOp.java
line diff
     1.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java	Fri Mar 08 19:41:02 2013 +0200
     1.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java	Wed Mar 20 18:28:58 2013 +0200
     1.3 @@ -59,9 +59,9 @@
     1.4  	public static final String FORMAT_KMZ		= "KMZ";
     1.5  	public static final String FORMAT_GEOJSON	= "GeoJSON";
     1.6  	public static final String FORMAT_EXP		= "EXP";
     1.7 -	public static final String FORMAT_HTML		= "HTML";
     1.8 +	public static final String FORMAT_HTML	= "HTML";
     1.9  	
    1.10 -	public static final String NEWLINE	= "\n";
    1.11 +	public static final String NEWLINE		= "\n";
    1.12  	
    1.13  	/**
    1.14  	 * Connection details (shared with subclasses)
     2.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/monetdb/QueryOp.java	Fri Mar 08 19:41:02 2013 +0200
     2.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/monetdb/QueryOp.java	Wed Mar 20 18:28:58 2013 +0200
     2.3 @@ -24,7 +24,7 @@
     2.4  	 */
     2.5  	public static void main(String[] args) {
     2.6  
     2.7 -		if (args.length < 6) {
     2.8 +		if (args.length < 7) {
     2.9  			System.err.println("Usage: eu.ist.semsorgrid4env.strabon.Strabon <HOST> <PORT> <DATABASE> <USERNAME> <PASSWORD> <QUERY> ");
    2.10  			System.err.println("       where <HOST>       is the postgis database host to connect to");
    2.11  			System.err.println("             <PORT>       is the port to connect to on the database host");		
    2.12 @@ -32,7 +32,8 @@
    2.13  			System.err.println("             <USERNAME>   is the username to use when connecting to the database ");
    2.14  			System.err.println("             <PASSWORD>   is the password to use when connecting to the database");
    2.15  			System.err.println("             <QUERY>      is the stSPARQL query to evaluate.");
    2.16 -			System.err.println("             [<FORMAT>]     is the format of your results (XML)");
    2.17 +			System.err.println("             <DELET_LOCK> is true when deletion of \"locked\" table should be enforced (e.g., when Strabon has been ungracefully shutdown).");
    2.18 +			System.err.println("             [<FORMAT>]   is the format of your results (XML)");
    2.19  			System.exit(0);
    2.20  		}
    2.21  
    2.22 @@ -42,14 +43,15 @@
    2.23  		String user = args[3];
    2.24  		String passwd = args[4];		
    2.25  		String queryString = args[5];
    2.26 +		boolean forceDelete = Boolean.valueOf(args[6]);
    2.27  		String resultsFormat = "";
    2.28 -		if ( args.length == 7 ) {
    2.29 -			resultsFormat = args[6];
    2.30 +		if ( args.length == 8 ) {
    2.31 +			resultsFormat = args[7];
    2.32  		}
    2.33  
    2.34  		Strabon strabon = null;
    2.35  		try {
    2.36 -			strabon = new Strabon(db, user, passwd, port, host, false);
    2.37 +			strabon = new Strabon(db, user, passwd, port, host, forceDelete);
    2.38  			strabon.query(queryString, Format.fromString(resultsFormat), strabon.getSailRepoConnection(), System.out);
    2.39  			
    2.40  		} catch (Exception e) {
     3.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/postgis/QueryOp.java	Fri Mar 08 19:41:02 2013 +0200
     3.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/postgis/QueryOp.java	Wed Mar 20 18:28:58 2013 +0200
     3.3 @@ -24,7 +24,7 @@
     3.4  	 */
     3.5  	public static void main(String[] args) {
     3.6  
     3.7 -		if (args.length < 6) {
     3.8 +		if (args.length < 7) {
     3.9  			System.err.println("Usage: eu.ist.semsorgrid4env.strabon.Strabon <HOST> <PORT> <DATABASE> <USERNAME> <PASSWORD> <QUERY> ");
    3.10  			System.err.println("       where <HOST>       is the postgis database host to connect to");
    3.11  			System.err.println("             <PORT>       is the port to connect to on the database host");		
    3.12 @@ -32,6 +32,7 @@
    3.13  			System.err.println("             <USERNAME>   is the username to use when connecting to the database ");
    3.14  			System.err.println("             <PASSWORD>   is the password to use when connecting to the database");
    3.15  			System.err.println("             <QUERY>      is the stSPARQL query to evaluate.");
    3.16 +			System.err.println("             <DELET_LOCK> is true when deletion of \"locked\" table should be enforced (e.g., when Strabon has been ungracefully shutdown).");
    3.17  			System.err.println("             [<FORMAT>]   is the format of your results (default: XML)");
    3.18  			System.exit(0);
    3.19  		}
    3.20 @@ -42,14 +43,15 @@
    3.21  		String user = args[3];
    3.22  		String passwd = args[4];		
    3.23  		String queryString = args[5];
    3.24 +		boolean forceDelete = Boolean.valueOf(args[6]);
    3.25  		String resultsFormat = "";
    3.26 -		if ( args.length == 7 ) {
    3.27 -			resultsFormat = args[6];
    3.28 +		if ( args.length == 8 ) {
    3.29 +			resultsFormat = args[7];
    3.30  		}
    3.31  
    3.32  		Strabon strabon = null;
    3.33  		try {
    3.34 -			strabon = new Strabon(db, user, passwd, port, host, false);
    3.35 +			strabon = new Strabon(db, user, passwd, port, host, forceDelete);
    3.36  			strabon.query(queryString, Format.fromString(resultsFormat), strabon.getSailRepoConnection(), System.out);
    3.37  			
    3.38  		} catch (Exception e) {