Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jdcasey/sshwrap
Convenience API for Jsch
https://github.com/jdcasey/sshwrap
Last synced: about 1 month ago
JSON representation
Convenience API for Jsch
- Host: GitHub
- URL: https://github.com/jdcasey/sshwrap
- Owner: jdcasey
- License: gpl-3.0
- Created: 2010-08-05T16:58:20.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2012-03-31T03:55:10.000Z (over 12 years ago)
- Last Synced: 2024-08-02T00:25:18.570Z (4 months ago)
- Language: Java
- Homepage:
- Size: 141 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE.txt
Awesome Lists containing this project
README
# SSHWrap - Convenience API for Jsch #
SSHWrap is designed to provide a minimal set of classes that allow you streamlined access to the features of the Jsch Java SSH client library.
## Usage ##
Imagine that you need to create and initialize a bare remote Git repository for a project you're about to push. The following method will do the trick:
private boolean createRemoteGitRepo( final String dir )
throws IOException, SSHWrapException
{
SSHConnection ssh = new SSHConnection( USER, HOST, PORT ).connect();
final Set cmds = new HashSet();
cmds.add( "mkdir -p " + dir );
cmds.add( "git --git-dir=" + dir + " --bare init" );final ByteArrayOutputStream cmdOutput = new ByteArrayOutputStream();
for ( final String cmd : cmds )
{
cmdOutput.reset();
final int result = ssh.execute( cmd, cmdOutput );if ( LOGGER.isDebugEnabled() )
{
LOGGER.debug( new String( cmdOutput.toByteArray() ) );
}if ( result != 0 )
{
return false;
}
}return true;
}