Introduction
This is imlementation of LoST Server conform to the rules described in draft-ietf-ecrit-lost-06 and draft-ietf-ecrit-mapping-arch-02
LoST is abbreviation for Location to Service Translation. This is a protocol for mapping a service identifier (service URNs) and location information (compatible with PIDF-LO) to one or more service URLs. LoST server provides a number of operations, centered around mapping locations and service URNs to service URLs and associated information.
LoST Server architecture

- Seeker
- Resolver
- Forest Guide
- Tree Node
- Tree Leaf
A seeker is a LoST client requesting a mapping. A seeker does not provide mapping services to others, but may cache results for its own use.
A resolver is contacted by a seeker, consults a forest mapping server and then resolves the query using an appropriate tree. Resolvers may cache query results.
A forest guide (FG) has knowledge of the coverage region of trees for a particular top-level service.
A node cluster (tree node) is a group of LoST servers that all share the same mapping information and return the same results for queries. Clusters provide redundancy and share query load. Clusters are fully-meshed, i.e., they all exchange updates with each other.
A tree consists of a self-contained hierarchy of authoritative mapping servers. Each tree exports its coverage region to the forest mapping servers.
Example LoST Server Response
<findServiceResponse xmlns="urn:ietf:params:xml:ns:lost1">
     <mapping
       expires="2007-01-01T01:44:33Z"
       lastUpdated="2006-11-01T01:00:00Z"
       source="esgw.ueber-110.de.example"
       sourceId="e8b05a41d8d1415b80f2cdbb96ccf109">
       <displayName xml:lang="de">
         Muenchen Polizei-Abteilung
       </displayName>
       <service>urn:service:sos.police</service>
       <serviceBoundary
         profile="urn:ietf:params:lost:location-profile:basic-civic">
         <civicAddress
           xmlns="urn:ietf:params:xml:ns:pidf:geopriv10:civicAddr">
           <country>Germany</country>
           <A1>Bavaria</A1>
           <A3>Munich</A3>
           <PC>81675</PC>
         </civicAddress>
       </serviceBoundary>
       <uri>sip:munich-police@example.com</uri>
       <uri>xmpp:munich-police@example.com</uri>
       <serviceNumber>110</serviceNumber>
     </mapping>
     <path>
       <via source="esgw.ueber-110.de.example"/>
       <via source="polizei.muenchen.de.example"/>
     </path>
     <locationUsed id="627b8bf819d0bad4d"/>
   </findServiceResponse>
