1
2
3
4
5
6 package gov.bnl.gums.admin;
7
8
9 import org.apache.axis.AxisFault;
10
11 import org.apache.commons.cli.*;
12
13 import java.net.ConnectException;
14 import java.net.InetAddress;
15 import java.net.URL;
16 import gov.bnl.gums.command.AbstractCommand;
17
18
19 /***
20 * @author carcassi
21 */
22 public class ManualMapping_Add extends RemoteCommand {
23 static {
24 command = new ManualMapping_Add();
25 }
26
27 /***
28 * Creates a new ManualMapping_Add object.
29 */
30 public ManualMapping_Add() {
31 syntax = "PERSISTANCE GROUP USERDN USERNAME";
32 description = "Maps a DN to a user in a manually managed mapping. " +
33 "PERSISTANCE is the 'persistenceFactory' as defined in the configuration for the group." +
34 "GROUP is the 'name' as defined in the configuration for the group.";
35 }
36
37 protected org.apache.commons.cli.Options buildOptions() {
38 Options options = new Options();
39
40 return options;
41 }
42
43 protected void execute(org.apache.commons.cli.CommandLine cmd)
44 throws Exception {
45 if (cmd.getArgs().length < 4) {
46 failForWrongParameters("Missing parameters...");
47 }
48
49 String persistenceFactory = cmd.getArgs()[0];
50 String groupName = cmd.getArgs()[1];
51 String userDN = cmd.getArgs()[2];
52 String username = cmd.getArgs()[3];
53
54 getGums().manualMappingAdd(persistenceFactory, groupName, userDN, username);
55 }
56 }