You are viewing a plain text version of this content. The canonical link for it is here.
Posted to olio-commits@incubator.apache.org by sh...@apache.org on 2008/12/11 01:56:30 UTC

svn commit: r725537 - in /incubator/olio/geocoder: ./ Web20Emulator/ src/ src/org/ src/org/apache/ src/org/apache/olio/ src/org/apache/olio/geocoder/ web/ web/META-INF/ web/WEB-INF/

Author: shanti
Date: Wed Dec 10 17:56:30 2008
New Revision: 725537

URL: http://svn.apache.org/viewvc?rev=725537&view=rev
Log:
Adding geocoder source code. Deleting old version which only add class files.

Added:
    incubator/olio/geocoder/README
    incubator/olio/geocoder/build.properties
    incubator/olio/geocoder/build.xml
    incubator/olio/geocoder/src/
    incubator/olio/geocoder/src/org/
    incubator/olio/geocoder/src/org/apache/
    incubator/olio/geocoder/src/org/apache/olio/
    incubator/olio/geocoder/src/org/apache/olio/geocoder/
    incubator/olio/geocoder/src/org/apache/olio/geocoder/Geocoder.java
    incubator/olio/geocoder/src/org/apache/olio/geocoder/GeocoderBean.java
    incubator/olio/geocoder/src/org/apache/olio/geocoder/GeocoderServlet.java
    incubator/olio/geocoder/src/org/apache/olio/geocoder/LatLngDegrees.java
    incubator/olio/geocoder/web/
    incubator/olio/geocoder/web/META-INF/
    incubator/olio/geocoder/web/META-INF/MANIFEST.MF
    incubator/olio/geocoder/web/META-INF/context.xml
    incubator/olio/geocoder/web/WEB-INF/
    incubator/olio/geocoder/web/WEB-INF/GeocodeResponse.xsd
    incubator/olio/geocoder/web/WEB-INF/SampleResponse.xml
    incubator/olio/geocoder/web/WEB-INF/web.xml
    incubator/olio/geocoder/web/index.jsp
Removed:
    incubator/olio/geocoder/Web20Emulator/

Added: incubator/olio/geocoder/README
URL: http://svn.apache.org/viewvc/incubator/olio/geocoder/README?rev=725537&view=auto
==============================================================================
--- incubator/olio/geocoder/README (added)
+++ incubator/olio/geocoder/README Wed Dec 10 17:56:30 2008
@@ -0,0 +1,5 @@
+. To  build the geocoder emulator, you will need an installation of tomcat.
+. Edit build.properties and set tomcat.home to point to your tomcat installation.
+. 'ant all' will create the emulator war file in the dist directory.
+. Copy the war file to your tomcat 'webapps' directory on the system that will run
+  the emulator. We typically run the emulator on the same system as the faban driver.

Added: incubator/olio/geocoder/build.properties
URL: http://svn.apache.org/viewvc/incubator/olio/geocoder/build.properties?rev=725537&view=auto
==============================================================================
--- incubator/olio/geocoder/build.properties (added)
+++ incubator/olio/geocoder/build.properties Wed Dec 10 17:56:30 2008
@@ -0,0 +1,2 @@
+tomcat.home=/home/shanti/apache-tomcat-6.0.13
+war.name=geocoder.war

