[java-identity-provider COMMIT] /trunk/idp-core/src/main/java/net/shibboleth/idp/cli/AbstractCommandLineArguments.java

noreply at shibboleth.net noreply at shibboleth.net
Tue May 5 20:04:02 EDT 2015


Author: scantor
Date: Tue May  5 20:04:02 2015
New Revision: 7492

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7492&view=rev
Log:
IDP-704 - Add a system property to override base URL for command line tools

Modified:
    trunk/idp-core/src/main/java/net/shibboleth/idp/cli/AbstractCommandLineArguments.java

Modified: trunk/idp-core/src/main/java/net/shibboleth/idp/cli/AbstractCommandLineArguments.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-core/src/main/java/net/shibboleth/idp/cli/AbstractCommandLineArguments.java?rev=7492&r1=7491&r2=7492&view=diff
==============================================================================
--- trunk/idp-core/src/main/java/net/shibboleth/idp/cli/AbstractCommandLineArguments.java	(original)
+++ trunk/idp-core/src/main/java/net/shibboleth/idp/cli/AbstractCommandLineArguments.java	Tue May  5 20:04:02 2015
@@ -23,6 +23,8 @@
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+
 import com.beust.jcommander.Parameter;
 import com.beust.jcommander.Parameters;
 
@@ -33,13 +35,16 @@
 @Parameters(separators = " =")
 public abstract class AbstractCommandLineArguments implements CommandLineArguments {
 
+    /** Name of system property for overriding default URL. */
+    @Nonnull @NotEmpty public static final String BASEURL_PROPERTY = "net.shibboleth.idp.cli.baseURL";
+    
     /** Display command usage. */
     @Parameter(names = {"-h", "--help"}, description = "Display program usage", help = true)
     private boolean help;
 
     /** URL to invoke. */
     @Parameter(names = {"-u", "--url"}, description = "Base URL to invoke (no path, no query string)")
-    @Nonnull private String url = "http://localhost";
+    @Nonnull private String url;
 
     /** Path to invoke. */
     @Parameter(names = {"-p", "--path"}, description = "Path to append to URL to invoke (may include query string)")
@@ -57,6 +62,14 @@
     @Parameter(names = {"-tp", "--trustStorePassword"}, description = "Password to a trust store for SSL connections")
     @Nullable private String trustStorePassword;
 
+    /** Constructor. */
+    public AbstractCommandLineArguments() {
+        url = System.getProperty(BASEURL_PROPERTY);
+        if (url == null) {
+            url = "http://localhost";
+        }
+    }
+    
     /**
      * Value of "help" parameter.
      * 



More information about the commits mailing list