Skip to content

Commit fcac99a

Browse files
committed
make getRootDir configurable via system property
- add fetchFile with defaultUser
1 parent 5563d62 commit fcac99a

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

src/main/java/org/kopi/ebics/client/EbicsClient.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,20 @@
6969
*
7070
*/
7171
public class EbicsClient {
72+
/**
73+
* The workspace holding ebics.txt, the user keys and the order numbers.
74+
*
75+
* <p>Overridable through EBICS_ROOT_DIR, the same variable {@link
76+
* ParameterizedEbicsClientLauncher} uses, so that a second access (a test bank, a second
77+
* agreement) can be initialized without writing into the workspace of the first one. The keys
78+
* are not the only thing at stake: quitting saves the incremented order number, which the bank
79+
* counts.
80+
*/
7281
private static File getRootDir() {
82+
String configured = System.getenv("EBICS_ROOT_DIR");
83+
if (configured != null && !configured.isBlank()) {
84+
return new File(configured.trim());
85+
}
7386
return new File(System.getProperty("user.home"), "ebics" + File.separator + "client");
7487
}
7588

@@ -417,6 +430,18 @@ public void fetchFile(File file, User user, Product product, EbicsOrderType orde
417430
fetchFile(file, user, product, orderType, null, isTest);
418431
}
419432

433+
/**
434+
* Downloads a file for the default user, with EBICS 3.0 service parameters.
435+
*
436+
* <p>The counterpart of {@link #sendFile(File, EbicsOrderType, EbicsUploadParams)}: callers
437+
* that use the default user have no other way to reach the BTD path, since the default
438+
* product is not exposed.
439+
*/
440+
public void fetchFile(File file, EbicsOrderType orderType, EbicsDownloadParams downloadParams)
441+
throws IOException, EbicsException {
442+
fetchFile(file, defaultUser, defaultProduct, orderType, downloadParams, false);
443+
}
444+
420445
/**
421446
* Downloads a file from the bank.
422447
*

0 commit comments

Comments
 (0)