@@ -303,14 +303,14 @@ public static bool IsValidUriForRegistryAasByAssetIds(string location)
303303
304304 public static bool IsValidUriForRegOfRegAasByAssetId ( string location )
305305 {
306- var m = Regex . Match ( location , @"^(http(|s))://(.*?)/registry-descriptors/([-A-Za-z0-9_]{1,999})$" ,
306+ var m = Regex . Match ( location , @"^(http(|s))://(.*?)/(?: registry-descriptors/|companies\?asset_id=) ([-A-Za-z0-9_]{1,999})$" ,
307307 RegexOptions . IgnoreCase | RegexOptions . IgnorePatternWhitespace ) ;
308308 return m . Success ;
309309 }
310310
311311 public static string IsValidAndDecodeUriForRegOfRegAasByAssetId ( string location )
312312 {
313- var m = Regex . Match ( location , @"^(http(|s))://(.*?)/registry-descriptors/([-A-Za-z0-9_]{1,999})$" ,
313+ var m = Regex . Match ( location , @"^(http(|s))://(.*?)/(?: registry-descriptors/|companies\?asset_id=) ([-A-Za-z0-9_]{1,999})$" ,
314314 RegexOptions . IgnoreCase | RegexOptions . IgnorePatternWhitespace ) ;
315315 if ( ! m . Success )
316316 return null ;
@@ -353,7 +353,7 @@ public static Uri GetBaseUri(string location)
353353 // try an explicit search for known parts of ressources
354354 // (preserves scheme, host and leading pathes)
355355 var m = Regex . Match ( location , @"^(.*?)(/shells|/submodel|/concept-description|/lookup|/description"
356- + "|/shell-descriptor|/submodel-descriptor|/bulk|/serialization|/package)" ) ;
356+ + "|/shell-descriptor|/submodel-descriptor|/bulk|/serialization|/package|/registry-descriptors|/companies )" ) ;
357357 if ( m . Success )
358358 return new Uri ( m . Groups [ 1 ] . ToString ( ) + "/" ) ;
359359
@@ -366,6 +366,10 @@ public static Uri GetBaseUri(string location)
366366 {
367367 return new Uri ( location . Substring ( 0 , p ) + "/" ) ;
368368 }
369+ else
370+ {
371+ return new Uri ( location ) ;
372+ }
369373 }
370374
371375 // go to error
@@ -732,10 +736,17 @@ public static Uri BuildUriForRegOfRegAasByAssetId(Uri baseUri, string id, bool e
732736 // access
733737 if ( id ? . HasContent ( ) != true )
734738 return null ;
739+ var route = "registry-descriptors/" ;
735740
736- // try combine
737741 var assenc = encryptIds ? AdminShellUtil . Base64UrlEncode ( id ) : id ;
738- return CombineUri ( baseUri , $ "registry-descriptors/{ assenc } ") ;
742+
743+ if ( baseUri . Host . Contains ( "leo-discovery" ) )
744+ {
745+ route = "companies" ;
746+ assenc = $ "?asset_id={ assenc } ";
747+ }
748+
749+ return CombineUri ( baseUri , $ "{ route } { assenc } ") ;
739750 }
740751
741752 //
@@ -819,7 +830,10 @@ private static async Task<bool> FromRegistryGetAasAndSubmodels(
819830 {
820831 // strictly check IFC
821832 var aasIfc = "" + ep [ "interface" ] ;
822- if ( aasIfc != "AAS-1.0" )
833+ if ( ! ( aasIfc == "AAS-1.0"
834+ || aasIfc == "AAS-2.0"
835+ || aasIfc == "AAS-3.0"
836+ || aasIfc == "AAS-3.1" ) )
823837 continue ;
824838
825839 // direct access HREF
@@ -843,8 +857,11 @@ private static async Task<bool> FromRegistryGetAasAndSubmodels(
843857 {
844858 // strictly check IFC
845859 var smIfc = "" + smep [ "interface" ] ;
846- if ( smIfc != "SUBMODEL-1.0" )
847- continue ;
860+ if ( ! ( aasIfc == "SUBMODEL-1.0"
861+ || aasIfc == "SUBMODEL-2.0"
862+ || aasIfc == "SUBMODEL-3.0"
863+ || aasIfc == "SUBMODEL-3.1" ) )
864+ continue ;
848865
849866 // ok
850867 string href = smep . protocolInformation . href ;
@@ -980,7 +997,8 @@ private static async Task<bool> FromRegOfRegGetAasAndSubmodels(
980997 List < Aas . IIdentifiable > trackNewIdentifiables = null ,
981998 List < Aas . IIdentifiable > trackLoadedIdentifiables = null ,
982999 Action < int , int , int , int > lambdaReportProgress = null ,
983- bool compatOldAasxServer = false )
1000+ bool compatOldAasxServer = false ,
1001+ bool isFXLeoDiscoveryServer = false )
9841002 {
9851003 // access
9861004 if ( record == null || regDescriptor == null || assetId ? . HasContent ( ) != true )
@@ -998,10 +1016,30 @@ private static async Task<bool> FromRegOfRegGetAasAndSubmodels(
9981016 // }
9991017 // However, only Url and Id are currently useful
10001018
1001- string regUrl = "" + regDescriptor [ "url" ] ;
1002- string regInfo = "" + regDescriptor [ "info" ] ;
1003- if ( regInfo == "" )
1004- regInfo = "<Unknown>" ;
1019+ string regUrl = String . Empty ;
1020+
1021+ if ( isFXLeoDiscoveryServer )
1022+ {
1023+ var endpoints = regDescriptor ? . endpoints ;
1024+
1025+ if ( endpoints != null )
1026+ {
1027+ foreach ( var endpoint in endpoints )
1028+ {
1029+ if ( endpoint [ "interface" ] == "AAS-REGISTRY-3.1"
1030+ || endpoint [ "interface" ] == "AAS-REGISTRY-3.0" )
1031+ {
1032+ regUrl = endpoint . protocolInformation . href ;
1033+ break ;
1034+ }
1035+ }
1036+ }
1037+ }
1038+ else
1039+ {
1040+ regUrl = "" + regDescriptor [ "url" ] ;
1041+ }
1042+
10051043
10061044 // valid url?
10071045 if ( regUrl == "" )
@@ -1013,7 +1051,7 @@ private static async Task<bool> FromRegOfRegGetAasAndSubmodels(
10131051
10141052 // build again a set of baseUris, but only one pattern set
10151053 var baseUris = new BaseUriDict ( key : "AAS-REG" , value : basicUri . ToString ( ) ) ;
1016-
1054+
10171055 // translate to a list of AAS-Ids ..
10181056 var uriGetListOfAids = BuildUriForRegistryAasByAssetId ( baseUris . GetBaseUriForAasReg ( ) , assetId ) ;
10191057 if ( compatOldAasxServer )
@@ -1221,6 +1259,12 @@ protected static async Task<AdminShellPackageEnvBase> LoadFromSourceInternalAsyn
12211259 }
12221260 else
12231261 {
1262+ bool isFXLeoDiscoveryServer = fullItemLocation . Contains ( "leo-discovery" ) ;
1263+ if ( isFXLeoDiscoveryServer )
1264+ {
1265+ resObj = resObj [ "data" ] ;
1266+ }
1267+
12241268 foreach ( var res in resObj )
12251269 {
12261270 // refer to dedicated function
@@ -1230,7 +1274,8 @@ await FromRegOfRegGetAasAndSubmodels(
12301274 trackNewIdentifiables , trackLoadedIdentifiables ,
12311275 lambdaReportProgress : lambdaReportAasSm ,
12321276 // TODO: check!!
1233- compatOldAasxServer : true ) ;
1277+ compatOldAasxServer : isFXLeoDiscoveryServer ? false : true ,
1278+ isFXLeoDiscoveryServer : isFXLeoDiscoveryServer ) ;
12341279 }
12351280 }
12361281 }
0 commit comments