-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathArguments.java
45 lines (33 loc) · 1.73 KB
/
Arguments.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.cherkashyn.vitalii.ldap;
import com.beust.jcommander.DynamicParameter;
import com.beust.jcommander.Parameter;
import java.util.HashMap;
import java.util.Map;
public class Arguments {
@Parameter(names = {"--help"}, description = "list of arguments for ldap authentication", help = true)
boolean isHelp;
@Parameter(names = {"-u", "--url"}, description = "url to ldap", required = true)
String url="ldaps://ubs000001.addp.com:636";
@Parameter(names = {"-p", "--password"}, description = "password of user", required = true)
String password="my_password";
@DynamicParameter(names = {"-d"}, description = "parameters for ldap connection: -dkey=value ", required = true)
Map<String, String> properties=new HashMap<String, String>();
public static void main( String[] args ) {
System.out.println( "--- begin ---" );
Arguments arguments = new Arguments();
JCommander.newBuilder()
.addObject(arguments)
.build()
.parse(args);
if(arguments.isHelp){
new JCommander(arguments, args).usage();
System.exit(0);
}
// contextFactory.createContext(getContextEnvironment(arguments.url, arguments.password, arguments.properties));
// System.out.println(arguments.url);
// System.out.println(arguments.password);
// System.out.println(arguments.properties);
// System.out.println("--- end ---");
// }
//
}