org.osmdroid.server.jdk.TileFetcher Maven / Gradle / Ivy
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.osmdroid.server.jdk;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import javax.ws.rs.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* This is a REST web service (via Apache CXF) that provides 3 functions
* - getSourceList() - provides a list of human readable tile sources
* - getImage - gets a ZXY OSM style map tile
* - serves from file system, a simple open layers slippy map that makes it easy to test to see if this thing is working
* and let's you flip tiles sources using some jquery magic
*
* @author Alex O'Ree
*/
@Path("/")
@Produces({"image/png", "application/json", "text/html","text/css","text/javascript"})
@org.apache.cxf.jaxrs.model.wadl.Description("")
public class TileFetcher {
private static final Log log = LogFactory.getLog(TileFetcher.class);
static ObjectMapper om = new ObjectMapper();
HashMap connections = new HashMap();
public TileFetcher() throws Exception {
initDatabases();
}
private void initDatabases() throws Exception {
Properties p = new Properties();
FileInputStream fis = new FileInputStream("sources.properties");
p.load(fis);
fis.close();
fis = null;
Iterator> iterator = p.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry
© 2015 - 2025 Weber Informatics LLC | Privacy Policy