Installation
This is describsion how to install LoST Server and all dependences. The installation was tested on Debian system.
- PostGIS instalation
- Java installation
- Tomcat installation
- apache-tomcat-[version].tar.gz
- apache-tomcat-[version]-deployer.tar.gz
- apache-tomcat-[version]-embed.tar.gz
- apache-tomcat-[version]-admin.tar.gz
- apache-tomcat-[version]-compat.tar.gz
- apache-tomcat-[version]-fulldocs.tar.gz
- LoST Server installation
PostgreSQL installation:
apt-get install postgresql-dev apt-get install postgresql-doc pgdocs libpqxx-dev libpgeasy-dev heimdal-dev apt-get install pgdocs-pdf apt-get install postgresql-doc pgdocs libpqxx-dev libpgeasy-dev heimdal-dev apt-get install postgresql-doc libpqxx-dev libpgeasy-dev heimdal-dev
Geos Library and PROJ4 installation:
cd /usr/local/src/ wget http://geos.refractions.net/geos-3.0.0rc3.tar.bz2 tar -jxvf geos-3.0.0rc3.tar.bz2
cd geos-3.0.0rc3 ./configure --prefix=/usr/local/geos-3.0.0rc3 make make install
cd /usr/local/src/ wget ftp://ftp.remotesensing.org/proj/proj-4.5.0.tar.gz tar -zxvf proj-4.5.0.tar.gz
cd proj-4.5.0 ./configure --prefix=/usr/local/proj-4.5.0 make make install
vim /etc/ld.so.conf
Add the following line to the end of the file:
/usr/local/geos-3.0.0rc3/lib /usr/local/proj-4.5.0/lib
ldconfig
PostGIS installation:
cd /usr/local/src apt-get build-dep postgresql apt-get source postgresql mkdir postgresql mv postgresql* postgresql cd postgresql/postgresql-7.4.7 ./debian/rules config cd build-tree/postgresql-7.4.7/contrib/
cd /usr/local/src/ wget http://postgis.refractions.net/download/postgis-1.2.0.tar.gz cd /usr/local/src/postgresql/postgresql-7.4.7/build-tree/postgresql-7.4.7/contrib/ tar -zxvf /usr/local/src/postgis-1.2.0.tar.gz
cd postgis-1.2.0/ ./configure --prefix=/usr/local/postgis-1.2.0 \ --with-geos=/usr/local/geos-3.0.0rc3/bin/geos-config \ --with-proj=/usr/local/proj-4.5.0/ \ --with-proj-libdir=/usr/local/proj-4.5.0/lib/ make make install
vim /etc/postgresql/pg_hba.conf
Add the following line to the file:
local postgis postgis md5 host postgis postgis 127.0.0.1 255.255.255.255 md5
/etc/init.d/postgresql restart
su - postgres psql -U postgres template1 -c "DROP DATABASE postgis;" psql -U postgres template1 -c "DROP USER postgis;" psql -U postgres template1 -c "CREATE USER postgis WITH ENCRYPTED \ PASSWORD 'postgis' NOCREATEDB NOCREATEUSER;" psql -U postgres template1 -c "CREATE DATABASE postgis WITH OWNER = postgis;" createlang plpgsql postgis cd /usr/local/postgis-1.2.0/share/ psql -d postgis -f lwpostgis.sql psql -U postgres postgis -c "GRANT ALL PRIVILEGES ON geometry_columns TO postgis" psql -d postgis -f spatial_ref_sys.sql psql -U postgres postgis -c "GRANT ALL PRIVILEGES ON spatial_ref_sys TO postgis"
Download and install Java SE Development Kit (JDK) from java.sun.com.
./jdk-6-linux-i586.bin mv jdk1.6.0 /usr/local/
vim /etc/profile
Add the following line to the end of the file:
export JAVA_HOME=/usr/local/jdk1.6.0 export PATH="$PATH:$JAVA_HOME/bin"
This LoST Server installation was tested on Tomcat 5.5.20. Download the following files from tomcat.apache.org:
mkdir -p /usr/local/src/apache-tomcat-[version] cd /usr/local/src/apache-tomcat-[version]
wget http://[your mirror]/tomcat/.../bin/apache-tomcat-[version].tar.gz wget http://[your mirror]/tomcat/.../bin/apache-tomcat-[version]-deployer.tar.gz wget http://[your mirror]/tomcat/.../bin/apache-tomcat-[version]-embed.tar.gz wget http://[your mirror]/tomcat/.../bin/apache-tomcat-[version]-admin.tar.gz wget http://[your mirror]/tomcat/.../bin/apache-tomcat-[version]-compat.tar.gz wget http://[your mirror]/tomcat/.../bin/apache-tomcat-[version]-fulldocs.tar.gz
Install Tomcat. See RUNNING.txt for more details.
cd /usr/local/ tar -zxvf src/apache-tomcat-[version]/apache-tomcat-[version].tar.gz tar -zxvf src/apache-tomcat-[version]/apache-tomcat-[version]-admin.tar.gz
cd apache-tomcat-[version]/ less RUNNING.txt
vim /etc/profile
Add the following line to the end of the file:
export CATALINA_HOME=/usr/local/apache-tomcat-[version] $CATALINA_HOME/bin/startup.sh $CATALINA_HOME/bin/shutdown.sh
Create tomcat startup script:
vim /etc/init.d/tomcat
Add the following line to the file:
#!/bin/sh -e
case $1 in
        start)
                echo "Starting web server: TOMCAT"
                /usr/local/apache-tomcat-[version]/bin/startup.sh
        ;;
        stop)
                echo "Stopping web server: TOMCAT"
                /usr/local/apache-tomcat-[version]/bin/shutdown.sh
        ;;
        restart)
                echo "Restart of web server: TOMCAT"
                /usr/local/apache-tomcat-[version]/bin/startup.sh
		sleep 1
                /usr/local/apache-tomcat-[version]/bin/shutdown.sh
        ;;
        *)
                echo "Usage: /etc/init.d/tomcat start|stop|restart"
        ;;
esac
Finally:
cd /etc/rc2.d/ ln -s ../init.d/tomcat S93tomcat cp S93tomcat ../rc0.d/K93tomcat cp S93tomcat ../rc1.d/K93tomcat cp S93tomcat ../rc3.d/S93tomcat cp S93tomcat ../rc4.d/S93tomcat cp S93tomcat ../rc5.d/S93tomcat cp S93tomcat ../rc6.d/K93tomcat
ln -s /usr/share/java/postgresql.jar /usr/local/apache-tomcat-[version]/common/lib/
cd /usr/local/apache-tomcat-[version]/ mkdir -p ./webapps/ecrit cd ./webapps/ecrit
svn co http://cordelia.ccns.pl/svn/ecrit/project/LoST_implementation/LoST_server/
login: ecrit (no password)
ln -s LoST_server LoST cd ./LoST/WEB-INF ./build.sh /etc/init.d/tomcat restart
Configuration
Configuration file is placed in WEB-INF/config/config.xml
Example configuration file
<?xml version="1.0" encoding="UTF-8"?>
   <configuration>
     <LoST>
       <debug>true</debug>
       <hostname>yoursite.com</hostname>
       <logFile>/usr/local/apache-tomcat-5.5.20/(...)/LoST.log</logFile>
       <dbCivicHostname>localhost</dbCivicHostname>
       <dbCivicUsername>postgis</dbCivicUsername>
       <dbCivicPassword>postgis</dbCivicPassword>
       <dbCivicBase>postgis</dbCivicBase>
       <dbLostHostname>localhost</dbLostHostname>
       <dbLostUsername>postgis</dbLostUsername>
       <dbLostPassword>postgis</dbLostPassword>
       <dbLostBase>postgis</dbLostBase>
       <mode>TreeLeaf</mode>
       <!-- <mode>ForestGuide</mode> -->
       <!-- <mode>Resolver</mode> -->
       <!-- <mode>TreeNode</mode> -->
       <!-- <mode>TreeLeaf</mode> -->
     </LoST>
   </configuration>