maven-wagon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r312817 - in /maven/wagon/trunk: wagon-provider-api/src/main/java/org/apache/maven/wagon/ wagon-providers/wagon-ssh-external/ wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext/ wagon-providers/wagon-ss...
Date Tue, 11 Oct 2005 06:32:32 GMT
Author: brett
Date: Mon Oct 10 23:32:11 2005
New Revision: 312817

URL: http://svn.apache.org/viewcvs?rev=312817&view=rev
Log:
use batch mode where necessary for new interactive options

Modified:
    maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java
    maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/Wagon.java
    maven/wagon/trunk/wagon-providers/wagon-ssh-external/pom.xml
    maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext/ScpExternalWagon.java
    maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/sshext/TestData.java
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/AbstractSshWagon.java
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProvider.java
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProvider.java

Modified: maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java?rev=312817&r1=312816&r2=312817&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java
(original)
+++ maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java
Mon Oct 10 23:32:11 2005
@@ -63,6 +63,8 @@
 
     protected AuthenticationInfo authenticationInfo;
 
+    protected boolean interactive = true;
+
     // ----------------------------------------------------------------------
     // Accessors
     // ----------------------------------------------------------------------
@@ -654,5 +656,15 @@
         }
         path += dir;
         return path;
+    }
+
+    public boolean isInteractive()
+    {
+        return interactive;
+    }
+
+    public void setInteractive( boolean interactive )
+    {
+        this.interactive = interactive;
     }
 }

Modified: maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/Wagon.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/Wagon.java?rev=312817&r1=312816&r2=312817&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/Wagon.java (original)
+++ maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/Wagon.java Mon
Oct 10 23:32:11 2005
@@ -117,4 +117,8 @@
     void removeTransferListener( TransferListener listener );
 
     boolean hasTransferListener( TransferListener listener );
+
+    boolean isInteractive();
+
+    void setInteractive( boolean interactive );
 }

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh-external/pom.xml
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh-external/pom.xml?rev=312817&r1=312816&r2=312817&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh-external/pom.xml (original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh-external/pom.xml Mon Oct 10 23:32:11 2005
@@ -23,6 +23,7 @@
         <configuration>
           <excludes>
             <exclude>**/ScpExternalWagon*Test.*</exclude>
+            <exclude>**/SshCommandExecutorTest.*</exclude>
           </excludes>
         </configuration>
       </plugin>

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext/ScpExternalWagon.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext/ScpExternalWagon.java?rev=312817&r1=312816&r2=312817&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext/ScpExternalWagon.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext/ScpExternalWagon.java
Mon Oct 10 23:32:11 2005
@@ -190,6 +190,17 @@
             }
         }
 
