Skip to content

Commit 3bf36c3

Browse files
committed
bugfix/add fallback registration for all ScannedApis in Fat JAR environment
1 parent c0e9bb5 commit 3bf36c3

1 file changed

Lines changed: 83 additions & 2 deletions

File tree

  • obp-api/src/main/scala/bootstrap/liftweb

obp-api/src/main/scala/bootstrap/liftweb/Boot.scala

Lines changed: 83 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,15 @@ import code.api.ResourceDocs1_4_0.ResourceDocs300.{ResourceDocs310, ResourceDocs
4141
import code.api.ResourceDocs1_4_0._
4242
import code.api._
4343
import code.api.attributedefinition.AttributeDefinition
44-
import code.api.berlin.group.v1_3.OBP_BERLIN_GROUP_1_3
44+
import code.api.berlin.group.v1_3.{OBP_BERLIN_GROUP_1_3, OBP_BERLIN_GROUP_1_3_Alias}
4545
import code.api.berlin.group.ConstantsBG
46+
import code.api.STET.v1_4.OBP_STET_1_4
47+
import code.api.Polish.v2_1_1_1.OBP_PAPI_2_1_1_1
48+
import code.api.MxOF.{OBP_MXOF_1_0_0, CNBV9_1_0_0}
49+
import code.api.BahrainOBF.v1_0_0.{ApiCollector => BahrainApiCollector}
50+
import code.api.AUOpenBanking.v1_0_0.{ApiCollector => AUApiCollector}
51+
import code.api.UKOpenBanking.v2_0_0.OBP_UKOpenBanking_200
52+
import code.api.UKOpenBanking.v3_1_0.OBP_UKOpenBanking_310
4653
import code.api.cache.Redis
4754
import code.api.util.APIUtil.{enableVersionIfAllowed, versionIsAllowed,errorJsonResponse, getPropsValue}
4855
import code.api.util.ApiRole._
@@ -470,7 +477,9 @@ class Boot extends MdcLoggable {
470477
ScannedApis.versionMapScannedApis.keys.foreach(enableVersionIfAllowed) // process all scanned apis versions
471478

472479

473-
// Manual registration for Berlin Group v1.3 if not already registered by ClassScanUtils
480+
// Manual registration for ScannedApis if not already registered by ClassScanUtils
481+
// This ensures all APIs work in Fat JAR environment where class scanning fails
482+
474483
if (!ScannedApis.versionMapScannedApis.contains(ConstantsBG.berlinGroupVersion1)) {
475484
logger.warn("BGv1.3 was NOT found by ClassScanUtils, registering manually")
476485
if (versionIsAllowed(ConstantsBG.berlinGroupVersion1)) {
@@ -479,6 +488,78 @@ class Boot extends MdcLoggable {
479488
}
480489
}
481490

491+
if (!ScannedApis.versionMapScannedApis.contains(OBP_BERLIN_GROUP_1_3_Alias.apiVersion)) {
492+
logger.warn("BGv1.3 Alias was NOT found by ClassScanUtils, registering manually")
493+
if (versionIsAllowed(OBP_BERLIN_GROUP_1_3_Alias.apiVersion)) {
494+
LiftRules.statelessDispatch.append(OBP_BERLIN_GROUP_1_3_Alias)
495+
logger.info(s"${OBP_BERLIN_GROUP_1_3_Alias.apiVersion.fullyQualifiedVersion} was ENABLED (manual registration)")
496+
}
497+
}
498+
499+
if (!ScannedApis.versionMapScannedApis.contains(ApiVersion.stetV14)) {
500+
logger.warn("STET v1.4 was NOT found by ClassScanUtils, registering manually")
501+
if (versionIsAllowed(ApiVersion.stetV14)) {
502+
LiftRules.statelessDispatch.append(OBP_STET_1_4)
503+
logger.info(s"${ApiVersion.stetV14.fullyQualifiedVersion} was ENABLED (manual registration)")
504+
}
505+
}
506+
507+
if (!ScannedApis.versionMapScannedApis.contains(ApiVersion.polishApiV2111)) {
508+
logger.warn("Polish API v2.1.1.1 was NOT found by ClassScanUtils, registering manually")
509+
if (versionIsAllowed(ApiVersion.polishApiV2111)) {
510+
LiftRules.statelessDispatch.append(OBP_PAPI_2_1_1_1)
511+
logger.info(s"${ApiVersion.polishApiV2111.fullyQualifiedVersion} was ENABLED (manual registration)")
512+
}
513+
}
514+
515+
if (!ScannedApis.versionMapScannedApis.contains(ApiVersion.mxofV100)) {
516+
logger.warn("Mexico Open Finance v1.0.0 was NOT found by ClassScanUtils, registering manually")
517+
if (versionIsAllowed(ApiVersion.mxofV100)) {
518+
LiftRules.statelessDispatch.append(OBP_MXOF_1_0_0)
519+
logger.info(s"${ApiVersion.mxofV100.fullyQualifiedVersion} was ENABLED (manual registration)")
520+
}
521+
}
522+
523+
if (!ScannedApis.versionMapScannedApis.contains(ApiVersion.cnbv9)) {
524+
logger.warn("Mexico CNBV9 v1.0.0 was NOT found by ClassScanUtils, registering manually")
525+
if (versionIsAllowed(ApiVersion.cnbv9)) {
526+
LiftRules.statelessDispatch.append(CNBV9_1_0_0)
527+
logger.info(s"${ApiVersion.cnbv9.fullyQualifiedVersion} was ENABLED (manual registration)")
528+
}
529+
}
530+
531+
if (!ScannedApis.versionMapScannedApis.contains(ApiVersion.bahrainObfV100)) {
532+
logger.warn("Bahrain OBF v1.0.0 was NOT found by ClassScanUtils, registering manually")
533+
if (versionIsAllowed(ApiVersion.bahrainObfV100)) {
534+
LiftRules.statelessDispatch.append(BahrainApiCollector)
535+
logger.info(s"${ApiVersion.bahrainObfV100.fullyQualifiedVersion} was ENABLED (manual registration)")
536+
}
537+
}
538+
539+
if (!ScannedApis.versionMapScannedApis.contains(ApiVersion.cdsAuV100)) {
540+
logger.warn("Australia CDS v1.0.0 was NOT found by ClassScanUtils, registering manually")
541+
if (versionIsAllowed(ApiVersion.cdsAuV100)) {
542+
LiftRules.statelessDispatch.append(AUApiCollector)
543+
logger.info(s"${ApiVersion.cdsAuV100.fullyQualifiedVersion} was ENABLED (manual registration)")
544+
}
545+
}
546+
547+
if (!ScannedApis.versionMapScannedApis.contains(ApiVersion.ukOpenBankingV20)) {
548+
logger.warn("UK Open Banking v2.0.0 was NOT found by ClassScanUtils, registering manually")
549+
if (versionIsAllowed(ApiVersion.ukOpenBankingV20)) {
550+
LiftRules.statelessDispatch.append(OBP_UKOpenBanking_200)
551+
logger.info(s"${ApiVersion.ukOpenBankingV20.fullyQualifiedVersion} was ENABLED (manual registration)")
552+
}
553+
}
554+
555+
if (!ScannedApis.versionMapScannedApis.contains(ApiVersion.ukOpenBankingV31)) {
556+
logger.warn("UK Open Banking v3.1.0 was NOT found by ClassScanUtils, registering manually")
557+
if (versionIsAllowed(ApiVersion.ukOpenBankingV31)) {
558+
LiftRules.statelessDispatch.append(OBP_UKOpenBanking_310)
559+
logger.info(s"${ApiVersion.ukOpenBankingV31.fullyQualifiedVersion} was ENABLED (manual registration)")
560+
}
561+
}
562+
482563
enableVersionIfAllowed(ApiVersion.v1_2_1)
483564
enableVersionIfAllowed(ApiVersion.v1_3_0)
484565
enableVersionIfAllowed(ApiVersion.v1_4_0)

0 commit comments

Comments
 (0)