View Javadoc

1   /*
2    * Version.java
3    *
4    * Created on May 11, 2005, 2:46 PM
5    *
6    * To change this template, choose Tools | Options and locate the template under
7    * the Source Creation and Management node. Right-click the template and choose
8    * Open. You can then make changes to the template in the Source Editor.
9    */
10  
11  package gov.bnl.gums.admin;
12  
13  import java.io.File;
14  
15  import org.apache.commons.cli.Option;
16  import org.apache.commons.cli.Options;
17  
18  /**
19   *
20   * @author carcassi
21   */
22  public class ServerVersion extends RemoteCommand {
23  
24      static {
25          command = new ServerVersion();
26      }
27  
28      /**
29       * Creates a new Version object.
30       */
31      public ServerVersion() {
32          syntax = "[-g GUMSURL]";
33          description = "Returns the version of GUMS server being used.";
34      }
35  
36      protected org.apache.commons.cli.Options buildOptions() {
37          Options options = new Options();
38  
39          Option gumsUrl = new Option("g", "GUMS URL", true,
40          "Fully Qualified GUMS URL to override gums.location within the gums-client.properties file");
41          options.addOption(gumsUrl);
42          
43          return options;
44      }
45  
46      protected void execute(org.apache.commons.cli.CommandLine cmd) throws Exception {
47      	String gumsUrl = (cmd.getOptionValue("g", null));
48      	
49      	System.out.println("GUMS server version " + getGums(gumsUrl).getVersion());
50      }
51      
52  }