Added: incubator/olio/geocoder/build.xml
URL: http://svn.apache.org/viewvc/incubator/olio/geocoder/build.xml?rev=725537&view=auto
==============================================================================
--- incubator/olio/geocoder/build.xml (added)
+++ incubator/olio/geocoder/build.xml Wed Dec 10 17:56:30 2008
@@ -0,0 +1,53 @@
+<project name="Geocoder Emulator" default="all" basedir=".">
+
+    <property file="build.properties"/>
+    <property name="src.dir" value="src"/>
+    <property name="build.dir" value="build"/>
+    <property name="build.web.dir" value="${build.dir}/web"/>
+    <property name="build.classes.dir" value="${build.web.dir}/WEB-INF/classes"/>
+    <property name="build.metainf.dir" value="${build.web.dir}/META-INF"/>
+    <property name="dist.dir" value="dist"/>
+    <property name="dist.war" value="${dist.dir}/${war.name}"/>
+    <property name="j2ee.libs" value="${tomcat.home}/lib"/>
+    <property name="web.docbase.dir" value="web"/>
+
+    <path id="class.path">
+        <fileset dir="${j2ee.libs}" includes="*.jar"/>
+    </path>
+
+    <target name="init">
+        <mkdir dir="${build.metainf.dir}"/>
+        <mkdir dir="${build.classes.dir}"/>
+        <mkdir dir="${build.web.dir}"/>
+    </target>
+
+    <target name="compile" depends="init" description="Compiling all source files">
+        <javac srcdir="${src.dir}"
+            deprecation="on" destdir="${build.classes.dir}">
+            <classpath refid="class.path"/>
+        </javac>
+		<copy todir="${build.web.dir}">
+		    <fileset dir="${web.docbase.dir}"/>
+        </copy>
+		<copy todir="${build.web.dir}/WEB-INF">
+		    <fileset dir="${web.docbase.dir}/WEB-INF"/>
+        </copy>
+    </target>
+
+    <target name="clean" description="cleanup module">
+      <delete>
+        <fileset dir="${build.dir}" includes="**/*"/>
+      </delete>
+	  <delete dir="{$dist.dir}"/>
+	  <delete dir="{$build.web.dir}"/>
+    </target>
+
+    <target name="all" depends="compile"
+        description="Creates web aplication war file">
+		<mkdir dir="${dist.dir}"/>
+        <jar jarfile="${dist.war}" manifest="${build.metainf.dir}/MANIFEST.MF">
+            <fileset dir="${build.web.dir}"/>
+        </jar>
+    </target>
+
+</project>

Added: incubator/olio/geocoder/src/org/apache/olio/geocoder/Geocoder.java
URL: http://svn.apache.org/viewvc/incubator/olio/geocoder/src/org/apache/olio/geocoder/Geocoder.java?rev=725537&view=auto
==============================================================================
--- incubator/olio/geocoder/src/org/apache/olio/geocoder/Geocoder.java (added)
+++ incubator/olio/geocoder/src/org/apache/olio/geocoder/Geocoder.java Wed Dec 10 17:56:30 2008
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Geocoder.java
+ *
+ * Assumes latitudes in the northern hemisphere are +ve (0-90) and 
+ * are -ve (0-90) in the southern hemisphere.
+ * 
+ * Assumes longitudes to the west of 0degrees are -ve (0-180) and 
+ *  to the east of 0degrees, +ve.
+ *
+ * For example, LAX is approximately +34degrees latitude and -118.5degrees longitude.
+ */
+
+package org.apache.olio.geocoder;
+
+/**
+ *
+ * @author Prashant Srinivasan
+ */
+public class Geocoder {
+    
+    /** Creates a new instance of Geocoder */
+    public Geocoder() {       
+    }
+    
+    
+    public LatLngDegrees returnCodes(GeocoderBean geoBean) {
+        return new LatLngDegrees(37.416384, -122.024853);
+    }    
+}

