@@ -129,7 +129,6 @@ public static Result generate(
129129 Consumer <Result > tracker ) {
130130 Result result = new Result ();
131131
132- System .out .println ("myParameters: " + parameters );
133132 System .out .println ("Initial types: " + types );
134133
135134 if (types == null || types .isEmpty ()) {
@@ -144,7 +143,7 @@ public static Result generate(
144143 Map .class
145144 );
146145
147- Map <String , Object > featureProviderTypeAndTypes = determineFeatureProviderTypeAndTypes (parameters , cfgJava );
146+ Map <String , Object > featureProviderTypeAndTypes = determineMissingParameters (parameters , cfgJava );
148147 types = (Map <String , List <String >>) featureProviderTypeAndTypes .get ("types" );
149148 } catch (IOException e ) {
150149 e .printStackTrace ();
@@ -196,6 +195,7 @@ public static Result generate(
196195
197196 System .out .println ("typeObject: " + typeObject );
198197
198+
199199 try {
200200 if (typeObject .getOrDefault ("provider" , true )) {
201201 ldproxyCfg .writeEntity (entityData );
@@ -283,6 +283,7 @@ private static FeatureProviderDataV2 parseFeatureProvider(
283283 }
284284
285285 System .out .println ("new featureProviderType: " + featureProviderType );
286+ System .out .println ("myParameters: " + parameters );
286287
287288 FeatureProviderDataV2 .Builder <?> builder =
288289 AutoTypes .getBuilder (
@@ -369,7 +370,7 @@ private static OgcApiDataV2 parseOgcApi(Map<String, String> parameters, LdproxyC
369370 return builder .build ();
370371 }
371372
372- private static Map <String , Object > determineFeatureProviderTypeAndTypes (
373+ private static Map <String , Object > determineMissingParameters (
373374 Map <String , String > parameters , Map <String , Object > yamlConfig ) {
374375
375376 Map <String , Object > result = new HashMap <>();
@@ -393,8 +394,6 @@ private static Map<String, Object> determineFeatureProviderTypeAndTypes(
393394 }
394395 parameters .put ("featureProviderType" , featureProviderType );
395396
396- result .put ("featureProviderType" , featureProviderType );
397-
398397 // If featureProviderType is WFS, extract the URI and set it in parameters
399398 if ("WFS" .equalsIgnoreCase (featureProviderType )) {
400399 Map <String , Object > connectionInfo = (Map <String , Object >) yamlConfig .get ("connectionInfo" );
@@ -404,6 +403,21 @@ private static Map<String, Object> determineFeatureProviderTypeAndTypes(
404403 }
405404 }
406405
406+ // If featureProviderType is PGIS, set additional parameters
407+ if ("PGIS" .equalsIgnoreCase (featureProviderType )) {
408+ Map <String , Object > connectionInfo = (Map <String , Object >) yamlConfig .get ("connectionInfo" );
409+ if (connectionInfo != null ) {
410+ parameters .put ("host" , (String ) connectionInfo .getOrDefault ("host" , "" ));
411+ parameters .put ("database" , (String ) connectionInfo .getOrDefault ("database" , "" ));
412+ parameters .put ("user" , (String ) connectionInfo .getOrDefault ("user" , "" ));
413+ String encodedPassword = (String ) connectionInfo .getOrDefault ("password" , "" );
414+ if (!encodedPassword .isBlank ()) {
415+ String decodedPassword = new String (Base64 .getDecoder ().decode (encodedPassword ), StandardCharsets .UTF_8 );
416+ parameters .put ("password" , decodedPassword );
417+ }
418+ }
419+ }
420+
407421 // Extract types
408422 Map <String , Object > yamlTypes = (Map <String , Object >) yamlConfig .get ("types" );
409423 Map <String , List <String >> extractedTypes = new HashMap <>();
0 commit comments