View Javadoc

1   /*
2    * GUMS2MapUser.java
3    *
4    * Created on June 9, 2004, 1:44 PM
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 ManualGroup_Remove extends RemoteCommand {
23      static {
24          command = new ManualGroup_Remove();
25      }
26  
27      /***
28       * Creates a new ManualGroup_Remove object.
29       */
30      public ManualGroup_Remove() {
31          syntax = "PERSISTANCE GROUP USERDN1 [USERDN2] ...";
32          description = "Removes a user from a manually managed group. " +
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 < 3) {
46              failForWrongParameters("Missing parameters...");
47          }
48  
49          String[] userDN = (cmd.getArgs());
50          String persistenceFactory = cmd.getArgs()[0];
51          String groupName = cmd.getArgs()[1];
52  
53          for (int nArg = 2; nArg < cmd.getArgs().length; nArg++) {
54              getGums().manualGroupRemove(persistenceFactory, groupName,
55                  cmd.getArgs()[nArg]);
56          }
57      }
58  }