+        // should check interactive flag, but scpexe never works in interactive mode right
now due to i/o streams
+        if ( sshExecutable.indexOf( "plink" ) >= 0 )
+        {
+            cl.createArgument().setValue( "-batch" );
+        }
+        else
+        {
+            cl.createArgument().setValue( "-o" );
+            cl.createArgument().setValue( "BatchMode yes" );
+        }
+
         if ( sshArgs != null )
         {
             cl.createArgument().setLine( sshArgs );
@@ -234,6 +245,17 @@
         if ( port != WagonConstants.UNKNOWN_PORT )
         {
             cl.createArgument().setLine( "-P " + port );
+        }
+
+        // should check interactive flag, but scpexe never works in interactive mode right
now due to i/o streams
+        if ( sshExecutable.indexOf( "pscp" ) >= 0 )
+        {
+            cl.createArgument().setValue( "-batch" );
+        }
+        else
+        {
+            cl.createArgument().setValue( "-o" );
+            cl.createArgument().setValue( "BatchMode yes" );
         }
 
         if ( scpArgs != null )

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/sshext/TestData.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/sshext/TestData.java?rev=312817&r1=312816&r2=312817&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/sshext/TestData.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/sshext/TestData.java
Mon Oct 10 23:32:11 2005
@@ -26,26 +26,21 @@
 {
     public static String getTestRepositoryUrl()
     {
-        return "scp://beaver.codehaus.org//home/projects/" + getUserName() + "/public_html";
+        return "scp://" + getHostname() + "/tmp/wagon-ssh-test/" + getUserName();
     }
 
     public static String getUserName()
     {
-
-        String retValue = System.getProperty( "test.user" );
-
-        if ( retValue == null )
-        {
-            retValue = System.getProperty( "user.name" );
-        }
-
-        return retValue;
+        return System.getProperty( "test.user", System.getProperty( "user.name" ) );
     }
 
     public static File getPrivateKey()
     {
-        File retValue = new File( System.getProperty( "user.home" ), "/.ssh/id_dsa" );
+        return new File( System.getProperty( "user.home" ), "/.ssh/id_dsa" );
+    }
 
-        return retValue;
+    public static String getHostname()
+    {
+        return System.getProperty( "test.host", "beaver.codehaus.org" );
     }
 }

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/AbstractSshWagon.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/AbstractSshWagon.java?rev=312817&r1=312816&r2=312817&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/AbstractSshWagon.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/AbstractSshWagon.java
Mon Oct 10 23:32:11 2005
@@ -38,6 +38,7 @@
 import org.apache.maven.wagon.events.TransferEvent;
 import org.apache.maven.wagon.providers.ssh.interactive.InteractiveUserInfo;
 import org.apache.maven.wagon.providers.ssh.interactive.UserInfoUIKeyboardInteractiveProxy;
+import org.apache.maven.wagon.providers.ssh.interactive.NullInteractiveUserInfo;
 import org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider;
 import org.apache.maven.wagon.repository.RepositoryPermissions;
 import org.apache.maven.wagon.resource.Resource;
@@ -81,8 +82,6 @@
 
     private UIKeyboardInteractive uIKeyboardInteractive;
 
-    private JSch sch;
-
     public void openConnection()
         throws AuthenticationException
     {
@@ -96,7 +95,7 @@
             authenticationInfo.setUserName( System.getProperty( "user.name" ) );
         }
 
-        sch = new JSch();
+        JSch sch = new JSch();
 
         int port = getRepository().getPort();
 
@@ -185,6 +184,19 @@
         }
 
         Properties config = new Properties();
+        config.setProperty( "BatchMode", interactive ? "no" : "yes" );
+
+        if ( !interactive )
+        {
+            interactiveUserInfo = new NullInteractiveUserInfo();
+            uIKeyboardInteractive = null;
+/*
+            if ( knownHostsProvider != null && "ask".equals( knownHostsProvider.getHostKeyChecking()
) )
+            {
+                knownHostsProvider.setHostKeyChecking( "yes" );
+            }
+*/
+        }
 
         // username and password will be given via UserInfo interface.
         UserInfo ui = new WagonUserInfo( authenticationInfo, interactiveUserInfo );
@@ -215,6 +227,11 @@
         try
         {
             session.connect();
+
+            if ( knownHostsProvider != null )
+            {
+                knownHostsProvider.storeKnownHosts( sch );
+            }
         }
         catch ( JSchException e )
         {
@@ -327,21 +344,11 @@
 
     public void closeConnection()
     {
-        if ( knownHostsProvider != null )
-        {
-            if ( sch != null )
-            {
-                knownHostsProvider.storeKnownHosts( sch );
-            }
-        }
-
         if ( session != null )
         {
             session.disconnect();
             session = null;
         }
-
-        sch = null;
     }
 
     protected void handleGetException( Resource resource, Exception e, File destination )

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProvider.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProvider.java?rev=312817&r1=312816&r2=312817&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProvider.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProvider.java
Mon Oct 10 23:32:11 2005
@@ -42,6 +42,11 @@
         this.hostKeyChecking = hostKeyChecking;
     }
 
+    public String getHostKeyChecking()
+    {
+        return hostKeyChecking;
+    }
+
     public void storeKnownHosts( JSch sch )
     {
     }

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProvider.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProvider.java?rev=312817&r1=312816&r2=312817&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProvider.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProvider.java
Mon Oct 10 23:32:11 2005
@@ -16,14 +16,11 @@
  * limitations under the License.
  */
 
-import org.apache.maven.wagon.TransferFailedException;
-
 import com.jcraft.jsch.JSch;
 import com.jcraft.jsch.JSchException;
 import com.jcraft.jsch.UserInfo;
 
 import java.util.Properties;
-import java.io.IOException;
 
 /**
  * Provides a way to add Known Hosts fingerprints to the JSch transport
@@ -48,4 +45,8 @@
     void addConfiguration( Properties config );
 
     void storeKnownHosts( JSch sch );
+
+    void setHostKeyChecking( String hostKeyChecking );
+
+    String getHostKeyChecking();
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: wagon-commits-unsubscribe@maven.apache.org
For additional commands, e-mail: wagon-commits-help@maven.apache.org


Mime
View raw message