You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 20 Next »

Trebuchet

Trebuchet is a multi-scheme file-transfer API written in Java.

Distributions

Version 2006 1.0-beta

Trebuchet 2006 Libraries + Documentation

Version 0.10.6 (post-Eclipse)

Trebuchet Library + Client(Linux)
Trebuchet Library + Client(MacOSX)
Trebuchet Library + Client(Windows)

Clients

Trebuchet RC - An Eclipse RCP based client

Logging

Trebuchet provides a detailed mechanism for getting verbose output in the form of FileOperation events.

Enable FileOp Logging
Configuration configuration = new Configuration();
configuration.addProperty( "fileOpLog", "/tmp/trebuchet-fileop.log" );
configuration.addBooleanProperty( "verbose", true );

You may also implement a custom FileOpListener as described here.

Examples

The primary entry point for use in Java-based programs is ncsa.tools.trebuchet.core.util.Trebuchet. This is a static utility class which provides for a some common use-cases.

For the examples, we'll use the following defintions and imports:

Common Imports
import java.net.URI;
import ncsa.tools.trebuchet.core.util.Trebuchet;
import ncsa.commons.types.Configuration;
Variable Definitions
URI sourceFile = new URI( "gridftp://source.host.edu/directory/file.xml" );
URI targetDirectorySSH = new URI( "ssh://target.host.edu/directory/destination" );
URI targetDirectoryFTP = new URI( "gridftp://target.host.edu/directory/destination" );
URI sshWithUserPass = new URI( "ssh://user:password@source.host.edu/directory/file.xml" );

Copying Files/Directories

Copy a Single URI to a target URI with no specific Configuration
Trebuchet.copy( sourceFile, targetDirectorySSH, new Configuration() );
Copy a Single URI to a target URI tweaking GridFTP performance settings
Configuration configuration = new Configuration();
configuration.addLongProperty( "tcpBufferSize", 15384 );
configuration.addLongProperty( "localTCPBufferSize", 15384 );

Trebuchet.copy( sourceFile, targetDirectoryFTP, configuration );
Set a Credential for Use with GridFTP
Configuration configuration = new Configuration();
NCSAAttribute a = new NCSAAttribute();
a.setName( "credential" );
a.setActualValue( credential );
configuration.addAttribute( a );
  • No labels