Added: incubator/olio/geocoder/src/org/apache/olio/geocoder/GeocoderBean.java
URL: http://svn.apache.org/viewvc/incubator/olio/geocoder/src/org/apache/olio/geocoder/GeocoderBean.java?rev=725537&view=auto
==============================================================================
--- incubator/olio/geocoder/src/org/apache/olio/geocoder/GeocoderBean.java (added)
+++ incubator/olio/geocoder/src/org/apache/olio/geocoder/GeocoderBean.java Wed Dec 10 17:56:30 2008
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * GeocodeBean.java
+ *
+ *
+ *  Used to encapsulate parameters from Geocode request.  
+ *  Parameters in this bean are populated as per the Yahoo
+ *  Geocoder specs at
+ *
+ *     http://developer.yahoo.com/maps/rest/V1/geocode.html
+ *
+ */
+
+package org.apache.olio.geocoder;
+
+/**
+ *
+ * @author Prashant Srinivasan
+ *
+ */
+public class GeocoderBean {
+    
+    public enum OutputType {xml, php}
+    
+    private String appid;
+    private String street;
+    private String city;
+    private String state;
+    private String zip;
+    private String location;
+    private OutputType output;
+    
+    /** Creates a new instance of GeocodeBean */
+    public GeocoderBean() {
+    }
+
+    public String getAppid() {
+        return appid;
+    }
+
+    public void setAppid(String appid) {
+        this.appid = appid;
+    }
+
+    public String getStreet() {
+        return street;
+    }
+
+    public void setStreet(String street) {
+        this.street = street;
+    }
+
+    public String getCity() {
+        return city;
+    }
+
+    public void setCity(String city) {
+        this.city = city;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public String getZip() {
+        return zip;
+    }
+
+    public void setZip(String zip) {
+        this.zip = zip;
+    }
+
+    public String getLocation() {
+        return location;
+    }
+
+    public void setLocation(String location) {
+        this.location = location;
+    }
+
+    public OutputType getOutput() {
+        return output;
+    }
+
+    public void setOutput(String output) {   
+        if (output == null) {
+            this.output = OutputType.xml;
+        } else if (output.equalsIgnoreCase("php")) {
+            this.output = OutputType.php;
+        }
+    }    
+}

Added: incubator/olio/geocoder/src/org/apache/olio/geocoder/GeocoderServlet.java
URL: http://svn.apache.org/viewvc/incubator/olio/geocoder/src/org/apache/olio/geocoder/GeocoderServlet.java?rev=725537&view=auto
==============================================================================
--- incubator/olio/geocoder/src/org/apache/olio/geocoder/GeocoderServlet.java (added)
+++ incubator/olio/geocoder/src/org/apache/olio/geocoder/GeocoderServlet.java Wed Dec 10 17:56:30 2008
@@ -0,0 +1,301 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* 
+ * GeocoderServlet.java
+ *
+ * This is the main servlet that handles the geocoder request.
+ */
+
+package org.apache.olio.geocoder;
+
+import java.io.*;
+import java.net.*;
+
+import javax.servlet.*;
+import javax.servlet.http.*;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import org.apache.jasper.tagplugins.jstl.core.Out;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Element;
+
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ *
+ * @author Prashant Srinivasan
+ * @version
+ */
+public class GeocoderServlet extends HttpServlet {
+    
+    /** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
+     * @param request servlet request
+     * @param response servlet response
+     */
+    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
+    throws ServletException, IOException {
+        
+        GeocoderBean geoBean = getGeocoderBean(request);
+        PrintWriter out = response.getWriter();
+//        if (!aGoodRequest(geoBean)) {
+//            response.setStatus(400);
+//            out.println("<Error xmlns=\"urn:yahoo:api\"> " +
+//                    "The following errors were detected:<Message>" +
+//                    "Input Parameters passed to the service did not" +
+//                    "match as was expected</Message></Error>");
+//            return;
+//        }
+        Geocoder geocoder = new Geocoder();
+        LatLngDegrees point = geocoder.returnCodes(geoBean);
+        
+        
+        response.setContentType("text/html;charset=UTF-8");
+        
+        //out.println("It works!<HR/>");
+        Document doc = buildDom(geoBean);
+        //out.println(printContents(doc));
+        System.out.println("===going to printDOMTree===");
+        displayDOM(doc, out);
+        System.out.println("====finished printDOMTree===");
+        //out.println("<hr/>DONE!");
+        out.close();
+    }
+    
+    public GeocoderBean getGeocoderBean(HttpServletRequest request) {
+        GeocoderBean geoBean = new GeocoderBean();
+        geoBean.setAppid(request.getParameter("appid"));
+        geoBean.setCity(request.getParameter("city"));
+        geoBean.setLocation(request.getParameter("location"));
+        geoBean.setOutput(request.getParameter("output"));
+        geoBean.setState(request.getParameter("state"));
+        geoBean.setState(request.getParameter("state"));
+        geoBean.setStreet(request.getParameter("street"));
+        geoBean.setZip(request.getParameter("zip"));
+        
+        return geoBean;
+    }
+    
+    public String getXmlResponseStream(LatLngDegrees latLng, GeocoderBean geoBean) {
+        return null;
+    }
+    
+    public Document buildDom(GeocoderBean geoBean) {
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        Document document = null;
+        try {
+            DocumentBuilder builder = factory.newDocumentBuilder();
+            document = builder.newDocument();
+            
+            
+            
+            Element root =
+                    (Element) document.createElementNS("http://www.w3.org/2001/XMLSchema-instance","ResultSet");
+            root.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
+            root.setAttribute("xmlns", "urn:yahoo:maps");
+            root.setAttribute("xsi:schemaLocation", "urn:yahoo:maps http://api.local.yahoo.com/MapsService/V1/GeocodeResponse.xsd");
+            document.appendChild(root);
+            Element result = (Element) document.createElement("Result");
+            result.setAttribute("precision", "address");
+            root.appendChild(result);
+            
+            Element latitude = (Element) document.createElement("Latitude");
+            latitude.appendChild(document.createTextNode("33.0000"));
+            result.appendChild(latitude);
+            
+            Element longitude = (Element) document.createElement("Longitude");
+            longitude.appendChild(document.createTextNode("-177.0000"));
+            result.appendChild(longitude);
+            
+            Element address = (Element) document.createElement("Address");
+            //address.appendChild(document.createTextNode("1600 Amphitheater Parkway"));
+            address.appendChild(document.createTextNode(geoBean.getStreet()));
+            result.appendChild(address);
+            
+            Element city = (Element) document.createElement("City");
+            //city.appendChild(document.createTextNode("Mountain View"));
+            city.appendChild(document.createTextNode(geoBean.getCity()));
+            result.appendChild(city);
+            
+            Element state = (Element) document.createElement("State");
+            //state.appendChild(document.createTextNode("CA"));
+            state.appendChild(document.createTextNode(geoBean.getState()));
+            result.appendChild(state);
+            
+            Element zip = (Element) document.createElement("zip");
+            //zip.appendChild(document.createTextNode("94025"));
+            zip.appendChild(document.createTextNode(geoBean.getZip()));
+            result.appendChild(zip);
+            
+            Element country = (Element) document.createElement("Country");
+            country.appendChild(document.createTextNode("USA"));
+            result.appendChild(country);
+            
+        } catch (ParserConfigurationException pce) {
+            // Parser with specified options can't be built
+            pce.printStackTrace();
+        }
+        return document;
+    }
+    
+    public String printContents(Node element) {
+        String stream = "";
+        //print start
+        //if child nodes call printContents on the child nodes.
+        //else print contents
+        //print end
+        stream += "<" + element.getNodeValue() + ">";
+        int numChildren = element.getChildNodes().getLength();
+        if ( numChildren !=0 ) {
+            //call printContents on the child nodes one-by-one
+            for (int j = 0; j < numChildren; j ++) {
+                stream += printContents(element.getChildNodes().item(j));
+            }
+        }
+        stream += "</" + element.getNodeName() + ">";
+        return stream;
+    }
+    
+    
+    public void displayDOM(Node node, PrintWriter out) {
+        
+        int type = node.getNodeType();
+        switch (type) {
+            // print the document element
+            case Node.DOCUMENT_NODE:
+            {
+                out.println("<?xml version=\"1.0\" ?>");
+                displayDOM(((Document)node).getDocumentElement(), out);
+                break;
+            }
+            
+            // print element with attributes
+            case Node.ELEMENT_NODE:
+            {
+                out.print("<");
+                out.print(node.getNodeName());
+                NamedNodeMap attrs = node.getAttributes();
+                for (int i = 0; i < attrs.getLength(); i++) {
+                    Node attr = attrs.item(i);
+                    out.print(" " + attr.getNodeName() +
+                            "=\"" + attr.getNodeValue() +
+                            "\"");
+                }
+                out.println(">");
+                
+                NodeList children = node.getChildNodes();
+                if (children != null) {
+                    int len = children.getLength();
+                    for (int i = 0; i < len; i++)
+                        displayDOM(children.item(i), out);
+                }
+                
+                break;
+            }
+            
+            // handle entity reference nodes
+            case Node.ENTITY_REFERENCE_NODE:
+            {
+                out.print("&");
+                out.print(node.getNodeName());
+                out.print(";");
+                break;
+            }
+            
+            // print cdata sections
+            case Node.CDATA_SECTION_NODE:
+            {
+                out.print("<![CDATA[");
+                out.print(node.getNodeValue());
+                out.print("]]>");
+                break;
+            }
+            
+            // print text
+            case Node.TEXT_NODE:
+            {
+                out.print(node.getNodeValue());
+                break;
+            }
+            
+            // print processing instruction
+            case Node.PROCESSING_INSTRUCTION_NODE:
+            {
+                out.print("<?");
+                out.print(node.getNodeName());
+                String data = node.getNodeValue();
+                {
+                    out.print(" ");
+                    out.print(data);
+                }
+                out.print("?>");
+                break;
+            }
+        }
+        
+        if (type == Node.ELEMENT_NODE) {
+            out.println();
+            out.print("</");
+            out.print(node.getNodeName());
+            out.print('>');
+        }
+    }
+    
+    public boolean aGoodRequest(GeocoderBean geoBean) {
+        if ((geoBean.getAppid() == null) || (geoBean.getCity() == null)
+        || (geoBean.getLocation() == null) || (geoBean.getStreet() == null)
+        || (geoBean.getState() == null) || (geoBean.getZip() == null)) {
+            return false;
+        }
+        return true;
+    }
+    
+    
+    
+    
+    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
+    /** Handles the HTTP <code>GET</code> method.
+     * @param request servlet request
+     * @param response servlet response
+     */
+    protected void doGet(HttpServletRequest request, HttpServletResponse response)
+    throws ServletException, IOException {
+        processRequest(request, response);
+    }
+    
+    /** Handles the HTTP <code>POST</code> method.
+     * @param request servlet request
+     * @param response servlet response
+     */
+    protected void doPost(HttpServletRequest request, HttpServletResponse response)
+    throws ServletException, IOException {
+        processRequest(request, response);
+    }
+    
+    /** Returns a short description of the servlet.
+     */
+    public String getServletInfo() {
+        return "Short description";
+    }
+    // </editor-fold>
+    
+}

Added: incubator/olio/geocoder/src/org/apache/olio/geocoder/LatLngDegrees.java
URL: http://svn.apache.org/viewvc/incubator/olio/geocoder/src/org/apache/olio/geocoder/LatLngDegrees.java?rev=725537&view=auto
==============================================================================
--- incubator/olio/geocoder/src/org/apache/olio/geocoder/LatLngDegrees.java (added)
+++ incubator/olio/geocoder/src/org/apache/olio/geocoder/LatLngDegrees.java Wed Dec 10 17:56:30 2008
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * LatLngDegrees.java
+ * @author Prashant Srinivasan
+ *
+ */
+
+package org.apache.olio.geocoder;
+
+public class LatLngDegrees {
+
+    private double lat;
+
+    private double lng;
+    
+    /** Creates a new instance of LatLngDegrees */
+    public LatLngDegrees(double lat, double lng) {
+        this.lat = lat;
+        this.lng = lng;
+    }
+    
+   public double getLat() {
+       return lat;
+   }
+    public double getLng() {
+        return lng;
+    }
+}

Added: incubator/olio/geocoder/web/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/incubator/olio/geocoder/web/META-INF/MANIFEST.MF?rev=725537&view=auto
==============================================================================
--- incubator/olio/geocoder/web/META-INF/MANIFEST.MF (added)
+++ incubator/olio/geocoder/web/META-INF/MANIFEST.MF Wed Dec 10 17:56:30 2008
@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+Ant-Version: Apache Ant 1.6.5
+Created-By: 1.6.0-rc-b104 (Sun Microsystems Inc.)
+

Added: incubator/olio/geocoder/web/META-INF/context.xml
URL: http://svn.apache.org/viewvc/incubator/olio/geocoder/web/META-INF/context.xml?rev=725537&view=auto
==============================================================================
--- incubator/olio/geocoder/web/META-INF/context.xml (added)
+++ incubator/olio/geocoder/web/META-INF/context.xml Wed Dec 10 17:56:30 2008
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Context path="/WebApplication1"/>

Added: incubator/olio/geocoder/web/WEB-INF/GeocodeResponse.xsd
URL: http://svn.apache.org/viewvc/incubator/olio/geocoder/web/WEB-INF/GeocodeResponse.xsd?rev=725537&view=auto
==============================================================================
--- incubator/olio/geocoder/web/WEB-INF/GeocodeResponse.xsd (added)
+++ incubator/olio/geocoder/web/WEB-INF/GeocodeResponse.xsd Wed Dec 10 17:56:30 2008
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  targetNamespace="urn:yahoo:maps"
+  xmlns="urn:yahoo:maps"
+  elementFormDefault="qualified">
+
+	<xs:element name="ResultSet">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:element name="Result" type="ResultType" minOccurs="0" maxOccurs="50" />
+			</xs:sequence>
+		</xs:complexType>
+	</xs:element>
+
+	<xs:complexType name="ResultType">
+		<xs:sequence>
+			<xs:element name="Latitude" type="xs:decimal" />
+			<xs:element name="Longitude" type="xs:decimal" />
+			<xs:element name="Address" type="xs:string" />
+			<xs:element name="City" type="xs:string" />
+			<xs:element name="State" type="xs:string" />
+			<xs:element name="Zip" type="xs:string" />
+			<xs:element name="Country" type="xs:string" />
+		</xs:sequence>
+		<xs:attribute name="precision" type="xs:string" />
+		<xs:attribute name="warning" type="xs:string" use="optional"/>
+	</xs:complexType>
+	
+</xs:schema>
+<!-- ws05.search.scd.yahoo.com compressed/chunked Fri Apr 13 16:07:31 PDT 2007 -->

Added: incubator/olio/geocoder/web/WEB-INF/SampleResponse.xml
URL: http://svn.apache.org/viewvc/incubator/olio/geocoder/web/WEB-INF/SampleResponse.xml?rev=725537&view=auto
==============================================================================
--- incubator/olio/geocoder/web/WEB-INF/SampleResponse.xml (added)
+++ incubator/olio/geocoder/web/WEB-INF/SampleResponse.xml Wed Dec 10 17:56:30 2008
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ResultSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xmlns="urn:yahoo:maps"
+xsi:schemaLocation="urn:yahoo:maps http://api.local.yahoo.com/MapsService/V1/GeocodeResponse.xsd">
+  <Result precision="address">
+    <Latitude>37.416384</Latitude>
+    <Longitude>-122.024853</Longitude>
+    <Address>701 FIRST AVE</Address>
+    <City>SUNNYVALE</City>
+    <State>CA</State>
+    <Zip>94089-1019</Zip>
+    <Country>US</Country>
+  </Result>
+</ResultSet>
\ No newline at end of file

Added: incubator/olio/geocoder/web/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/olio/geocoder/web/WEB-INF/web.xml?rev=725537&view=auto
==============================================================================
--- incubator/olio/geocoder/web/WEB-INF/web.xml (added)
+++ incubator/olio/geocoder/web/WEB-INF/web.xml Wed Dec 10 17:56:30 2008
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" 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">
+    <servlet>
+        <servlet-name>GeocoderServlet</servlet-name>
+        <servlet-class>org.apache.olio.geocoder.GeocoderServlet</servlet-class>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>GeocoderServlet</servlet-name>
+        <url-pattern>/geocode</url-pattern>
+    </servlet-mapping>
+    <session-config>
+        <session-timeout>
+            30
+        </session-timeout>
+    </session-config>
+    <welcome-file-list>
+	<welcome-file>
+            index.jsp
+        </welcome-file>
+    </welcome-file-list>
+</web-app>

Added: incubator/olio/geocoder/web/index.jsp
URL: http://svn.apache.org/viewvc/incubator/olio/geocoder/web/index.jsp?rev=725537&view=auto
==============================================================================
--- incubator/olio/geocoder/web/index.jsp (added)
+++ incubator/olio/geocoder/web/index.jsp Wed Dec 10 17:56:30 2008
@@ -0,0 +1,36 @@
+<%@page contentType="text/html"%>
+<%@page pageEncoding="UTF-8"%>
+<%--
+The taglib directive below imports the JSTL library. If you uncomment it,
+you must also add the JSTL library to the project. The Add Library... action
+on Libraries node in Projects view can be used to add the JSTL 1.1 library.
+--%>
+<%--
+<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 
+--%>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+   "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+        <title>JSP Page</title>
+    </head>
+    <body>
+
+    <h1>JSP Page</h1>
+    
+    <%--
+    This example uses JSTL, uncomment the taglib directive above.
+    To test, display the page like this: index.jsp?sayHello=true&name=Murphy
+    --%>
+    <%--
+    <c:if test="${param.sayHello}">
+        <!-- Let's welcome the user ${param.name} -->
+        Hello ${param.name}!
+    </c:if>
+    --%>
+    
+    </body>
+</html>