Changeset 3240 for TI02-CSML/trunk
- Timestamp:
- 17/01/08 12:07:13 (13 years ago)
- Location:
- TI02-CSML/trunk/csml
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TI02-CSML/trunk/csml/csmllibs/csmlbuilder.py
r3221 r3240 6 6 #this class contains all the method calls to create and populate a csmldoc 7 7 #it needs to be provided with several bits of information to be able to do this. 8 def __init__(self,datasetid, directory,csmlft, mapping, timedimension ,outputfile,printscreen,timestorage,spatialstorage,valuestorage, minaxes ):8 def __init__(self,datasetid, directory,csmlft, mapping, timedimension ,outputfile,printscreen,timestorage,spatialstorage,valuestorage, minaxes, secallow, secdeny): 9 9 if datasetid is not None: 10 10 self.datasetid = datasetid … … 23 23 self.csml = None # csml object holds the csml document in memory. 24 24 self.ds_element = None #<Dataset> tag, root node. 25 self.secallow=secallow 26 self.secdeny=secdeny 25 27 26 28 def build(self): … … 33 35 print 'error: Cannot find a config file at this location.' 34 36 sys.exit() 35 37 self.addSecurity() 36 38 self.createFeatureFileMap() 37 39 if self.spatialstorage=='fileextract': … … 74 76 #self.ds.description=csml.parser.Description(strGmlDescription) 75 77 76 def createCSML(self): 77 print "Create CSML" 78 #create an empty csml document and dataset tag 79 self.csml, self.ds_element = csml.csmllibs.csmlmeta.createDataset() 80 #add gml metadata elements 81 self.csml, self.ds_element = csml.csmllibs.csmlmeta.addGMLMetadata(self.csml, self.directory, self.ds_element) 82 78 def addSecurity(self): 79 '''Adds NDG style AccessControlPolicy to the dataset based on info in config file''' 80 def _buildSimpleCondition(condition): 81 #builds the tag structure for a SimpleCondition 82 scond=csml.parser.SimpleCondition() 83 parts=condition.split(' ') 84 attauth=csml.parser.csString(parts[0]) 85 role=csml.parser.csString(parts[1]) 86 scond.attrauthRole=role 87 scond.dgAttributeAuthority=attauth 88 return scond 89 90 acp=csml.parser.AccessControlPolicy() 91 if self.secallow: 92 for condition in self.secallow.split(','): 93 dgSecurityCondition=csml.parser.DgSecurityCondition() 94 dgSecurityCondition.effect=csml.parser.csString('allow') 95 dgSecurityCondition.addChildElem('simpleCondition', _buildSimpleCondition(condition)) 96 acp.addChildElem('dgSecurityCondition', dgSecurityCondition) 97 if self.secdeny: 98 for condition in self.secallow.split(','): 99 dgSecurityCondition=csml.parser.DgSecurityCondition() 100 dgSecurityCondition.effect=csml.parser.csString('deny') 101 dgSecurityCondition.addChildElem('simpleCondition', _buildSimpleCondition(condition)) 102 acp.addChildElem('dgSecurityCondition', dgSecurityCondition) 103 self.ds.accessControlPolicy=acp 104 83 105 def createFeatureFileMap(self): 84 106 print "Create FFMAP" -
TI02-CSML/trunk/csml/csmlscan.py
r3239 r3240 202 202 #build CSML document 203 203 print ROOTDIRECTORY 204 csmldataset=csmllibs.csmlbuilder.csmlBuilder(DATASETID,ROOTDIRECTORY,FEATURETYPE,MAPPING,TIMEDIMENSION, OUTPUTFILE, PRINTSCREEN,TIMESTORAGE,SPATIALSTORAGE,VALUESTORAGE, MINAXES )204 csmldataset=csmllibs.csmlbuilder.csmlBuilder(DATASETID,ROOTDIRECTORY,FEATURETYPE,MAPPING,TIMEDIMENSION, OUTPUTFILE, PRINTSCREEN,TIMESTORAGE,SPATIALSTORAGE,VALUESTORAGE, MINAXES, SEC_ALLOW, SEC_DENY) 205 205 csmldataset.build() 206 206
Note: See TracChangeset
for help on using the changeset viewer.