You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2010/08/11 22:14:35 UTC

svn commit: r984567 - in /subversion/trunk/subversion/bindings/javahl/src/org: apache/subversion/javahl/callback/UserPasswordCallback.java tigris/subversion/javahl/SVNClient.java

Author: hwright
Date: Wed Aug 11 20:14:34 2010
New Revision: 984567

URL: http://svn.apache.org/viewvc?rev=984567&view=rev
Log:
JavaHL: Add the additional required APIs to the apache prompter interface,
and do the appropriate thing in the wrapper as well.

* subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/UserPasswordCallback.java
  (prompt, askQuestion, userAllowedSave): New.

* subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java
  (PromptUser1Wrapper.userAllowedSave): New.
  (PromptUser1Wrapper.askQuestion): New.
  (PromptUser1Wrapper.prompt): New.

Modified:
    subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/UserPasswordCallback.java
    subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java

Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/UserPasswordCallback.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/UserPasswordCallback.java?rev=984567&r1=984566&r2=984567&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/UserPasswordCallback.java (original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/UserPasswordCallback.java Wed Aug 11 20:14:34 2010
@@ -104,4 +104,52 @@ public interface UserPasswordCallback
      * @return the password
      */
     public String getPassword();
+
+    /**
+     * Request a user name and password from the user, and (usually)
+     * store the auth credential caching preference specified by
+     * <code>maySave</code> (used by {@link #userAllowedSave()}).
+     * Applications wanting to emulate the behavior of
+     * <code>--non-interactive</code> will implement this method in a
+     * manner which does not require user interaction (e.g. a no-op
+     * which assumes pre-cached auth credentials).
+     *
+     * @param realm The realm from which the question originates.
+     * @param username The name of the user in <code>realm</code>.
+     * @param maySave Whether caching of credentials is allowed.
+     * Usually affects the return value of the {@link
+     * #userAllowedSave()} method.
+     * @return Whether the prompt for authentication credentials was
+     * successful (e.g. in a GUI application whether the dialog box
+     * was canceled).
+     */
+    public boolean prompt(String realm, String username, boolean maySave);
+
+    /**
+     * Ask the user a question, and (usually) store the auth
+     * credential caching preference specified by <code>maySave</code>
+     * (used by {@link #userAllowedSave()}).  Applications wanting to
+     * emulate the behavior of <code>--non-interactive</code> will
+     * implement this method in a manner which does not require user
+     * interaction (e.g. a no-op).
+     *
+     * @param realm The realm from which the question originates.
+     * @param question The text of the question.
+     * @param showAnswer Whether the answer may be displayed.
+     * @param maySave Whether caching of credentials is allowed.
+     * Usually affects the return value of the {@link
+     * #userAllowedSave()} method.
+     * @return              answer as entered or null if canceled
+     */
+    public String askQuestion(String realm, String question,
+                              boolean showAnswer, boolean maySave);
+
+    /**
+     * @return Whether the caller allowed caching of credentials the
+     * last time {@link #prompt(String, String, boolean)} was called.
+     * Applications wanting to emulate the behavior of
+     * <code>--no-auth-cache</code> will probably always return
+     * <code>false</code>.
+     */
+    public boolean userAllowedSave();
 }

Modified: subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java?rev=984567&r1=984566&r2=984567&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java (original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java Wed Aug 11 20:14:34 2010
@@ -354,6 +354,22 @@ public class SVNClient implements SVNCli
         {
             return askTrustSSLServer(info, allowPermanently);
         }
+
+        public boolean userAllowedSave()
+        {
+            return false;
+        }
+
+        public String askQuestion(String realm, String question,
+                                  boolean showAnswer, boolean maySave)
+        {
+            return askQuestion(realm, question, showAnswer);
+        }
+
+        public boolean prompt(String realm, String username, boolean maySave)
+        {
+            return prompt(realm, username);
+        }
     }
 
     /**