You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by Dave Bryson <da...@miceda-data.com> on 2000/12/19 14:12:04 UTC
Re: Sung-Gu's cmd code
On Tue, 19 Dec 2000, you wrote:
> This codes are for "ls" and Exception process for processStartUp.
> I'll get you more soon... ^^
Thank you!
I'll integrate this stuff in tonight. If possible, try to send code changes as a patch. It makes it much easier to add.
Thanks again,
--
Dave Bryson
daveb@miceda-data.com
----------------------
Re: Sung-Gu's cmd code
Posted by "Park, Sung-Gu" <je...@thinkfree.com>.
Actually, I made my own cmd code. Bt it's very not arranged. ^^;
So, I want... this codes help you... :-)
Simple source for delete, lock, propatch, copy, move methods.
===================================================================
FILE: Main.java
CODE:
import com.tf.webdav.client.properties.LockEntryProperty;
<snip>
else if( todo.equalsIgnoreCase("delete") )
{
if( params.empty() )
{
System.out.println("delete <uri>");
}
else
{
String uri = checkUri( (String)params.pop() );
DeleteMethod dm = new DeleteMethod(uri);
client.executeMethod( dm );
System.out.println( "Status: " + dm.getStatusCode() );
}
}
else if( todo.equalsIgnoreCase("lock") )
{
String owner = "jericho@thinkfree.com"; // user info
short lock = LockEntryProperty.SCOPE_EXCLUSIVE;
// to make it easy to manage lock information
long timeout = 120; // 2 min.
if( params.empty() )
{
System.out.println("lock <uri>");
}
else
{
String uri = checkUri( (String)params.pop() );
LockMethod lm = new LockMethod(uri, owner, lock, timeout);
client.executeMethod( lm );
// TODO: to manage lock information for unlock
System.out.println( "Status: " + lm.getStatusCode() +
"\nLockToken: " + lm.getLockToken());
// lm.recycle();
}
}
else if( todo.equalsIgnoreCase("proppatch") )
{
if( params.size() != 3 )
{
System.out.println("proppatch <uri> <property name> <property value>");
}
else
{
String propertyValue = checkUri( (String)params.pop() );
String propertyName = checkUri( (String)params.pop() );
String uri = checkUri( (String)params.pop() );
PropPatchMethod pp = new PropPatchMethod(uri);
pp.addPropertyToSet(propertyName, propertyValue);
// pp.addPropertyToSet("password", "jericho");
client.executeMethod( pp );
System.out.println( "Status: " + pp.getStatusCode() );
// pp.recycle();
}
}
else if( todo.equalsIgnoreCase("copy") )
{
if( params.size() != 2 )
{
System.out.println("copy <source uri> <destination uri>");
}
else
{
String destination = checkUri( (String)params.pop() );
String source = checkUri( (String)params.pop() );
CopyMethod cm = new CopyMethod(source, destination);
client.executeMethod( cm );
System.out.println( "Status: " + cm.getStatusCode() );
// cm.recycle();
}
}
else if( todo.equalsIgnoreCase("move") )
{
if( params.size() != 2)
{
System.out.println("move <source uri> <destination uri> ");
}
else
{
String destination = checkUri( (String)params.pop() );
String source = checkUri( (String)params.pop() );
MoveMethod mm = new MoveMethod(source, destination);
client.executeMethod( mm );
System.out.println( "Status: " + mm.getStatusCode() );
// mm.recycle();
}
}
}
<snip>
{
System.out.println("WebDAV Client commands:");
System.out.println(" quit");
System.out.println(" help/?");
System.out.println(" get [uri] Get a file");
System.out.println(" put [source uri] [destination uri] Upload a file");
System.out.println(" options [uri] Display methods available on the server");
System.out.println(" propfind [uri] Display properties on a resource");
System.out.println(" proppatch [uri] Propacth a property on a resource");
System.out.println(" ls [uri] Display directory");
System.out.println(" cd [uri] Change directory");
System.out.println(" pwd Show the present working directory");
System.out.println(" mkcol [uri] Make a new collection");
System.out.println(" delete [uri] Delete a collection or a file");
System.out.println(" copy [source uri] [destination uri] Copy a file to a file");
System.out.println(" move [source uri] [destination uri] Move a file to a file");
System.out.println(" lock [uri] Lock a collection or a file");
System.out.println(" unlock [uri] Unlock a collection or a file");
}
----- Original Message -----
From: "Dave Bryson" <da...@miceda-data.com>
To: <sl...@jakarta.apache.org>
Sent: Tuesday, December 19, 2000 10:12 PM
Subject: Re: Sung-Gu's cmd code
| On Tue, 19 Dec 2000, you wrote:
| > This codes are for "ls" and Exception process for processStartUp.
| > I'll get you more soon... ^^
|
| Thank you!
|
| I'll integrate this stuff in tonight. If possible, try to send code changes as a patch. It makes it much easier to add.
|
| Thanks again,
|
| --
| Dave Bryson
| daveb@miceda-data.com
| ----------------------
|