Strabon

changeset 68:ca4ebeead182

Add StrabonEndpoint as a module of Strabon.
author Kostis Kyzirakos <kkyzir@di.uoa.gr>
date Tue Mar 20 10:54:48 2012 +0100 (2012-03-20)
parents 5e58b11d2c68
children f16c92bf67b1 d37e0e4704dd
files pom.xml webapp/WebContent/WEB-INF/beans.xml webapp/WebContent/WEB-INF/web.xml webapp/WebContent/images/base_bg1.gif webapp/WebContent/images/base_bg2.gif webapp/WebContent/images/nav1_bg1.gif webapp/WebContent/images/nav2_bg.gif webapp/WebContent/images/pixi_white.gif webapp/WebContent/images/spacer.gif webapp/WebContent/images/teleios_logo.png webapp/WebContent/images/top_bg_blue.gif webapp/WebContent/images/top_twogreys.gif webapp/WebContent/store.jsp webapp/WebContent/style.css webapp/pom.xml webapp/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java webapp/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StoreBean.java webapp/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StrabonBeanWrapper.java webapp/src/main/webapp/WEB-INF/web.xml webapp/src/main/webapp/index.jsp
line diff
     1.1 --- a/pom.xml	Mon Mar 19 21:57:30 2012 +0100
     1.2 +++ b/pom.xml	Tue Mar 20 10:54:48 2012 +0100
     1.3 @@ -25,6 +25,7 @@
     1.4  		<module>monetdb</module>
     1.5  		<module>generaldb</module>
     1.6  		<module>resultio</module>
     1.7 +		<module>webapp</module>
     1.8  	</modules>
     1.9  
    1.10  	<properties>
    1.11 @@ -40,7 +41,7 @@
    1.12  
    1.13  	<dependencyManagement>
    1.14  		<dependencies>
    1.15 -
    1.16 +			<!-- Sesame dependencies -->
    1.17  			<dependency>
    1.18  				<groupId>org.openrdf.sesame</groupId>
    1.19  				<artifactId>sesame-repository-sail</artifactId>
    1.20 @@ -82,7 +83,7 @@
    1.21  				<artifactId>sesame-sail-generaldb</artifactId>
    1.22  				<version>${eu.earthobservatory.version}</version>
    1.23  			</dependency>
    1.24 -			<!-- OpenRDF modules -->
    1.25 +
    1.26  			<dependency>
    1.27  				<groupId>org.openrdf.sesame</groupId>
    1.28  				<artifactId>sesame-queryalgebra</artifactId>
    1.29 @@ -137,128 +138,37 @@
    1.30  				<version>${sesame.version}</version>
    1.31  			</dependency>
    1.32  
    1.33 -			<!-- <dependency> <groupId>info.aduna.commons</groupId> <artifactId>aduna-commons-lang</artifactId> 
    1.34 -				<version>2.10.0-SNAPSHOT</version> </dependency> -->
    1.35 -
    1.36  			<!-- Aduna Commons -->
    1.37 -			<!-- Note: other Aduna Commons dependencies are imported from appbase -->
    1.38  			<dependency>
    1.39  				<groupId>info.aduna.commons</groupId>
    1.40  				<artifactId>aduna-commons-collections</artifactId>
    1.41  				<version>2.8.0</version>
    1.42  			</dependency>
    1.43 +
    1.44  			<dependency>
    1.45  				<groupId>info.aduna.commons</groupId>
    1.46  				<artifactId>aduna-commons-concurrent</artifactId>
    1.47  				<version>2.7.0</version>
    1.48  			</dependency>
    1.49 +
    1.50  			<dependency>
    1.51  				<groupId>info.aduna.commons</groupId>
    1.52  				<artifactId>aduna-commons-i18n</artifactId>
    1.53  				<version>1.4.0</version>
    1.54  			</dependency>
    1.55 +
    1.56  			<dependency>
    1.57  				<groupId>info.aduna.commons</groupId>
    1.58  				<artifactId>aduna-commons-iteration</artifactId>
    1.59  				<version>2.10.0</version>
    1.60  			</dependency>
    1.61 +
    1.62  			<dependency>
    1.63  				<groupId>info.aduna.commons</groupId>
    1.64  				<artifactId>aduna-commons-net-http-server-embedded</artifactId>
    1.65  				<version>2.5.0</version>
    1.66  			</dependency>
    1.67  
    1.68 -			<!-- Apache Commons -->
    1.69 -			<dependency>
    1.70 -				<groupId>commons-cli</groupId>
    1.71 -				<artifactId>commons-cli</artifactId>
    1.72 -				<version>1.2</version>
    1.73 -			</dependency>
    1.74 -			<dependency>
    1.75 -				<groupId>commons-dbcp</groupId>
    1.76 -				<artifactId>commons-dbcp</artifactId>
    1.77 -				<version>1.3</version>
    1.78 -			</dependency>
    1.79 -			<dependency>
    1.80 -				<groupId>commons-fileupload</groupId>
    1.81 -				<artifactId>commons-fileupload</artifactId>
    1.82 -				<version>1.2.1</version>
    1.83 -			</dependency>
    1.84 -			<dependency>
    1.85 -				<groupId>commons-io</groupId>
    1.86 -				<artifactId>commons-io</artifactId>
    1.87 -				<!-- this is the version that is specified as an optional dependency 
    1.88 -					for fileupload -->
    1.89 -				<version>1.3.2</version>
    1.90 -			</dependency>
    1.91 -			<dependency>
    1.92 -				<groupId>commons-httpclient</groupId>
    1.93 -				<artifactId>commons-httpclient</artifactId>
    1.94 -				<version>3.1</version>
    1.95 -				<exclusions>
    1.96 -					<exclusion>
    1.97 -						<groupId>commons-logging</groupId>
    1.98 -						<artifactId>commons-logging</artifactId>
    1.99 -					</exclusion>
   1.100 -					<exclusion>
   1.101 -						<!-- httpclient includes older codec -->
   1.102 -						<groupId>commons-codec</groupId>
   1.103 -						<artifactId>commons-codec</artifactId>
   1.104 -					</exclusion>
   1.105 -				</exclusions>
   1.106 -			</dependency>
   1.107 -			<dependency>
   1.108 -				<groupId>commons-codec</groupId>
   1.109 -				<artifactId>commons-codec</artifactId>
   1.110 -				<version>1.4</version>
   1.111 -				<scope>runtime</scope>
   1.112 -			</dependency>
   1.113 -
   1.114 -			<!-- Spring framework -->
   1.115 -			<dependency>
   1.116 -				<groupId>org.springframework</groupId>
   1.117 -				<artifactId>spring-aop</artifactId>
   1.118 -				<version>${spring.version}</version>
   1.119 -				<exclusions>
   1.120 -					<exclusion>
   1.121 -						<groupId>commons-logging</groupId>
   1.122 -						<artifactId>commons-logging</artifactId>
   1.123 -					</exclusion>
   1.124 -				</exclusions>
   1.125 -			</dependency>
   1.126 -
   1.127 -			<!-- Compliance tests -->
   1.128 -			<dependency>
   1.129 -				<groupId>edu.lehigh.swat.bench</groupId>
   1.130 -				<artifactId>uba</artifactId>
   1.131 -				<version>1.7</version>
   1.132 -			</dependency>
   1.133 -			<dependency>
   1.134 -				<groupId>edu.lehigh.swat.bench</groupId>
   1.135 -				<artifactId>ubt</artifactId>
   1.136 -				<version>1.1</version>
   1.137 -			</dependency>
   1.138 -
   1.139 -			<!-- JDBC Drivers -->
   1.140 -			<dependency>
   1.141 -				<groupId>postgresql</groupId>
   1.142 -				<artifactId>postgresql</artifactId>
   1.143 -				<version>9.0-801.jdbc4</version>
   1.144 -			</dependency>
   1.145 -
   1.146 -			<dependency>
   1.147 -				<groupId>mysql</groupId>
   1.148 -				<artifactId>mysql-connector-java</artifactId>
   1.149 -				<version>5.1.15</version>
   1.150 -			</dependency>
   1.151 -
   1.152 -			<!-- various -->
   1.153 -			<dependency>
   1.154 -				<groupId>cglib</groupId>
   1.155 -				<artifactId>cglib</artifactId>
   1.156 -				<version>2.2</version>
   1.157 -			</dependency>
   1.158 -
   1.159  			<!-- GeoTools -->
   1.160  			<dependency>
   1.161  				<groupId>org.geotools.xsd</groupId>
   1.162 @@ -302,20 +212,29 @@
   1.163  				<version>${geotools.version}</version>
   1.164  			</dependency>
   1.165  
   1.166 -			<!-- <dependency> -->
   1.167 -			<!-- <groupId>org.opengis</groupId> -->
   1.168 -			<!-- <artifactId>geoapi</artifactId> -->
   1.169 -			<!-- <version>3.0.0</version> -->
   1.170 -			<!-- </dependency> -->
   1.171 +			<!-- 
   1.172 +			<dependency> 
   1.173 +				<groupId>org.opengis</groupId> 
   1.174 +				<artifactId>geoapi</artifactId> 
   1.175 +				<version>3.0.0</version> 
   1.176 +			</dependency> 
   1.177 +			-->
   1.178  
   1.179 -			<!-- Testing: JUnit -->
   1.180 +			<!-- JDBC Drivers -->
   1.181  			<dependency>
   1.182 -				<groupId>junit</groupId>
   1.183 -				<artifactId>junit</artifactId>
   1.184 -				<version>4.7</version>
   1.185 -				<scope>test</scope>
   1.186 +				<groupId>postgresql</groupId>
   1.187 +				<artifactId>postgresql</artifactId>
   1.188 +				<version>9.0-801.jdbc4</version>
   1.189  			</dependency>
   1.190  
   1.191 +			<!--
   1.192 +			<dependency>
   1.193 +				<groupId>mysql</groupId>
   1.194 +				<artifactId>mysql-connector-java</artifactId>
   1.195 +				<version>5.1.15</version>
   1.196 +			</dependency>
   1.197 +			-->			
   1.198 +
   1.199  			<!-- SLF4J -->
   1.200  			<dependency>
   1.201  				<groupId>org.slf4j</groupId>
   1.202 @@ -335,7 +254,140 @@
   1.203                          	<version>1.2</version>
   1.204  	                </dependency>
   1.205  
   1.206 +			<!-- Apache Commons -->
   1.207 +			<dependency>
   1.208 +				<groupId>commons-cli</groupId>
   1.209 +				<artifactId>commons-cli</artifactId>
   1.210 +				<version>1.2</version>
   1.211 +			</dependency>
   1.212  
   1.213 +			<dependency>
   1.214 +				<groupId>commons-dbcp</groupId>
   1.215 +				<artifactId>commons-dbcp</artifactId>
   1.216 +				<version>1.3</version>
   1.217 +			</dependency>
   1.218 +
   1.219 +			<dependency>
   1.220 +				<groupId>commons-fileupload</groupId>
   1.221 +				<artifactId>commons-fileupload</artifactId>
   1.222 +				<version>1.2.1</version>
   1.223 +			</dependency>
   1.224 +
   1.225 +			<dependency>
   1.226 +				<groupId>commons-io</groupId>
   1.227 +				<artifactId>commons-io</artifactId>
   1.228 +
   1.229 +				<version>1.3.2</version>
   1.230 +			</dependency>
   1.231 +
   1.232 +			<dependency>
   1.233 +				<groupId>commons-httpclient</groupId>
   1.234 +				<artifactId>commons-httpclient</artifactId>
   1.235 +				<version>3.1</version>
   1.236 +				<exclusions>
   1.237 +					<exclusion>
   1.238 +						<groupId>commons-logging</groupId>
   1.239 +						<artifactId>commons-logging</artifactId>
   1.240 +					</exclusion>
   1.241 +					<exclusion>
   1.242 +						<!-- httpclient includes older codec -->
   1.243 +						<groupId>commons-codec</groupId>
   1.244 +						<artifactId>commons-codec</artifactId>
   1.245 +					</exclusion>
   1.246 +				</exclusions>
   1.247 +			</dependency>
   1.248 +
   1.249 +			<dependency>
   1.250 +				<groupId>commons-codec</groupId>
   1.251 +				<artifactId>commons-codec</artifactId>
   1.252 +				<version>1.4</version>
   1.253 +				<scope>runtime</scope>
   1.254 +			</dependency>
   1.255 +
   1.256 +			<dependency>
   1.257 +				<groupId>commons-validator</groupId>
   1.258 +				<artifactId>commons-validator</artifactId>
   1.259 +				<version>1.3.1</version>
   1.260 +			</dependency>
   1.261 +
   1.262 +			<!-- Spring framework -->
   1.263 +			<dependency>
   1.264 +				<groupId>org.springframework</groupId>
   1.265 +				<artifactId>spring-aop</artifactId>
   1.266 +				<version>${spring.version}</version>
   1.267 +				<exclusions>
   1.268 +					<exclusion>
   1.269 +						<groupId>commons-logging</groupId>
   1.270 +						<artifactId>commons-logging</artifactId>
   1.271 +					</exclusion>
   1.272 +				</exclusions>
   1.273 +			</dependency>
   1.274 +
   1.275 +			<dependency>
   1.276 +				<groupId>org.springframework</groupId>
   1.277 +				<artifactId>spring-webmvc</artifactId>
   1.278 +				<version>${spring.version}</version>
   1.279 +				<exclusions>
   1.280 +					<exclusion>
   1.281 +						<groupId>commons-logging</groupId>
   1.282 +						<artifactId>commons-logging</artifactId>
   1.283 +					</exclusion>
   1.284 +				</exclusions>
   1.285 +			</dependency>
   1.286 +
   1.287 +			<!-- Apache CXF framework -->
   1.288 +			<dependency>
   1.289 +				<groupId>org.apache.cxf</groupId>
   1.290 +				<artifactId>cxf-rt-frontend-jaxws</artifactId>
   1.291 +				<version>2.2.5</version>
   1.292 +			</dependency>
   1.293 +
   1.294 +			<dependency>
   1.295 +				<groupId>org.apache.cxf</groupId>
   1.296 +				<artifactId>cxf-rt-transports-http</artifactId>
   1.297 +				<version>2.2.5</version>
   1.298 +			</dependency>
   1.299 +
   1.300 +			<dependency>
   1.301 +				<groupId>org.apache.cxf</groupId>
   1.302 +				<artifactId>cxf-rt-transports-http-jetty</artifactId>
   1.303 +				<version>2.2.5</version>
   1.304 +			</dependency>
   1.305 +
   1.306 +			<!-- Compliance tests -->
   1.307 +			<dependency>
   1.308 +				<groupId>edu.lehigh.swat.bench</groupId>
   1.309 +				<artifactId>uba</artifactId>
   1.310 +				<version>1.7</version>
   1.311 +			</dependency>
   1.312 +
   1.313 +			<dependency>
   1.314 +				<groupId>edu.lehigh.swat.bench</groupId>
   1.315 +				<artifactId>ubt</artifactId>
   1.316 +				<version>1.1</version>
   1.317 +			</dependency>
   1.318 +
   1.319 +			<!-- Testing: JUnit -->
   1.320 +			<dependency>
   1.321 +				<groupId>junit</groupId>
   1.322 +				<artifactId>junit</artifactId>
   1.323 +				<version>4.7</version>
   1.324 +				<scope>test</scope>
   1.325 +			</dependency>
   1.326 +			
   1.327 +			<!-- Various -->
   1.328 +			<dependency>
   1.329 +				<groupId>cglib</groupId>
   1.330 +				<artifactId>cglib</artifactId>
   1.331 +				<version>2.2</version>
   1.332 +			</dependency>
   1.333 +
   1.334 +			<dependency>
   1.335 +				<groupId>javax</groupId>
   1.336 +				<artifactId>javaee-web-api</artifactId>
   1.337 +				<version>6.0</version>
   1.338 +				<scope>provided</scope>
   1.339 +			</dependency>
   1.340  		</dependencies>
   1.341  	</dependencyManagement>
   1.342  
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/webapp/WebContent/WEB-INF/beans.xml	Tue Mar 20 10:54:48 2012 +0100
     2.3 @@ -0,0 +1,74 @@
     2.4 +<?xml version="1.0" encoding="UTF-8"?>
     2.5 +<beans xmlns="http://www.springframework.org/schema/beans"
     2.6 +	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
     2.7 +	xsi:schemaLocation="http://www.springframework.org/schema/beans 
     2.8 +						http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
     2.9 +						http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
    2.10 +	<import resource="classpath:META-INF/cxf/cxf.xml" />
    2.11 +	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
    2.12 +	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
    2.13 +
    2.14 +	<bean id="strabonBean" class="eu.earthobservatory.org.StrabonEndpoint.StrabonBeanWrapper" destroy-method="destroy">
    2.15 +		<constructor-arg type="java.lang.String">
    2.16 +			<!-- Database name -->
    2.17 +			<value>endpoint</value>
    2.18 +		</constructor-arg>
    2.19 +		<constructor-arg type="java.lang.String">
    2.20 +			<!-- Username -->
    2.21 +			<value>postgres</value>
    2.22 +		</constructor-arg>
    2.23 +		<constructor-arg type="java.lang.String">
    2.24 +			<!-- Password -->
    2.25 +			<value>p1r3as</value>
    2.26 +		</constructor-arg>
    2.27 +		<constructor-arg type="int">
    2.28 +			<!-- Port -->
    2.29 +			<value>5432</value>
    2.30 +		</constructor-arg>
    2.31 +		<constructor-arg type="java.lang.String">
    2.32 +			<!-- Database server -->
    2.33 +			<value>localhost</value>
    2.34 +		</constructor-arg>
    2.35 +		<constructor-arg type="boolean">
    2.36 +			<!-- Check for locks and remove them (in case of a crash) -->
    2.37 +			<value>true</value>
    2.38 +		</constructor-arg>
    2.39 +		<constructor-arg type="java.lang.String">
    2.40 +			<!-- Query1 -->
    2.41 +			<value><![CDATA[%23+Get+all+hotspots+%0D%0A%23+-+in+Pelloponesus+%0D%0A%23+-+at+2007-08-23%0D%0A%23+-+of+firms%0D%0A%0D%0APREFIX+noa%3A+<http%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23>%0D%0APREFIX+clc%3A+<http%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FclcOntology.owl%23>%0D%0APREFIX+rdf%3A+<http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23>%0D%0APREFIX+rdfs%3A+<http%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23>%0D%0APREFIX+strdf%3A+<http%3A%2F%2Fstrdf.di.uoa.gr%2Fontology%23>%0D%0APREFIX+teleios%3A+<http%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23>%0D%0APREFIX+gag%3A+<http%3A%2F%2Fwww.semanticweb.org%2Fontologies%2F2011%2FgagKallikratis.rdf%23>%0D%0APREFIX+geo%3A+<http%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23>%0D%0APREFIX+georss%3A+<http%3A%2F%2Fwww.georss.org%2Fgeorss%2F>%0D%0APREFIX+xsd%3A+<http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23>%0D%0APREFIX+lgdo%3A+<http%3A%2F%2Flinkedgeodata.org%2Fontology%2F>%0D%0APREFIX+gn%3A+<http%3A%2F%2Fwww.geonames.org%2Fontology%23>%0D%0A%0D%0ASELECT+%3Fh+%3FhGeo+%3FhAcqTime+%3FhConfidence+%3FhConfirmation+%3FhProvider+%3FhSensor+%3FhSatellite%0D%0AWHERE+{%0D%0A++++%3Fh++a+noa%3AHotspot+%3B+%23+all%0D%0A++++++++noa%3AhasGeometry+%3FhGeo+%3B+%23+all%0D%0A++++++++noa%3AhasAcquisitionTime+%3FhAcqTime+%3B+%23+all%0D%0A++++++++noa%3AhasConfidence+%3FhConfidence+%3B+%23+all%0D%0A++++++++noa%3AisProducedBy+%3FhProvider+%3B+%23+all%0D%0A++++++++noa%3AhasConfirmation+%3FhConfirmation+%3B+%23+all+(only+value+unknown)%0D%0A++++++++noa%3AisDerivedFromSensor+%3FhSensor+%3B+%23+all%0D%0A++++++++noa%3AisDerivedFromSatellite+%3FhSatellite+.+%23+only+firms+noa%0D%0A++++++++FILTER(+%222007-08-23T00%3A00%3A00%22^^xsd%3AdateTime+<%3D+%3FhAcqTime+%26%26+%3FhAcqTime+<%3D+%222007-08-23T23%3A59%3A59%22^^xsd%3AdateTime+)+.%0D%0A++++++++FILTER(+%3FhProvider+%3D+noa%3Afirms+)+.%0D%0A++++++++FILTER(++strdf%3Acontains(%22POLYGON((21.027+38.36%2C+23.77+38.36%2C+23.77+36.05%2C+21.027+36.05%2C+21.027+38.36))%22^^strdf%3AWKT%2C+%3FhGeo)+)+.%0D%0A}&format=KML]]></value>
    2.42 +		</constructor-arg>
    2.43 +		<constructor-arg type="java.lang.String">
    2.44 +			<!-- Query2 -->
    2.45 +			<value><![CDATA[%23+Get+all+ArtificialSurfaces%0D%0A%23+-+in+Pelloponesus%0D%0A%0D%0APREFIX+noa%3A+<http%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23>%0D%0APREFIX+clc%3A+<http%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FclcOntology.owl%23>%0D%0APREFIX+rdf%3A+<http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23>%0D%0APREFIX+rdfs%3A+<http%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23>%0D%0APREFIX+strdf%3A+<http%3A%2F%2Fstrdf.di.uoa.gr%2Fontology%23>%0D%0APREFIX+teleios%3A+<http%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23>%0D%0APREFIX+gag%3A+<http%3A%2F%2Fwww.semanticweb.org%2Fontologies%2F2011%2FgagKallikratis.rdf%23>%0D%0APREFIX+geo%3A+<http%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23>%0D%0APREFIX+georss%3A+<http%3A%2F%2Fwww.georss.org%2Fgeorss%2F>%0D%0APREFIX+xsd%3A+<http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23>%0D%0APREFIX+lgdo%3A+<http%3A%2F%2Flinkedgeodata.org%2Fontology%2F>%0D%0APREFIX+gn%3A+<http%3A%2F%2Fwww.geonames.org%2Fontology%23>%0D%0APREFIX+owl%3A+<http%3A%2F%2Fwww.w3.org%2F2002%2F07%2Fowl%23>%0D%0A%0D%0ASELECT+%3Fa+%3FaGeo%0D%0AWHERE+{%0D%0A++++%3Fa++a+clc%3AArea+%3B%0D%0A++++++++clc%3AhasLandUse+%3FaLandUse+%3B%0D%0A++++++++noa%3AhasGeometry+%3FaGeo+.%0D%0A++++%3FaLandUse+a+%3FaLandUseType+.%0D%0A++++FILTER(+%3FaLandUseType+%3D+clc%3AArtificialSurfaces+)+.%0D%0A++++FILTER(++strdf%3Acontains(%22POLYGON((21.027+38.36%2C+23.77+38.36%2C+23.77+36.05%2C+21.027+36.05%2C+21.027+38.36))%22^^strdf%3AWKT%2C+%3FaGeo)+)+.%0D%0A}&format=KML]]></value>
    2.46 +		</constructor-arg>
    2.47 +		<constructor-arg type="java.lang.String">
    2.48 +			<!-- Query3 -->
    2.49 +			<value><![CDATA[PREFIX+noa%3A+<http%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23>%0D%0APREFIX+clc%3A+<http%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FclcOntology.owl%23>%0D%0APREFIX+rdf%3A+<http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23>%0D%0APREFIX+rdfs%3A+<http%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23>%0D%0APREFIX+strdf%3A+<http%3A%2F%2Fstrdf.di.uoa.gr%2Fontology%23>%0D%0APREFIX+teleios%3A+<http%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23>%0D%0APREFIX+gag%3A+<http%3A%2F%2Fwww.semanticweb.org%2Fontologies%2F2011%2FgagKallikratis.rdf%23>%0D%0APREFIX+geo%3A+<http%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23>%0D%0APREFIX+georss%3A+<http%3A%2F%2Fwww.georss.org%2Fgeorss%2F>%0D%0APREFIX+xsd%3A+<http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23>%0D%0APREFIX+lgdo%3A+<http%3A%2F%2Flinkedgeodata.org%2Fontology%2F>%0D%0APREFIX+gn%3A+<http%3A%2F%2Fwww.geonames.org%2Fontology%23>%0D%0A%0D%0ASELECT+%3Fn+%3FnGeo+%3FnType+%3FnLabel%0D%0A{%0D%0A++++%3Fn++a+%3FnType+%3B%0D%0A++++++++geo%3Ageometry+%3FnGeo+%3B%0D%0A++++++++rdfs%3Alabel+%3FnLabel+.%0D%0A++++++++FILTER(+%3FnType+%3D+lgdo%3AHospital+||+%3FnType+%3D+lgdo%3AAerodrome+||+%3FnType+%3D+lgdo%3ARailway+)+.%0D%0A++++++++FILTER(++strdf%3Acontains(%22POLYGON((21.027+38.36%2C+23.77+38.36%2C+23.77+36.05%2C+21.027+36.05%2C+21.027+38.36))%22^^strdf%3AWKT%2C+%3FnGeo)+)+.%0D%0A}&format=KML]]></value>
    2.50 +		</constructor-arg>
    2.51 +		<constructor-arg type="java.lang.String">
    2.52 +			<!-- Query4 -->
    2.53 +			<value><![CDATA[%23+Get+all+Perfectures%0D%0A%23+-+in+Pelloponesus%0D%0A%0D%0A%23real%090m31.239s%0D%0A%23user%090m8.060s%0D%0A%23sys%090m0.480s%0D%0A%0D%0APREFIX+noa%3A+<http%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23>%0D%0APREFIX+clc%3A+<http%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FclcOntology.owl%23>%0D%0APREFIX+rdf%3A+<http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23>%0D%0APREFIX+rdfs%3A+<http%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23>%0D%0APREFIX+strdf%3A+<http%3A%2F%2Fstrdf.di.uoa.gr%2Fontology%23>%0D%0APREFIX+teleios%3A+<http%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23>%0D%0APREFIX+gag%3A+<http%3A%2F%2Fwww.semanticweb.org%2Fontologies%2F2011%2FgagKallikratis.rdf%23>%0D%0APREFIX+geo%3A+<http%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23>%0D%0APREFIX+georss%3A+<http%3A%2F%2Fwww.georss.org%2Fgeorss%2F>%0D%0APREFIX+xsd%3A+<http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23>%0D%0APREFIX+lgdo%3A+<http%3A%2F%2Flinkedgeodata.org%2Fontology%2F>%0D%0APREFIX+gn%3A+<http%3A%2F%2Fwww.geonames.org%2Fontology%23>%0D%0A%0D%0ASELECT+%3Fg+%3FgYpesCode+%3FgContainer+%3FgLabel+(+strdf%3Aboundary(%3FgGeog)+as+%3FgBoundary+)%0D%0AWHERE+{%0D%0A++++%3Fg++a+gag%3ADhmos+%3B%0D%0A++++++++noa%3AhasYpesCode+%3FgYpesCode+%3B%0D%0A++++++++gag%3AisPartOf+%3FgContainer+%3B%0D%0A++++++++rdfs%3Alabel+%3FgLabel+%3B%0D%0A++++++++strdf%3AhasGeometry+%3FgGeog+.%0D%0A++++FILTER(++strdf%3Acontains(%22POLYGON((21.027+38.36%2C+23.77+38.36%2C+23.77+36.05%2C+21.027+36.05%2C+21.027+38.36))%22^^strdf%3AWKT%2C+%3FgGeog)+)+.%0D%0A}&format=KML]]></value>
    2.54 +		</constructor-arg>
    2.55 +		<constructor-arg type="java.lang.String">
    2.56 +			<!-- Query5 -->
    2.57 +			<value><![CDATA[%23+Get+all+Prefectures%0D%0A%23+-+in+Pelloponesus%0D%0A%0D%0A%23real%090m31.239s%0D%0A%23user%090m8.060s%0D%0A%23sys%090m0.480s%0D%0A%0D%0APREFIX+noa%3A+<http%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23>%0D%0APREFIX+clc%3A+<http%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FclcOntology.owl%23>%0D%0APREFIX+rdf%3A+<http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23>%0D%0APREFIX+rdfs%3A+<http%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23>%0D%0APREFIX+strdf%3A+<http%3A%2F%2Fstrdf.di.uoa.gr%2Fontology%23>%0D%0APREFIX+teleios%3A+<http%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23>%0D%0APREFIX+gag%3A+<http%3A%2F%2Fwww.semanticweb.org%2Fontologies%2F2011%2FgagKallikratis.rdf%23>%0D%0APREFIX+geo%3A+<http%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23>%0D%0APREFIX+georss%3A+<http%3A%2F%2Fwww.georss.org%2Fgeorss%2F>%0D%0APREFIX+xsd%3A+<http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23>%0D%0APREFIX+lgdo%3A+<http%3A%2F%2Flinkedgeodata.org%2Fontology%2F>%0D%0APREFIX+gn%3A+<http%3A%2F%2Fwww.geonames.org%2Fontology%23>%0D%0A%0D%0ASELECT+%3Fg+%3FgYpesCode+%3FgContainer+%3FgLabel+(+strdf%3Aboundary(%3FgGeog)+as+%3FgBoundary+)%0D%0AWHERE+{%0D%0A++++%3Fg++a+gag%3ADhmos+%3B%0D%0A++++++++noa%3AhasYpesCode+%3FgYpesCode+%3B%0D%0A++++++++gag%3AisPartOf+%3FgContainer+%3B%0D%0A++++++++rdfs%3Alabel+%3FgLabel+%3B%0D%0A++++++++strdf%3AhasGeometry+%3FgGeog+.%0D%0A++++FILTER(++strdf%3Acontains(%22POLYGON((21.027+38.36%2C+23.77+38.36%2C+23.77+36.05%2C+21.027+36.05%2C+21.027+38.36))%22^^strdf%3AWKT%2C+%3FgGeog)+)+.%0D%0A}&format=KML]]></value>
    2.58 +		</constructor-arg>
    2.59 +		<constructor-arg type="java.lang.String">
    2.60 +			<!-- Query6 -->
    2.61 +                        <value><![CDATA[]]></value>
    2.62 +		</constructor-arg>
    2.63 +		<constructor-arg type="java.lang.String">
    2.64 +			<!-- Query7 -->
    2.65 +                        <value><![CDATA[]]></value>
    2.66 +		</constructor-arg>
    2.67 +		<constructor-arg type="java.lang.String">
    2.68 +			<!-- Query8 -->
    2.69 +                        <value><![CDATA[]]></value>
    2.70 +		</constructor-arg>
    2.71 +	</bean>
    2.72 +
    2.73 +<!-- 	<bean id="queryBean" class="eu.earthobservatory.org.StrabonEndpoint.QueryBean"> -->
    2.74 +<!-- 		<property name="strabon" ref="strabonBean" /> -->
    2.75 +<!-- 	</bean> -->
    2.76 +
    2.77 +</beans>
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/webapp/WebContent/WEB-INF/web.xml	Tue Mar 20 10:54:48 2012 +0100
     3.3 @@ -0,0 +1,53 @@
     3.4 +<?xml version="1.0" encoding="UTF-8"?>
     3.5 +<web-app id="WebApp_ID" version="2.4"
     3.6 +	xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     3.7 +	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
     3.8 +	<display-name>StrabonEndpoint</display-name>
     3.9 +	<context-param>
    3.10 +		<param-name>contextConfigLocation</param-name>
    3.11 +		<param-value>WEB-INF/beans.xml</param-value>
    3.12 +	</context-param>
    3.13 +	<listener>
    3.14 +		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    3.15 +	</listener>
    3.16 +		
    3.17 +	<servlet>
    3.18 +		<display-name>Query</display-name>
    3.19 +		<servlet-name>Query</servlet-name>
    3.20 +		<servlet-class>eu.earthobservatory.org.StrabonEndpoint.QueryBean</servlet-class>
    3.21 +		<load-on-startup>1</load-on-startup>
    3.22 +	</servlet>
    3.23 +	<servlet-mapping>
    3.24 +		<servlet-name>Query</servlet-name>
    3.25 +		<url-pattern>/Query</url-pattern>
    3.26 +	</servlet-mapping>
    3.27 +	
    3.28 +	<servlet>
    3.29 +		<display-name>Store</display-name>
    3.30 +		<servlet-name>Store</servlet-name>
    3.31 +		<servlet-class>eu.earthobservatory.org.StrabonEndpoint.StoreBean</servlet-class>
    3.32 +		<load-on-startup>1</load-on-startup>
    3.33 +	</servlet>
    3.34 +	<servlet-mapping>
    3.35 +		<servlet-name>Store</servlet-name>
    3.36 +		<url-pattern>/Store</url-pattern>
    3.37 +	</servlet-mapping>
    3.38 +	
    3.39 +<!-- 	<servlet> -->
    3.40 +<!-- 		<display-name>QueryServlet</display-name> -->
    3.41 +<!-- 		<servlet-name>QueryServlet</servlet-name> -->
    3.42 +<!-- 		<servlet-class>eu.earthobservatory.QueryServlet</servlet-class> -->
    3.43 +<!-- 		<load-on-startup>1</load-on-startup> -->
    3.44 +<!-- 	</servlet> -->
    3.45 +<!-- 	<servlet-mapping> -->
    3.46 +<!-- 		<servlet-name>QueryServlet</servlet-name> -->
    3.47 +<!-- 		<url-pattern>/QueryServlet</url-pattern> -->
    3.48 +<!-- 	</servlet-mapping> -->
    3.49 +	
    3.50 +	<session-config>
    3.51 +		<session-timeout>60</session-timeout>
    3.52 +	</session-config>
    3.53 +	<welcome-file-list>
    3.54 +		<welcome-file>Query</welcome-file>
    3.55 +	</welcome-file-list>
    3.56 +</web-app>
     4.1 Binary file webapp/WebContent/images/base_bg1.gif has changed
     5.1 Binary file webapp/WebContent/images/base_bg2.gif has changed
     6.1 Binary file webapp/WebContent/images/nav1_bg1.gif has changed
     7.1 Binary file webapp/WebContent/images/nav2_bg.gif has changed
     8.1 Binary file webapp/WebContent/images/pixi_white.gif has changed
     9.1 Binary file webapp/WebContent/images/spacer.gif has changed
    10.1 Binary file webapp/WebContent/images/teleios_logo.png has changed
    11.1 Binary file webapp/WebContent/images/top_bg_blue.gif has changed
    12.1 Binary file webapp/WebContent/images/top_twogreys.gif has changed
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/webapp/WebContent/store.jsp	Tue Mar 20 10:54:48 2012 +0100
    13.3 @@ -0,0 +1,139 @@
    13.4 +<%@ page import = "eu.earthobservatory.org.StrabonEndpoint.StoreBean" %>
    13.5 +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    13.6 +<html>
    13.7 +<head>
    13.8 +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    13.9 +<link rel="stylesheet" href="style.css" type="text/css" /> 
   13.10 +<style type="text/css"> 
   13.11 +<!--
   13.12 +.style3 {font-size: 15px}
   13.13 +.style4 {font-size: 12px}
   13.14 +.style5 {font-size: 15px;font-weight: bold;}
   13.15 +.style6 {color: #FF0000}
   13.16 +.style7 {font-size: 14px}
   13.17 + .hidden { visibility: hidden }
   13.18 +-->
   13.19 +</style> 
   13.20 +<title>TELEIOS: Strabon Endpoint</title>
   13.21 +</head>
   13.22 +<body topmargin="0" leftmargin="0" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
   13.23 +  <TABLE width="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0>
   13.24 +    <TR>
   13.25 +		
   13.26 +      <TD height="16" background="images/pixi_white.gif"><img src="images/pixi_white.gif" width="16" height="16"></TD>
   13.27 +	</TR>
   13.28 +	<TR>
   13.29 +      <TD height="1" background="images/top_bg_blue.gif"></TD>
   13.30 +	</TR>		
   13.31 +	<TR>
   13.32 +      <TD height="60" background="images/nav2_bg.gif"> 
   13.33 +        <table width="100%" border="0">
   13.34 +         <tr>
   13.35 +            <td width="1"><img src="images/nav2_bg.gif" width="1" height="60"></td>
   13.36 +            <td valign="top" width="80px"><img border="0" src="images/teleios_logo.png"/></td>
   13.37 +            <td valign="top" align="left">
   13.38 +            <span class="logo">Strabon Endpoint</span><br><span class="style4">based on Strabon</span></td>
   13.39 +          </tr>
   13.40 +        </table> </TD>
   13.41 +	</TR>
   13.42 +	<TR>
   13.43 +      <TD height="21" background="images/nav1_bg1.gif">
   13.44 +      </TD>
   13.45 +	</TR>
   13.46 +	<TR>
   13.47 +      <TD height="2" background="images/top_bg_blue.gif"></TD>
   13.48 +	</TR>
   13.49 +</TABLE>
   13.50 +
   13.51 +<FORM method="get" action=Store>
   13.52 +<INPUT type=hidden name="<%=StoreBean.SRC_REQ%>" value="browser"/>
   13.53 +
   13.54 +<TABLE border="0" width="100%">
   13.55 +<tr> 
   13.56 +	<td width="90" valign="top" bgcolor="#dfe8f0"> 
   13.57 +		<TABLE border="0" cellspacing="0" cellpadding="0" width="165" id="navigation">
   13.58 +			<tr><td width="90" class="style4"><a href="Query" class="navText">Query</a></td></tr> 
   13.59 +			<tr><td width="90" class="style4"><a href="javascript:history.go(0)" class="navText">Clear</a></td></tr> 
   13.60 +		</TABLE>
   13.61 +	</td>
   13.62 +	<td width="*" valign="top" >
   13.63 +		<TABLE cellspacing="5">
   13.64 +<%
   13.65 +	if (request.getParameter(StoreBean.DATA_ERROR) != null) {
   13.66 +  		%>
   13.67 +  		<TR><TD colspan=3>
   13.68 +  		<CENTER><P style="color: red;">No data provided!</P></CENTER>
   13.69 +  		</TD></TR>
   13.70 +  		<%
   13.71 +  	}
   13.72 +  		
   13.73 +  	if (request.getParameter(StoreBean.FORMAT_ERROR) != null) {
   13.74 +  		%>
   13.75 +  		<TR><TD colspan=3>
   13.76 +  		<CENTER><P style="color: red;">Unknown RDF Format!</P></CENTER>
   13.77 +  		</TD></TR>
   13.78 +  		<%
   13.79 +  	}
   13.80 +  	
   13.81 +  	if (request.getParameter(StoreBean.STORE_ERROR) != null) {
   13.82 +  		%>
   13.83 +  		<TR><TD colspan=3>
   13.84 +  		<CENTER><P style="color: red;">An error occurred while storing input data!</P></CENTER>
   13.85 +  		</TD></TR>
   13.86 +  		<%
   13.87 +  	}
   13.88 +  	
   13.89 +  	if (request.getParameter(StoreBean.STORE_OK) != null) {
   13.90 +  		%>
   13.91 +  		<TR><TD colspan=3>
   13.92 +  		<CENTER><P>Data stored successfully!</P></CENTER>
   13.93 +  		</TD></TR>
   13.94 +  		<%
   13.95 +  	}
   13.96 +%>
   13.97 +	<tr>
   13.98 +	<!--  direct input form -->
   13.99 +		<td style="border: 1px dashed #bbbbbb;">Direct Input:</td>
  13.100 +		<td style="border: 1px dashed #bbbbbb;">
  13.101 +			<textarea name="<%=StoreBean.PARAM_DATA%>" rows="15" cols="100"></textarea></td>
  13.102 +		<td rowspan=4 style="border: 1px dashed #bbbbbb;">
  13.103 +			<CENTER>RDF Format:<br/>
  13.104 +				<SELECT name="<%=StoreBean.PARAM_FORMAT%>">
  13.105 +				<% for (String format : StoreBean.registeredFormats) {%>
  13.106 +					<OPTION value="<%=format%>"><%=format%></OPTION>
  13.107 +				<%}%>
  13.108 +				</SELECT>
  13.109 +			</CENTER>
  13.110 +		</td>
  13.111 +	</tr>
  13.112 +	<tr>
  13.113 +		<td colspan=2 style="border: 1px dashed #bbbbbb;"><br/>
  13.114 +		<CENTER>
  13.115 +			<input type="submit" value="Store Input" name="<%=StoreBean.SUBMIT_INPUT%>" style="width: 400px"/>
  13.116 +		</CENTER><br/>
  13.117 +		</td>
  13.118 +	</tr>
  13.119 +	
  13.120 +	<tr>
  13.121 +		<td style="border: 1px dashed #bbbbbb;">URI Input:</td>
  13.122 +		<td style="border: 1px dashed #bbbbbb;">
  13.123 +			<textarea name="<%=StoreBean.PARAM_DATA_URL%>" rows="1" cols="100"></textarea>
  13.124 +		</td>
  13.125 +	</tr>
  13.126 +	
  13.127 +	<tr>
  13.128 +		<td colspan=2 style="border: 1px dashed #bbbbbb;"><br/>
  13.129 +			<CENTER>
  13.130 +				<INPUT type="submit" value="Store from URI" name="<%=StoreBean.SUBMIT_URL%>" style="width: 400px"/>
  13.131 +			</CENTER><br/>
  13.132 +		</td>
  13.133 +	</tr>
  13.134 +	
  13.135 +	</TABLE>
  13.136 +	</td>
  13.137 +</tr>
  13.138 +</TABLE>
  13.139 +</FORM>
  13.140 +<br/><br/><br/><br/><br/>
  13.141 +</BODY>
  13.142 +</HTML>
  13.143 \ No newline at end of file
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/webapp/WebContent/style.css	Tue Mar 20 10:54:48 2012 +0100
    14.3 @@ -0,0 +1,101 @@
    14.4 +/* Global Styles */
    14.5 +
    14.6 +body {
    14.7 +	margin:0px;
    14.8 +	}
    14.9 +	
   14.10 +td {
   14.11 +	font:11px Arial, Helvetica, sans-serif;
   14.12 +	color:#222222;
   14.13 +	font-size: 15px
   14.14 +	}
   14.15 +	
   14.16 +a {
   14.17 +	color: darkblue;
   14.18 +	}	
   14.19 +a:hover {
   14.20 +	color: blue;
   14.21 +	}
   14.22 +
   14.23 +p {
   14.24 +	text-align: justify
   14.25 +}
   14.26 +
   14.27 +/* ID Styles */
   14.28 +
   14.29 +#navigation td {
   14.30 +	border-bottom: 1px solid #8da3b1;
   14.31 +	}
   14.32 +	
   14.33 +#navigation a {
   14.34 +	font: bold 11px Arial, Helvetica, sans-serif;
   14.35 +	color: #5f7383;
   14.36 +	line-height:16px;
   14.37 +	letter-spacing:.1em;
   14.38 +	text-decoration: none;
   14.39 +	display:block;
   14.40 +	padding:8px 6px 10px 20px;
   14.41 +	}
   14.42 +	
   14.43 +#navigation a:hover {
   14.44 +	background: #5f7383;
   14.45 +	color:#dfe8f0;
   14.46 +	}
   14.47 +	
   14.48 +.logo 	{
   14.49 +	font:24px Arial, Helvetica, sans-serif;
   14.50 +	color: #333333;
   14.51 +	letter-spacing:.2em;
   14.52 +	line-height:30px;
   14.53 +	}
   14.54 +
   14.55 +#tagline 	{	
   14.56 +	font:11px Arial, Helvetica, sans-serif;
   14.57 +	color: #993300;
   14.58 +	letter-spacing:.4em;
   14.59 +	line-height:18px;
   14.60 +	}
   14.61 +	
   14.62 +/* Class Styles */
   14.63 +	
   14.64 +.bodyText {
   14.65 +	font:11px Arial, Helvetica, sans-serif;
   14.66 +	color:#666666;
   14.67 +	line-height:20px;
   14.68 +	margin-top:0px;
   14.69 +	}
   14.70 +	
   14.71 +.pageName{
   14.72 +	font: 18px Arial, Helvetica, sans-serif;
   14.73 +	color: #99CC66;
   14.74 +	line-height:26px;
   14.75 +	letter-spacing:.21em;
   14.76 +	}
   14.77 +	
   14.78 +.subHeader {
   14.79 +	font:bold 11px Arial, Helvetica, sans-serif;
   14.80 +	color: #993300;
   14.81 +	line-height:22px;
   14.82 +	letter-spacing:.2em;
   14.83 +	}
   14.84 +
   14.85 +.quote {
   14.86 +	font: 20px Arial, Helvetica, sans-serif;
   14.87 +	color: #759DA1;
   14.88 +	line-height:30px;
   14.89 +	}
   14.90 +	
   14.91 +.smallText {
   14.92 +	font: 10px Arial, Helvetica, sans-serif;
   14.93 +	color: #666666;
   14.94 +	line-height: 22px;
   14.95 +	}
   14.96 +	
   14.97 +.navText {
   14.98 +	font: 11px Arial, Helvetica, sans-serif;
   14.99 +	color: #003366;
  14.100 +	line-height:16px;
  14.101 +	letter-spacing:.1em;
  14.102 +	text-decoration: none;
  14.103 +	}
  14.104 +	
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/webapp/pom.xml	Tue Mar 20 10:54:48 2012 +0100
    15.3 @@ -0,0 +1,219 @@
    15.4 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    15.5 +	<modelVersion>4.0.0</modelVersion>
    15.6 +
    15.7 +	<parent>
    15.8 +		<groupId>eu.earthobservatory</groupId>
    15.9 +		<artifactId>strabon</artifactId>
   15.10 +		<version>3.1.8-SNAPSHOT</version>
   15.11 +	</parent>
   15.12 +  
   15.13 +	<groupId>eu.earthobservatory</groupId>
   15.14 +	<artifactId>StrabonEndpoint</artifactId>
   15.15 +	<version>3.1.8-SNAPSHOT</version>
   15.16 +	<packaging>war</packaging>
   15.17 +
   15.18 +	<name>StrabonEndpoint</name>
   15.19 +	<description>An endpoint for Strabon</description>
   15.20 +
   15.21 +	<properties>
   15.22 +		<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
   15.23 +	</properties>
   15.24 +
   15.25 +	<dependencies>
   15.26 +		<dependency>
   15.27 +			<groupId>javax</groupId>
   15.28 +			<artifactId>javaee-web-api</artifactId>
   15.29 +			<scope>provided</scope>
   15.30 +		</dependency>
   15.31 +
   15.32 +		<dependency>
   15.33 +			<groupId>eu.earthobservatory</groupId>
   15.34 +			<artifactId>strabon-runtime</artifactId>
   15.35 +			<type>jar</type>
   15.36 +			<scope>compile</scope>
   15.37 +		</dependency>
   15.38 +
   15.39 +		<!-- GeoTools -->
   15.40 +		<dependency>
   15.41 +			<groupId>org.geotools.xsd</groupId>
   15.42 +			<artifactId>gt-xsd-kml</artifactId>
   15.43 +		</dependency>
   15.44 +
   15.45 +		<dependency>
   15.46 +			<groupId>org.geotools</groupId>
   15.47 +			<artifactId>gt-xml</artifactId>
   15.48 +		</dependency>
   15.49 +
   15.50 +		<dependency>
   15.51 +			<groupId>org.geotools</groupId>
   15.52 +			<artifactId>gt-epsg-hsql</artifactId>
   15.53 +		</dependency>
   15.54 +		<dependency>
   15.55 +			<groupId>org.geotools</groupId>
   15.56 +			<artifactId>gt-shapefile</artifactId>
   15.57 +		</dependency>
   15.58 +
   15.59 +		<!-- Testing: JUnit -->
   15.60 +		<dependency>
   15.61 +			<groupId>junit</groupId>
   15.62 +			<artifactId>junit</artifactId>
   15.63 +			<scope>test</scope>
   15.64 +		</dependency>
   15.65 +
   15.66 +		<!-- JDBC Drivers -->
   15.67 +
   15.68 +		<dependency>
   15.69 +			<groupId>postgresql</groupId>
   15.70 +			<artifactId>postgresql</artifactId>
   15.71 +		</dependency>
   15.72 +
   15.73 +		<!-- Spring framework -->
   15.74 +		<dependency>
   15.75 +			<groupId>org.springframework</groupId>
   15.76 +			<artifactId>spring-webmvc</artifactId>
   15.77 +			<exclusions>
   15.78 +				<exclusion>
   15.79 +					<groupId>commons-logging</groupId>
   15.80 +					<artifactId>commons-logging</artifactId>
   15.81 +				</exclusion>
   15.82 +			</exclusions>
   15.83 +		</dependency>
   15.84 +		<dependency>
   15.85 +			<groupId>org.springframework</groupId>
   15.86 +			<artifactId>spring-aop</artifactId>
   15.87 +			<exclusions>
   15.88 +				<exclusion>
   15.89 +					<groupId>commons-logging</groupId>
   15.90 +					<artifactId>commons-logging</artifactId>
   15.91 +				</exclusion>
   15.92 +			</exclusions>
   15.93 +		</dependency>
   15.94 +		
   15.95 +		<dependency>
   15.96 +			<groupId>org.apache.cxf</groupId>
   15.97 +			<artifactId>cxf-rt-frontend-jaxws</artifactId>
   15.98 +		</dependency>
   15.99 +
  15.100 +		<dependency>
  15.101 +			<groupId>org.apache.cxf</groupId>
  15.102 +			<artifactId>cxf-rt-transports-http</artifactId>
  15.103 +		</dependency>
  15.104 +
  15.105 +		<dependency>
  15.106 +			<groupId>org.apache.cxf</groupId>
  15.107 +			<artifactId>cxf-rt-transports-http-jetty</artifactId>
  15.108 +		</dependency>
  15.109 +
  15.110 +		<dependency>
  15.111 +			<groupId>commons-validator</groupId>
  15.112 +			<artifactId>commons-validator</artifactId>
  15.113 +		</dependency>
  15.114 +	</dependencies>
  15.115 +
  15.116 +	<build>
  15.117 +		<plugins>
  15.118 +			<plugin>
  15.119 +				<groupId>org.apache.maven.plugins</groupId>
  15.120 +				<artifactId>maven-compiler-plugin</artifactId>
  15.121 +				<version>2.3.2</version>
  15.122 +				<configuration>
  15.123 +					<source>1.6</source>
  15.124 +					<target>1.6</target>
  15.125 +					<compilerArguments>
  15.126 +						<endorseddirs>${endorsed.dir}</endorseddirs>
  15.127 +					</compilerArguments>
  15.128 +				</configuration>
  15.129 +			</plugin>
  15.130 +			<plugin>
  15.131 +				<groupId>org.apache.maven.plugins</groupId>
  15.132 +				<artifactId>maven-war-plugin</artifactId>
  15.133 +				<version>2.1.1</version>
  15.134 +				<configuration>
  15.135 +					<webXml>${basedir}/WebContent/WEB-INF/web.xml</webXml>
  15.136 +					<webResources>
  15.137 +						<resource>
  15.138 +							<targetPath>/WEB-INF</targetPath>
  15.139 +							<directory>${basedir}/WebContent/WEB-INF</directory>
  15.140 +							<includes>
  15.141 +								<include>lib/**</include>
  15.142 +							</includes>
  15.143 +						</resource>
  15.144 +
  15.145 +						<resource>
  15.146 +							<targetPath>/WEB-INF</targetPath>
  15.147 +							<directory>${basedir}</directory>
  15.148 +							<includes>
  15.149 +								<include>wsdl/**</include>
  15.150 +							</includes>
  15.151 +						</resource>
  15.152 +
  15.153 +						<resource>
  15.154 +							<targetPath>/WEB-INF</targetPath>
  15.155 +							<directory>${basedir}/WebContent/WEB-INF</directory>
  15.156 +							<includes>
  15.157 +								<include>beans.xml</include>
  15.158 +							</includes>
  15.159 +						</resource>
  15.160 +						
  15.161 +						<resource>
  15.162 +							<targetPath>/</targetPath>
  15.163 +							<directory>${basedir}/WebContent</directory>
  15.164 +							<includes>
  15.165 +								<include>style.css</include>
  15.166 +								<include>store.jsp</include>
  15.167 +							</includes>
  15.168 +						</resource>
  15.169 +						
  15.170 +						<resource>
  15.171 +							<targetPath>/</targetPath>
  15.172 +							<directory>${basedir}/WebContent</directory>
  15.173 +							<includes>
  15.174 +								<include>images/**</include>
  15.175 +							</includes>
  15.176 +						</resource>
  15.177 +					</webResources>
  15.178 +					<!-- 
  15.179 +					<archive>
  15.180 +						<manifest>
  15.181 +							<addClasspath>true</addClasspath>
  15.182 +						</manifest>
  15.183 +					</archive>
  15.184 +					 -->
  15.185 +				</configuration>
  15.186 +			</plugin>
  15.187 +			<plugin>
  15.188 +				<groupId>org.apache.maven.plugins</groupId>
  15.189 +				<artifactId>maven-dependency-plugin</artifactId>
  15.190 +				<version>2.1</version>
  15.191 +				<executions>
  15.192 +					<execution>
  15.193 +						<phase>validate</phase>
  15.194 +						<goals>
  15.195 +							<goal>copy</goal>
  15.196 +						</goals>
  15.197 +						<configuration>
  15.198 +							<outputDirectory>${endorsed.dir}</outputDirectory>
  15.199 +							<silent>true</silent>
  15.200 +							<artifactItems>
  15.201 +								<artifactItem>
  15.202 +									<groupId>javax</groupId>
  15.203 +									<artifactId>javaee-endorsed-api</artifactId>
  15.204 +									<version>6.0</version>
  15.205 +									<type>jar</type>
  15.206 +								</artifactItem>
  15.207 +							</artifactItems>
  15.208 +						</configuration>
  15.209 +					</execution>
  15.210 +				</executions>
  15.211 +			</plugin>
  15.212 +			<plugin>
  15.213 +				<artifactId>maven-release-plugin</artifactId>
  15.214 +				<version>2.2.2</version>
  15.215 +				<configuration>
  15.216 +					<tagNameFormat>v@{project.version}</tagNameFormat>
  15.217 +					<autoVersionSubmodules>true</autoVersionSubmodules>
  15.218 +				</configuration>
  15.219 +			</plugin>
  15.220 +		</plugins>
  15.221 +	</build>
  15.222 +</project>
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/webapp/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java	Tue Mar 20 10:54:48 2012 +0100
    16.3 @@ -0,0 +1,523 @@
    16.4 +package eu.earthobservatory.org.StrabonEndpoint;
    16.5 +
    16.6 +import java.io.BufferedWriter;
    16.7 +import java.io.File;
    16.8 +import java.io.FileWriter;
    16.9 +import java.io.IOException;
   16.10 +import java.io.PrintWriter;
   16.11 +import java.math.BigInteger;
   16.12 +import java.net.InetAddress;
   16.13 +import java.security.SecureRandom;
   16.14 +import java.util.Date;
   16.15 +import java.util.Iterator;
   16.16 +
   16.17 +import javax.servlet.ServletConfig;
   16.18 +import javax.servlet.ServletContext;
   16.19 +import javax.servlet.ServletException;
   16.20 +import javax.servlet.http.HttpServlet;
   16.21 +import javax.servlet.http.HttpServletRequest;
   16.22 +import javax.servlet.http.HttpServletResponse;
   16.23 +
   16.24 +import org.apache.commons.httpclient.HttpClient;
   16.25 +import org.apache.commons.httpclient.HttpException;
   16.26 +import org.apache.commons.httpclient.HttpMethod;
   16.27 +import org.apache.commons.httpclient.NameValuePair;
   16.28 +import org.apache.commons.httpclient.methods.GetMethod;
   16.29 +import org.apache.commons.io.FileUtils;
   16.30 +import org.openrdf.query.MalformedQueryException;
   16.31 +import org.openrdf.query.QueryEvaluationException;
   16.32 +import org.openrdf.query.TupleQueryResultHandlerException;
   16.33 +import org.openrdf.repository.RepositoryException;
   16.34 +import org.springframework.web.context.WebApplicationContext;
   16.35 +import org.springframework.web.context.support.WebApplicationContextUtils;
   16.36 + 
   16.37 +
   16.38 +public class QueryBean extends HttpServlet {
   16.39 +	
   16.40 +	private static final long serialVersionUID = -378175118289907707L;
   16.41 +	
   16.42 +	public QueryBean() {}
   16.43 +	
   16.44 +	public void doGet(HttpServletRequest request, HttpServletResponse response)
   16.45 +	throws ServletException, IOException
   16.46 +	{
   16.47 +		doPost(request, response);
   16.48 +	}
   16.49 +	
   16.50 +	public void doPost(HttpServletRequest request, HttpServletResponse response)
   16.51 +	throws ServletException, IOException
   16.52 +	{
   16.53 +		final class DataHive{
   16.54 +			private String format;
   16.55 +			private String SPARQLQuery;
   16.56 +			private String errorMessage;
   16.57 +			
   16.58 +			DataHive(){
   16.59 +				this.format = null;
   16.60 +				this.SPARQLQuery = null;
   16.61 +				this.errorMessage = null;				
   16.62 +			}
   16.63 +			
   16.64 +			public String getTinyURL(String fullURL){
   16.65 +				String tinyUrl = null;
   16.66 +				
   16.67 +				try {
   16.68 +					HttpClient httpclient = new HttpClient();
   16.69 +					HttpMethod method = new GetMethod("http://tinyurl.com/api-create.php"); 
   16.70 +					method.setQueryString(new NameValuePair[]{new NameValuePair("url",fullURL)});
   16.71 +					httpclient.executeMethod(method);
   16.72 +					tinyUrl = method.getResponseBodyAsString();
   16.73 +					method.releaseConnection();
   16.74 +					
   16.75 +				} catch (HttpException e) {
   16.76 +					// TODO Auto-generated catch block
   16.77 +					e.printStackTrace();
   16.78 +				} catch (IOException e) {
   16.79 +					// TODO Auto-generated catch block
   16.80 +					e.printStackTrace();
   16.81 +				}
   16.82 +				
   16.83 +				return tinyUrl;
   16.84 +			}
   16.85 +			
   16.86 +			public String getSPARQLQuery() {
   16.87 +				return SPARQLQuery;
   16.88 +			}
   16.89 +
   16.90 +			public void setSPARQLQuery(String sPARQLQuery) {
   16.91 +				SPARQLQuery = sPARQLQuery;
   16.92 +			}
   16.93 +			
   16.94 +			public String getFormat() {
   16.95 +				return format;
   16.96 +			}
   16.97 +
   16.98 +			public void setFormat(String fFormat) {
   16.99 +				format = fFormat;
  16.100 +			}
  16.101 +
  16.102 +			public String getErrorMessage() {
  16.103 +				return errorMessage;
  16.104 +			}
  16.105 +
  16.106 +			public void setErrorMessage(String error) {
  16.107 +				this.errorMessage = error;
  16.108 +			}
  16.109 +		}
  16.110 +		
  16.111 +//		System.out.println("\n\n\n\n\n\n\nrequest: ");
  16.112 +//		System.out.println("HEADERS");
  16.113 +//	    Enumeration headerNames = request.getHeaderNames();
  16.114 +//	    while(headerNames.hasMoreElements()) {
  16.115 +//	      String headerName = (String)headerNames.nextElement();
  16.116 +//	      System.out.println(headerName + ":" +request.getHeader(headerName));
  16.117 +//	    }
  16.118 +//	    System.out.println("ATTRIBUTES");
  16.119 +//	    Enumeration attributeNames = request.getAttributeNames();
  16.120 +//	    while(attributeNames.hasMoreElements()) {
  16.121 +//	      String attributeName = (String)attributeNames.nextElement();
  16.122 +//	      System.out.println(attributeName + ":" +request.getAttribute(attributeName).toString());
  16.123 +//	    }
  16.124 +//	    Enumeration paramNames = request.getParameterNames();
  16.125 +//	    while(paramNames.hasMoreElements()) {
  16.126 +//	      String paramName = (String)paramNames.nextElement();
  16.127 +//	      System.out.print(paramName + ":");
  16.128 +//	      String[] paramValues = request.getParameterValues(paramName);
  16.129 +//	      if (paramValues.length == 1) {
  16.130 +//	        String paramValue = paramValues[0];
  16.131 +//	        if (paramValue.length() == 0)
  16.132 +//	          System.out.print("No Value");
  16.133 +//	        else
  16.134 +//	          System.out.print(paramValue + " ");
  16.135 +//	      } else {
  16.136 +//	        for(int i=0; i<paramValues.length; i++) {
  16.137 +//	          System.out.println(":" + paramValues[i]);
  16.138 +//	        }
  16.139 +//	      }	    
  16.140 +//	    }
  16.141 +//		
  16.142 +//		System.out.println("\n\n\n\n\nREQUEST.CONTENTTYPE='"+request.getContentType()+"'\n\n\n\n\n");
  16.143 +		
  16.144 +		DataHive hive = new DataHive(); 
  16.145 +		
  16.146 +		hive.setSPARQLQuery(request.getParameter("SPARQLQuery"));
  16.147 +		//System.out.println("SPARQLQuery = " + this.SPARQLQuery);
  16.148 +		
  16.149 +		String reqFormat = (request.getParameter("format") == null) ? "" : request.getParameter("format");
  16.150 +		String reqAccept = (request.getHeader("accept") == null) ? "" : request.getHeader("accept");
  16.151 +		String reqFuncionality = (request.getParameter("submit") == null) ? "" : request.getParameter("submit");
  16.152 +		
  16.153 +		// check whether Update submit button was fired
  16.154 +		boolean isUpdate = (reqFuncionality.equals("Update") ? true:false);
  16.155 +		
  16.156 +		if ((reqFormat == "") && (reqAccept == "")) {
  16.157 +			hive.setFormat("HTML");
  16.158 +			response.setContentType("text/html; charset=UTF-8");			
  16.159 +		} else if (reqAccept.contains("application/vnd.google-earth.kml+xml")) {
  16.160 +			response.setContentType("application/vnd.google-earth.kml+xml; charset=UTF-8");
  16.161 +			hive.setFormat("KML");
  16.162 +		} else if (reqAccept.contains("application/sparql-results+xml")) {			
  16.163 +			response.setContentType("application/sparql-results+xml; charset=UTF-8");
  16.164 +			hive.setFormat("XML");
  16.165 +		} else if (reqAccept.contains("text/xml")) {
  16.166 +			response.setContentType("text/xml; charset=UTF-8");
  16.167 +			hive.setFormat("XML");
  16.168 +		} else if (reqFormat.equalsIgnoreCase("KML")) {
  16.169 +			response.setContentType("application/vnd.google-earth.kml+xml; charset=UTF-8");
  16.170 +			hive.setFormat("KML");
  16.171 +		} else if (reqFormat.equalsIgnoreCase("SPARQLRESULTS"))  {
  16.172 +			response.setContentType("application/sparql-results+xml; charset=UTF-8");
  16.173 +			hive.setFormat("XML");
  16.174 +		} else if (reqFormat.equalsIgnoreCase("XML"))  {
  16.175 +			response.setContentType("text/xml; charset=UTF-8");
  16.176 +			hive.setFormat("XML");
  16.177 +		} else {
  16.178 +			response.setContentType("text/html; charset=UTF-8");
  16.179 +			hive.setFormat("HTML");
  16.180 +		}
  16.181 +		//System.out.println("\n\n\n\n\format='"+this.format+"'\n\n\n\n\n");
  16.182 +		
  16.183 +		ServletContext context = getServletContext();
  16.184 +		WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(context);
  16.185 +		StrabonBeanWrapper strabonWrapper = (StrabonBeanWrapper)applicationContext.getBean("strabonBean");
  16.186 +		
  16.187 +		if (isUpdate) {
  16.188 +			try {
  16.189 +				strabonWrapper.getStrabon().update(hive.getSPARQLQuery(), strabonWrapper.getStrabon().getSailRepoConnection());
  16.190 +				response.setStatus(HttpServletResponse.SC_OK);
  16.191 +				
  16.192 +			} catch(MalformedQueryException e) {
  16.193 +				response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
  16.194 +				PrintWriter out = response.getWriter();
  16.195 +				e.printStackTrace(out);
  16.196 +			}
  16.197 +			
  16.198 +			return;
  16.199 +		}
  16.200 +
  16.201 +		PrintWriter out = response.getWriter();
  16.202 +		
  16.203 +		if ((hive.getFormat().equalsIgnoreCase("KML"))) {
  16.204 +			//try {
  16.205 +		    //     String url = "http://www.google.com";
  16.206 +		    //     java.awt.Desktop.getDesktop().browse(java.net.URI.create(url));
  16.207 +		    //     }
  16.208 +		    //  catch (java.io.IOException e) {
  16.209 +		    //     System.out.println(e.getMessage());
  16.210 +		    //     }
  16.211 +			
  16.212 +			StringBuilder errorMessage = new StringBuilder ();
  16.213 +			String answer = evaluateQuery(strabonWrapper, hive.getFormat(), reqFuncionality, hive.getSPARQLQuery(), errorMessage);
  16.214 +			hive.setErrorMessage(errorMessage.toString());
  16.215 +            SecureRandom random = new SecureRandom();
  16.216 +            String temp = new BigInteger(130, random).toString(32);        
  16.217 +            
  16.218 +            try{
  16.219 +                Date date = new Date();
  16.220 +                
  16.221 +                FileUtils.forceMkdir(new File((String) context.getRealPath("/") + "/../ROOT/tmp/"));
  16.222 +            	
  16.223 +            	Iterator it = FileUtils.iterateFiles(new File((String) context.getRealPath("/") + "/../ROOT/tmp/"), null, false);
  16.224 +                while(it.hasNext()){
  16.225 +                	File tbd = new File(((File) it.next()).getAbsolutePath());
  16.226 +                	if (FileUtils.isFileOlder( new File(tbd.getAbsolutePath()), date.getTime())){
  16.227 +                        FileUtils.forceDelete(new File(tbd.getAbsolutePath()));
  16.228 +                		}
  16.229 +                }
  16.230 +                
  16.231 +            	File file =new File((String) context.getRealPath("/") + "/../ROOT/tmp/" + temp + ".kml");
  16.232 + 
  16.233 +    	        //if file doesnt exists, then create it
  16.234 +    	        if(!file.exists()){
  16.235 +    		       file.createNewFile();
  16.236 +    	        }
  16.237 + 
  16.238 +    	        FileWriter fw = new FileWriter((String) context.getRealPath("/") + "/../ROOT/tmp/" + temp + ".kml");
  16.239 +    	        BufferedWriter bw = new BufferedWriter(fw);
  16.240 +    	        bw.write(answer);
  16.241 +    	        bw.close();
  16.242 +    	        //FileUtils.forceDeleteOnExit(new File((String) context.getRealPath("/") + "/../ROOT/tmp/" + temp + ".kml"));
  16.243 + 
  16.244 +	            //System.out.println("Done");
  16.245 + 
  16.246 +    	     }catch(IOException e){
  16.247 +    		        e.printStackTrace();
  16.248 +    	           }
  16.249 +    	     
  16.250 + 			 response.setContentType("application/vnd.google-earth.kml+xml; charset=UTF-8");
  16.251 + 			 response.setDateHeader("Expires", 0);
  16.252 + 			 InetAddress thisIp =InetAddress.getLocalHost();
  16.253 + 			 response.setHeader("Location", request.getScheme() + "://" +  request.getServerName() +":" + request.getServerPort() +"/tmp/" + temp + ".kml");
  16.254 + 			 response.setStatus(301);
  16.255 +             
  16.256 + 			 //out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">");
  16.257 +             //out.println("<html>");
  16.258 +             //out.println("<head>");
  16.259 +             //out.println("<title>:)</title>");
  16.260 +             //out.println("<meta http-equiv=\"REFRESH\" content=\"0;url=http://maps.google.com/maps?q=http://localhost:8080/tmp/temp.kml\"></HEAD>");
  16.261 +             //out.println("<BODY>");
  16.262 +             //out.println("Redirection WILL occur!");
  16.263 +             //out.println("</BODY>");
  16.264 +             //out.println("</HTML>");
  16.265 +			//out.println(answer);
  16.266 +			 
  16.267 +			 
  16.268 +    	    String pathToKML = "";
  16.269 +    	    //InetAddress thisIp = InetAddress.getLocalHost();
  16.270 +    	    
  16.271 +    	    if (answer!="")
  16.272 +			   pathToKML = request.getScheme() + "://" +  request.getServerName() +":" + request.getServerPort() +"/tmp/" + temp + ".kml";//"http://dl.dropbox.com/u/19752551/dlr.kml";
  16.273 +			
  16.274 +            appendHTML1a(out,pathToKML);
  16.275 +			
  16.276 +			appendHTMLQ(out, strabonWrapper);
  16.277 +			
  16.278 +			appendHTML1b(out);
  16.279 +			
  16.280 +			if (hive.getSPARQLQuery() != null)
  16.281 +				out.write(hive.getSPARQLQuery());
  16.282 +			
  16.283 +			appendHTML2(out);
  16.284 +			
  16.285 +			out.append("</table></td></tr></table>");
  16.286 +			
  16.287 +			appendHTML4(out);
  16.288 +			if (answer!="")
  16.289 +			   //out.append("<div id=\"map_canvas\"></div>");
  16.290 +				out.append("");
  16.291 +			appendHTML5(out);
  16.292 +		} 
  16.293 +		else if ((hive.getFormat().equalsIgnoreCase("XML"))) {
  16.294 +			response.setContentType("text/xml; charset=UTF-8");
  16.295 +			StringBuilder errorMessage = new StringBuilder ();
  16.296 +			String answer = evaluateQuery(strabonWrapper, hive.getFormat(), reqFuncionality, hive.getSPARQLQuery(), errorMessage);
  16.297 +			hive.setErrorMessage(errorMessage.toString());
  16.298 +			out.println(answer);
  16.299 +
  16.300 +		}
  16.301 +		else {
  16.302 +			
  16.303 +			appendHTML1a(out,"");
  16.304 +			
  16.305 +			appendHTMLQ(out, strabonWrapper);
  16.306 +			
  16.307 +			appendHTML1b(out);
  16.308 +			
  16.309 +			if (hive.getSPARQLQuery() != null)
  16.310 +				out.write(hive.getSPARQLQuery());
  16.311 +			
  16.312 +			appendHTML2(out);
  16.313 +			
  16.314 +			String answer = "";
  16.315 +			if (hive.getSPARQLQuery() != null) {
  16.316 +				StringBuilder errorMessage = new StringBuilder ();
  16.317 +				answer = evaluateQuery(strabonWrapper, hive.getFormat(), reqFuncionality, hive.getSPARQLQuery(), errorMessage);
  16.318 +				hive.setErrorMessage(errorMessage.toString());
  16.319 +				if (hive.getErrorMessage() != null) {
  16.320 +					appendHTML3(out, hive.getErrorMessage());
  16.321 +				}
  16.322 +			}
  16.323 +			
  16.324 +			out.append("</table></td></tr></table>");
  16.325 +			if (!answer.equals("")) {
  16.326 +				out.println("<style type=\"text/css\">");
  16.327 +				out.println("table.result    {border:1px solid #777777;}");
  16.328 +				out.println("table.result tr {border:1px dashed grey;}");
  16.329 +				out.println("table.result th {background-color:grey;color:black;}");
  16.330 +				out.println("</style>");
  16.331 +				out.println("<table class=\"result\">");
  16.332 +				out.append(answer);
  16.333 +				out.append("</table>");
  16.334 +			}
  16.335 +			appendHTML4(out);
  16.336 +			appendHTML5(out);
  16.337 +		}
  16.338 +		out.flush();
  16.339 +	}
  16.340 +
  16.341 +	public void init(ServletConfig servletConfig) throws ServletException {
  16.342 +		super.init(servletConfig);
  16.343 +	}
  16.344 +
  16.345 +	public String evaluateQuery(StrabonBeanWrapper strabonWrapper, String resultFormat, String reqFunctionality, String SPARQLQuery, StringBuilder errorMessage) {		
  16.346 +		String answer = "";
  16.347 +
  16.348 +//		System.out.println("evaluateQuery: will call wrapper. Query  = " + this.SPARQLQuery);
  16.349 +//		System.out.println("evaluateQuery: will call wrapper. result = " + resultFormat);
  16.350 +
  16.351 +		try {
  16.352 +			if (SPARQLQuery == null) {
  16.353 +				answer = "";
  16.354 +			} else {
  16.355 +				//System.out.println("evaluateQuery: Calling...");
  16.356 +				if (reqFunctionality.equals("Update")) {
  16.357 +				//if (((String)this.SPARQLQuery).toLowerCase().contains("insert") || ((String)this.SPARQLQuery).toLowerCase().contains("delete"))  { 
  16.358 +				   answer = (String)strabonWrapper.update(SPARQLQuery, resultFormat);
  16.359 +				   }
  16.360 +				else{
  16.361 +				   answer = (String)strabonWrapper.query(SPARQLQuery, resultFormat);
  16.362 +				}
  16.363 +				//System.out.println("evaluateQuery: Called...");
  16.364 +			}
  16.365 +		} catch (MalformedQueryException e) {
  16.366 +			e.printStackTrace();
  16.367 +			errorMessage.append(e.getMessage());
  16.368 +		} catch (RepositoryException e) {
  16.369 +			e.printStackTrace();
  16.370 +			errorMessage.append(e.getMessage());
  16.371 +		} catch (QueryEvaluationException e) {
  16.372 +			e.printStackTrace();
  16.373 +			errorMessage.append(e.getMessage());
  16.374 +		} catch (TupleQueryResultHandlerException e) {
  16.375 +			e.printStackTrace();
  16.376 +			errorMessage.append(e.getMessage());
  16.377 +		} catch (IOException e) {
  16.378 +			e.printStackTrace();
  16.379 +			errorMessage.append(e.getMessage());
  16.380 +		} catch (ClassNotFoundException e) {
  16.381 +			e.printStackTrace();
  16.382 +			errorMessage.append(e.getMessage());
  16.383 +		} catch (Exception e) {
  16.384 +			e.printStackTrace();
  16.385 +			errorMessage.append(e.getMessage());
  16.386 +		}
  16.387 +
  16.388 +		//System.out.println("evaluateQuery: called wrapper. answer  = " + answer);
  16.389 +		//System.out.println("evaluateQuery: called wrapper. error   = " + ((this.errorMessage == null) ? "" : this.errorMessage));
  16.390 +
  16.391 +		
  16.392 +		return answer;		
  16.393 +	}
  16.394 +	
  16.395 +	protected static void appendHTML1a(PrintWriter out, String pathToKML) {
  16.396 +		out.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
  16.397 +		out.println("<html>");
  16.398 +		out.println("<head>");
  16.399 +		out.println("<meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\" />");
  16.400 +		out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />");
  16.401 +		out.println("<link href=\"http://code.google.com/apis/maps/documentation/javascript/examples/default.css\" rel=\"stylesheet\" type=\"text/css\" />");
  16.402 +		out.println("<link rel=\"stylesheet\" href=\"style.css\" type=\"text/css\" /> ");
  16.403 +		out.println("<script type=\"text/javascript\" src=\"http://maps.googleapis.com/maps/api/js?sensor=false\"></script>");
  16.404 +		out.println("<script type=\"text/javascript\">");
  16.405 +		out.println("function initialize() {");
  16.406 +		out.println("  var chicago = new google.maps.LatLng(41.875696,-87.624207);");
  16.407 +		out.println("  var myOptions = {");
  16.408 +		out.println("    zoom: 11,");
  16.409 +		out.println("    center: chicago,");
  16.410 +		out.println("   mapTypeId: google.maps.MapTypeId.ROADMAP");
  16.411 +		out.println("  }");
  16.412 +		out.println("");
  16.413 +		out.println("  var map = new google.maps.Map(document.getElementById(\"map_canvas\"), myOptions);");
  16.414 +		out.println("");
  16.415 +		out.println("  var ctaLayer = new google.maps.KmlLayer('" + pathToKML + "');");
  16.416 +		out.println("  ctaLayer.setMap(map);");
  16.417 +		out.println("}");
  16.418 +		out.println("</script>");
  16.419 +		out.println("<style type=\"text/css\"> ");
  16.420 +		out.println("<!--");
  16.421 +		out.println(".style3 {font-size: 15px}");
  16.422 +		out.println(".style4 {font-size: 12px}");
  16.423 +		out.println(".style5 {font-size: 15px;font-weight: bold;}");
  16.424 +		out.println(".style6 {color: #FF0000}");
  16.425 +		out.println(".style7 {font-size: 14px}");
  16.426 +		out.println(" .hidden { visibility: hidden }");
  16.427 +		out.println("-->");
  16.428 +		out.println("</style> ");
  16.429 +		out.println("<title>TELEIOS: Strabon Endpoint</title>");
  16.430 +		out.println("</head>");
  16.431 +		out.println("<body topmargin=\"0\" leftmargin=\"0\" link=\"#FFFFFF\" vlink=\"#FFFFFF\" alink=\"#FFFFFF\" onload=\"initialize()\">");
  16.432 +		out.println("  <TABLE width=\"100%\" BORDER=0 CELLPADDING=0 CELLSPACING=0>");
  16.433 +		out.println("    <TR>");
  16.434 +		out.println("		");
  16.435 +		out.println("      <TD height=\"16\" background=\"images/pixi_white.gif\"><img src=\"images/pixi_white.gif\" width=\"16\" height=\"16\"></TD>");
  16.436 +		out.println("	</TR>");
  16.437 +		out.println("	<TR>");
  16.438 +		out.println("      <TD height=\"1\" background=\"images/top_bg_blue.gif\"></TD>");
  16.439 +		out.println("	</TR>		");
  16.440 +		out.println("	<TR>");
  16.441 +		out.println("      <TD height=\"60\" background=\"images/nav2_bg.gif\"> ");
  16.442 +		out.println("        <table width=\"100%\" border=\"0\">");
  16.443 +		out.println("         <tr>");
  16.444 +		out.println("            <td width=\"1\"><img src=\"images/nav2_bg.gif\" width=\"1\" height=\"60\"></td>");
  16.445 +		out.println("            <td valign=\"top\" width=\"80px\"><img border=\"0\" src=\"images/teleios_logo.png\"/></td>");
  16.446 +		out.println("            <td valign=\"top\" align=\"left\">");
  16.447 +		out.println("            <span class=\"logo\">Strabon Endpoint</span><br><span class=\"style4\">based on Strabon</span></td>");
  16.448 +		out.println("          </tr>");
  16.449 +		out.println("        </table> </TD>");
  16.450 +		out.println("	</TR>");
  16.451 +		out.println("	<TR>");
  16.452 +		out.println("      <TD height=\"21\" background=\"images/nav1_bg1.gif\">");
  16.453 +		out.println("      </TD>");
  16.454 +		out.println("	</TR>");
  16.455 +		out.println("	<TR>");
  16.456 +		out.println("      <TD height=\"2\" background=\"images/top_bg_blue.gif\"></TD>");
  16.457 +		out.println("	</TR>");
  16.458 +		out.println("</TABLE>");
  16.459 +		out.println("<form method=\"get\">");
  16.460 +
  16.461 +		out.println("<table border=\"0\" width=\"100%\"><tr> ");
  16.462 +		out.println("<td width=\"90\" valign=\"top\" bgcolor=\"#dfe8f0\"> ");
  16.463 +		out.println("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"165\" id=\"navigation\"> ");
  16.464 +		out.println("<tr><td width=\"90\" class=\"style4\"><a href=\"Query\" class=\"navText\">Query</a></td></tr> ");
  16.465 +	}
  16.466 +		
  16.467 +	protected static void appendHTML1b(PrintWriter out) {	
  16.468 +		out.println("<tr><td width=\"90\" class=\"style4\"><a href=\"store.jsp\" class=\"navText\">Store</a></td></tr> ");
  16.469 +		out.println("<tr><td width=\"90\" class=\"style4\"><a href=\"javascript:history.go(0)\" class=\"navText\">Clear</a></td></tr> ");
  16.470 +		out.println("</table>");
  16.471 +		out.println("</td>");
  16.472 +		out.println("<td width=\"*\" valign=\"top\" >"); 
  16.473 +		
  16.474 +		out.println("<table cellspacing=\"5\">");
  16.475 +		out.println("<tr>");
  16.476 +		out.println("<td style=\"border: 1px dashed #bbbbbb;\">stSPARQL Query:</td>");
  16.477 +		out.println("<td style=\"border: 1px dashed #bbbbbb;\"><textarea name=\"SPARQLQuery\" rows=\"15\" cols=\"100\">");
  16.478 +	}
  16.479 +	
  16.480 +	protected static void appendHTML2(PrintWriter out) {
  16.481 +		out.println("</textarea></td>");
  16.482 +//		out.println("<td style=\"border: 1px dashed #bbbbbb;\"><input type=\"radio\" name=\"format\" value=\"KML\">KML<br/>");
  16.483 +//		out.println("<input type=\"radio\" name=\"format\" value=\"HTML\">HTML</td>");
  16.484 +		out.println("<td style=\"border: 1px dashed #bbbbbb;\"><center>Output Format:<br/><select name=\"format\">");
  16.485 +		out.println("	<option value=\"HTML\">HTML</option>");
  16.486 +		out.println("	<option value=\"KML\">KML</option>");
  16.487 +		out.println("	<option value=\"XML\">XML</option>");
  16.488 +		out.println("</select></center></td>");
  16.489 +		out.println("</tr>");
  16.490 +		out.println("<tr>");
  16.491 +		out.println("<td colspan=2 style=\"border: 1px dashed #bbbbbb;\"><br/><center><input type=\"submit\" value=\"Query\" name=\"submit\" style=\"width: 400px\"/><br/><input type=\"submit\" value=\"Update\" name=\"submit\" style=\"width: 400px\"/></center><br/></td>");
  16.492 +		out.println("</tr>");
  16.493 +	}
  16.494 +	
  16.495 +	protected static void appendHTML3(PrintWriter out, String errorMessage) {
  16.496 +		out.println("<tr>");
  16.497 +		out.println("<td style=\"border: 1px dashed #bbbbbb;\">Result: </td>");
  16.498 +		out.println("<td style=\"border: 1px dashed #bbbbbb;\">");
  16.499 +		out.println(errorMessage);
  16.500 +		out.println("</td>");
  16.501 +		out.println("</tr>");
  16.502 +	}
  16.503 +
  16.504 +	protected static void appendHTML4(PrintWriter out) {
  16.505 +		out.println("<br/><br/>");
  16.506 +		out.println("</form>");
  16.507 +	}
  16.508 +	
  16.509 +	protected static void appendHTML5(PrintWriter out) {
  16.510 +		out.println("</body>");
  16.511 +		out.println("</html>");
  16.512 +	}
  16.513 +	
  16.514 +	protected static void appendHTMLQ(PrintWriter out, StrabonBeanWrapper strabonWrapper) {
  16.515 +		out.println("<tr><td width=\"90\">");
  16.516 +		out.println("<a href=\"Query?SPARQLQuery="+strabonWrapper.getQuery1()+"\">&nbsp;&middot;&nbsp;Query 1</a></br> ");		
  16.517 +		out.println("<a href=\"Query?SPARQLQuery="+strabonWrapper.getQuery2()+"\">&nbsp;&middot;&nbsp;Query 2</a></br> ");
  16.518 +		out.println("<a href=\"Query?SPARQLQuery="+strabonWrapper.getQuery3()+"\">&nbsp;&middot;&nbsp;Query 3</a></br> ");
  16.519 +		out.println("<a href=\"Query?SPARQLQuery="+strabonWrapper.getQuery4()+"\">&nbsp;&middot;&nbsp;Query 4</a></br> ");
  16.520 +		out.println("<a href=\"Query?SPARQLQuery="+strabonWrapper.getQuery5()+"\">&nbsp;&middot;&nbsp;Query 5</a></br> ");
  16.521 +		out.println("<a href=\"Query?SPARQLQuery="+strabonWrapper.getQuery6()+"\">&nbsp;&middot;&nbsp;Query 6</a></br> ");
  16.522 +		out.println("<a href=\"Query?SPARQLQuery="+strabonWrapper.getQuery7()+"\">&nbsp;&middot;&nbsp;Query 7</a></br>");
  16.523 +		out.println("<a href=\"Query?SPARQLQuery="+strabonWrapper.getQuery8()+"\">&nbsp;&middot;&nbsp;Query 8</a> ");
  16.524 +		out.println("</td></tr> ");
  16.525 +	}
  16.526 +}
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/webapp/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StoreBean.java	Tue Mar 20 10:54:48 2012 +0100
    17.3 @@ -0,0 +1,156 @@
    17.4 +/**
    17.5 + * 
    17.6 + */
    17.7 +package eu.earthobservatory.org.StrabonEndpoint;
    17.8 +
    17.9 +import java.io.IOException;
   17.10 +import java.util.ArrayList;
   17.11 +
   17.12 +import javax.servlet.ServletConfig;
   17.13 +import javax.servlet.ServletContext;
   17.14 +import javax.servlet.ServletException;
   17.15 +import javax.servlet.http.HttpServlet;
   17.16 +import javax.servlet.http.HttpServletRequest;
   17.17 +import javax.servlet.http.HttpServletResponse;
   17.18 +
   17.19 +import org.openrdf.rio.RDFFormat;
   17.20 +import org.openrdf.rio.RDFParseException;
   17.21 +import org.springframework.web.context.WebApplicationContext;
   17.22 +import org.springframework.web.context.support.WebApplicationContextUtils;
   17.23 +
   17.24 +/**
   17.25 + * @author charnik
   17.26 + *
   17.27 + */
   17.28 +public class StoreBean extends HttpServlet {
   17.29 +	
   17.30 +	private static final long serialVersionUID = -7541662133934957148L;
   17.31 +	
   17.32 +	/**
   17.33 +	 * Parameters used in the store.jsp file
   17.34 +	 */
   17.35 +	public static final String PARAM_DATA 		= "data";
   17.36 +	public static final String PARAM_FORMAT 	= "format";
   17.37 +	public static final String PARAM_DATA_URL	= "url";
   17.38 +	public static final String SRC_REQ			= "source_request";
   17.39 +	
   17.40 +	/**
   17.41 +	 * Error parameters used in the store.jsp file
   17.42 +	 */
   17.43 +	public static final String DATA_ERROR 		= "edata";
   17.44 +	public static final String FORMAT_ERROR 	= "eformat";
   17.45 +	public static final String STORE_ERROR 		= "estore";
   17.46 +	
   17.47 +	/**
   17.48 +	 * Submit buttons
   17.49 +	 */
   17.50 +	public static final String SUBMIT_INPUT		= "dsubmit";
   17.51 +	public static final String SUBMIT_URL		= "fromurl";
   17.52 +	
   17.53 +	/**
   17.54 +	 * Parameter for successful store used in the store.jsp file
   17.55 +	 */
   17.56 +	public static final String STORE_OK			= "storeOK";
   17.57 +	
   17.58 +	/**
   17.59 +	 * Keeps the registered and available RDF formats.
   17.60 +	 */
   17.61 +	public static ArrayList<String> registeredFormats;
   17.62 +	
   17.63 +	/**
   17.64 +	 * Strabon wrapper
   17.65 +	 */
   17.66 +	private StrabonBeanWrapper strabon;
   17.67 +	
   17.68 +	@Override
   17.69 +	public void init(ServletConfig servletConfig) throws ServletException {
   17.70 +		super.init(servletConfig);
   17.71 +		
   17.72 +		// get strabon wrapper
   17.73 +		ServletContext context = getServletContext();
   17.74 +		WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(context);
   17.75 +		strabon = (StrabonBeanWrapper) applicationContext.getBean("strabonBean");
   17.76 +		
   17.77 +		// initialize registered and available formats
   17.78 +		registeredFormats = new ArrayList<String>();
   17.79 +		for (RDFFormat format : RDFFormat.values()) {
   17.80 +			registeredFormats.add(format.getName());
   17.81 +		}
   17.82 +	}
   17.83 +	
   17.84 +	@Override
   17.85 +	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
   17.86 +		doPost(request, response);
   17.87 +	}
   17.88 +	
   17.89 +	@Override
   17.90 +	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
   17.91 +		// check whether we read from INPUT or URL
   17.92 +		boolean input = (request.getParameter(SUBMIT_URL) != null) ? false:true;
   17.93 +		
   17.94 +		// check if the request was from store.jsp
   17.95 +		boolean browser = (request.getParameter(SRC_REQ) != null) ? true:false;
   17.96 +		
   17.97 +		// RDF data to store
   17.98 +		String data = null;
   17.99 +		
  17.100 +		// the format of the data
  17.101 +		String format = null;
  17.102 +		
  17.103 +		format = request.getParameter(PARAM_FORMAT);
  17.104 +		data = input ? request.getParameter(PARAM_DATA):request.getParameter(PARAM_DATA_URL); 
  17.105 +		
  17.106 +		if (data == null) { 
  17.107 +			if (browser) {
  17.108 +				redirect(response, DATA_ERROR);
  17.109 +				
  17.110 +			} else {
  17.111 +				response.sendError(HttpServletResponse.SC_NO_CONTENT);
  17.112 +			}
  17.113 +			return ;
  17.114 +		}
  17.115 +		
  17.116 +		// get input format
  17.117 +		RDFFormat rdfFormat = RDFFormat.valueOf(format); 
  17.118 +		
  17.119 +		if (rdfFormat == null) { // unknown format
  17.120 +			if (browser) {
  17.121 +				redirect(response, FORMAT_ERROR);
  17.122 +				
  17.123 +			} else {
  17.124 +				response.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
  17.125 +			}
  17.126 +			
  17.127 +			return ;
  17.128 +		}		
  17.129 +		
  17.130 +		// store data
  17.131 +		try {
  17.132 +			strabon.store(data, rdfFormat, !input);
  17.133 +			
  17.134 +			// store was successful, return the respective message
  17.135 +			if (browser) {
  17.136 +				redirect(response, STORE_OK);
  17.137 +				
  17.138 +			} else {
  17.139 +				response.sendError(HttpServletResponse.SC_OK);
  17.140 +			}
  17.141 +		} catch (Exception e) {
  17.142 +			if (browser) {
  17.143 +				redirect(response, STORE_ERROR);
  17.144 +			} else {
  17.145 +				if (e instanceof RDFParseException) {
  17.146 +					response.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
  17.147 +				} else {
  17.148 +					response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
  17.149 +				}
  17.150 +			}
  17.151 +			System.err.println(e.getMessage());
  17.152 +		}
  17.153 +	}
  17.154 +	
  17.155 +	private void redirect(HttpServletResponse response, String error) {
  17.156 +		response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
  17.157 +        response.setHeader("Location", "store.jsp?" + error + "=");
  17.158 +	}
  17.159 +}
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/webapp/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StrabonBeanWrapper.java	Tue Mar 20 10:54:48 2012 +0100
    18.3 @@ -0,0 +1,262 @@
    18.4 +package eu.earthobservatory.org.StrabonEndpoint;
    18.5 +
    18.6 +import java.io.IOException;
    18.7 +import java.io.StringReader;
    18.8 +import java.net.URL;
    18.9 +import java.sql.SQLException;
   18.10 +
   18.11 +import org.openrdf.model.Resource;
   18.12 +import org.openrdf.query.MalformedQueryException;
   18.13 +import org.openrdf.query.QueryEvaluationException;
   18.14 +import org.openrdf.query.TupleQueryResultHandlerException;
   18.15 +import org.openrdf.repository.RepositoryException;
   18.16 +import org.openrdf.repository.sail.SailRepositoryConnection;
   18.17 +import org.openrdf.rio.RDFFormat;
   18.18 +import org.openrdf.rio.RDFParseException;
   18.19 +
   18.20 +import eu.earthobservatory.runtime.postgis.Strabon;
   18.21 +
   18.22 +public class StrabonBeanWrapper implements org.springframework.beans.factory.DisposableBean {
   18.23 +	private String serverName;
   18.24 +	private int port;
   18.25 +	private String databaseName;
   18.26 +	private String user;
   18.27 +	private String password;
   18.28 +	
   18.29 +	private Strabon strabon = null;
   18.30 +	private boolean checkForLockTable;
   18.31 +	private String query1;
   18.32 +	private String query2;
   18.33 +	private String query3;
   18.34 +	private String query4;
   18.35 +	private String query5;
   18.36 +	private String query6;
   18.37 +	private String query7;
   18.38 +	private String query8;
   18.39 +	
   18.40 +	public StrabonBeanWrapper() {
   18.41 +		this.strabon = null;
   18.42 +	}
   18.43 +	
   18.44 +	public StrabonBeanWrapper(Strabon strabon) {
   18.45 +		this.strabon = strabon;
   18.46 +	}
   18.47 +	
   18.48 +	public StrabonBeanWrapper(String databaseName, String user, String password, int port, String serverName, boolean checkForLockTable, String query1, String query2, String query3, String query4, String query5, String query6, String query7, String query8) {
   18.49 +		this.serverName = serverName;
   18.50 +		this.port = port;
   18.51 +		this.databaseName = databaseName;
   18.52 +		this.user = user;
   18.53 +		this.password = password;
   18.54 +		this.checkForLockTable = checkForLockTable;
   18.55 +		//this.strabon = new Strabon(databaseName, user, password, port, serverName, checkForLockTable);
   18.56 +		this.query1 = query1;
   18.57 +		this.query2 = query2;
   18.58 +		this.query3 = query3;
   18.59 +		this.query4 = query4;
   18.60 +		this.query5 = query5;
   18.61 +		this.query6 = query6;
   18.62 +		this.query7 = query7;
   18.63 +		this.query8 = query8;
   18.64 +		
   18.65 +		init();
   18.66 +	}
   18.67 +	
   18.68 +	private boolean init() {
   18.69 +		if (this.strabon == null) {
   18.70 +			try {
   18.71 +				System.err.println("Strabon not initialized yet.");
   18.72 +				System.err.println("Initializing strabon.");
   18.73 +				System.out.println(this.getDetails());
   18.74 +				this.strabon = new Strabon(databaseName, user, password, port, serverName, checkForLockTable);
   18.75 +			} catch (Exception e) {
   18.76 +				System.err.println("Exception occured while creating Strabon.\n"+this.getDetails());
   18.77 +				e.printStackTrace();
   18.78 +				return false;
   18.79 +			}
   18.80 +		}
   18.81 +		
   18.82 +		return true;
   18.83 +	}
   18.84 +	
   18.85 +	public StrabonBeanWrapper(String databaseName, String user, String password, int port, String serverName) throws SQLException, ClassNotFoundException {
   18.86 +		this.strabon = new Strabon(databaseName, user, password, port, serverName, true);
   18.87 +	}
   18.88 +
   18.89 +	public Strabon getStrabon() {
   18.90 +		return strabon;
   18.91 +	}
   18.92 +
   18.93 +	public void setStrabon(Strabon strabon) {
   18.94 +		this.strabon = strabon;
   18.95 +	}
   18.96 +
   18.97 +	public void destroy() throws Exception {
   18.98 +		strabon.close();
   18.99 +	}
  18.100 +	
  18.101 +	
  18.102 +	
  18.103 +	public Object query(String queryString, String answerFormatStrabon) throws MalformedQueryException, RepositoryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException, ClassNotFoundException {
  18.104 +		if ((this.strabon == null) && (!init())) {
  18.105 +			throw new RepositoryException("Could not connect to Strabon.");
  18.106 +		} 
  18.107 +		
  18.108 +    	//String newQueryString = TemporalWrapper.rebuildQuery(queryString);
  18.109 +    	
  18.110 +    	System.out.println("================================================================");
  18.111 +    	System.out.println("Query:");
  18.112 +    	System.out.println(queryString);
  18.113 +    	System.out.println("================================================================");
  18.114 +    	System.out.println("Answer format: " + answerFormatStrabon);
  18.115 +    	System.out.println("================================================================");
  18.116 +    	//System.out.println("Rewritten query:");
  18.117 +    	//System.out.println(newQueryString);
  18.118 +    	//System.out.println("================================================================");
  18.119 +		
  18.120 +   		//return strabon.query(newQueryString, answerFormatStrabon, strabon.getSailRepoConnection());
  18.121 +		return strabon.query(queryString, answerFormatStrabon, strabon.getSailRepoConnection());
  18.122 +	}
  18.123 +	
  18.124 +	public Object update(String updateString, String answerFormatStrabon) throws MalformedQueryException, RepositoryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException, ClassNotFoundException {
  18.125 +		if ((this.strabon == null) && (!init())) {
  18.126 +			throw new RepositoryException("Could not connect to Strabon.");
  18.127 +		} 
  18.128 +		
  18.129 +    	//String newQueryString = TemporalWrapper.rebuildQuery(queryString);
  18.130 +    	
  18.131 +    	System.out.println("================================================================");
  18.132 +    	System.out.println("Update:");
  18.133 +    	System.out.println(updateString);
  18.134 +    	System.out.println("================================================================");
  18.135 +    	System.out.println("Answer format: " + answerFormatStrabon);
  18.136 +    	System.out.println("================================================================");
  18.137 +    	//System.out.println("Rewritten query:");
  18.138 +    	//System.out.println(newQueryString);
  18.139 +    	//System.out.println("================================================================");
  18.140 +		
  18.141 +   		//return strabon.query(newQueryString, answerFormatStrabon, strabon.getSailRepoConnection());
  18.142 +		strabon.update(updateString, strabon.getSailRepoConnection());
  18.143 +		return "OK!";
  18.144 +	}
  18.145 +
  18.146 +	/**
  18.147 +	 * Store the given data in the given format into Strabon repository. If url is true, then
  18.148 +	 * input comes from a URL. 
  18.149 +	 * 
  18.150 +	 * Returns true on success, false otherwise.
  18.151 +	 * 
  18.152 +	 * @param source_data
  18.153 +	 * @param format
  18.154 +	 * @param url
  18.155 +	 * @return
  18.156 +	 * @throws MalformedQueryException
  18.157 +	 * @throws RepositoryException
  18.158 +	 * @throws QueryEvaluationException
  18.159 +	 * @throws TupleQueryResultHandlerException
  18.160 +	 * @throws IOException
  18.161 +	 * @throws ClassNotFoundException
  18.162 +	 */
  18.163 +	public boolean store(String source_data, RDFFormat format, boolean url) throws Exception {
  18.164 +		if ((this.strabon == null) && (!init())) {
  18.165 +			throw new RepositoryException("Could not connect to Strabon.");
  18.166 +		}
  18.167 +		
  18.168 +		// get sail connection
  18.169 +		SailRepositoryConnection conn = strabon.getSailRepoConnection();
  18.170 +		
  18.171 +		try {
  18.172 +			// store data
  18.173 +			if (url) {
  18.174 +				conn.add(new URL(source_data), "", format, new Resource[1]);
  18.175 +				
  18.176 +			} else {
  18.177 +				conn.add(new StringReader(source_data), "", format, new Resource[1]);
  18.178 +			}
  18.179 +			
  18.180 +		} catch (Exception e) {
  18.181 +			throw e;
  18.182 +		}
  18.183 +		
  18.184 +    	return true;
  18.185 +	}
  18.186 +	
  18.187 +	private String getDetails() {
  18.188 +		String details = "-----------------------------------------\n";
  18.189 +		details += "Connection details:\n";
  18.190 +		details += "host     : " + serverName + "\n";
  18.191 +		details += "port     : " + port + "\n";
  18.192 +		details += "database : " + databaseName + "\n";
  18.193 +		details += "user     : " + user + "\n";
  18.194 +		details += "password : " + password + "\n";
  18.195 +		details += "-----------------------------------------\n";
  18.196 +
  18.197 +		return details;
  18.198 +	}
  18.199 +
  18.200 +	public String getQuery1() {
  18.201 +		return query1;
  18.202 +	}
  18.203 +
  18.204 +	public void setQuery1(String query1) {
  18.205 +		this.query1 = query1;
  18.206 +	}
  18.207 +
  18.208 +	public String getQuery2() {
  18.209 +		return query2;
  18.210 +	}
  18.211 +
  18.212 +	public void setQuery2(String query2) {
  18.213 +		this.query2 = query2;
  18.214 +	}
  18.215 +
  18.216 +	public String getQuery3() {
  18.217 +		return query3;
  18.218 +	}
  18.219 +
  18.220 +	public void setQuery3(String query3) {
  18.221 +		this.query3 = query3;
  18.222 +	}
  18.223 +	
  18.224 +	public String getQuery4() {
  18.225 +		return query4;
  18.226 +	}
  18.227 +
  18.228 +	public void setQuery4(String query4) {
  18.229 +		this.query4 = query4;
  18.230 +	}
  18.231 +
  18.232 +	public String getQuery5() {
  18.233 +		return query5;
  18.234 +	}
  18.235 +
  18.236 +	public void setQuery5(String query5) {
  18.237 +		this.query5 = query5;
  18.238 +	}
  18.239 +
  18.240 +	public String getQuery6() {
  18.241 +		return query6;
  18.242 +	}
  18.243 +
  18.244 +	public void setQuery6(String query6) {
  18.245 +		this.query6 = query6;
  18.246 +	}
  18.247 +
  18.248 +	public String getQuery7() {
  18.249 +		return query7;
  18.250 +	}
  18.251 +
  18.252 +	public void setQuery7(String query7) {
  18.253 +		this.query7 = query7;
  18.254 +	}
  18.255 +	public String getQuery8() {
  18.256 +		return query8;
  18.257 +	}
  18.258 +
  18.259 +	public void setQuery8(String query8) {
  18.260 +		this.query8 = query8;
  18.261 +	}
  18.262 +	
  18.263 +	
  18.264 +}
  18.265 +
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/webapp/src/main/webapp/WEB-INF/web.xml	Tue Mar 20 10:54:48 2012 +0100
    19.3 @@ -0,0 +1,12 @@
    19.4 +<?xml version="1.0" encoding="UTF-8"?>
    19.5 +<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" id="WebApp_ID">
    19.6 +	<display-name>StrabonEndpoint</display-name>
    19.7 +	<welcome-file-list>
    19.8 +		<welcome-file>index.html</welcome-file>
    19.9 +		<welcome-file>index.htm</welcome-file>
   19.10 +		<welcome-file>index.jsp</welcome-file>
   19.11 +		<welcome-file>default.html</welcome-file>
   19.12 +		<welcome-file>default.htm</welcome-file>
   19.13 +		<welcome-file>default.jsp</welcome-file>
   19.14 +	</welcome-file-list>
   19.15 +</web-app>
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/webapp/src/main/webapp/index.jsp	Tue Mar 20 10:54:48 2012 +0100
    20.3 @@ -0,0 +1,13 @@
    20.4 +<%@page contentType="text/html" pageEncoding="UTF-8"%>
    20.5 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    20.6 +   "http://www.w3.org/TR/html4/loose.dtd">
    20.7 +
    20.8 +<html>
    20.9 +    <head>
   20.10 +        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   20.11 +        <title>JSP Page</title>
   20.12 +    </head>
   20.13 +    <body>
   20.14 +        <h1>Hello World!</h1>
   20.15 +    </body>
   20.16 +</html>