-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMiddleware.java
44 lines (41 loc) · 1.55 KB
/
Middleware.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.tonebeller.middleware;
public class Middleware {
public static void main(String[] args) {
long startTime = System.nanoTime();
try {
int len = args.length;
if (len < 4){
System.out.println("\n Parameters are required.\n");
System.out.println("\n [0] KYC_ROOT.\n");
System.out.println("\n [1] Client.\n");
System.out.println("\n [2] Online subfolder.\n");
System.out.println("\n [3] Config PATH.\n");
System.exit(-1);
}
Config config = Config.getInstance();
// setters
config.setKYCRoot(args[0]).setClient(args[1]).setSubfolder(args[2]).setPath(args[3]).load();
System.out.println("\n---------- Integration middleware started ---------- \n"
+ Middleware.class.getName());
Customer customer = new Customer(config);
config.setCustomer(customer);
if (config.json.getBoolean("restrictResult")){
System.out.println(Integer.parseInt(customer.getRisk()));
if (Integer.parseInt(customer.getRisk()) == 0 || Integer.parseInt(customer.getRisk()) > config.json.getInt("restrictValue")){
System.out.println("\n\n==== STOPPED MIDDLEWARE DUE TO NO RISK NOT FOUND OR HIGHER THAN ALLOWED===\n\n");
System.exit(-1);
}
}
new Webservice();
}
catch(Exception e){
System.out.println("\n\n== Error in middleware: ==\n" + e.getMessage() + "\n\n");
System.exit(-1);
}
finally {
long stopTime = System.nanoTime();
long elapsedTime = stopTime - startTime;
System.out.println("Time Elapsed to fully execute middleware: " + (double)elapsedTime / 1000000000.0 + " seconds.");
}
}
}