Skip to content

Commit 9c215b6

Browse files
committed
various updates
1 parent 68bb6ae commit 9c215b6

File tree

111 files changed

+48154
-152
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+48154
-152
lines changed

elmclient/_app.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ class _App( httpops.HttpOperations_Mixin ):
2727
reportablerest_baseurl = "publish"
2828
supports_reportable_rest = False
2929
reportable_rest_status = "Not supported by application"
30+
majorVersion = None
31+
version = None
3032

31-
def __init__(self, server, contextroot, jts=None):
33+
def __init__(self, server, contextroot, *, jts=None):
3234
super().__init__()
3335
logger.info( f'Creating app {contextroot} {server=}' )
3436
self.contextroot = contextroot
@@ -46,14 +48,14 @@ def __init__(self, server, contextroot, jts=None):
4648
def retrieve_cm_service_provider_xml(self):
4749
cm_service_provider_uri = rdfxml.xmlrdf_get_resource_uri(self.rootservices_xml,
4850
self.cmServiceProviders)
49-
rdf = self.execute_get_rdf_xml(cm_service_provider_uri)
51+
rdf = self.execute_get_rdf_xml(cm_service_provider_uri, intent="Retrieve application CM Service Provider" )
5052
return rdf
5153

5254
def retrieve_oslc_catalog_xml(self):
5355
oslccataloguri = rdfxml.xmlrdf_get_resource_uri(self.rootservices_xml, self.serviceproviders)
5456
if oslccataloguri is None:
5557
return None
56-
return self.execute_get_rdf_xml(oslccataloguri)
58+
return self.execute_get_rdf_xml(oslccataloguri, intent="Retrieve application OSLC Catalog (list of projects)")
5759

5860
# get local headers
5961
def _get_headers(self, headers=None):
@@ -120,7 +122,7 @@ def _load_projects(self,include_archived=False,force=False):
120122
params = {}
121123
if include_archived:
122124
params['includeArchived'] = 'true'
123-
self.project_areas_xml = self.execute_get_xml(uri, params=params)
125+
self.project_areas_xml = self.execute_get_xml(uri, params=params, intent="Retrieve all project area definitions" )
124126
logger.debug( f"{self.project_areas_xml=}" )
125127
for projectel in rdfxml.xml_find_elements(self.project_areas_xml,".//jp06:project-area" ):
126128
logger.debug( f"{projectel=}" )
@@ -290,7 +292,7 @@ def user_nametouri_resolver(self, name, raiseifinvalid=True):
290292
user_uri = self.jts.baseurl+f"users/{name}"
291293
# check it using whoami
292294
try:
293-
res = self.execute_get(user_uri)
295+
res = self.execute_get(user_uri, intent="Try to retrieve User" )
294296
except requests.exceptions.HTTPError as e:
295297
res = None
296298
if res:

elmclient/_ccm.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def get_missing_uri_title( self,uri):
187187
id = None
188188
if uri.startswith( self.app.baseurl ):
189189
try:
190-
resource_xml = self.execute_get_rdf_xml(reluri=uri)
190+
resource_xml = self.execute_get_rdf_xml(reluri=uri, intent="Retrieve type definition to get its title" )
191191
id = rdfxml.xmlrdf_get_resource_text(resource_xml, ".//dcterms:title")
192192
except ET.XMLSyntaxError as e:
193193
logger.debug( f"Type {uri} doesn't exist (not XML)!" )
@@ -209,7 +209,7 @@ def get_missing_uri_title( self,uri):
209209
def type_name_from_uri(self, uri):
210210
if self.is_type_uri(uri):
211211
try:
212-
resource_xml = self.execute_get_rdf_xml(reluri=uri)
212+
resource_xml = self.execute_get_rdf_xml( reluri=uri, intent="Retrieve type definition to get its identifier" )
213213
id = rdfxml.xmlrdf_get_resource_text(resource_xml, ".//dcterms:identifier")
214214
except requests.HTTPError as e:
215215
if e.response.status_code==404 or e.response.status_code==406:
@@ -274,7 +274,7 @@ class _CCMApp(_app._App, _typesystem.No_Type_System_Mixin):
274274

