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

noreply at shibboleth.net noreply at shibboleth.net
Tue Sep 30 18:53:59 EDT 2014


Author: scantor
Date: Tue Sep 30 18:53:58 2014
New Revision: 6608

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=6608&view=rev
Log:
IDP-244 - Revamp CLI prototype into a generalized tool and a pluggable parameter driver.

Added:
    trunk/idp-core/src/main/java/net/shibboleth/idp/cli/AbstractCommandLineArguments.java   (with props)
    trunk/idp-core/src/main/java/net/shibboleth/idp/cli/CLI.java   (with props)
    trunk/idp-core/src/main/java/net/shibboleth/idp/cli/CommandLineArguments.java   (with props)
    trunk/idp-core/src/main/java/net/shibboleth/idp/cli/ResolverTestArguments.java
      - copied, changed from r6605, trunk/idp-core/src/main/java/net/shibboleth/idp/cli/ResolverTest.java
Modified:
    trunk/idp-core/src/main/java/net/shibboleth/idp/cli/ResolverTest.java

Copied: trunk/idp-core/src/main/java/net/shibboleth/idp/cli/ResolverTestArguments.java (from r6605, trunk/idp-core/src/main/java/net/shibboleth/idp/cli/ResolverTest.java)
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-core/src/main/java/net/shibboleth/idp/cli/ResolverTestArguments.java?p2=trunk/idp-core/src/main/java/net/shibboleth/idp/cli/ResolverTestArguments.java&p1=trunk/idp-core/src/main/java/net/shibboleth/idp/cli/ResolverTest.java&r1=6605&r2=6608&rev=6608&view=diff
==============================================================================
--- trunk/idp-core/src/main/java/net/shibboleth/idp/cli/ResolverTest.java (original)
+++ trunk/idp-core/src/main/java/net/shibboleth/idp/cli/ResolverTestArguments.java Tue Sep 30 18:53:58 2014
@@ -17,216 +17,112 @@
 
 package net.shibboleth.idp.cli;
 
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
-import java.net.URL;
 import java.net.URLEncoder;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
-import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.beust.jcommander.JCommander;
 import com.beust.jcommander.Parameter;
 
+/** Command line processing for ResolverTest flow. */
+public class ResolverTestArguments extends AbstractCommandLineArguments {
 
-/**
- * Entry point for command line attribute utility.
- */
-public final class ResolverTest {
+    /** Attribute requester identity. */
+    @Parameter(names = {"-r", "--requester"}, required = true, description = "Relying party identity")
+    @Nullable private String requester;
 
-    /** Class logger. */
-    @Nonnull private static final Logger LOG = LoggerFactory.getLogger(ResolverTest.class);
+    /** Identity of attribute subject. */
+    @Parameter(names = {"-n", "--principal"}, required = true, description = "Subject principal name")
+    @Nullable private String principal;
+
+    /** Index into metadata.  */
+    @Parameter(names = {"-i", "--acsIndex"}, description = "AttributeConsumingService index")
+    @Nullable private Integer index;
+
+    /** Show results with a custom protocol encoding.  */
+    @Parameter(names = "--protocol", description = "Show results with a custom protocol encoding")
+    @Nullable private String protocol;
+
+    /** Show results with SAML 1.1 encoding. */
+    @Parameter(names = "--saml1", description = "Show results with SAML 1.1 encoding")
+    private boolean saml1;
+
+    /** Show results with SAML 2.0 encoding. */
+    @Parameter(names = "--saml2", description = "Show results with SAML 2.0 encoding")
+    private boolean saml2;
+
+    /**
+     * Below are legacy options from the 2.x AACLI tool that are no longer supported.
+     */
     
-    /** Command line argument container. */
-    @Nonnull private static final CommandLineArgs COMMAND_LINE_ARGS = new CommandLineArgs();
+    /** Obsolete. */
+    @Parameter(names = "--configDir", description = "This option is obsolete", hidden = true)
+    @Nullable private String dummy1;
     
-    /** Constructor. */
-    private ResolverTest() {
-        
+    /** Obsolete. */
+    @Parameter(names = "--springExt", description = "This option is obsolete", hidden = true)
+    @Nullable private String dummy2;
+
+    /** Obsolete. */
+    @Parameter(names = "--issuer", description = "This option is obsolete", hidden = true)
+    @Nullable private String dummy3;
+
+    /** Obsolete. */
+    @Parameter(names = "--authnMethod", description = "This option is obsolete", hidden = true)
+    @Nullable private String dummy4;
+
+    
+    /** {@inheritDoc} */
+    @Override
+    public void validate() {
+        if (saml1) {
+            if (saml2 || protocol != null) {
+                throw new IllegalArgumentException("The saml1, saml2, and protocol options are mutually exclusive");
+            }
+        } else if (saml2) {
+            if (saml1 || protocol != null) {
+                throw new IllegalArgumentException("The saml1, saml2, and protocol options are mutually exclusive");
+            }
+        } else if (protocol != null) {

[... 213 lines stripped ...]


More information about the commits mailing list