Strabon

changeset 75:fac311d00d26

removing old module
author Kostis Kyzirakos <kkyzir@di.uoa.gr>
date Thu Mar 22 13:06:03 2012 +0100 (2012-03-22)
parents 54cc5fd21f65
children e2a9aab812bf
files 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/webapp/WebContent/WEB-INF/beans.xml	Thu Mar 22 12:36:56 2012 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,74 +0,0 @@
     1.4 -<?xml version="1.0" encoding="UTF-8"?>
     1.5 -<beans xmlns="http://www.springframework.org/schema/beans"
     1.6 -	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
     1.7 -	xsi:schemaLocation="http://www.springframework.org/schema/beans 
     1.8 -						http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
     1.9 -						http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
    1.10 -	<import resource="classpath:META-INF/cxf/cxf.xml" />
    1.11 -	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
    1.12 -	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
    1.13 -
    1.14 -	<bean id="strabonBean" class="eu.earthobservatory.org.StrabonEndpoint.StrabonBeanWrapper" destroy-method="destroy">
    1.15 -		<constructor-arg type="java.lang.String">
    1.16 -			<!-- Database name -->
    1.17 -			<value>endpoint</value>
    1.18 -		</constructor-arg>
    1.19 -		<constructor-arg type="java.lang.String">
    1.20 -			<!-- Username -->
    1.21 -			<value>postgres</value>
    1.22 -		</constructor-arg>
    1.23 -		<constructor-arg type="java.lang.String">
    1.24 -			<!-- Password -->
    1.25 -			<value>p1r3as</value>
    1.26 -		</constructor-arg>
    1.27 -		<constructor-arg type="int">
    1.28 -			<!-- Port -->
    1.29 -			<value>5432</value>
    1.30 -		</constructor-arg>
    1.31 -		<constructor-arg type="java.lang.String">
    1.32 -			<!-- Database server -->
    1.33 -			<value>localhost</value>
    1.34 -		</constructor-arg>
    1.35 -		<constructor-arg type="boolean">
    1.36 -			<!-- Check for locks and remove them (in case of a crash) -->
    1.37 -			<value>true</value>
    1.38 -		</constructor-arg>
    1.39 -		<constructor-arg type="java.lang.String">
    1.40 -			<!-- Query1 -->
    1.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>
    1.42 -		</constructor-arg>
    1.43 -		<constructor-arg type="java.lang.String">
    1.44 -			<!-- Query2 -->
    1.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>
    1.46 -		</constructor-arg>
    1.47 -		<constructor-arg type="java.lang.String">
    1.48 -			<!-- Query3 -->
    1.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>
    1.50 -		</constructor-arg>
    1.51 -		<constructor-arg type="java.lang.String">
    1.52 -			<!-- Query4 -->
    1.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>
    1.54 -		</constructor-arg>
    1.55 -		<constructor-arg type="java.lang.String">
    1.56 -			<!-- Query5 -->
    1.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>
    1.58 -		</constructor-arg>
    1.59 -		<constructor-arg type="java.lang.String">
    1.60 -			<!-- Query6 -->
    1.61 -                        <value><![CDATA[]]></value>
    1.62 -		</constructor-arg>
    1.63 -		<constructor-arg type="java.lang.String">
    1.64 -			<!-- Query7 -->
    1.65 -                        <value><![CDATA[]]></value>
    1.66 -		</constructor-arg>
    1.67 -		<constructor-arg type="java.lang.String">
    1.68 -			<!-- Query8 -->
    1.69 -                        <value><![CDATA[]]></value>
    1.70 -		</constructor-arg>
    1.71 -	</bean>
    1.72 -
    1.73 -<!-- 	<bean id="queryBean" class="eu.earthobservatory.org.StrabonEndpoint.QueryBean"> -->
    1.74 -<!-- 		<property name="strabon" ref="strabonBean" /> -->
    1.75 -<!-- 	</bean> -->
    1.76 -
    1.77 -</beans>
     2.1 --- a/webapp/WebContent/WEB-INF/web.xml	Thu Mar 22 12:36:56 2012 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,53 +0,0 @@
     2.4 -<?xml version="1.0" encoding="UTF-8"?>
     2.5 -<web-app id="WebApp_ID" version="2.4"
     2.6 -	xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     2.7 -	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
     2.8 -	<display-name>StrabonEndpoint</display-name>
     2.9 -	<context-param>
    2.10 -		<param-name>contextConfigLocation</param-name>
    2.11 -		<param-value>WEB-INF/beans.xml</param-value>
    2.12 -	</context-param>
    2.13 -	<listener>
    2.14 -		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    2.15 -	</listener>
    2.16 -		
    2.17 -	<servlet>
    2.18 -		<display-name>Query</display-name>
    2.19 -		<servlet-name>Query</servlet-name>
    2.20 -		<servlet-class>eu.earthobservatory.org.StrabonEndpoint.QueryBean</servlet-class>
    2.21 -		<load-on-startup>1</load-on-startup>
    2.22 -	</servlet>
    2.23 -	<servlet-mapping>
    2.24 -		<servlet-name>Query</servlet-name>
    2.25 -		<url-pattern>/Query</url-pattern>
    2.26 -	</servlet-mapping>
    2.27 -	
    2.28 -	<servlet>
    2.29 -		<display-name>Store</display-name>
    2.30 -		<servlet-name>Store</servlet-name>
    2.31 -		<servlet-class>eu.earthobservatory.org.StrabonEndpoint.StoreBean</servlet-class>
    2.32 -		<load-on-startup>1</load-on-startup>
    2.33 -	</servlet>
    2.34 -	<servlet-mapping>
    2.35 -		<servlet-name>Store</servlet-name>
    2.36 -		<url-pattern>/Store</url-pattern>
    2.37 -	</servlet-mapping>
    2.38 -	
    2.39 -<!-- 	<servlet> -->
    2.40 -<!-- 		<display-name>QueryServlet</display-name> -->
    2.41 -<!-- 		<servlet-name>QueryServlet</servlet-name> -->
    2.42 -<!-- 		<servlet-class>eu.earthobservatory.QueryServlet</servlet-class> -->
    2.43 -<!-- 		<load-on-startup>1</load-on-startup> -->
    2.44 -<!-- 	</servlet> -->
    2.45 -<!-- 	<servlet-mapping> -->
    2.46 -<!-- 		<servlet-name>QueryServlet</servlet-name> -->
    2.47 -<!-- 		<url-pattern>/QueryServlet</url-pattern> -->
    2.48 -<!-- 	</servlet-mapping> -->
    2.49 -	
    2.50 -	<session-config>
    2.51 -		<session-timeout>60</session-timeout>
    2.52 -	</session-config>
    2.53 -	<welcome-file-list>
    2.54 -		<welcome-file>Query</welcome-file>
    2.55 -	</welcome-file-list>
    2.56 -</web-app>
     3.1 Binary file webapp/WebContent/images/base_bg1.gif has changed
     4.1 Binary file webapp/WebContent/images/base_bg2.gif has changed
     5.1 Binary file webapp/WebContent/images/nav1_bg1.gif has changed
     6.1 Binary file webapp/WebContent/images/nav2_bg.gif has changed
     7.1 Binary file webapp/WebContent/images/pixi_white.gif has changed
     8.1 Binary file webapp/WebContent/images/spacer.gif has changed
     9.1 Binary file webapp/WebContent/images/teleios_logo.png has changed
    10.1 Binary file webapp/WebContent/images/top_bg_blue.gif has changed
    11.1 Binary file webapp/WebContent/images/top_twogreys.gif has changed
    12.1 --- a/webapp/WebContent/store.jsp	Thu Mar 22 12:36:56 2012 +0100
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,139 +0,0 @@
    12.4 -<%@ page import = "eu.earthobservatory.org.StrabonEndpoint.StoreBean" %>
    12.5 -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    12.6 -<html>
    12.7 -<head>
    12.8 -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    12.9 -<link rel="stylesheet" href="style.css" type="text/css" /> 
   12.10 -<style type="text/css"> 
   12.11 -<!--
   12.12 -.style3 {font-size: 15px}
   12.13 -.style4 {font-size: 12px}
   12.14 -.style5 {font-size: 15px;font-weight: bold;}
   12.15 -.style6 {color: #FF0000}
   12.16 -.style7 {font-size: 14px}
   12.17 - .hidden { visibility: hidden }
   12.18 --->
   12.19 -</style> 
   12.20 -<title>TELEIOS: Strabon Endpoint</title>
   12.21 -</head>
   12.22 -<body topmargin="0" leftmargin="0" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
   12.23 -  <TABLE width="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0>
   12.24 -    <TR>
   12.25 -		
   12.26 -      <TD height="16" background="images/pixi_white.gif"><img src="images/pixi_white.gif" width="16" height="16"></TD>
   12.27 -	</TR>
   12.28 -	<TR>
   12.29 -      <TD height="1" background="images/top_bg_blue.gif"></TD>
   12.30 -	</TR>		
   12.31 -	<TR>
   12.32 -      <TD height="60" background="images/nav2_bg.gif"> 
   12.33 -        <table width="100%" border="0">
   12.34 -         <tr>
   12.35 -            <td width="1"><img src="images/nav2_bg.gif" width="1" height="60"></td>
   12.36 -            <td valign="top" width="80px"><img border="0" src="images/teleios_logo.png"/></td>
   12.37 -            <td valign="top" align="left">
   12.38 -            <span class="logo">Strabon Endpoint</span><br><span class="style4">based on Strabon</span></td>
   12.39 -          </tr>
   12.40 -        </table> </TD>
   12.41 -	</TR>
   12.42 -	<TR>
   12.43 -      <TD height="21" background="images/nav1_bg1.gif">
   12.44 -      </TD>
   12.45 -	</TR>
   12.46 -	<TR>
   12.47 -      <TD height="2" background="images/top_bg_blue.gif"></TD>
   12.48 -	</TR>
   12.49 -</TABLE>
   12.50 -
   12.51 -<FORM method="get" action=Store>
   12.52 -<INPUT type=hidden name="<%=StoreBean.SRC_REQ%>" value="browser"/>
   12.53 -
   12.54 -<TABLE border="0" width="100%">
   12.55 -<tr> 
   12.56 -	<td width="90" valign="top" bgcolor="#dfe8f0"> 
   12.57 -		<TABLE border="0" cellspacing="0" cellpadding="0" width="165" id="navigation">
   12.58 -			<tr><td width="90" class="style4"><a href="Query" class="navText">Query</a></td></tr> 
   12.59 -			<tr><td width="90" class="style4"><a href="javascript:history.go(0)" class="navText">Clear</a></td></tr> 
   12.60 -		</TABLE>
   12.61 -	</td>
   12.62 -	<td width="*" valign="top" >
   12.63 -		<TABLE cellspacing="5">
   12.64 -<%
   12.65 -	if (request.getParameter(StoreBean.DATA_ERROR) != null) {
   12.66 -  		%>
   12.67 -  		<TR><TD colspan=3>
   12.68 -  		<CENTER><P style="color: red;">No data provided!</P></CENTER>
   12.69 -  		</TD></TR>
   12.70 -  		<%
   12.71 -  	}
   12.72 -  		
   12.73 -  	if (request.getParameter(StoreBean.FORMAT_ERROR) != null) {
   12.74 -  		%>
   12.75 -  		<TR><TD colspan=3>
   12.76 -  		<CENTER><P style="color: red;">Unknown RDF Format!</P></CENTER>
   12.77 -  		</TD></TR>
   12.78 -  		<%
   12.79 -  	}
   12.80 -  	
   12.81 -  	if (request.getParameter(StoreBean.STORE_ERROR) != null) {
   12.82 -  		%>
   12.83 -  		<TR><TD colspan=3>
   12.84 -  		<CENTER><P style="color: red;">An error occurred while storing input data!</P></CENTER>
   12.85 -  		</TD></TR>
   12.86 -  		<%
   12.87 -  	}
   12.88 -  	
   12.89 -  	if (request.getParameter(StoreBean.STORE_OK) != null) {
   12.90 -  		%>
   12.91 -  		<TR><TD colspan=3>
   12.92 -  		<CENTER><P>Data stored successfully!</P></CENTER>
   12.93 -  		</TD></TR>
   12.94 -  		<%
   12.95 -  	}
   12.96 -%>
   12.97 -	<tr>
   12.98 -	<!--  direct input form -->
   12.99 -		<td style="border: 1px dashed #bbbbbb;">Direct Input:</td>
  12.100 -		<td style="border: 1px dashed #bbbbbb;">
  12.101 -			<textarea name="<%=StoreBean.PARAM_DATA%>" rows="15" cols="100"></textarea></td>
  12.102 -		<td rowspan=4 style="border: 1px dashed #bbbbbb;">
  12.103 -			<CENTER>RDF Format:<br/>
  12.104 -				<SELECT name="<%=StoreBean.PARAM_FORMAT%>">
  12.105 -				<% for (String format : StoreBean.registeredFormats) {%>
  12.106 -					<OPTION value="<%=format%>"><%=format%></OPTION>
  12.107 -				<%}%>
  12.108 -				</SELECT>
  12.109 -			</CENTER>
  12.110 -		</td>
  12.111 -	</tr>
  12.112 -	<tr>
  12.113 -		<td colspan=2 style="border: 1px dashed #bbbbbb;"><br/>
  12.114 -		<CENTER>
  12.115 -			<input type="submit" value="Store Input" name="<%=StoreBean.SUBMIT_INPUT%>" style="width: 400px"/>
  12.116 -		</CENTER><br/>
  12.117 -		</td>
  12.118 -	</tr>
  12.119 -	
  12.120 -	<tr>
  12.121 -		<td style="border: 1px dashed #bbbbbb;">URI Input:</td>
  12.122 -		<td style="border: 1px dashed #bbbbbb;">
  12.123 -			<textarea name="<%=StoreBean.PARAM_DATA_URL%>" rows="1" cols="100"></textarea>
  12.124 -		</td>
  12.125 -	</tr>
  12.126 -	
  12.127 -	<tr>
  12.128 -		<td colspan=2 style="border: 1px dashed #bbbbbb;"><br/>
  12.129 -			<CENTER>
  12.130 -				<INPUT type="submit" value="Store from URI" name="<%=StoreBean.SUBMIT_URL%>" style="width: 400px"/>
  12.131 -			</CENTER><br/>
  12.132 -		</td>
  12.133 -	</tr>
  12.134 -	
  12.135 -	</TABLE>
  12.136 -	</td>
  12.137 -</tr>
  12.138 -</TABLE>
  12.139 -</FORM>
  12.140 -<br/><br/><br/><br/><br/>
  12.141 -</BODY>
  12.142 -</HTML>
  12.143 \ No newline at end of file
    13.1 --- a/webapp/WebContent/style.css	Thu Mar 22 12:36:56 2012 +0100
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,101 +0,0 @@
    13.4 -/* Global Styles */
    13.5 -
    13.6 -body {
    13.7 -	margin:0px;
    13.8 -	}
    13.9 -	
   13.10 -td {
   13.11 -	font:11px Arial, Helvetica, sans-serif;
   13.12 -	color:#222222;
   13.13 -	font-size: 15px
   13.14 -	}
   13.15 -	
   13.16 -a {
   13.17 -	color: darkblue;
   13.18 -	}	
   13.19 -a:hover {
   13.20 -	color: blue;
   13.21 -	}
   13.22 -
   13.23 -p {
   13.24 -	text-align: justify
   13.25 -}
   13.26 -
   13.27 -/* ID Styles */
   13.28 -
   13.29 -#navigation td {
   13.30 -	border-bottom: 1px solid #8da3b1;
   13.31 -	}
   13.32 -	
   13.33 -#navigation a {
   13.34 -	font: bold 11px Arial, Helvetica, sans-serif;
   13.35 -	color: #5f7383;
   13.36 -	line-height:16px;
   13.37 -	letter-spacing:.1em;
   13.38 -	text-decoration: none;
   13.39 -	display:block;
   13.40 -	padding:8px 6px 10px 20px;
   13.41 -	}
   13.42 -	
   13.43 -#navigation a:hover {
   13.44 -	background: #5f7383;
   13.45 -	color:#dfe8f0;
   13.46 -	}
   13.47 -	
   13.48 -.logo 	{
   13.49 -	font:24px Arial, Helvetica, sans-serif;
   13.50 -	color: #333333;
   13.51 -	letter-spacing:.2em;
   13.52 -	line-height:30px;
   13.53 -	}
   13.54 -
   13.55 -#tagline 	{	
   13.56 -	font:11px Arial, Helvetica, sans-serif;
   13.57 -	color: #993300;
   13.58 -	letter-spacing:.4em;
   13.59 -	line-height:18px;
   13.60 -	}
   13.61 -	
   13.62 -/* Class Styles */
   13.63 -	
   13.64 -.bodyText {
   13.65 -	font:11px Arial, Helvetica, sans-serif;
   13.66 -	color:#666666;
   13.67 -	line-height:20px;
   13.68 -	margin-top:0px;
   13.69 -	}
   13.70 -	
   13.71 -.pageName{
   13.72 -	font: 18px Arial, Helvetica, sans-serif;
   13.73 -	color: #99CC66;
   13.74 -	line-height:26px;
   13.75 -	letter-spacing:.21em;
   13.76 -	}
   13.77 -	
   13.78 -.subHeader {
   13.79 -	font:bold 11px Arial, Helvetica, sans-serif;
   13.80 -	color: #993300;
   13.81 -	line-height:22px;
   13.82 -	letter-spacing:.2em;
   13.83 -	}
   13.84 -
   13.85 -.quote {
   13.86 -	font: 20px Arial, Helvetica, sans-serif;
   13.87 -	color: #759DA1;
   13.88 -	line-height:30px;
   13.89 -	}
   13.90 -	
   13.91 -.smallText {
   13.92 -	font: 10px Arial, Helvetica, sans-serif;
   13.93 -	color: #666666;
   13.94 -	line-height: 22px;
   13.95 -	}
   13.96 -	
   13.97 -.navText {
   13.98 -	font: 11px Arial, Helvetica, sans-serif;
   13.99 -	color: #003366;
  13.100 -	line-height:16px;
  13.101 -	letter-spacing:.1em;
  13.102 -	text-decoration: none;
  13.103 -	}
  13.104 -	
    14.1 --- a/webapp/pom.xml	Thu Mar 22 12:36:56 2012 +0100
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,219 +0,0 @@
    14.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">
    14.5 -	<modelVersion>4.0.0</modelVersion>
    14.6 -
    14.7 -	<parent>
    14.8 -		<groupId>eu.earthobservatory</groupId>
    14.9 -		<artifactId>strabon</artifactId>
   14.10 -		<version>3.1.8-SNAPSHOT</version>
   14.11 -	</parent>
   14.12 -  
   14.13 -	<groupId>eu.earthobservatory</groupId>
   14.14 -	<artifactId>StrabonEndpoint</artifactId>
   14.15 -	<version>3.1.8-SNAPSHOT</version>
   14.16 -	<packaging>war</packaging>
   14.17 -
   14.18 -	<name>StrabonEndpoint</name>
   14.19 -	<description>An endpoint for Strabon</description>
   14.20 -
   14.21 -	<properties>
   14.22 -		<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
   14.23 -	</properties>
   14.24 -
   14.25 -	<dependencies>
   14.26 -		<dependency>
   14.27 -			<groupId>javax</groupId>
   14.28 -			<artifactId>javaee-web-api</artifactId>
   14.29 -			<scope>provided</scope>
   14.30 -		</dependency>
   14.31 -
   14.32 -		<dependency>
   14.33 -			<groupId>eu.earthobservatory</groupId>
   14.34 -			<artifactId>strabon-runtime</artifactId>
   14.35 -			<type>jar</type>
   14.36 -			<scope>compile</scope>
   14.37 -		</dependency>
   14.38 -
   14.39 -		<!-- GeoTools -->
   14.40 -		<dependency>
   14.41 -			<groupId>org.geotools.xsd</groupId>
   14.42 -			<artifactId>gt-xsd-kml</artifactId>
   14.43 -		</dependency>
   14.44 -
   14.45 -		<dependency>
   14.46 -			<groupId>org.geotools</groupId>
   14.47 -			<artifactId>gt-xml</artifactId>
   14.48 -		</dependency>
   14.49 -
   14.50 -		<dependency>
   14.51 -			<groupId>org.geotools</groupId>
   14.52 -			<artifactId>gt-epsg-hsql</artifactId>
   14.53 -		</dependency>
   14.54 -		<dependency>
   14.55 -			<groupId>org.geotools</groupId>
   14.56 -			<artifactId>gt-shapefile</artifactId>
   14.57 -		</dependency>
   14.58 -
   14.59 -		<!-- Testing: JUnit -->
   14.60 -		<dependency>
   14.61 -			<groupId>junit</groupId>
   14.62 -			<artifactId>junit</artifactId>
   14.63 -			<scope>test</scope>
   14.64 -		</dependency>
   14.65 -
   14.66 -		<!-- JDBC Drivers -->
   14.67 -
   14.68 -		<dependency>
   14.69 -			<groupId>postgresql</groupId>
   14.70 -			<artifactId>postgresql</artifactId>
   14.71 -		</dependency>
   14.72 -
   14.73 -		<!-- Spring framework -->
   14.74 -		<dependency>
   14.75 -			<groupId>org.springframework</groupId>
   14.76 -			<artifactId>spring-webmvc</artifactId>
   14.77 -			<exclusions>
   14.78 -				<exclusion>
   14.79 -					<groupId>commons-logging</groupId>
   14.80 -					<artifactId>commons-logging</artifactId>
   14.81 -				</exclusion>
   14.82 -			</exclusions>
   14.83 -		</dependency>
   14.84 -		<dependency>
   14.85 -			<groupId>org.springframework</groupId>
   14.86 -			<artifactId>spring-aop</artifactId>
   14.87 -			<exclusions>
   14.88 -				<exclusion>
   14.89 -					<groupId>commons-logging</groupId>
   14.90 -					<artifactId>commons-logging</artifactId>
   14.91 -				</exclusion>
   14.92 -			</exclusions>
   14.93 -		</dependency>
   14.94 -		
   14.95 -		<dependency>
   14.96 -			<groupId>org.apache.cxf</groupId>
   14.97 -			<artifactId>cxf-rt-frontend-jaxws</artifactId>
   14.98 -		</dependency>
   14.99 -
  14.100 -		<dependency>
  14.101 -			<groupId>org.apache.cxf</groupId>
  14.102 -			<artifactId>cxf-rt-transports-http</artifactId>
  14.103 -		</dependency>
  14.104 -
  14.105 -		<dependency>
  14.106 -			<groupId>org.apache.cxf</groupId>
  14.107 -			<artifactId>cxf-rt-transports-http-jetty</artifactId>
  14.108 -		</dependency>
  14.109 -
  14.110 -		<dependency>
  14.111 -			<groupId>commons-validator</groupId>
  14.112 -			<artifactId>commons-validator</artifactId>
  14.113 -		</dependency>
  14.114 -	</dependencies>
  14.115 -
  14.116 -	<build>
  14.117 -		<plugins>
  14.118 -			<plugin>
  14.119 -				<groupId>org.apache.maven.plugins</groupId>
  14.120 -				<artifactId>maven-compiler-plugin</artifactId>
  14.121 -				<version>2.3.2</version>
  14.122 -				<configuration>
  14.123 -					<source>1.6</source>
  14.124 -					<target>1.6</target>
  14.125 -					<compilerArguments>
  14.126 -						<endorseddirs>${endorsed.dir}</endorseddirs>
  14.127 -					</compilerArguments>
  14.128 -				</configuration>
  14.129 -			</plugin>
  14.130 -			<plugin>
  14.131 -				<groupId>org.apache.maven.plugins</groupId>
  14.132 -				<artifactId>maven-war-plugin</artifactId>
  14.133 -				<version>2.1.1</version>
  14.134 -				<configuration>
  14.135 -					<webXml>${basedir}/WebContent/WEB-INF/web.xml</webXml>
  14.136 -					<webResources>
  14.137 -						<resource>
  14.138 -							<targetPath>/WEB-INF</targetPath>
  14.139 -							<directory>${basedir}/WebContent/WEB-INF</directory>
  14.140 -							<includes>
  14.141 -								<include>lib/**</include>
  14.142 -							</includes>
  14.143 -						</resource>
  14.144 -
  14.145 -						<resource>
  14.146 -							<targetPath>/WEB-INF</targetPath>
  14.147 -							<directory>${basedir}</directory>
  14.148 -							<includes>
  14.149 -								<include>wsdl/**</include>
  14.150 -							</includes>
  14.151 -						</resource>
  14.152 -
  14.153 -						<resource>
  14.154 -							<targetPath>/WEB-INF</targetPath>
  14.155 -							<directory>${basedir}/WebContent/WEB-INF</directory>
  14.156 -							<includes>
  14.157 -								<include>beans.xml</include>
  14.158 -							</includes>
  14.159 -						</resource>
  14.160 -						
  14.161 -						<resource>
  14.162 -							<targetPath>/</targetPath>
  14.163 -							<directory>${basedir}/WebContent</directory>
  14.164 -							<includes>
  14.165 -								<include>style.css</include>
  14.166 -								<include>store.jsp</include>
  14.167 -							</includes>
  14.168 -						</resource>
  14.169 -						
  14.170 -						<resource>
  14.171 -							<targetPath>/</targetPath>
  14.172 -							<directory>${basedir}/WebContent</directory>
  14.173 -							<includes>
  14.174 -								<include>images/**</include>
  14.175 -							</includes>
  14.176 -						</resource>
  14.177 -					</webResources>
  14.178 -					<!-- 
  14.179 -					<archive>
  14.180 -						<manifest>
  14.181 -							<addClasspath>true</addClasspath>
  14.182 -						</manifest>
  14.183 -					</archive>
  14.184 -					 -->
  14.185 -				</configuration>
  14.186 -			</plugin>
  14.187 -			<plugin>
  14.188 -				<groupId>org.apache.maven.plugins</groupId>
  14.189 -				<artifactId>maven-dependency-plugin</artifactId>
  14.190 -				<version>2.1</version>
  14.191 -				<executions>
  14.192 -					<execution>
  14.193 -						<phase>validate</phase>
  14.194 -						<goals>
  14.195 -							<goal>copy</goal>
  14.196 -						</goals>
  14.197 -						<configuration>
  14.198 -							<outputDirectory>${endorsed.dir}</outputDirectory>
  14.199 -							<silent>true</silent>
  14.200 -							<artifactItems>
  14.201 -								<artifactItem>
  14.202 -									<groupId>javax</groupId>
  14.203 -									<artifactId>javaee-endorsed-api</artifactId>
  14.204 -									<version>6.0</version>
  14.205 -									<type>jar</type>
  14.206 -								</artifactItem>
  14.207 -							</artifactItems>
  14.208 -						</configuration>
  14.209 -					</execution>
  14.210 -				</executions>
  14.211 -			</plugin>
  14.212 -			<plugin>
  14.213 -				<artifactId>maven-release-plugin</artifactId>
  14.214 -				<version>2.2.2</version>
  14.215 -				<configuration>
  14.216 -					<tagNameFormat>v@{project.version}</tagNameFormat>
  14.217 -					<autoVersionSubmodules>true</autoVersionSubmodules>
  14.218 -				</configuration>
  14.219 -			</plugin>
  14.220 -		</plugins>
  14.221 -	</build>
  14.222 -</project>
    15.1 --- a/webapp/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java	Thu Mar 22 12:36:56 2012 +0100
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,523 +0,0 @@
    15.4 -package eu.earthobservatory.org.StrabonEndpoint;
    15.5 -
    15.6 -import java.io.BufferedWriter;
    15.7 -import java.io.File;
    15.8 -import java.io.FileWriter;
    15.9 -import java.io.IOException;
   15.10 -import java.io.PrintWriter;
   15.11 -import java.math.BigInteger;
   15.12 -import java.net.InetAddress;
   15.13 -import java.security.SecureRandom;
   15.14 -import java.util.Date;
   15.15 -import java.util.Iterator;
   15.16 -
   15.17 -import javax.servlet.ServletConfig;
   15.18 -import javax.servlet.ServletContext;
   15.19 -import javax.servlet.ServletException;
   15.20 -import javax.servlet.http.HttpServlet;
   15.21 -import javax.servlet.http.HttpServletRequest;
   15.22 -import javax.servlet.http.HttpServletResponse;
   15.23 -
   15.24 -import org.apache.commons.httpclient.HttpClient;
   15.25 -import org.apache.commons.httpclient.HttpException;
   15.26 -import org.apache.commons.httpclient.HttpMethod;
   15.27 -import org.apache.commons.httpclient.NameValuePair;
   15.28 -import org.apache.commons.httpclient.methods.GetMethod;
   15.29 -import org.apache.commons.io.FileUtils;
   15.30 -import org.openrdf.query.MalformedQueryException;
   15.31 -import org.openrdf.query.QueryEvaluationException;
   15.32 -import org.openrdf.query.TupleQueryResultHandlerException;
   15.33 -import org.openrdf.repository.RepositoryException;
   15.34 -import org.springframework.web.context.WebApplicationContext;
   15.35 -import org.springframework.web.context.support.WebApplicationContextUtils;
   15.36 - 
   15.37 -
   15.38 -public class QueryBean extends HttpServlet {
   15.39 -	
   15.40 -	private static final long serialVersionUID = -378175118289907707L;
   15.41 -	
   15.42 -	public QueryBean() {}
   15.43 -	
   15.44 -	public void doGet(HttpServletRequest request, HttpServletResponse response)
   15.45 -	throws ServletException, IOException
   15.46 -	{
   15.47 -		doPost(request, response);
   15.48 -	}
   15.49 -	
   15.50 -	public void doPost(HttpServletRequest request, HttpServletResponse response)
   15.51 -	throws ServletException, IOException
   15.52 -	{
   15.53 -		final class DataHive{
   15.54 -			private String format;
   15.55 -			private String SPARQLQuery;
   15.56 -			private String errorMessage;
   15.57 -			
   15.58 -			DataHive(){
   15.59 -				this.format = null;
   15.60 -				this.SPARQLQuery = null;
   15.61 -				this.errorMessage = null;				
   15.62 -			}
   15.63 -			
   15.64 -			public String getTinyURL(String fullURL){
   15.65 -				String tinyUrl = null;
   15.66 -				
   15.67 -				try {
   15.68 -					HttpClient httpclient = new HttpClient();
   15.69 -					HttpMethod method = new GetMethod("http://tinyurl.com/api-create.php"); 
   15.70 -					method.setQueryString(new NameValuePair[]{new NameValuePair("url",fullURL)});
   15.71 -					httpclient.executeMethod(method);
   15.72 -					tinyUrl = method.getResponseBodyAsString();
   15.73 -					method.releaseConnection();
   15.74 -					
   15.75 -				} catch (HttpException e) {
   15.76 -					// TODO Auto-generated catch block
   15.77 -					e.printStackTrace();
   15.78 -				} catch (IOException e) {
   15.79 -					// TODO Auto-generated catch block
   15.80 -					e.printStackTrace();
   15.81 -				}
   15.82 -				
   15.83 -				return tinyUrl;
   15.84 -			}
   15.85 -			
   15.86 -			public String getSPARQLQuery() {
   15.87 -				return SPARQLQuery;
   15.88 -			}
   15.89 -
   15.90 -			public void setSPARQLQuery(String sPARQLQuery) {
   15.91 -				SPARQLQuery = sPARQLQuery;
   15.92 -			}
   15.93 -			
   15.94 -			public String getFormat() {
   15.95 -				return format;
   15.96 -			}
   15.97 -
   15.98 -			public void setFormat(String fFormat) {
   15.99 -				format = fFormat;
  15.100 -			}
  15.101 -
  15.102 -			public String getErrorMessage() {
  15.103 -				return errorMessage;
  15.104 -			}
  15.105 -
  15.106 -			public void setErrorMessage(String error) {
  15.107 -				this.errorMessage = error;
  15.108 -			}
  15.109 -		}
  15.110 -		
  15.111 -//		System.out.println("\n\n\n\n\n\n\nrequest: ");
  15.112 -//		System.out.println("HEADERS");
  15.113 -//	    Enumeration headerNames = request.getHeaderNames();
  15.114 -//	    while(headerNames.hasMoreElements()) {
  15.115 -//	      String headerName = (String)headerNames.nextElement();
  15.116 -//	      System.out.println(headerName + ":" +request.getHeader(headerName));
  15.117 -//	    }
  15.118 -//	    System.out.println("ATTRIBUTES");
  15.119 -//	    Enumeration attributeNames = request.getAttributeNames();
  15.120 -//	    while(attributeNames.hasMoreElements()) {
  15.121 -//	      String attributeName = (String)attributeNames.nextElement();
  15.122 -//	      System.out.println(attributeName + ":" +request.getAttribute(attributeName).toString());
  15.123 -//	    }
  15.124 -//	    Enumeration paramNames = request.getParameterNames();
  15.125 -//	    while(paramNames.hasMoreElements()) {
  15.126 -//	      String paramName = (String)paramNames.nextElement();
  15.127 -//	      System.out.print(paramName + ":");
  15.128 -//	      String[] paramValues = request.getParameterValues(paramName);
  15.129 -//	      if (paramValues.length == 1) {
  15.130 -//	        String paramValue = paramValues[0];
  15.131 -//	        if (paramValue.length() == 0)
  15.132 -//	          System.out.print("No Value");
  15.133 -//	        else
  15.134 -//	          System.out.print(paramValue + " ");
  15.135 -//	      } else {
  15.136 -//	        for(int i=0; i<paramValues.length; i++) {
  15.137 -//	          System.out.println(":" + paramValues[i]);
  15.138 -//	        }
  15.139 -//	      }	    
  15.140 -//	    }
  15.141 -//		
  15.142 -//		System.out.println("\n\n\n\n\nREQUEST.CONTENTTYPE='"+request.getContentType()+"'\n\n\n\n\n");
  15.143 -		
  15.144 -		DataHive hive = new DataHive(); 
  15.145 -		
  15.146 -		hive.setSPARQLQuery(request.getParameter("SPARQLQuery"));
  15.147 -		//System.out.println("SPARQLQuery = " + this.SPARQLQuery);
  15.148 -		
  15.149 -		String reqFormat = (request.getParameter("format") == null) ? "" : request.getParameter("format");
  15.150 -		String reqAccept = (request.getHeader("accept") == null) ? "" : request.getHeader("accept");
  15.151 -		String reqFuncionality = (request.getParameter("submit") == null) ? "" : request.getParameter("submit");
  15.152 -		
  15.153 -		// check whether Update submit button was fired
  15.154 -		boolean isUpdate = (reqFuncionality.equals("Update") ? true:false);
  15.155 -		
  15.156 -		if ((reqFormat == "") && (reqAccept == "")) {
  15.157 -			hive.setFormat("HTML");
  15.158 -			response.setContentType("text/html; charset=UTF-8");			
  15.159 -		} else if (reqAccept.contains("application/vnd.google-earth.kml+xml")) {
  15.160 -			response.setContentType("application/vnd.google-earth.kml+xml; charset=UTF-8");
  15.161 -			hive.setFormat("KML");
  15.162 -		} else if (reqAccept.contains("application/sparql-results+xml")) {			
  15.163 -			response.setContentType("application/sparql-results+xml; charset=UTF-8");
  15.164 -			hive.setFormat("XML");
  15.165 -		} else if (reqAccept.contains("text/xml")) {
  15.166 -			response.setContentType("text/xml; charset=UTF-8");
  15.167 -			hive.setFormat("XML");
  15.168 -		} else if (reqFormat.equalsIgnoreCase("KML")) {
  15.169 -			response.setContentType("application/vnd.google-earth.kml+xml; charset=UTF-8");
  15.170 -			hive.setFormat("KML");
  15.171 -		} else if (reqFormat.equalsIgnoreCase("SPARQLRESULTS"))  {
  15.172 -			response.setContentType("application/sparql-results+xml; charset=UTF-8");
  15.173 -			hive.setFormat("XML");
  15.174 -		} else if (reqFormat.equalsIgnoreCase("XML"))  {
  15.175 -			response.setContentType("text/xml; charset=UTF-8");
  15.176 -			hive.setFormat("XML");
  15.177 -		} else {
  15.178 -			response.setContentType("text/html; charset=UTF-8");
  15.179 -			hive.setFormat("HTML");
  15.180 -		}
  15.181 -		//System.out.println("\n\n\n\n\format='"+this.format+"'\n\n\n\n\n");
  15.182 -		
  15.183 -		ServletContext context = getServletContext();
  15.184 -		WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(context);
  15.185 -		StrabonBeanWrapper strabonWrapper = (StrabonBeanWrapper)applicationContext.getBean("strabonBean");
  15.186 -		
  15.187 -		if (isUpdate) {
  15.188 -			try {
  15.189 -				strabonWrapper.getStrabon().update(hive.getSPARQLQuery(), strabonWrapper.getStrabon().getSailRepoConnection());
  15.190 -				response.setStatus(HttpServletResponse.SC_OK);
  15.191 -				
  15.192 -			} catch(MalformedQueryException e) {
  15.193 -				response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
  15.194 -				PrintWriter out = response.getWriter();
  15.195 -				e.printStackTrace(out);
  15.196 -			}
  15.197 -			
  15.198 -			return;
  15.199 -		}
  15.200 -
  15.201 -		PrintWriter out = response.getWriter();
  15.202 -		
  15.203 -		if ((hive.getFormat().equalsIgnoreCase("KML"))) {
  15.204 -			//try {
  15.205 -		    //     String url = "http://www.google.com";
  15.206 -		    //     java.awt.Desktop.getDesktop().browse(java.net.URI.create(url));
  15.207 -		    //     }
  15.208 -		    //  catch (java.io.IOException e) {
  15.209 -		    //     System.out.println(e.getMessage());
  15.210 -		    //     }
  15.211 -			
  15.212 -			StringBuilder errorMessage = new StringBuilder ();
  15.213 -			String answer = evaluateQuery(strabonWrapper, hive.getFormat(), reqFuncionality, hive.getSPARQLQuery(), errorMessage);
  15.214 -			hive.setErrorMessage(errorMessage.toString());
  15.215 -            SecureRandom random = new SecureRandom();
  15.216 -            String temp = new BigInteger(130, random).toString(32);        
  15.217 -            
  15.218 -            try{
  15.219 -                Date date = new Date();
  15.220 -                
  15.221 -                FileUtils.forceMkdir(new File((String) context.getRealPath("/") + "/../ROOT/tmp/"));
  15.222 -            	
  15.223 -            	Iterator it = FileUtils.iterateFiles(new File((String) context.getRealPath("/") + "/../ROOT/tmp/"), null, false);
  15.224 -                while(it.hasNext()){
  15.225 -                	File tbd = new File(((File) it.next()).getAbsolutePath());
  15.226 -                	if (FileUtils.isFileOlder( new File(tbd.getAbsolutePath()), date.getTime())){
  15.227 -                        FileUtils.forceDelete(new File(tbd.getAbsolutePath()));
  15.228 -                		}
  15.229 -                }
  15.230 -                
  15.231 -            	File file =new File((String) context.getRealPath("/") + "/../ROOT/tmp/" + temp + ".kml");
  15.232 - 
  15.233 -    	        //if file doesnt exists, then create it
  15.234 -    	        if(!file.exists()){
  15.235 -    		       file.createNewFile();
  15.236 -    	        }
  15.237 - 
  15.238 -    	        FileWriter fw = new FileWriter((String) context.getRealPath("/") + "/../ROOT/tmp/" + temp + ".kml");
  15.239 -    	        BufferedWriter bw = new BufferedWriter(fw);
  15.240 -    	        bw.write(answer);
  15.241 -    	        bw.close();
  15.242 -    	        //FileUtils.forceDeleteOnExit(new File((String) context.getRealPath("/") + "/../ROOT/tmp/" + temp + ".kml"));
  15.243 - 
  15.244 -	            //System.out.println("Done");
  15.245 - 
  15.246 -    	     }catch(IOException e){
  15.247 -    		        e.printStackTrace();
  15.248 -    	           }
  15.249 -    	     
  15.250 - 			 response.setContentType("application/vnd.google-earth.kml+xml; charset=UTF-8");
  15.251 - 			 response.setDateHeader("Expires", 0);
  15.252 - 			 InetAddress thisIp =InetAddress.getLocalHost();
  15.253 - 			 response.setHeader("Location", request.getScheme() + "://" +  request.getServerName() +":" + request.getServerPort() +"/tmp/" + temp + ".kml");
  15.254 - 			 response.setStatus(301);
  15.255 -             
  15.256 - 			 //out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">");
  15.257 -             //out.println("<html>");
  15.258 -             //out.println("<head>");
  15.259 -             //out.println("<title>:)</title>");
  15.260 -             //out.println("<meta http-equiv=\"REFRESH\" content=\"0;url=http://maps.google.com/maps?q=http://localhost:8080/tmp/temp.kml\"></HEAD>");
  15.261 -             //out.println("<BODY>");
  15.262 -             //out.println("Redirection WILL occur!");
  15.263 -             //out.println("</BODY>");
  15.264 -             //out.println("</HTML>");
  15.265 -			//out.println(answer);
  15.266 -			 
  15.267 -			 
  15.268 -    	    String pathToKML = "";
  15.269 -    	    //InetAddress thisIp = InetAddress.getLocalHost();
  15.270 -    	    
  15.271 -    	    if (answer!="")
  15.272 -			   pathToKML = request.getScheme() + "://" +  request.getServerName() +":" + request.getServerPort() +"/tmp/" + temp + ".kml";//"http://dl.dropbox.com/u/19752551/dlr.kml";
  15.273 -			
  15.274 -            appendHTML1a(out,pathToKML);
  15.275 -			
  15.276 -			appendHTMLQ(out, strabonWrapper);
  15.277 -			
  15.278 -			appendHTML1b(out);
  15.279 -			
  15.280 -			if (hive.getSPARQLQuery() != null)
  15.281 -				out.write(hive.getSPARQLQuery());
  15.282 -			
  15.283 -			appendHTML2(out);
  15.284 -			
  15.285 -			out.append("</table></td></tr></table>");
  15.286 -			
  15.287 -			appendHTML4(out);
  15.288 -			if (answer!="")
  15.289 -			   //out.append("<div id=\"map_canvas\"></div>");
  15.290 -				out.append("");
  15.291 -			appendHTML5(out);
  15.292 -		} 
  15.293 -		else if ((hive.getFormat().equalsIgnoreCase("XML"))) {
  15.294 -			response.setContentType("text/xml; charset=UTF-8");
  15.295 -			StringBuilder errorMessage = new StringBuilder ();
  15.296 -			String answer = evaluateQuery(strabonWrapper, hive.getFormat(), reqFuncionality, hive.getSPARQLQuery(), errorMessage);
  15.297 -			hive.setErrorMessage(errorMessage.toString());
  15.298 -			out.println(answer);
  15.299 -
  15.300 -		}
  15.301 -		else {
  15.302 -			
  15.303 -			appendHTML1a(out,"");
  15.304 -			
  15.305 -			appendHTMLQ(out, strabonWrapper);
  15.306 -			
  15.307 -			appendHTML1b(out);
  15.308 -			
  15.309 -			if (hive.getSPARQLQuery() != null)
  15.310 -				out.write(hive.getSPARQLQuery());
  15.311 -			
  15.312 -			appendHTML2(out);
  15.313 -			
  15.314 -			String answer = "";
  15.315 -			if (hive.getSPARQLQuery() != null) {
  15.316 -				StringBuilder errorMessage = new StringBuilder ();
  15.317 -				answer = evaluateQuery(strabonWrapper, hive.getFormat(), reqFuncionality, hive.getSPARQLQuery(), errorMessage);
  15.318 -				hive.setErrorMessage(errorMessage.toString());
  15.319 -				if (hive.getErrorMessage() != null) {
  15.320 -					appendHTML3(out, hive.getErrorMessage());
  15.321 -				}
  15.322 -			}
  15.323 -			
  15.324 -			out.append("</table></td></tr></table>");
  15.325 -			if (!answer.equals("")) {
  15.326 -				out.println("<style type=\"text/css\">");
  15.327 -				out.println("table.result    {border:1px solid #777777;}");
  15.328 -				out.println("table.result tr {border:1px dashed grey;}");
  15.329 -				out.println("table.result th {background-color:grey;color:black;}");
  15.330 -				out.println("</style>");
  15.331 -				out.println("<table class=\"result\">");
  15.332 -				out.append(answer);
  15.333 -				out.append("</table>");
  15.334 -			}
  15.335 -			appendHTML4(out);
  15.336 -			appendHTML5(out);
  15.337 -		}
  15.338 -		out.flush();
  15.339 -	}
  15.340 -
  15.341 -	public void init(ServletConfig servletConfig) throws ServletException {
  15.342 -		super.init(servletConfig);
  15.343 -	}
  15.344 -
  15.345 -	public String evaluateQuery(StrabonBeanWrapper strabonWrapper, String resultFormat, String reqFunctionality, String SPARQLQuery, StringBuilder errorMessage) {		
  15.346 -		String answer = "";
  15.347 -
  15.348 -//		System.out.println("evaluateQuery: will call wrapper. Query  = " + this.SPARQLQuery);
  15.349 -//		System.out.println("evaluateQuery: will call wrapper. result = " + resultFormat);
  15.350 -
  15.351 -		try {
  15.352 -			if (SPARQLQuery == null) {
  15.353 -				answer = "";
  15.354 -			} else {
  15.355 -				//System.out.println("evaluateQuery: Calling...");
  15.356 -				if (reqFunctionality.equals("Update")) {
  15.357 -				//if (((String)this.SPARQLQuery).toLowerCase().contains("insert") || ((String)this.SPARQLQuery).toLowerCase().contains("delete"))  { 
  15.358 -				   answer = (String)strabonWrapper.update(SPARQLQuery, resultFormat);
  15.359 -				   }
  15.360 -				else{
  15.361 -				   answer = (String)strabonWrapper.query(SPARQLQuery, resultFormat);
  15.362 -				}
  15.363 -				//System.out.println("evaluateQuery: Called...");
  15.364 -			}
  15.365 -		} catch (MalformedQueryException e) {
  15.366 -			e.printStackTrace();
  15.367 -			errorMessage.append(e.getMessage());
  15.368 -		} catch (RepositoryException e) {
  15.369 -			e.printStackTrace();
  15.370 -			errorMessage.append(e.getMessage());
  15.371 -		} catch (QueryEvaluationException e) {
  15.372 -			e.printStackTrace();
  15.373 -			errorMessage.append(e.getMessage());
  15.374 -		} catch (TupleQueryResultHandlerException e) {
  15.375 -			e.printStackTrace();
  15.376 -			errorMessage.append(e.getMessage());
  15.377 -		} catch (IOException e) {
  15.378 -			e.printStackTrace();
  15.379 -			errorMessage.append(e.getMessage());
  15.380 -		} catch (ClassNotFoundException e) {
  15.381 -			e.printStackTrace();
  15.382 -			errorMessage.append(e.getMessage());
  15.383 -		} catch (Exception e) {
  15.384 -			e.printStackTrace();
  15.385 -			errorMessage.append(e.getMessage());
  15.386 -		}
  15.387 -
  15.388 -		//System.out.println("evaluateQuery: called wrapper. answer  = " + answer);
  15.389 -		//System.out.println("evaluateQuery: called wrapper. error   = " + ((this.errorMessage == null) ? "" : this.errorMessage));
  15.390 -
  15.391 -		
  15.392 -		return answer;		
  15.393 -	}
  15.394 -	
  15.395 -	protected static void appendHTML1a(PrintWriter out, String pathToKML) {
  15.396 -		out.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
  15.397 -		out.println("<html>");
  15.398 -		out.println("<head>");
  15.399 -		out.println("<meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\" />");
  15.400 -		out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />");
  15.401 -		out.println("<link href=\"http://code.google.com/apis/maps/documentation/javascript/examples/default.css\" rel=\"stylesheet\" type=\"text/css\" />");
  15.402 -		out.println("<link rel=\"stylesheet\" href=\"style.css\" type=\"text/css\" /> ");
  15.403 -		out.println("<script type=\"text/javascript\" src=\"http://maps.googleapis.com/maps/api/js?sensor=false\"></script>");
  15.404 -		out.println("<script type=\"text/javascript\">");
  15.405 -		out.println("function initialize() {");
  15.406 -		out.println("  var chicago = new google.maps.LatLng(41.875696,-87.624207);");
  15.407 -		out.println("  var myOptions = {");
  15.408 -		out.println("    zoom: 11,");
  15.409 -		out.println("    center: chicago,");
  15.410 -		out.println("   mapTypeId: google.maps.MapTypeId.ROADMAP");
  15.411 -		out.println("  }");
  15.412 -		out.println("");
  15.413 -		out.println("  var map = new google.maps.Map(document.getElementById(\"map_canvas\"), myOptions);");
  15.414 -		out.println("");
  15.415 -		out.println("  var ctaLayer = new google.maps.KmlLayer('" + pathToKML + "');");
  15.416 -		out.println("  ctaLayer.setMap(map);");
  15.417 -		out.println("}");
  15.418 -		out.println("</script>");
  15.419 -		out.println("<style type=\"text/css\"> ");
  15.420 -		out.println("<!--");
  15.421 -		out.println(".style3 {font-size: 15px}");
  15.422 -		out.println(".style4 {font-size: 12px}");
  15.423 -		out.println(".style5 {font-size: 15px;font-weight: bold;}");
  15.424 -		out.println(".style6 {color: #FF0000}");
  15.425 -		out.println(".style7 {font-size: 14px}");
  15.426 -		out.println(" .hidden { visibility: hidden }");
  15.427 -		out.println("-->");
  15.428 -		out.println("</style> ");
  15.429 -		out.println("<title>TELEIOS: Strabon Endpoint</title>");
  15.430 -		out.println("</head>");
  15.431 -		out.println("<body topmargin=\"0\" leftmargin=\"0\" link=\"#FFFFFF\" vlink=\"#FFFFFF\" alink=\"#FFFFFF\" onload=\"initialize()\">");
  15.432 -		out.println("  <TABLE width=\"100%\" BORDER=0 CELLPADDING=0 CELLSPACING=0>");
  15.433 -		out.println("    <TR>");
  15.434 -		out.println("		");
  15.435 -		out.println("      <TD height=\"16\" background=\"images/pixi_white.gif\"><img src=\"images/pixi_white.gif\" width=\"16\" height=\"16\"></TD>");
  15.436 -		out.println("	</TR>");
  15.437 -		out.println("	<TR>");
  15.438 -		out.println("      <TD height=\"1\" background=\"images/top_bg_blue.gif\"></TD>");
  15.439 -		out.println("	</TR>		");
  15.440 -		out.println("	<TR>");
  15.441 -		out.println("      <TD height=\"60\" background=\"images/nav2_bg.gif\"> ");
  15.442 -		out.println("        <table width=\"100%\" border=\"0\">");
  15.443 -		out.println("         <tr>");
  15.444 -		out.println("            <td width=\"1\"><img src=\"images/nav2_bg.gif\" width=\"1\" height=\"60\"></td>");
  15.445 -		out.println("            <td valign=\"top\" width=\"80px\"><img border=\"0\" src=\"images/teleios_logo.png\"/></td>");
  15.446 -		out.println("            <td valign=\"top\" align=\"left\">");
  15.447 -		out.println("            <span class=\"logo\">Strabon Endpoint</span><br><span class=\"style4\">based on Strabon</span></td>");
  15.448 -		out.println("          </tr>");
  15.449 -		out.println("        </table> </TD>");
  15.450 -		out.println("	</TR>");
  15.451 -		out.println("	<TR>");
  15.452 -		out.println("      <TD height=\"21\" background=\"images/nav1_bg1.gif\">");
  15.453 -		out.println("      </TD>");
  15.454 -		out.println("	</TR>");
  15.455 -		out.println("	<TR>");
  15.456 -		out.println("      <TD height=\"2\" background=\"images/top_bg_blue.gif\"></TD>");
  15.457 -		out.println("	</TR>");
  15.458 -		out.println("</TABLE>");
  15.459 -		out.println("<form method=\"get\">");
  15.460 -
  15.461 -		out.println("<table border=\"0\" width=\"100%\"><tr> ");
  15.462 -		out.println("<td width=\"90\" valign=\"top\" bgcolor=\"#dfe8f0\"> ");
  15.463 -		out.println("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"165\" id=\"navigation\"> ");
  15.464 -		out.println("<tr><td width=\"90\" class=\"style4\"><a href=\"Query\" class=\"navText\">Query</a></td></tr> ");
  15.465 -	}
  15.466 -		
  15.467 -	protected static void appendHTML1b(PrintWriter out) {	
  15.468 -		out.println("<tr><td width=\"90\" class=\"style4\"><a href=\"store.jsp\" class=\"navText\">Store</a></td></tr> ");
  15.469 -		out.println("<tr><td width=\"90\" class=\"style4\"><a href=\"javascript:history.go(0)\" class=\"navText\">Clear</a></td></tr> ");
  15.470 -		out.println("</table>");
  15.471 -		out.println("</td>");
  15.472 -		out.println("<td width=\"*\" valign=\"top\" >"); 
  15.473 -		
  15.474 -		out.println("<table cellspacing=\"5\">");
  15.475 -		out.println("<tr>");
  15.476 -		out.println("<td style=\"border: 1px dashed #bbbbbb;\">stSPARQL Query:</td>");
  15.477 -		out.println("<td style=\"border: 1px dashed #bbbbbb;\"><textarea name=\"SPARQLQuery\" rows=\"15\" cols=\"100\">");
  15.478 -	}
  15.479 -	
  15.480 -	protected static void appendHTML2(PrintWriter out) {
  15.481 -		out.println("</textarea></td>");
  15.482 -//		out.println("<td style=\"border: 1px dashed #bbbbbb;\"><input type=\"radio\" name=\"format\" value=\"KML\">KML<br/>");
  15.483 -//		out.println("<input type=\"radio\" name=\"format\" value=\"HTML\">HTML</td>");
  15.484 -		out.println("<td style=\"border: 1px dashed #bbbbbb;\"><center>Output Format:<br/><select name=\"format\">");
  15.485 -		out.println("	<option value=\"HTML\">HTML</option>");
  15.486 -		out.println("	<option value=\"KML\">KML</option>");
  15.487 -		out.println("	<option value=\"XML\">XML</option>");
  15.488 -		out.println("</select></center></td>");
  15.489 -		out.println("</tr>");
  15.490 -		out.println("<tr>");
  15.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>");
  15.492 -		out.println("</tr>");
  15.493 -	}
  15.494 -	
  15.495 -	protected static void appendHTML3(PrintWriter out, String errorMessage) {
  15.496 -		out.println("<tr>");
  15.497 -		out.println("<td style=\"border: 1px dashed #bbbbbb;\">Result: </td>");
  15.498 -		out.println("<td style=\"border: 1px dashed #bbbbbb;\">");
  15.499 -		out.println(errorMessage);
  15.500 -		out.println("</td>");
  15.501 -		out.println("</tr>");
  15.502 -	}
  15.503 -
  15.504 -	protected static void appendHTML4(PrintWriter out) {
  15.505 -		out.println("<br/><br/>");
  15.506 -		out.println("</form>");
  15.507 -	}
  15.508 -	
  15.509 -	protected static void appendHTML5(PrintWriter out) {
  15.510 -		out.println("</body>");
  15.511 -		out.println("</html>");
  15.512 -	}
  15.513 -	
  15.514 -	protected static void appendHTMLQ(PrintWriter out, StrabonBeanWrapper strabonWrapper) {
  15.515 -		out.println("<tr><td width=\"90\">");
  15.516 -		out.println("<a href=\"Query?SPARQLQuery="+strabonWrapper.getQuery1()+"\">&nbsp;&middot;&nbsp;Query 1</a></br> ");		
  15.517 -		out.println("<a href=\"Query?SPARQLQuery="+strabonWrapper.getQuery2()+"\">&nbsp;&middot;&nbsp;Query 2</a></br> ");
  15.518 -		out.println("<a href=\"Query?SPARQLQuery="+strabonWrapper.getQuery3()+"\">&nbsp;&middot;&nbsp;Query 3</a></br> ");
  15.519 -		out.println("<a href=\"Query?SPARQLQuery="+strabonWrapper.getQuery4()+"\">&nbsp;&middot;&nbsp;Query 4</a></br> ");
  15.520 -		out.println("<a href=\"Query?SPARQLQuery="+strabonWrapper.getQuery5()+"\">&nbsp;&middot;&nbsp;Query 5</a></br> ");
  15.521 -		out.println("<a href=\"Query?SPARQLQuery="+strabonWrapper.getQuery6()+"\">&nbsp;&middot;&nbsp;Query 6</a></br> ");
  15.522 -		out.println("<a href=\"Query?SPARQLQuery="+strabonWrapper.getQuery7()+"\">&nbsp;&middot;&nbsp;Query 7</a></br>");
  15.523 -		out.println("<a href=\"Query?SPARQLQuery="+strabonWrapper.getQuery8()+"\">&nbsp;&middot;&nbsp;Query 8</a> ");
  15.524 -		out.println("</td></tr> ");
  15.525 -	}
  15.526 -}
    16.1 --- a/webapp/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StoreBean.java	Thu Mar 22 12:36:56 2012 +0100
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,156 +0,0 @@
    16.4 -/**
    16.5 - * 
    16.6 - */
    16.7 -package eu.earthobservatory.org.StrabonEndpoint;
    16.8 -
    16.9 -import java.io.IOException;
   16.10 -import java.util.ArrayList;
   16.11 -
   16.12 -import javax.servlet.ServletConfig;
   16.13 -import javax.servlet.ServletContext;
   16.14 -import javax.servlet.ServletException;
   16.15 -import javax.servlet.http.HttpServlet;
   16.16 -import javax.servlet.http.HttpServletRequest;
   16.17 -import javax.servlet.http.HttpServletResponse;
   16.18 -
   16.19 -import org.openrdf.rio.RDFFormat;
   16.20 -import org.openrdf.rio.RDFParseException;
   16.21 -import org.springframework.web.context.WebApplicationContext;
   16.22 -import org.springframework.web.context.support.WebApplicationContextUtils;
   16.23 -
   16.24 -/**
   16.25 - * @author charnik
   16.26 - *
   16.27 - */
   16.28 -public class StoreBean extends HttpServlet {
   16.29 -	
   16.30 -	private static final long serialVersionUID = -7541662133934957148L;
   16.31 -	
   16.32 -	/**
   16.33 -	 * Parameters used in the store.jsp file
   16.34 -	 */
   16.35 -	public static final String PARAM_DATA 		= "data";
   16.36 -	public static final String PARAM_FORMAT 	= "format";
   16.37 -	public static final String PARAM_DATA_URL	= "url";
   16.38 -	public static final String SRC_REQ			= "source_request";
   16.39 -	
   16.40 -	/**
   16.41 -	 * Error parameters used in the store.jsp file
   16.42 -	 */
   16.43 -	public static final String DATA_ERROR 		= "edata";
   16.44 -	public static final String FORMAT_ERROR 	= "eformat";
   16.45 -	public static final String STORE_ERROR 		= "estore";
   16.46 -	
   16.47 -	/**
   16.48 -	 * Submit buttons
   16.49 -	 */
   16.50 -	public static final String SUBMIT_INPUT		= "dsubmit";
   16.51 -	public static final String SUBMIT_URL		= "fromurl";
   16.52 -	
   16.53 -	/**
   16.54 -	 * Parameter for successful store used in the store.jsp file
   16.55 -	 */
   16.56 -	public static final String STORE_OK			= "storeOK";
   16.57 -	
   16.58 -	/**
   16.59 -	 * Keeps the registered and available RDF formats.
   16.60 -	 */
   16.61 -	public static ArrayList<String> registeredFormats;
   16.62 -	
   16.63 -	/**
   16.64 -	 * Strabon wrapper
   16.65 -	 */
   16.66 -	private StrabonBeanWrapper strabon;
   16.67 -	
   16.68 -	@Override
   16.69 -	public void init(ServletConfig servletConfig) throws ServletException {
   16.70 -		super.init(servletConfig);
   16.71 -		
   16.72 -		// get strabon wrapper
   16.73 -		ServletContext context = getServletContext();
   16.74 -		WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(context);
   16.75 -		strabon = (StrabonBeanWrapper) applicationContext.getBean("strabonBean");
   16.76 -		
   16.77 -		// initialize registered and available formats
   16.78 -		registeredFormats = new ArrayList<String>();
   16.79 -		for (RDFFormat format : RDFFormat.values()) {
   16.80 -			registeredFormats.add(format.getName());
   16.81 -		}
   16.82 -	}
   16.83 -	
   16.84 -	@Override
   16.85 -	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
   16.86 -		doPost(request, response);
   16.87 -	}
   16.88 -	
   16.89 -	@Override
   16.90 -	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
   16.91 -		// check whether we read from INPUT or URL
   16.92 -		boolean input = (request.getParameter(SUBMIT_URL) != null) ? false:true;
   16.93 -		
   16.94 -		// check if the request was from store.jsp
   16.95 -		boolean browser = (request.getParameter(SRC_REQ) != null) ? true:false;
   16.96 -		
   16.97 -		// RDF data to store
   16.98 -		String data = null;
   16.99 -		
  16.100 -		// the format of the data
  16.101 -		String format = null;
  16.102 -		
  16.103 -		format = request.getParameter(PARAM_FORMAT);
  16.104 -		data = input ? request.getParameter(PARAM_DATA):request.getParameter(PARAM_DATA_URL); 
  16.105 -		
  16.106 -		if (data == null) { 
  16.107 -			if (browser) {
  16.108 -				redirect(response, DATA_ERROR);
  16.109 -				
  16.110 -			} else {
  16.111 -				response.sendError(HttpServletResponse.SC_NO_CONTENT);
  16.112 -			}
  16.113 -			return ;
  16.114 -		}
  16.115 -		
  16.116 -		// get input format
  16.117 -		RDFFormat rdfFormat = RDFFormat.valueOf(format); 
  16.118 -		
  16.119 -		if (rdfFormat == null) { // unknown format
  16.120 -			if (browser) {
  16.121 -				redirect(response, FORMAT_ERROR);
  16.122 -				
  16.123 -			} else {
  16.124 -				response.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
  16.125 -			}
  16.126 -			
  16.127 -			return ;
  16.128 -		}		
  16.129 -		
  16.130 -		// store data
  16.131 -		try {
  16.132 -			strabon.store(data, rdfFormat, !input);
  16.133 -			
  16.134 -			// store was successful, return the respective message
  16.135 -			if (browser) {
  16.136 -				redirect(response, STORE_OK);
  16.137 -				
  16.138 -			} else {
  16.139 -				response.sendError(HttpServletResponse.SC_OK);
  16.140 -			}
  16.141 -		} catch (Exception e) {
  16.142 -			if (browser) {
  16.143 -				redirect(response, STORE_ERROR);
  16.144 -			} else {
  16.145 -				if (e instanceof RDFParseException) {
  16.146 -					response.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
  16.147 -				} else {
  16.148 -					response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
  16.149 -				}
  16.150 -			}
  16.151 -			System.err.println(e.getMessage());
  16.152 -		}
  16.153 -	}
  16.154 -	
  16.155 -	private void redirect(HttpServletResponse response, String error) {
  16.156 -		response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
  16.157 -        response.setHeader("Location", "store.jsp?" + error + "=");
  16.158 -	}
  16.159 -}
    17.1 --- a/webapp/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StrabonBeanWrapper.java	Thu Mar 22 12:36:56 2012 +0100
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,262 +0,0 @@
    17.4 -package eu.earthobservatory.org.StrabonEndpoint;
    17.5 -
    17.6 -import java.io.IOException;
    17.7 -import java.io.StringReader;
    17.8 -import java.net.URL;
    17.9 -import java.sql.SQLException;
   17.10 -
   17.11 -import org.openrdf.model.Resource;
   17.12 -import org.openrdf.query.MalformedQueryException;
   17.13 -import org.openrdf.query.QueryEvaluationException;
   17.14 -import org.openrdf.query.TupleQueryResultHandlerException;
   17.15 -import org.openrdf.repository.RepositoryException;
   17.16 -import org.openrdf.repository.sail.SailRepositoryConnection;
   17.17 -import org.openrdf.rio.RDFFormat;
   17.18 -import org.openrdf.rio.RDFParseException;
   17.19 -
   17.20 -import eu.earthobservatory.runtime.postgis.Strabon;
   17.21 -
   17.22 -public class StrabonBeanWrapper implements org.springframework.beans.factory.DisposableBean {
   17.23 -	private String serverName;
   17.24 -	private int port;
   17.25 -	private String databaseName;
   17.26 -	private String user;
   17.27 -	private String password;
   17.28 -	
   17.29 -	private Strabon strabon = null;
   17.30 -	private boolean checkForLockTable;
   17.31 -	private String query1;
   17.32 -	private String query2;
   17.33 -	private String query3;
   17.34 -	private String query4;
   17.35 -	private String query5;
   17.36 -	private String query6;
   17.37 -	private String query7;
   17.38 -	private String query8;
   17.39 -	
   17.40 -	public StrabonBeanWrapper() {
   17.41 -		this.strabon = null;
   17.42 -	}
   17.43 -	
   17.44 -	public StrabonBeanWrapper(Strabon strabon) {
   17.45 -		this.strabon = strabon;
   17.46 -	}
   17.47 -	
   17.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) {
   17.49 -		this.serverName = serverName;
   17.50 -		this.port = port;
   17.51 -		this.databaseName = databaseName;
   17.52 -		this.user = user;
   17.53 -		this.password = password;
   17.54 -		this.checkForLockTable = checkForLockTable;
   17.55 -		//this.strabon = new Strabon(databaseName, user, password, port, serverName, checkForLockTable);
   17.56 -		this.query1 = query1;
   17.57 -		this.query2 = query2;
   17.58 -		this.query3 = query3;
   17.59 -		this.query4 = query4;
   17.60 -		this.query5 = query5;
   17.61 -		this.query6 = query6;
   17.62 -		this.query7 = query7;
   17.63 -		this.query8 = query8;
   17.64 -		
   17.65 -		init();
   17.66 -	}
   17.67 -	
   17.68 -	private boolean init() {
   17.69 -		if (this.strabon == null) {
   17.70 -			try {
   17.71 -				System.err.println("Strabon not initialized yet.");
   17.72 -				System.err.println("Initializing strabon.");
   17.73 -				System.out.println(this.getDetails());
   17.74 -				this.strabon = new Strabon(databaseName, user, password, port, serverName, checkForLockTable);
   17.75 -			} catch (Exception e) {
   17.76 -				System.err.println("Exception occured while creating Strabon.\n"+this.getDetails());
   17.77 -				e.printStackTrace();
   17.78 -				return false;
   17.79 -			}
   17.80 -		}
   17.81 -		
   17.82 -		return true;
   17.83 -	}
   17.84 -	
   17.85 -	public StrabonBeanWrapper(String databaseName, String user, String password, int port, String serverName) throws SQLException, ClassNotFoundException {
   17.86 -		this.strabon = new Strabon(databaseName, user, password, port, serverName, true);
   17.87 -	}
   17.88 -
   17.89 -	public Strabon getStrabon() {
   17.90 -		return strabon;
   17.91 -	}
   17.92 -
   17.93 -	public void setStrabon(Strabon strabon) {
   17.94 -		this.strabon = strabon;
   17.95 -	}
   17.96 -
   17.97 -	public void destroy() throws Exception {
   17.98 -		strabon.close();
   17.99 -	}
  17.100 -	
  17.101 -	
  17.102 -	
  17.103 -	public Object query(String queryString, String answerFormatStrabon) throws MalformedQueryException, RepositoryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException, ClassNotFoundException {
  17.104 -		if ((this.strabon == null) && (!init())) {
  17.105 -			throw new RepositoryException("Could not connect to Strabon.");
  17.106 -		} 
  17.107 -		
  17.108 -    	//String newQueryString = TemporalWrapper.rebuildQuery(queryString);
  17.109 -    	
  17.110 -    	System.out.println("================================================================");
  17.111 -    	System.out.println("Query:");
  17.112 -    	System.out.println(queryString);
  17.113 -    	System.out.println("================================================================");
  17.114 -    	System.out.println("Answer format: " + answerFormatStrabon);
  17.115 -    	System.out.println("================================================================");
  17.116 -    	//System.out.println("Rewritten query:");
  17.117 -    	//System.out.println(newQueryString);
  17.118 -    	//System.out.println("================================================================");
  17.119 -		
  17.120 -   		//return strabon.query(newQueryString, answerFormatStrabon, strabon.getSailRepoConnection());
  17.121 -		return strabon.query(queryString, answerFormatStrabon, strabon.getSailRepoConnection());
  17.122 -	}
  17.123 -	
  17.124 -	public Object update(String updateString, String answerFormatStrabon) throws MalformedQueryException, RepositoryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException, ClassNotFoundException {
  17.125 -		if ((this.strabon == null) && (!init())) {
  17.126 -			throw new RepositoryException("Could not connect to Strabon.");
  17.127 -		} 
  17.128 -		
  17.129 -    	//String newQueryString = TemporalWrapper.rebuildQuery(queryString);
  17.130 -    	
  17.131 -    	System.out.println("================================================================");
  17.132 -    	System.out.println("Update:");
  17.133 -    	System.out.println(updateString);
  17.134 -    	System.out.println("================================================================");
  17.135 -    	System.out.println("Answer format: " + answerFormatStrabon);
  17.136 -    	System.out.println("================================================================");
  17.137 -    	//System.out.println("Rewritten query:");
  17.138 -    	//System.out.println(newQueryString);
  17.139 -    	//System.out.println("================================================================");
  17.140 -		
  17.141 -   		//return strabon.query(newQueryString, answerFormatStrabon, strabon.getSailRepoConnection());
  17.142 -		strabon.update(updateString, strabon.getSailRepoConnection());
  17.143 -		return "OK!";
  17.144 -	}
  17.145 -
  17.146 -	/**
  17.147 -	 * Store the given data in the given format into Strabon repository. If url is true, then
  17.148 -	 * input comes from a URL. 
  17.149 -	 * 
  17.150 -	 * Returns true on success, false otherwise.
  17.151 -	 * 
  17.152 -	 * @param source_data
  17.153 -	 * @param format
  17.154 -	 * @param url
  17.155 -	 * @return
  17.156 -	 * @throws MalformedQueryException
  17.157 -	 * @throws RepositoryException
  17.158 -	 * @throws QueryEvaluationException
  17.159 -	 * @throws TupleQueryResultHandlerException
  17.160 -	 * @throws IOException
  17.161 -	 * @throws ClassNotFoundException
  17.162 -	 */
  17.163 -	public boolean store(String source_data, RDFFormat format, boolean url) throws Exception {
  17.164 -		if ((this.strabon == null) && (!init())) {
  17.165 -			throw new RepositoryException("Could not connect to Strabon.");
  17.166 -		}
  17.167 -		
  17.168 -		// get sail connection
  17.169 -		SailRepositoryConnection conn = strabon.getSailRepoConnection();
  17.170 -		
  17.171 -		try {
  17.172 -			// store data
  17.173 -			if (url) {
  17.174 -				conn.add(new URL(source_data), "", format, new Resource[1]);
  17.175 -				
  17.176 -			} else {
  17.177 -				conn.add(new StringReader(source_data), "", format, new Resource[1]);
  17.178 -			}
  17.179 -			
  17.180 -		} catch (Exception e) {
  17.181 -			throw e;
  17.182 -		}
  17.183 -		
  17.184 -    	return true;
  17.185 -	}
  17.186 -	
  17.187 -	private String getDetails() {
  17.188 -		String details = "-----------------------------------------\n";
  17.189 -		details += "Connection details:\n";
  17.190 -		details += "host     : " + serverName + "\n";
  17.191 -		details += "port     : " + port + "\n";
  17.192 -		details += "database : " + databaseName + "\n";
  17.193 -		details += "user     : " + user + "\n";
  17.194 -		details += "password : " + password + "\n";
  17.195 -		details += "-----------------------------------------\n";
  17.196 -
  17.197 -		return details;
  17.198 -	}
  17.199 -
  17.200 -	public String getQuery1() {
  17.201 -		return query1;
  17.202 -	}
  17.203 -
  17.204 -	public void setQuery1(String query1) {
  17.205 -		this.query1 = query1;
  17.206 -	}
  17.207 -
  17.208 -	public String getQuery2() {
  17.209 -		return query2;
  17.210 -	}
  17.211 -
  17.212 -	public void setQuery2(String query2) {
  17.213 -		this.query2 = query2;
  17.214 -	}
  17.215 -
  17.216 -	public String getQuery3() {
  17.217 -		return query3;
  17.218 -	}
  17.219 -
  17.220 -	public void setQuery3(String query3) {
  17.221 -		this.query3 = query3;
  17.222 -	}
  17.223 -	
  17.224 -	public String getQuery4() {
  17.225 -		return query4;
  17.226 -	}
  17.227 -
  17.228 -	public void setQuery4(String query4) {
  17.229 -		this.query4 = query4;
  17.230 -	}
  17.231 -
  17.232 -	public String getQuery5() {
  17.233 -		return query5;
  17.234 -	}
  17.235 -
  17.236 -	public void setQuery5(String query5) {
  17.237 -		this.query5 = query5;
  17.238 -	}
  17.239 -
  17.240 -	public String getQuery6() {
  17.241 -		return query6;
  17.242 -	}
  17.243 -
  17.244 -	public void setQuery6(String query6) {
  17.245 -		this.query6 = query6;
  17.246 -	}
  17.247 -
  17.248 -	public String getQuery7() {
  17.249 -		return query7;
  17.250 -	}
  17.251 -
  17.252 -	public void setQuery7(String query7) {
  17.253 -		this.query7 = query7;
  17.254 -	}
  17.255 -	public String getQuery8() {
  17.256 -		return query8;
  17.257 -	}
  17.258 -
  17.259 -	public void setQuery8(String query8) {
  17.260 -		this.query8 = query8;
  17.261 -	}
  17.262 -	
  17.263 -	
  17.264 -}
  17.265 -
    18.1 --- a/webapp/src/main/webapp/WEB-INF/web.xml	Thu Mar 22 12:36:56 2012 +0100
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,12 +0,0 @@
    18.4 -<?xml version="1.0" encoding="UTF-8"?>
    18.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">
    18.6 -	<display-name>StrabonEndpoint</display-name>
    18.7 -	<welcome-file-list>
    18.8 -		<welcome-file>index.html</welcome-file>
    18.9 -		<welcome-file>index.htm</welcome-file>
   18.10 -		<welcome-file>index.jsp</welcome-file>
   18.11 -		<welcome-file>default.html</welcome-file>
   18.12 -		<welcome-file>default.htm</welcome-file>
   18.13 -		<welcome-file>default.jsp</welcome-file>
   18.14 -	</welcome-file-list>
   18.15 -</web-app>
    19.1 --- a/webapp/src/main/webapp/index.jsp	Thu Mar 22 12:36:56 2012 +0100
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,13 +0,0 @@
    19.4 -<%@page contentType="text/html" pageEncoding="UTF-8"%>
    19.5 -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    19.6 -   "http://www.w3.org/TR/html4/loose.dtd">
    19.7 -
    19.8 -<html>
    19.9 -    <head>
   19.10 -        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   19.11 -        <title>JSP Page</title>
   19.12 -    </head>
   19.13 -    <body>
   19.14 -        <h1>Hello World!</h1>
   19.15 -    </body>
   19.16 -</html>