275275
def __init__(self, server, contextroot, jts=None):
276276
super().__init__(server, contextroot, jts=jts)
277-
self.rootservices_xml = self.execute_get_xml(self.reluri('rootservices'))
277+
self.rootservices_xml = self.execute_get_xml(self.reluri('rootservices'), intent="Retrieve CCM rootservices" )
278278
self.serviceproviders = 'oslc_cm:cmServiceProviders'
279279

280280
def _get_headers(self, headers=None):
@@ -348,7 +348,7 @@ def process_represt_arguments( self, args, allapps ):
348348
if args.report:
349349
typestodo = []
350350
# get the schema, walk it building the tree of fields
351-
schema_x = self.execute_get_xml(queryurl+"?metadata=schema").getroot()
351+
schema_x = self.execute_get_xml(queryurl+"?metadata=schema", intent="Retrieve CCM Reportable REST schema" ).getroot()
352352
# print( f"{schema_x.tag=}" )
353353
# print( f"{schema_x=}" )
354354
el_x = rdfxml.xml_find_element( schema_x, "./xs:element" )

elmclient/_gcm.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def __init__(self, name, project_uri, app, is_optin=False, singlemode=False,defa
7474
if not self.services_uri:
7575
raise Exception( "Service provide not found!" )
7676
if self.services_uri:
77-
self.services_xml = self.app.execute_get_rdf_xml(self.services_uri)
77+
self.services_xml = self.app.execute_get_rdf_xml( self.services_uri, intent="Retrieve project services xml" )
7878
else:
7979
self.services_xml = None
8080

@@ -306,7 +306,7 @@ def _get_typeuri_rdf(self,uri):
306306
# strip off the fragment as it does nothing
307307
realuri = uri.rsplit( '#',1 )[0]
308308
if realuri not in self._gettypecache.keys():
309-
self._gettypecache[realuri] = self.execute_get_rdf_xml(uri)
309+
self._gettypecache[realuri] = self.execute_get_rdf_xml( uri, intent="Retrieve project/component type definition to cache it" )
310310
return self._gettypecache[realuri]
311311

312312
# for OSLC query, given a type URI, return its name
@@ -386,7 +386,7 @@ class GCMApp(_app._App, oslcqueryapi._OSLCOperations_Mixin, _typesystem.Type_Sys
386386
def __init__(self, server, contextroot, jts=None):
387387
super().__init__(server, contextroot, jts=jts)
388388

389-
self.rootservices_xml = self.execute_get_xml(self.reluri('rootservices'))
389+
self.rootservices_xml = self.execute_get_xml(self.reluri('rootservices'), intent="Retrieve GCM application rootservices" )
390390
self.serviceproviders = 'gc:globalConfigServiceProviders'
391391
self.default_query_resource = 'oslc_config:Configuration'
392392
# load all projects and components?
@@ -432,7 +432,7 @@ def get_query_capability_uris_from_xml(self,capabilitiesxml,context):
432432
break
433433
if not found:
434434
raise Exception( "No empty service provider found!" )
435-
sx = self.execute_get_rdf_xml(spurl)
435+
sx = self.execute_get_rdf_xml( spurl, intent="Retrieve project/component service provider definition to find query capability" )
436436
for qcx in rdfxml.xml_find_elements(sx,'.//oslc:queryBase/..'):
437437
for qcrtx in rdfxml.xml_find_elements( qcx, 'oslc:resourceType'):
438438
qcs[rdfxml.xmlrdf_get_resource_uri(qcrtx)] = rdfxml.xmlrdf_get_resource_uri(qcx, "oslc:queryBase")
@@ -443,7 +443,7 @@ def get_query_capability_uris_from_xml(self,capabilitiesxml,context):
443443

444444
def check_valid_config_uri( self, uri, raise_exception=True ):
445445
try:
446-
x = self.rootservices_xml = self.execute_get_xml(uri)
446+
x = self.rootservices_xml = self.execute_get_xml( uri, intent="Check if configuration URL is valid (gets a response)" )
447447
except requests.HTTPError:
448448
if raiseException:
449449
raise
@@ -475,7 +475,7 @@ def _load_types(self,force=False):
475475
break
476476
if not found:
477477
raise Exception( "No empty service provider found!" )
478-
sx = self.execute_get_rdf_xml(spurl)
478+
sx = self.execute_get_rdf_xml( spurl, intent="Retrieve project/component service provider XML" )
479479

480480
if sx:
481481
shapes_to_load = rdfxml.xml_find_elements(sx, './/oslc:resourceShape' )
@@ -655,7 +655,7 @@ def _get_typeuri_rdf(self,uri):
655655
# strip off the fragment as it does nothing
656656
realuri = uri.rsplit( '#',1 )[0]
657657
if realuri not in self._gettypecache.keys():
658-
self._gettypecache[realuri] = self.execute_get_rdf_xml(uri)
658+
self._gettypecache[realuri] = self.execute_get_rdf_xml(uri,intent="Retrieve type definition" )
659659
return self._gettypecache[realuri]
660660

661661
# given a type URI, return its name

elmclient/_project.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def _get_typeuri_rdf(self,uri):
6868
logger.info( f"Retrieving {uri}" )
6969
logger.info( utils.callers() )
7070
try:
71-
self._gettypecache[realuri] = self.execute_get_rdf_xml(uri) if uri.startswith( "https://") else None
71+
self._gettypecache[realuri] = self.execute_get_rdf_xml(uri, intent="Retrieve type definition") if uri.startswith( "https://") else None
7272
logger.info( f"Retrieved:" )
7373
except ET.XMLSyntaxError:
7474
self._gettypecache[realuri] = None
@@ -113,7 +113,7 @@ def get_services_xml(self, headers=None, force=False):
113113
logger.info( f"get_services_xml {self.name=} {self.project_uri=} {self=} {self.services_uri=}" )
114114
if force or self.services_xml is None:
115115
if self.services_uri:
116-
self.services_xml = self.execute_get_rdf_xml(self.services_uri, headers=headers)
116+
self.services_xml = self.execute_get_rdf_xml(self.services_uri, headers=headers, intent="Retrieve project's services XML")
117117
logger.info( f"{self.services_uri=}" )
118118
elif self.component_project:
119119
logger.debug( f"component sx not retrieved - need a config" )
@@ -207,7 +207,7 @@ def set_local_config(self, name_or_uri, global_config_uri=None):
207207
# for a component, setting the config is when we can load the services xml!
208208
if self.component_project:
209209
# retrieve the services.xml in the current config!
210-
self.services_xml = self.execute_get_rdf_xml(self.component_project.services_uri)
210+
self.services_xml = self.execute_get_rdf_xml(self.component_project.services_uri, intent="Retrieve project's services.xml")
211211

212212
def _load_types(self,force=False):
213213
logger.info( f"{self=}" )

elmclient/_qm.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,24 @@ def load_components_and_configurations(self,force=False):
5252
if not self.is_optin:
5353
logger.debug( f"{self.is_optin=}" )
5454
# get the default configuration
55-
projx = self.execute_get_xml(self.reluri('rm-projects/' + self.iid))
55+
projx = self.execute_get_xml( self.reluri( 'rm-projects/' + self.iid ), intent="Retrieve the project definition (opt-out)" )
5656
compsu = rdfxml.xmlrdf_get_resource_text( projx, './/jp06:components' )
57-
compsx = self.execute_get_xml(compsu)
57+
compsx = self.execute_get_xml(compsu, intent="Retrieve the component definition (opt-out)" )
5858
defaultcompu = rdfxml.xmlrdf_get_resource_uri( compsx, './/oslc_config:component' )
59-
59+
6060
# register the only component
6161
ncomps += 1
6262
self._components[defaultcompu] = {'name': self.name, 'configurations': {}}
6363
thisconfu = defaultcompu+"/configurations"
64-
configs = self.execute_get_json(thisconfu)
64+
configs = self.execute_get_json( thisconfu, intent="Retrieve all configurations (opt-out)" )
6565
configdetails = configs[defaultcompu+"/configurations"]
6666
if type(configs[thisconfu]["http://www.w3.org/2000/01/rdf-schema#member"])==dict:
6767
confs = [configs[thisconfu]["http://www.w3.org/2000/01/rdf-schema#member"]]
6868
else:
6969
confs = configs[thisconfu]["http://www.w3.org/2000/01/rdf-schema#member"]
7070
for aconf in confs:
7171
confu = aconf['value']
72-
confx = self.execute_get_xml(confu)
72+
confx = self.execute_get_xml( confu, intent="Retrieve configuration definition (opt-out)" )
7373
conftitle = rdfxml.xmlrdf_get_resource_text(confx,'.//dcterms:title')
7474
conftype = 'Stream' if 'stream' in confu else 'Baseline'
7575
self._components[defaultcompu]['configurations'][confu] = {'name': conftitle, 'conftype': conftype, 'confXml': confx}
@@ -85,7 +85,7 @@ def load_components_and_configurations(self,force=False):
8585
# <dcterms:title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">View Definition Query Capability</dcterms:title>
8686
# </oslc:QueryCapability>
8787

88-
px = self.execute_get_xml(self.project_uri)
88+
px = self.execute_get_xml( self.project_uri, intent="Retrieve project definition" )
8989

9090
sx = self.get_services_xml()
9191
assert sx is not None, "sx is None"
@@ -94,10 +94,10 @@ def load_components_and_configurations(self,force=False):
9494

9595
ncomps += 1
9696
self._components[compuri] = {'name': self.name, 'configurations': {}}
97-
configs = self.execute_get_xml(compuri+"/configurations")
97+
configs = self.execute_get_xml( compuri+"/configurations", intent="Retrieve all project/component configurations (singlemode)" )
9898
for conf in rdfxml.xml_find_elements(configs,'.//rdfs:member'):
9999
confu = rdfxml.xmlrdf_get_resource_uri(conf)
100-
thisconfx = self.execute_get_xml(confu)
100+
thisconfx = self.execute_get_xml( confu, intent="Retrieve a configuration definition (singlemode)" )
101101
conftitle= rdfxml.xmlrdf_get_resource_text(thisconfx,'.//dcterms:title')
102102
# e.g. http://open-services.net/ns/config#Stream
103103
isstr = rdfxml.xml_find_element( thisconfx,'.//oslc_config:Stream' )
@@ -124,7 +124,7 @@ def load_components_and_configurations(self,force=False):
124124
components_uri = rdfxml.xmlrdf_get_resource_uri(cmsp_xml, './/rdf:Description/rdf:type[@rdf:resource="http://open-services.net/ns/core#QueryCapability"]/../oslc:resourceType[@rdf:resource="http://open-services.net/ns/config#Component"]/../oslc:queryBase')
125125
logger.info( f"{components_uri=}" )
126126
# get all components
127-
crx = self.execute_get_xml(components_uri)
127+
crx = self.execute_get_xml( components_uri, intent="Retrieve component definition" )
128128

129129
# <oslc_config:Component rdf:about="https://jazz.ibm.com:9443/qm/oslc_config/resources/com.ibm.team.vvc.Component/_iw4s4EB3Eeus6Zk4qsm_Cw">
130130
# <dcterms:title rdf:parseType="Literal">SGC Agile</dcterms:title>
@@ -146,13 +146,13 @@ def load_components_and_configurations(self,force=False):
146146
self._components[compu] = {'name': comptitle, 'configurations': {}}
147147
ncomps += 1
148148
confu = rdfxml.xmlrdf_get_resource_uri(component_el, './/oslc_config:configurations')
149-
configs_xml = self.execute_get_rdf_xml( confu )
149+
configs_xml = self.execute_get_rdf_xml( confu, intent="Retrieve all project/component configuration definitions" )
150150
# Each config: <ldp:contains rdf:resource="https://jazz.ibm.com:9443/qm/oslc_config/resources/com.ibm.team.vvc.Configuration/_qT1EcEB4Eeus6Zk4qsm_Cw"/>
151151

152152
for confmemberx in rdfxml.xml_find_elements(configs_xml, './/ldp:contains'):
153153
thisconfu = rdfxml.xmlrdf_get_resource_uri( confmemberx )
154154
try:
155-
thisconfx = self.execute_get_rdf_xml(thisconfu)
155+
thisconfx = self.execute_get_rdf_xml( thisconfu, intent="Retrieve a configuration definition" )
156156
conftitle = rdfxml.xmlrdf_get_resource_text(thisconfx, './/dcterms:title')
157157
conftype = rdfxml.xmlrdf_get_resource_uri(thisconfx, './/rdf:type')
158158
logger.info( f"Found config {conftitle} {conftype} {thisconfu}" )
@@ -267,7 +267,7 @@ def type_name_from_uri(self, uri):
267267
id = match.group(1)
268268
else:
269269
# retrieve the definition
270-
resource_xml = self.execute_get_rdf_xml(reluri=uri)
270+
resource_xml = self.execute_get_rdf_xml( reluri=uri, intent="Retrieve type definition to get its name")
271271
# check for a rdf label (used for links, maybe other things)
272272
id = rdfxml.xmlrdf_get_resource_text(resource_xml,".//rdf:Property/rdfs:label") or rdfxml.xmlrdf_get_resource_text(resource_xml,".//oslc:ResourceShape/dcterms:title") or rdfxml.xmlrdf_get_resource_text(resource_xml,f'.//rdf:Description[@rdf:about="{uri}"]/rdfs:label')
273273
if id is None:
@@ -290,7 +290,7 @@ def is_resource_uri(self, uri):
290290
# for OSLC query, given a resource URI, return the requirement dcterms:identifier
291291
def resource_id_from_uri(self, uri):
292292
if self.is_resource_uri(uri):
293-
resource_xml = self.execute_get_rdf_xml(reluri=uri)
293+
resource_xml = self.execute_get_rdf_xml(reluri=uri, intent="Retrieve resource dcterms:identifier")
294294
id = rdfxml.xmlrdf_get_resource_text(resource_xml, ".//dcterms:identifier")
295295
return id
296296
raise Exception(f"Bad resource uri {uri}")
@@ -381,12 +381,12 @@ class _QMApp(_app._App, oslcqueryapi._OSLCOperations_Mixin, _typesystem.Type_Sys
381381

382382
def __init__(self, server, contextroot, jts=None):
383383
super().__init__(server, contextroot, jts=jts)
384-
self.rootservices_xml = self.execute_get_xml(self.reluri('rootservices'))
384+
self.rootservices_xml = self.execute_get_xml(self.reluri('rootservices'), intent="Retrieve QM application rootservices")
385385
self.serviceproviders = 'oslc_qm_10:qmServiceProviders'
386386
self.default_query_resource = "oslc_config:Configuration"
387387

388-
self.version = rdfxml.xmlrdf_get_resource_text(self.rootservices_xml,'.//oslc_rm_10:version')
389-
self.majorversion = rdfxml.xmlrdf_get_resource_text(self.rootservices_xml,'.//oslc_rm_10:majorVersion')
388+
self.version = rdfxml.xmlrdf_get_resource_text(self.rootservices_xml,'.//rqm:version')
389+
self.majorversion = rdfxml.xmlrdf_get_resource_text(self.rootservices_xml,'.//rqm:majorVersion')
390390
logger.info( f"Versions {self.majorversion} {self.version}" )
391391

392392
def _get_headers(self, headers=None):
@@ -533,7 +533,7 @@ def process_represt_arguments( self, args, allapps ):
533533
if args.report:
534534
typestodo = []
535535
# get the schema, walk it building the tree of fields
536-
schema_x = self.execute_get_xml(queryurl+"?metadata=schema").getroot()
536+
schema_x = self.execute_get_xml(queryurl+"?metadata=schema", intent="Retrieve Reportable REST schema").getroot()
537537
# print( f"{schema_x.tag=}" )
538538
# print( f"{schema_x=}" )
539539
el_x = rdfxml.xml_find_element( schema_x, "./xs:element" )

0 commit comments

Comments
 (0)