def list(conf,inputs,outputs): elements={} import datastores.directories.service as dirs dirs.displayJSON(conf,{"state": {"value": "open"}},outputs) dirStr=eval(outputs["Result"]["value"]) b=0 for i in dirStr: if b==0: elements["Directories"]=[] elements["Directories"]+=[{"name": i["text"]}] b+=1 import datastores.wfs.service as wfs import json wxs=["WFS","WMS"] for k in range(0,len(wxs)): outputs["Result"]["value"]='{"sub_elements":[]}' wfs.displayJSON(conf,{"state": {"value": "open"},"type":{"value":wxs[k]}},outputs) print >> sys.stderr,outputs["Result"]["value"] try: wfsStr=json.loads(outputs["Result"]["value"]) except: wfsStr={"sub_elements":[]} b=0 for i in wfsStr["sub_elements"]: if b==0: elements[wxs[k]]=[] elements[wxs[k]]+=[{"name": i["name"]}] b+=1 import datastores.postgis.service as dbs suported_dbs=["PostGIS","MySQL"] dbStrs={} for i in suported_dbs: dbs.displayJson(conf,{"type":{"value":i}},outputs) try: dbStrs[i]=eval(outputs["Result"]["value"]) #print >> sys.stderrrr,conf #print >> sys.stderr,dbStrs[i]["sub_elements"] b=0 for a in dbStrs[i]["sub_elements"]: tmpI={} if b==0: elements[i]=[] dbs.load(conf,{"type": {"value": i}, "name": {"value": a["name"]}},outputs) #print >> sys.stderr,outputs tmp=eval(outputs["Result"]["value"]) #print >> sys.stderr,"tmp" #print >> sys.stderr,tmp li={} for c in tmp: li[c]={} li[c]["value"]=tmp[c] li["type"]={} li["type"]["value"]=i if dbs.test(conf,li,outputs)==3: elements[i]+=[{"name": a["name"]}] #print >> sys.stderr, a["name"] b+=1 #print >> sys.stderr, dbStrs except: pass #print >> sys.stderr,dbStrs #print >> sys.stderr,dirStr #print >> sys.stderr,elements import json outputs["Result"]["value"]=json.dumps(elements) return 3
def list(conf, inputs, outputs): elements = {} import datastores.directories.service as dirs dirs.displayJSON(conf, {"state": {"value": "open"}}, outputs) dirStr = eval(outputs["Result"]["value"]) b = 0 for i in dirStr: if b == 0: elements["Directories"] = [] elements["Directories"] += [{"name": i["text"]}] b += 1 import datastores.wfs.service as wfs import json wxs = ["WFS", "WMS"] for k in range(0, len(wxs)): outputs["Result"]["value"] = '{"sub_elements":[]}' wfs.displayJSON(conf, { "state": { "value": "open" }, "type": { "value": wxs[k] } }, outputs) print >> sys.stderr, outputs["Result"]["value"] try: wfsStr = json.loads(outputs["Result"]["value"]) except: wfsStr = {"sub_elements": []} b = 0 for i in wfsStr["sub_elements"]: if b == 0: elements[wxs[k]] = [] elements[wxs[k]] += [{"name": i["name"]}] b += 1 import datastores.postgis.service as dbs suported_dbs = ["PostGIS", "MySQL"] dbStrs = {} for i in suported_dbs: print >> sys.stderr, i dbs.displayJson(conf, {"type": {"value": i}}, outputs) print >> sys.stderr, str(outputs["Result"]["value"]) try: dbStrs[i] = json.loads(outputs["Result"]["value"]) b = 0 for a in dbStrs[i]["sub_elements"]: tmpI = {} if b == 0: elements[i] = [] b += 1 outputs1 = {"Result": {}} inputs1 = {"type": {"value": i}, "name": {"value": a["name"]}} dbs.load(conf, inputs1, outputs1) print >> sys.stderr, "LOAD <=> " + str(outputs1) tmp = json.loads(outputs1["Result"]["value"]) print >> sys.stderr, "tmp <=> " + str(tmp) li = {} for c in tmp: li[c] = {} li[c]["value"] = tmp[c].decode('utf-8') li["type"] = {} li["type"]["value"] = i if dbs.test(conf, li, outputs) == 3: elements[i] += [{"name": a["name"]}] except Exception, e: print >> sys.stderr, e pass print >> sys.stderr, "/" + i
def list(conf,inputs,outputs): elements={} import datastores.directories.service as dirs dirs.displayJSON(conf,{"state": {"value": "open"}},outputs) dirStr=eval(outputs["Result"]["value"]) b=0 for i in dirStr: if b==0: elements["Directories"]=[] elements["Directories"]+=[{"name": i["text"]}] b+=1 import datastores.wfs.service as wfs import json wxs=["WFS","WMS"] for k in range(0,len(wxs)): outputs["Result"]["value"]='{"sub_elements":[]}' wfs.displayJSON(conf,{"state": {"value": "open"},"type":{"value":wxs[k]}},outputs) print >> sys.stderr,outputs["Result"]["value"] try: wfsStr=json.loads(outputs["Result"]["value"]) except: wfsStr={"sub_elements":[]} b=0 for i in wfsStr["sub_elements"]: if b==0: elements[wxs[k]]=[] elements[wxs[k]]+=[{"name": i["name"]}] b+=1 import datastores.postgis.service as dbs suported_dbs=["PostGIS","MySQL"] dbStrs={} for i in suported_dbs: print >> sys.stderr,i dbs.displayJson(conf,{"type":{"value":i}},outputs) print >> sys.stderr,str(outputs["Result"]["value"]) try: dbStrs[i]=json.loads(outputs["Result"]["value"]) b=0 for a in dbStrs[i]["sub_elements"]: tmpI={} if b==0: elements[i]=[] b+=1 outputs1={"Result":{}} inputs1={"type": {"value": i}, "name": {"value": a["name"]}} dbs.load(conf,inputs1,outputs1) print >> sys.stderr,"LOAD <=> "+str(outputs1) tmp=json.loads(outputs1["Result"]["value"]) print >> sys.stderr,"tmp <=> "+str(tmp) li={} for c in tmp: li[c]={} li[c]["value"]=tmp[c].decode('utf-8') li["type"]={} li["type"]["value"]=i if dbs.test(conf,li,outputs)==3: elements[i]+=[{"name": a["name"]}] except Exception,e: print >> sys.stderr, e pass print >> sys.stderr,"/"+i