|
| 1 | +package com.cherkashyn.vitalii.ldap; |
| 2 | + |
| 3 | +import com.beust.jcommander.DynamicParameter; |
| 4 | +import com.beust.jcommander.Parameter; |
| 5 | + |
| 6 | +import java.util.HashMap; |
| 7 | +import java.util.Map; |
| 8 | + |
| 9 | +public class Arguments { |
| 10 | + |
| 11 | + @Parameter(names = {"--help"}, description = "list of arguments for ldap authentication", help = true) |
| 12 | + boolean isHelp; |
| 13 | + |
| 14 | + @Parameter(names = {"-u", "--url"}, description = "url to ldap", required = true) |
| 15 | + String url="ldaps://ubs000001.addp.com:636"; |
| 16 | + |
| 17 | + @Parameter(names = {"-p", "--password"}, description = "password of user", required = true) |
| 18 | + String password="my_password"; |
| 19 | + |
| 20 | + @DynamicParameter(names = {"-d"}, description = "parameters for ldap connection: -dkey=value ", required = true) |
| 21 | + Map<String, String> properties=new HashMap<String, String>(); |
| 22 | + |
| 23 | + |
| 24 | + public static void main( String[] args ) { |
| 25 | + System.out.println( "--- begin ---" ); |
| 26 | + |
| 27 | + Arguments arguments = new Arguments(); |
| 28 | + JCommander.newBuilder() |
| 29 | + .addObject(arguments) |
| 30 | + .build() |
| 31 | + .parse(args); |
| 32 | + if(arguments.isHelp){ |
| 33 | + new JCommander(arguments, args).usage(); |
| 34 | + System.exit(0); |
| 35 | + } |
| 36 | + |
| 37 | + // contextFactory.createContext(getContextEnvironment(arguments.url, arguments.password, arguments.properties)); |
| 38 | + // System.out.println(arguments.url); |
| 39 | + // System.out.println(arguments.password); |
| 40 | + // System.out.println(arguments.properties); |
| 41 | + // System.out.println("--- end ---"); |
| 42 | + // } |
| 43 | + // |
| 44 | +} |
| 45 | + |
0 commit comments