<s> import tornado . httpserver <EOL> import tornado . ioloop <EOL> import tornado . web <EOL> import platform <EOL> import sys <EOL> import apiserver . const as C <EOL> from capabilities import CapabilitiesHandler <EOL> from maphandler import MapHandler <EOL> from osmelement import OsmElementHandler , OsmElementRelationsHandler , OsmFullQueryHandler , OsmMultiElementHandler , OsmWaysForNodeHandler <EOL> class RootHandler ( tornado . web . RequestHandler ) : <EOL> """<STR_LIT>""" <EOL> default_message = """<STR_LIT>""" <EOL> def initialize ( self , cfg ) : <EOL> self . usagemessage = RootHandler . default_message % dict ( <EOL> apiversion = cfg . get ( C . FRONT_END , C . API_VERSION ) , <EOL> hostname = platform . node ( ) , <EOL> projectdoc = cfg . get ( C . DEFAULT , C . PROJECT_DOC ) , <EOL> sourcerepository = cfg . get ( C . DEFAULT , C . SOURCE_REPOSITORY ) ) <EOL> def get ( self ) : <EOL> self . write ( self . usagemessage ) <EOL> class ReadOnlyHandler ( tornado . web . RequestHandler ) : <EOL> """<STR_LIT>""" <EOL> def initialize ( self , cfg = None ) : <EOL> pass <EOL> class NotImplementedHandler ( tornado . web . RequestHandler ) : <EOL> """<STR_LIT>""" <EOL> def initialize ( self , cfg = None ) : <EOL> pass <EOL> def get ( self , request ) : <EOL> raise tornado . web . HTTPError ( <NUM_LIT> ) <EOL> class OSMFrontEndServer : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , cfg , options , datastore ) : <EOL> """<STR_LIT>""" <EOL> osm_api_version = cfg . get ( C . FRONT_END , C . API_VERSION ) <EOL> application = tornado . web . Application ( [ <EOL> ( r"<STR_LIT>" % osm_api_version , MapHandler , <EOL> dict ( cfg = cfg , datastore = datastore ) ) , <EOL> ( r"<STR_LIT>" % osm_api_version , CapabilitiesHandler , <EOL> dict ( cfg = cfg ) ) , <EOL> ( r"<STR_LIT>" % osm_api_version , <EOL> NotImplementedHandler , dict ( cfg = cfg ) ) , <EOL> ( r"<STR_LIT>" % osm_api_version , <EOL> NotImplementedHandler , dict ( cfg = cfg ) ) , <EOL> ( r"<STR_LIT>" % osm_api_version , <EOL> NotImplementedHandler , dict ( cfg = cfg ) ) , <EOL> ( r"<STR_LIT>" % osm_api_version , <EOL> NotImplementedHandler , dict ( cfg = cfg ) ) , <EOL> ( r"<STR_LIT>" % osm_api_version , <EOL> NotImplementedHandler , dict ( cfg = cfg ) ) , <EOL> ( r"<STR_LIT>" % osm_api_version , <EOL> OsmWaysForNodeHandler , dict ( datastore = datastore ) ) , <EOL> ( r"<STR_LIT>" % osm_api_version , <EOL> OsmMultiElementHandler , dict ( datastore = datastore ) ) , <EOL> ( r"<STR_LIT>" % osm_api_version , <EOL> ReadOnlyHandler , dict ( cfg = cfg ) ) , <EOL> ( r"<STR_LIT>" % <EOL> osm_api_version , NotImplementedHandler , <EOL> dict ( cfg = cfg ) ) , <EOL> ( r"<STR_LIT>" % <EOL> osm_api_version , NotImplementedHandler , <EOL> dict ( cfg = cfg ) ) , <EOL> ( r"<STR_LIT>" % <EOL> osm_api_version , OsmElementRelationsHandler , <EOL> dict ( datastore = datastore ) ) , <EOL> ( r"<STR_LIT>" % <EOL> osm_api_version , OsmElementHandler , dict ( datastore = datastore ) ) , <EOL> ( r"<STR_LIT>" % osm_api_version , <EOL> OsmFullQueryHandler , dict ( datastore = datastore ) ) , <EOL> ( r"<STR_LIT>" , CapabilitiesHandler , dict ( cfg = cfg ) ) , <EOL> ( r"<STR_LIT:/>" , RootHandler , dict ( cfg = cfg ) ) <EOL> ] ) <EOL> self . _application = application <EOL> self . _config = cfg <EOL> self . _datastore = datastore <EOL> def _get_application ( self ) : <EOL> return self . _application <EOL> def _get_config ( self ) : <EOL> return self . _config <EOL> def _get_datastore ( self ) : <EOL> return self . _datastore <EOL> application = property ( _get_application ) <EOL> config = property ( _get_config ) <EOL> datastore = property ( _get_datastore ) </s>
