Exemplo n.º 1
0
def setupServer():
    config = configparser.ConfigParser()
    config.readfp(open(SWIS_CONFIG_FILE))

    swis_dao = SwisDao(SWIS_CONFIG_FILE,
                       database_uri="sqlite:///test_swis2.db")
    app = wof.flask.create_wof_flask_app(swis_dao, SWIS_CONFIG_FILE)
    # app.config['DEBUG'] = True

    url = "http://127.0.0.1:" + str(openPort)
    print("----------------------------------------------------------------")
    print("Service endpoints")
    for path in wof.flask.site_map_flask_wsgi_mount(app):
        print("{}{}s".format(url, path))

    print("----------------------------------------------------------------")
    print("----------------------------------------------------------------")
    print("Access HTML endpoints at ")
    for path in wof.site_map(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")

    # app.run(host='0.0.0.0', port=openPort, threaded=True)
    app.run(host='0.0.0.0', port=openPort, threaded=False)
Exemplo n.º 2
0
def setupServer():
    config = ConfigParser.ConfigParser()
    config.readfp(open(SWIS_CONFIG_FILE))

    swis_dao = SwisDao(SWIS_CONFIG_FILE, database_uri="sqlite:///test_swis2.db")
    app = wof.flask.create_wof_flask_app(swis_dao, SWIS_CONFIG_FILE)
    #    app.config['DEBUG'] = True



    url = "http://127.0.0.1:" + str(openPort)
    print "----------------------------------------------------------------"
    print "Service endpoints"
    for path in wof.flask.site_map_flask_wsgi_mount(app):
        print "%s%s" % (url, path)

    print "----------------------------------------------------------------"
    print "----------------------------------------------------------------"
    print "Acess HTML endpoints at "
    for path in wof.site_map(app):
        print "%s%s" % (url, path)

    print "----------------------------------------------------------------"

    #app.run(host='0.0.0.0', port=openPort, threaded=True)
    app.run(host='0.0.0.0', port=openPort, threaded=False)
Exemplo n.º 3
0
def startServer(m_config=M_CONFIG_FILE,
                t_config=T_CONFIG_FILE,
                m_connection=None,
                t_connection=None,
                openPort=8080):
    if m_connection is None and t_connection is None:
        sys.exit("connection  must be provided")
    m_dao = measurement(m_connection.read())
    t_dao = timeseries(t_connection.read())

    m_conf = wof.core.wofConfig(m_dao, m_config)
    t_conf = wof.core.wofConfig(t_dao, t_config)

    app= wof.flask.create_wof_flask_multiple({m_conf, t_conf}, templates=wof._TEMPLATES)

    url = "http://127.0.0.1:" + str(openPort)
    print("----------------------------------------------------------------")
    print("Service endpoints")
    for path in wof.flask.site_map_flask_wsgi_mount(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")
    print("----------------------------------------------------------------")
    print("Access HTML descriptions of endpoints at ")
    for path in wof.site_map(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")

    app.run(host='0.0.0.0', port=openPort, threaded=True)
Exemplo n.º 4
0
def startServer(config=CSV_CONFIG_FILE,config2=CSV_CONFIG_FILE2,
                sites_file=SITES_FILE,
                values_file=VALUES_FILE):

    dao = CsvDao(sites_file, values_file)

    conf1 = wof.core.wofConfig(dao, config)
    conf2 = wof.core.wofConfig(dao, config2)

    app= wof.flask.create_wof_flask_multiple({conf1, conf2})

    openPort = 8080
    url = "http://127.0.0.1:" + str(openPort)
    print("----------------------------------------------------------------")
    print("Service endpoints")
    for path in wof.flask.site_map_flask_wsgi_mount(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")
    print("----------------------------------------------------------------")
    print("Access HTML descriptions of endpoints at ")
    for path in wof.site_map(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")

    app.run(host='0.0.0.0', port=openPort, threaded=True)
Exemplo n.º 5
0
def startServer(config=CSV_CONFIG_FILE,
                config2=CSV_CONFIG_FILE2,
                sites_file=SITES_FILE,
                values_file=VALUES_FILE):

    dao = CsvDao(sites_file, values_file)

    conf1 = wof.core.wofConfig(dao, config)
    conf2 = wof.core.wofConfig(dao, config2)

    app = wof.flask.create_wof_flask_multiple({conf1, conf2})

    openPort = 8080
    url = "http://127.0.0.1:" + str(openPort)
    print("----------------------------------------------------------------")
    print("Service endpoints")
    for path in wof.flask.site_map_flask_wsgi_mount(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")
    print("----------------------------------------------------------------")
    print("Access HTML descriptions of endpoints at ")
    for path in wof.site_map(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")

    app.run(host='0.0.0.0', port=openPort, threaded=True)
Exemplo n.º 6
0
def startServer(config=CSV_CONFIG_FILE,
                sites_file=SITES_FILE,
                values_file=VALUES_FILE):
    dao = CsvDao(sites_file, values_file)
    app = wof.create_wof_flask_app(dao, config)
    app.config['DEBUG'] = True
    site_map = wof.site_map(app)

    openPort = 8080
    url = "http://127.0.0.1:" + str(openPort)
    print "----------------------------------------------------------------"
    print "Acess Service endpoints at "
    for path in wof.site_map(app):
        print "%s%s" % (url,path)

    print "----------------------------------------------------------------"

    app.run(host='0.0.0.0', port=openPort, threaded=True)
Exemplo n.º 7
0
def startServer(config=CSV_CONFIG_FILE,
                sites_file=SITES_FILE,
                values_file=VALUES_FILE,
                openPort=8080):
    dao = CsvDao(sites_file, values_file)
    app = wof.flask.create_wof_flask_app(dao, config)
    #    app.config['DEBUG'] = True
    site_map = wof.site_map(app)

    url = "http://127.0.0.1:" + str(openPort)
    print("----------------------------------------------------------------")
    print("Access Service endpoints at ")
    for path in wof.site_map(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")

    app.run(host='0.0.0.0', port=openPort, threaded=True)
Exemplo n.º 8
0
def startServer(config="odm2_config_timeseries.cfg", connection=None, openPort=8080):
    dao = Odm2Dao(connection.read())
    app = wof.flask.create_wof_flask_app(dao, config)
    app.config["DEBUG"] = True

    url = "http://127.0.0.1:" + str(openPort)
    print "----------------------------------------------------------------"
    print "Acess Service endpoints at "
    for path in wof.site_map(app):
        print "%s%s" % (url, path)

    print "----------------------------------------------------------------"

    app.run(host="0.0.0.0", port=openPort, threaded=True)
Exemplo n.º 9
0
def startServer(config='odm2_config_timeseries.cfg',connection=None):
    dao = Odm2Dao(connection)
    app = wof.create_wof_flask_app(dao, config)
    app.config['DEBUG'] = True

    openPort = 8080
    url = "http://127.0.0.1:" + str(openPort)
    print "----------------------------------------------------------------"
    print "Acess Service endpoints at "
    for path in wof.site_map(app):
        print "%s%s" % (url,path)

    print "----------------------------------------------------------------"

    app.run(host='0.0.0.0', port=openPort, threaded=True)
Exemplo n.º 10
0
def startServer(config=SWIS_CONFIG_FILE,
                connection=SWIS_DATABASE_URI,
                openPort=8080):

    swis_dao = SwisDao(SWIS_CONFIG_FILE, database_uri=connection)
    app = wof.flask.create_wof_flask_app(swis_dao, config)
    #    app.config['DEBUG'] = True

    url = "http://127.0.0.1:" + str(openPort)
    print("----------------------------------------------------------------")
    print("Access Service endpoints at ")
    for path in wof.site_map(app):
        print("{}{}".format(url, path))
    print("----------------------------------------------------------------")

    app.run(host='0.0.0.0', port=openPort, threaded=True)
Exemplo n.º 11
0
def startServer(config='odm2_config_measurement.cfg',
                connection=None,
                openPort=8080):
    dao = Odm2Dao(connection.read())
    app = wof.flask.create_wof_flask_app(dao, config)
    app.config['DEBUG'] = True

    url = "http://127.0.0.1:" + str(openPort)
    print("----------------------------------------------------------------")
    print("Access Service endpoints at ")
    for path in wof.site_map(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")

    app.run(host='0.0.0.0', port=openPort, threaded=True)
Exemplo n.º 12
0
def startServer(config=SWIS_CONFIG_FILE,connection=SWIS_DATABASE_URI, openPort=8080):

    swis_dao = SwisDao(SWIS_CONFIG_FILE, database_uri=connection)
    app = wof.create_wof_flask_app(swis_dao, config)
    app.config['DEBUG'] = True


    url = "http://127.0.0.1:" + str(openPort)
    print "----------------------------------------------------------------"
    print "Acess Service endpoints at "
    for path in wof.site_map(app):
        print "%s%s" % (url,path)

    print "----------------------------------------------------------------"

    app.run(host='0.0.0.0', port=openPort, threaded=True)
Exemplo n.º 13
0
def startServer(config='odm2_config_measurement.cfg',connection=None,
                    openPort = 8080):
    dao = Odm2Dao(connection.read())
    app = wof.flask.create_wof_flask_app(dao, config)
    app.config['DEBUG'] = True


    url = "http://127.0.0.1:" + str(openPort)
    print("----------------------------------------------------------------")
    print("Access Service endpoints at ")
    for path in wof.site_map(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")

    app.run(host='0.0.0.0', port=openPort, threaded=True)
Exemplo n.º 14
0
def startServer(config="LCM_config.cfg", connection="sqlite:///LCM_Data/LCM.db", openPort=8080):

    dao = LCMDao(connection, config)
    app = wof.flask.create_wof_flask_app(dao, config)
    #    app.config['DEBUG'] = True

    url = "http://127.0.0.1:" + str(openPort)
    print "----------------------------------------------------------------"
    print "Service endpoints"
    for path in wof.flask.site_map_flask_wsgi_mount(app):
        print "%s%s" % (url, path)

    print "----------------------------------------------------------------"
    print "----------------------------------------------------------------"
    print "HTML Acess Service endpoints at "
    for path in wof.site_map(app):
        print "%s%s" % (url, path)

    print "----------------------------------------------------------------"
    app.run(host="0.0.0.0", port=openPort, threaded=True)
Exemplo n.º 15
0
def startServer(config='LCM_config.cfg',connection='sqlite:///LCM_Data/LCM.db', openPort=8080):

    dao = LCMDao(connection,config)
    app = wof.flask.create_wof_flask_app(dao, config)
    app.config['DEBUG'] = True


    url = "http://127.0.0.1:" + str(openPort)
    print("----------------------------------------------------------------")
    print("Service endpoints")
    for path in wof.flask.site_map_flask_wsgi_mount(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")
    print("----------------------------------------------------------------")
    print("HTML Access Service endpoints at ")
    for path in wof.site_map(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")
    app.run(host='0.0.0.0', port=openPort, threaded=True)
Exemplo n.º 16
0
def startServer(connection, config="config.cfg", openPort=8080):
    """given an open file on connection, read it to get a connection string to open the database and start up flask running WOF."""
    dao = OdmDao(connection.read())
    app = wof.flask.create_wof_flask_app(dao, config)

    configFile = WOFConfig(config)

    url = "http://127.0.0.1:" + str(openPort)
    print "----------------------------------------------------------------"
    print "Service endpoints"
    for path in wof.flask.site_map_flask_wsgi_mount(app):
        print "%s%s" % (url, path)

    print "----------------------------------------------------------------"
    print "----------------------------------------------------------------"
    print "HTML Access Service endpoints at "
    for path in wof.site_map(app):
        print "%s%s" % (url, path)

    print "----------------------------------------------------------------"

    app.run(host="0.0.0.0", port=openPort, threaded=True)
Exemplo n.º 17
0
def startServer(connection, config='config.cfg', openPort=8080):
    """given an open file on connection, read it to get a connection string to open the database and start up flask running WOF."""
    dao = OdmDao(connection.read())
    app = wof.flask.create_wof_flask_app(dao, config)

    configFile = WOFConfig(config)

    url = "http://127.0.0.1:" + str(openPort)
    print("----------------------------------------------------------------")
    print("Service endpoints")
    for path in wof.flask.site_map_flask_wsgi_mount(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")
    print("----------------------------------------------------------------")
    print("HTML Access Service endpoints at ")
    for path in wof.site_map(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")

    app.run(host='0.0.0.0', port=openPort, threaded=True)
Exemplo n.º 18
0
def startServer(config='config.cfg',connection=None,openPort=8080):

    dao = OdmDao(connection)
    app = wof.create_wof_flask_app(dao, config)
    app.config['DEBUG'] = True

    configFile = WOFConfig(config)

    url = "http://127.0.0.1:" + str(openPort)
    print "----------------------------------------------------------------"
    print "Service endpoints"
    for path in wof.core.site_map_flask_wsgi_mount(app):
        print "%s%s" % (url,path)

    print "----------------------------------------------------------------"
    print "----------------------------------------------------------------"
    print "HTML Acess Service endpoints at "
    for path in wof.site_map(app):
        print "%s%s" % (url,path)

    print "----------------------------------------------------------------"

    app.run(host='0.0.0.0', port=openPort, threaded=True)
Exemplo n.º 19
0
def startServer(config=CBI_CONFIG_FILE,connection=CBI_CACHE_DATABASE_URI):

    cbi_dao = CbiDao(CBI_CONFIG_FILE, database_uri=CBI_CACHE_DATABASE_URI)
    app = wof.create_wof_flask_app(cbi_dao, config)
    app.config['DEBUG'] = True


    openPort = 8080
    url = "http://127.0.0.1:" + str(openPort)
    print "----------------------------------------------------------------"
    print "Service endpoints"
    for path in wof.core.site_map_flask_wsgi_mount(app):
        print "%s%s" % (url,path)

    print "----------------------------------------------------------------"
    print "----------------------------------------------------------------"
    print "HTML Acess Service endpoints at "
    for path in wof.site_map(app):
        print "%s%s" % (url,path)

    print "----------------------------------------------------------------"

    app.run(host='0.0.0.0', port=openPort, threaded=True)
Exemplo n.º 20
0
def startServer(config=CBI_CONFIG_FILE,
                connection=CBI_CACHE_DATABASE_URI,
                openPort=8080):

    cbi_dao = CbiDao(CBI_CONFIG_FILE, database_uri=CBI_CACHE_DATABASE_URI)
    app = wof.flask.create_wof_flask_app(cbi_dao, config)
    #    app.config['DEBUG'] = True

    url = "http://127.0.0.1:" + str(openPort)
    print("----------------------------------------------------------------")
    print("Service endpoints")
    for path in wof.flask.site_map_flask_wsgi_mount(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")
    print("----------------------------------------------------------------")
    print("HTML Access Service endpoints at ")
    for path in wof.site_map(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")

    app.run(host='0.0.0.0', port=openPort, threaded=True)
Exemplo n.º 21
0
def startServer(config=CBI_CONFIG_FILE,connection=CBI_CACHE_DATABASE_URI, openPort = 8080):

    cbi_dao = CbiDao(CBI_CONFIG_FILE, database_uri=CBI_CACHE_DATABASE_URI)
    app = wof.flask.create_wof_flask_app(cbi_dao, config)
#    app.config['DEBUG'] = True



    url = "http://127.0.0.1:" + str(openPort)
    print("----------------------------------------------------------------")
    print("Service endpoints")
    for path in wof.flask.site_map_flask_wsgi_mount(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")
    print("----------------------------------------------------------------")
    print("HTML Access Service endpoints at ")
    for path in wof.site_map(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")

    app.run(host='0.0.0.0', port=openPort, threaded=True)
Exemplo n.º 22
0
                   help='Open port for server."', default=8080, type=int)
args = parser.parse_args()

# Add the necessary DAO objects for each config
m_dao = timeseries(get_connection(M_CONFIG_FILE))
s_dao = timeseries(get_connection(S_CONFIG_FILE))

# Create the necessary WOF config from the DAO and Config File Path
m_conf = wof.core.wofConfig(m_dao, M_CONFIG_FILE)
s_conf = wof.core.wofConfig(s_dao, S_CONFIG_FILE)

app = wof.flask.create_wof_flask_multiple({m_conf, s_conf}, templates=wof._TEMPLATES)

if __name__ == '__main__':

    url = "http://127.0.0.1:" + str(args.port)
    print("----------------------------------------------------------------")
    print("Service endpoints")
    for path in wof.flask.site_map_flask_wsgi_mount(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")
    print("----------------------------------------------------------------")
    print("Access HTML descriptions of endpoints at ")
    for path in wof.site_map(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")

    app.run(host='0.0.0.0', port=args.port, threaded=True)
Exemplo n.º 23
0
def startServer(openPort):
    SWIS_CONFIG='swis/swis_config.cfg'
    LCM_CONFIG='barebones/LCM_config.cfg'
    swis_dao = SwisDao('swis/swis_config.cfg',
                       database_uri='sqlite:///swis/swis2.db')
    lcm_dao = LCMDao('sqlite:///barebones/LCM_Data/LCM.db',
                         'barebones/LCM_config.cfg')
    CSV_CONFIG_FILE = 'csv_server/csv_config.cfg'
    SITES_FILE = 'csv_server/sites.csv'
    VALUES_FILE = 'csv_server/data.csv'
    csv_doa = CsvDao(SITES_FILE, VALUES_FILE)

    # swis_wof = WOF(swis_dao)
    # swis_wof.config_from_file('swis/swis_config.cfg')
    #
    # lcm_wof = WOF(lcm_dao)
    # lcm_wof.config_from_file('barebones/LCM_config.cfg')
    # #Create the Flask applications
    # swis_flask_app = create_app(swis_wof)
    # lcm_flask_app = create_app(lcm_wof)
    #
    # #Create the soaplib classes
    # SWISWOFService = create_wof_service_class(swis_wof)
    # LCMWOFService = create_wof_service_class(lcm_wof)
    #
    # #Create the soaplib applications
    # swis_soap_app = soaplib.core.Application(services=[SWISWOFService],
    #     tns='http://www.cuahsi.org/his/1.0/ws/',
    #     name='WaterOneFlow')
    #
    # lcm_soap_app = soaplib.core.Application(services=[LCMWOFService],
    #     tns='http://www.cuahsi.org/his/1.0/ws/',
    #     name='WaterOneFlow')
    #
    # #Create WSGI apps from the soaplib applications
    # swis_soap_wsgi_app = soaplib.core.server.wsgi.Application(swis_soap_app)
    # lcm_soap_wsgi_app = soaplib.core.server.wsgi.Application(lcm_soap_app)
    #
    # combined_app = DispatcherMiddleware(NotFound, {
    #     '/swis': swis_flask_app,
    #     '/lcm': lcm_flask_app,
    #     '/swis/soap/wateroneflow': swis_soap_wsgi_app,
    #     '/lcm/soap/wateroneflow': lcm_soap_wsgi_app
    # })


    conf_swis = wof.core.wofConfig(swis_dao, SWIS_CONFIG)
    conf_lcm = wof.core.wofConfig(lcm_dao, LCM_CONFIG)
    conf_csv = wof.core.wofConfig(csv_doa, CSV_CONFIG_FILE)

    app= wof.flask.create_wof_flask_multiple({conf_swis, conf_lcm, conf_csv}, templates=wof._TEMPLATES)


    url = "http://127.0.0.1:" + str(openPort)
    print("----------------------------------------------------------------")
    print("Service endpoints")
    for path in wof.flask.site_map_flask_wsgi_mount(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")
    print("----------------------------------------------------------------")
    print("Access HTML descriptions of endpoints at ")
    for path in wof.site_map(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")

    app.run(host='0.0.0.0', port=openPort, threaded=True)
                   help='Open port for server."', default=8080, type=int)
args = parser.parse_args()

# Add the necessary DAO objects for each config
m_dao = timeseries(get_connection(M_CONFIG_FILE))
s_dao = timeseries(get_connection(S_CONFIG_FILE))

# Create the necessary WOF config from the DAO and Config File Path
m_conf = wof.core.wofConfig(m_dao, M_CONFIG_FILE)
s_conf = wof.core.wofConfig(s_dao, S_CONFIG_FILE)

app = wof.flask.create_wof_flask_multiple({m_conf, s_conf}, templates=wof._TEMPLATES)

if __name__ == '__main__':
    wof.vocabularies.update_watermlcvs()
    url = "http://127.0.0.1:" + str(args.port)
    print("----------------------------------------------------------------")
    print("Service endpoints")
    for path in wof.flask.site_map_flask_wsgi_mount(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")
    print("----------------------------------------------------------------")
    print("Access HTML descriptions of endpoints at ")
    for path in wof.site_map(app):
        print("{}{}".format(url, path))

    print("----------------------------------------------------------------")

    app.run(host='0.0.0.0', port=args.port, threaded=True)