Strabon

changeset 459:8474bc9a1e60

merge
author Kostis Kyzirakos <kkyzir@di.uoa.gr>
date Thu Jul 19 15:38:08 2012 +0300 (2012-07-19)
parents bca9421e4cfc 206040860011
children a85f0f7cb00a
files
line diff
     1.1 --- a/endpoint/WebContent/WEB-INF/web.xml	Thu Jul 19 15:38:00 2012 +0300
     1.2 +++ b/endpoint/WebContent/WEB-INF/web.xml	Thu Jul 19 15:38:08 2012 +0300
     1.3 @@ -43,6 +43,17 @@
     1.4  		<servlet-name>Update</servlet-name>
     1.5  		<url-pattern>/Update</url-pattern>
     1.6  	</servlet-mapping>
     1.7 +
     1.8 +        <servlet>
     1.9 +		<display-name>Describe</display-name>
    1.10 +		<servlet-name>Describe</servlet-name>
    1.11 +		<servlet-class>eu.earthobservatory.org.StrabonEndpoint.DescribeBean</servlet-class>
    1.12 +		<load-on-startup>1</load-on-startup>
    1.13 +	</servlet>
    1.14 +	<servlet-mapping>
    1.15 +		<servlet-name>Describe</servlet-name>
    1.16 +		<url-pattern>/Describe</url-pattern>
    1.17 +	</servlet-mapping>
    1.18  		
    1.19  	<servlet>
    1.20  		<servlet-name>store.jsp</servlet-name>
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/DescribeBean.java	Thu Jul 19 15:38:08 2012 +0300
     2.3 @@ -0,0 +1,99 @@
     2.4 +package eu.earthobservatory.org.StrabonEndpoint;
     2.5 +
     2.6 +import java.io.IOException;
     2.7 +import java.net.MalformedURLException;
     2.8 +import java.util.ArrayList;
     2.9 +
    2.10 +import javax.servlet.ServletConfig;
    2.11 +import javax.servlet.ServletContext;
    2.12 +import javax.servlet.ServletException;
    2.13 +import javax.servlet.http.HttpServlet;
    2.14 +import javax.servlet.http.HttpServletRequest;
    2.15 +import javax.servlet.http.HttpServletResponse;
    2.16 +
    2.17 +import org.openrdf.rio.RDFFormat;
    2.18 +import org.openrdf.rio.RDFParseException;
    2.19 +import org.slf4j.Logger;
    2.20 +import org.slf4j.LoggerFactory;
    2.21 +import org.springframework.web.context.WebApplicationContext;
    2.22 +import org.springframework.web.context.support.WebApplicationContextUtils;
    2.23 +
    2.24 +import java.io.PrintWriter;
    2.25 +
    2.26 +
    2.27 +public class DescribeBean extends HttpServlet{
    2.28 +
    2.29 +	private static Logger logger = LoggerFactory.getLogger(eu.earthobservatory.org.StrabonEndpoint.DescribeBean.class);
    2.30 +
    2.31 +        private static final long serialVersionUID = -7541662133934957148L;
    2.32 +
    2.33 +	/**
    2.34 +	* @param args
    2.35 +	* @throws Exception
    2.36 +	*/
    2.37 +	private StrabonBeanWrapper strabonWrapper;
    2.38 +
    2.39 +        @Override
    2.40 +	public void init(ServletConfig servletConfig) throws ServletException {
    2.41 +		super.init(servletConfig);
    2.42 +		
    2.43 +		// get strabon wrapper
    2.44 +		ServletContext context = getServletContext();
    2.45 +		WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(context);
    2.46 +		
    2.47 +		strabonWrapper = (StrabonBeanWrapper) applicationContext.getBean("strabonBean");
    2.48 +	}
    2.49 +
    2.50 +        @Override
    2.51 +	public void doGet(HttpServletRequest request, HttpServletResponse response)
    2.52 +	throws ServletException, IOException 
    2.53 +	{
    2.54 +		doPost(request, response);
    2.55 +	}
    2.56 +
    2.57 +        @Override
    2.58 +	public void doPost(HttpServletRequest request, HttpServletResponse response)
    2.59 +	throws ServletException, IOException
    2.60 +	{
    2.61 +
    2.62 +        	PrintWriter out = response.getWriter();
    2.63 +                out.println("Build a form or sth?");
    2.64 +        	out.flush();
    2.65 +        /*
    2.66 +        String[] args = NULL;
    2.67 +
    2.68 +	if (args.length < 7) {
    2.69 + 		out.println("Usage: eu.ist.semsorgrid4env.strabon.Strabon <HOST> <PORT> <DATABASE> <USERNAME> <PASSWORD> <QUERY> <OUTPUT>");
    2.70 + 		out.println(" where <HOST> is the postgis database host to connect to");
    2.71 + 		out.println(" <PORT> is the port to connect to on the database host");
    2.72 + 		out.println(" <DATABASE> is the spatially enabled postgis database that Strabon will use as a backend, ");
    2.73 + 		out.println(" <USERNAME> is the username to use when connecting to the database ");
    2.74 + 		out.println(" <PASSWORD> is the password to use when connecting to the database");
    2.75 + 		out.println(" <QUERY> is the stSPARQL query to evaluate.");
    2.76 + 		out.println(" <OUTPUT> is the output file.");
    2.77 + 		System.exit(0);
    2.78 +		}
    2.79 +        else{
    2.80 +
    2.81 +	String host = args[0];
    2.82 +	Integer port = new Integer(args[1]);
    2.83 +	String db = args[2];
    2.84 +	String user = args[3];
    2.85 +	String passwd = args[4];
    2.86 +	String queryString = args[5];
    2.87 +	String outFile = args[6];
    2.88 +        }
    2.89 +
    2.90 +	Strabon strabon = null;
    2.91 +	try {
    2.92 +  		strabon = new Strabon(db, user, passwd, port, host, true);
    2.93 +  		strabon.describe(queryString, strabon.getSailRepoConnection(), outFile);
    2.94 +	} catch (Exception e) {
    2.95 +		logger.error("[Strabon.DescribeOp] Error during execution of DESCRIBE query.", e);
    2.96 +	} finally {
    2.97 +		if (strabon != null) {
    2.98 +			strabon.close();
    2.99 +		}
   2.100 +	}*/
   2.101 +	}
   2.102 +} 
     3.1 --- a/scripts/v2.2/runNoaRefinementChain.sh	Thu Jul 19 15:38:00 2012 +0300
     3.2 +++ b/scripts/v2.2/runNoaRefinementChain.sh	Thu Jul 19 15:38:08 2012 +0300
     3.3 @@ -98,14 +98,14 @@
     3.4  POSTGRES_MAIN_VERSION=$(sudo service ${postgres} status | grep -o '.\..' | cut -b 1)
     3.5  
     3.6  echo "Dropping endpoint database";
     3.7 -dropdb -U postgres ${DB}
     3.8 +dropdb  ${DB}
     3.9  
    3.10  echo "Creating endpoint database"
    3.11 -createdb -U postgres ${DB} 
    3.12 +createdb  ${DB} 
    3.13  
    3.14  # load data
    3.15 -curl -s  http://dev.strabon.di.uoa.gr/rdf/Kallikratis-Coastline-Corine-dump-postgres-${POSTGRES_MAIN_VERSION}.tgz | tar xz -O | psql -U postgres -d ${DB}
    3.16 -psql ${DB} -U postgres -c 'VACUUM ANALYZE '
    3.17 +curl -s  http://dev.strabon.di.uoa.gr/rdf/Kallikratis-Coastline-Corine-dump-postgres-${POSTGRES_MAIN_VERSION}.tgz | tar xz -O | psql  -d ${DB}
    3.18 +psql ${DB}  -c 'VACUUM ANALYZE ' 
    3.19  
    3.20  echo "starting tomcat"
    3.21  if test -z "${tomcat}"; then
    3.22 @@ -159,7 +159,7 @@
    3.23  
    3.24  		tmr1=$(timer)
    3.25  
    3.26 -		query=`echo "${insertMunicipalities}" | sed "s/TIMESTAMP/20${year}-${month}-${day}T${time2}:00/g" | \
    3.27 +		query=`echo "${insertMunicipalities}" | sed "s/TIMESTAMP/${year}-${month}-${day}T${time2}:00/g" | \
    3.28  		sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \
    3.29  		sed "s/SENSOR/MSG2/g"`
    3.30  
    3.31 @@ -170,8 +170,8 @@
    3.32  		echo;echo;echo;echo "File ${file} inserted Municipalities!"
    3.33  		
    3.34  		# deleteSeaHotspots
    3.35 -		echo -n "Going to deleteSeaHotspots 20${year}-${month}-${day}T${time2}:00 " ;echo; echo; echo;
    3.36 -		query=`echo "${deleteSeaHotspots}" | sed "s/TIMESTAMP/20${year}-${month}-${day}T${time2}:00/g" | \
    3.37 +		echo -n "Going to deleteSeaHotspots ${year}-${month}-${day}T${time2}:00 " ;echo; echo; echo;
    3.38 +		query=`echo "${deleteSeaHotspots}" | sed "s/TIMESTAMP/${year}-${month}-${day}T${time2}:00/g" | \
    3.39  		sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \
    3.40  		sed "s/SENSOR/MSG2/g"`
    3.41  		# ${countTime} ./strabon -db endpoint update "${query}"
    3.42 @@ -186,8 +186,8 @@
    3.43  		# echo "Continue?"
    3.44  		# read a
    3.45  			# invalidForFires
    3.46 -		echo -n "invalidForFires 20${year}-${month}-${day}T${time2}:00 "  ; echo; echo ; echo;
    3.47 -		query=`echo "${invalidForFires}" | sed "s/TIMESTAMP/20${year}-${month}-${day}T${time2}:00/g" | \
    3.48 +		echo -n "invalidForFires ${year}-${month}-${day}T${time2}:00 "  ; echo; echo ; echo;
    3.49 +		query=`echo "${invalidForFires}" | sed "s/TIMESTAMP/${year}-${month}-${day}T${time2}:00/g" | \
    3.50  		sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \
    3.51  		sed "s/SENSOR/MSG2/g" |\
    3.52  		sed "s/SAT/METEOSAT9/g"`
    3.53 @@ -199,8 +199,8 @@
    3.54  		echo "File ${file} invalidForFires done!"
    3.55   
    3.56  		# refinePartialSeaHotspots
    3.57 -		echo -n "refinePartialSeaHotspots 20${year}-${month}-${day}T${time2}:00 "  ; echo; echo ; echo;
    3.58 -		query=`echo "${refinePartialSeaHotspots}" | sed "s/TIMESTAMP/20${year}-${month}-${day}T${time2}:00/g" | \
    3.59 +		echo -n "refinePartialSeaHotspots ${year}-${month}-${day}T${time2}:00 "  ; echo; echo ; echo;
    3.60 +		query=`echo "${refinePartialSeaHotspots}" | sed "s/TIMESTAMP/${year}-${month}-${day}T${time2}:00/g" | \
    3.61  		sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \
    3.62  		sed "s/SENSOR/MSG2/g" |\
    3.63  		sed "s/SAT/METEOSAT9/g"`
    3.64 @@ -215,9 +215,9 @@
    3.65  		# read a
    3.66  
    3.67  		# refineTimePersistence
    3.68 -		echo -n "Going to refineTimePersistence 20${year}-${month}-${day}T${time2}:00 ";echo;echo;echo; 
    3.69 -		min_acquisition_time=`date --date="20${year}-${month}-${day} ${time2}:00 EEST -30 minutes" +%Y-%m-%dT%H:%m:00`
    3.70 -		query=`echo "${refineTimePersistence}" | sed "s/TIMESTAMP/20${year}-${month}-${day}T${time2}:00/g" | \
    3.71 +		echo -n "Going to refineTimePersistence ${year}-${month}-${day}T${time2}:00 ";echo;echo;echo; 
    3.72 +		min_acquisition_time=`date --date="${year}-${month}-${day} ${time2}:00 EEST -30 minutes" +%Y-%m-%dT%H:%m:00`
    3.73 +		query=`echo "${refineTimePersistence}" | sed "s/TIMESTAMP/${year}-${month}-${day}T${time2}:00/g" | \
    3.74  		sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \
    3.75  		sed "s/SENSOR/MSG2/g" | \
    3.76  		sed "s/ACQUISITIONS_IN_HALF_AN_HOUR/3.0/g" | \
    3.77 @@ -236,9 +236,9 @@
    3.78  
    3.79  
    3.80  		# discover
    3.81 -		echo -n "Going to discover 20${year}-${month}-${day}T${time2}:00 ";echo;echo;echo; 
    3.82 -		min_acquisition_time=`date --date="20${year}-${month}-${day} 00:00 EEST" +%Y-%m-%dT%H:%m:00`
    3.83 -		max_acquisition_time=`date --date="20${year}-${month}-${day} 23:59 EEST" +%Y-%m-%dT%H:%m:00`
    3.84 +		echo -n "Going to discover ${year}-${month}-${day}T${time2}:00 ";echo;echo;echo; 
    3.85 +		min_acquisition_time=`date --date="${year}-${month}-${day} 00:00 EEST" +%Y-%m-%dT%H:%m:00`
    3.86 +		max_acquisition_time=`date --date="${year}-${month}-${day} 23:59 EEST" +%Y-%m-%dT%H:%m:00`
    3.87  		query=`echo "${discover}" | \
    3.88  			sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \
    3.89  			sed "s/SENSOR/MSG2/g" | \