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 je...@apache.org on 2001/03/01 22:21:21 UTC
cvs commit: jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd Slide.java
jericho 01/03/01 13:21:20
Added: src/webdav/client/src/org/apache/webdav/cmd Slide.java
Log:
- This is the WebDAV client main program using experimental WebdavResource class.
- It's also experimental too and still buggy!
Revision Changes Path
1.1 jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Slide.java
Index: Slide.java
===================================================================
/*
* $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Slide.java,v 1.1 2001/03/01 21:21:19 jericho Exp $
* $Revision: 1.1 $
* $Date: 2001/03/01 21:21:19 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.webdav.cmd;
import java.io.File;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.FileNotFoundException;
import java.util.Stack;
import java.util.Vector;
import java.util.Hashtable;
import java.util.Enumeration;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.MalformedURLException;
import org.apache.webdav.util.HttpURL;
import org.apache.webdav.util.WebdavResource;
import org.apache.webdav.lib.WebdavStatus;
import org.apache.webdav.lib.WebdavException;
import org.apache.webdav.lib.methods.*;
/**
* The Slide client, the command line version for WebDAV client.
*
* @author <a href="mailto:jericho@thinkree.com">Park, Sung-Gu</a>
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
* @author <a href="mailto:daveb@miceda-data.com">Dave Bryson</a>
*/
public class Slide {
/**
* The version information for the Slide client.
*/
public final static String version = "Slide client v1.0 alpha";
/**
* The http URL on the client connection.
*/
private HttpURL httpUrl;
/**
* The http URL string on the command line by the user given.
*/
private String stringUrl;
/**
* The path for the display information.
*/
private String path = "";
/**
* The command prompt for the display information.
*/
private String commandPrompt = null;
/**
* A space mark.
*/
public static final String SP = " ";
/**
* The main function to start a Slide client.
*/
public static void main(String args[]) {
final Slide slide = new Slide();
String argOptions = null;
// parse arguments
for (int i = 0; i < args.length; i++) {
if (args[i].startsWith("-")) {
if (argOptions != null)
argOptions += args[i].substring(1);
else
argOptions = args[i];
} else {
slide.stringUrl = args[i];
}
}
// print options
if (argOptions != null) {
char option;
for (int i = 0; i < argOptions.length(); i++) {
option = argOptions.charAt(i);
switch (option) {
case '-':
break;
case 'h':
printCmdLineUsage();
break;
case 'v':
System.out.println(version);
break;
default:
System.exit(-1);
}
}
}
Thread inner =
new Thread(
new Runnable() {
public void run() {
// Start command line client.
slide.processCommands();
}});
inner.start();
}
/**
* Parse the Slide client commands and execute the requests.
*/
public void processCommands() {
/**
* The WebDAV Resource.
*/
WebdavResource webdavResource = null;
try {
if (stringUrl != null) {
// Set up for processing WebDAV resources from command line.
try {
httpUrl = new HttpURL(stringUrl);
webdavResource = new WebdavResource(httpUrl);
setPath(webdavResource.getPath());
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
httpUrl = null;
} catch (IOException e) {
System.err.println("Error: check! " + e.getMessage());
httpUrl = null;
}
}
updatePrompt(getPath());
BufferedReader in =
new BufferedReader(new InputStreamReader(System.in));
String command = null;
do {
System.out.print(getPrompt());
command = in.readLine();
if (command == null || command.length() == 0)
continue;
StringTokenizer st = new StringTokenizer(command.trim());
String todo = st.nextToken();
Stack params = new Stack();
while (st.hasMoreTokens()) {
params.push(st.nextToken());
}
if (todo.equalsIgnoreCase("open")) {
String inputUrl = null;
if (!params.empty()) {
inputUrl = (String) params.pop();
} else {
System.out.print("Enter http URL: ");
inputUrl = in.readLine();
if (inputUrl != null && inputUrl.length() == 0)
continue;
}
try {
// Set up for processing WebDAV resources
httpUrl = new HttpURL(inputUrl);
if (webdavResource == null) {
webdavResource = new WebdavResource(httpUrl);
} else {
webdavResource.close();
webdavResource.setHttpUrl(inputUrl);
}
setPath(webdavResource.getPath());
} catch (WebdavException we) {
if (we.getStatusCode() ==
WebdavStatus.SC_UNAUTHORIZED) {
System.out.print("UserName: ");
String userName = in.readLine();
if (userName != null && userName.length() > 0) {
System.out.print("Password: ");
String password = in.readLine();
try {
try {
if (webdavResource != null)
webdavResource.close();
} catch (IOException e) {
} finally {
httpUrl = null;
webdavResource = null;
}
httpUrl = new HttpURL(inputUrl);
httpUrl.setUserInfo(userName, password);
if (webdavResource != null) {
webdavResource.setHttpUrl(inputUrl);
} else {
webdavResource =
new WebdavResource(httpUrl);
}
setPath(webdavResource.getPath());
} catch (WebdavException e) {
System.err.println("Warning: "
+ e.getMessage());
httpUrl = null;
} catch (IOException e) {
System.err.println("Error: check! "
+ e.getMessage());
httpUrl = null;
}
updatePrompt(getPath());
}
} else {
System.err.println("Error: " + we.getMessage());
httpUrl = null;
}
} catch (IOException e) {
System.err.println("Error: check! " + e.getMessage());
httpUrl = null;
}
updatePrompt(getPath());
} else
if (todo.equalsIgnoreCase("exit") ||
todo.equalsIgnoreCase("quit")) {
break;
} else
if (todo.equalsIgnoreCase("help") ||
todo.equalsIgnoreCase("?")) {
printSlideClientUsage();
} else
// Check the status of connection
if (webdavResource == null) {
System.out.println("Not connected yet.");
continue;
} else
if (todo.equalsIgnoreCase("close")) {
try {
webdavResource.close();
} catch (IOException e) {
} finally {
// Make sure the connection closed.
httpUrl = null;
webdavResource = null;
}
updatePrompt(getPath());
} else
if (todo.equalsIgnoreCase("url")) {
try {
System.out.println(webdavResource.getURL());
} catch (MalformedURLException mue) {
System.err.println("Warning: " + mue.getMessage());
}
} else
if (todo.equalsIgnoreCase("status")) {
System.out.println(webdavResource.getStatusMessage());
} else
if (todo.equalsIgnoreCase("pwc") ||
todo.equalsIgnoreCase("pwd")) {
System.out.println(getPath());
} else
if (todo.equalsIgnoreCase("cc") ||
todo.equalsIgnoreCase("cd")) {
if (params.size() == 0) {
System.out.println(getPath());
} else
if (params.size() == 1) {
String cdPath = checkUri((String) params.pop() + "/");
try {
webdavResource.setPath(cdPath);
if (webdavResource.exists()) {
setPath(webdavResource.getPath());
}
} catch (WebdavException we) {
if (we.getStatusCode() ==
WebdavStatus.SC_UNAUTHORIZED) {
System.out.print("UserName: ");
String userName = in.readLine();
if (userName != null &&
userName.length() > 0) {
System.out.print("Password: ");
String password = in.readLine();
try {
httpUrl.setUserInfo(userName,
password);
webdavResource.close();
webdavResource =
new WebdavResource(httpUrl);
setPath(webdavResource.getPath());
} catch (WebdavException e) {
System.err.println("Warning: "
+ e.getMessage());
httpUrl = null;
} catch (IOException e) {
System.err.println("Error: check! "
+ e.getMessage());
httpUrl = null;
}
updatePrompt(getPath());
}
} else {
System.err.println
("Error: Couldn't change the collection"
+ we.getMessage());
}
} catch (IOException e) {
System.err.println("Error: check! " + e.getMessage());
httpUrl = null;
}
updatePrompt(getPath());
}
} else
if (todo.equalsIgnoreCase("ls") ||
todo.equalsIgnoreCase("dir")) {
String token = null;
String path = null;
// set default options.
byte[] options = { '-', 'F' };
while (!params.empty()) {
// get the input token.
token = (String) params.pop();
// parse the input token.
if (token != null) {
if (!token.startsWith("-")) {
// FIXME: in the case of the child-resource?
path = checkUri(token + "/");
} else {
options = token.getBytes();
}
}
}
for (int o = 1; o < options.length; o++) {
switch (options[o]) {
case 'l':
try {
Vector list = webdavResource.listCollection();
for (int i = 0; i < list.size(); i++) {
String[] longFormat =
(String []) list.elementAt(i);
for (int j = 0;
j < longFormat.length; j++) {
String s = longFormat[j];
int len = s.length();
switch (j) {
case 0:
System.out.print(s);
for (int k = len; k < 20; k++)
System.out.print(SP);
break;
case 1:
for (int k = 10 - len;
k > 0 ; k--)
System.out.print(SP);
// don't cut the size.
System.out.print(s + SP);
break;
case 2:
// cut the description.
System.out.print(SP +
((len > 20) ?
s.substring(0, 20) : s));
for (int k = len; k < 20; k++)
System.out.print(SP);
break;
case 3:
default:
System.out.print(SP + s);
}
}
// Start with a new line.
System.out.println();
}
} catch (WebdavException we) {
System.err.println("Warning: "
+ we.getMessage());
} catch (IOException e) {
System.err.println("Error: check! " +
e.getMessage());
}
break;
case 'F':
try {
if (path != null)
webdavResource.setPath(path);
// FIXME: the problem, once it has an error
if (webdavResource.exists()) {
String[] list = webdavResource.list();
int i = 0;
for (; i < list.length; i++) {
System.out.print(list[i] + SP);
for (int j = list[i].length();
j < 25; j++) {
System.out.print(SP);
}
if (i % 3 == 2)
System.out.println();
}
if (list.length > 0 && i % 3 != 0)
System.out.println();
} else {
if (webdavResource.getStatusCode() ==
WebdavStatus.SC_NOT_FOUND) {
System.err.println
("Warning: Not found the path");
} else
if (webdavResource.getStatusCode() ==
WebdavStatus.SC_METHOD_NOT_ALLOWED) {
System.err.println
("Warning: Not WebDAV-enabled?");
} else {
System.out.println("failed. " +
webdavResource.getStatusMessage());
}
}
} catch (WebdavException we) {
System.err.println
("Error: Couldn't list the collection");
} catch (IOException e) {
System.err.println("Error: check! " +
e.getMessage());
}
break;
default:
} // end of switch
}
} else
if (todo.equalsIgnoreCase("propget")) {
// FIXME: some work is still needed.
int count = params.size();
if (count <= 1)
continue;
Vector properties = new Vector();
for (int i = 0; i < count-1; i++) {
String property = (String) params.pop();
properties.addElement(property);
}
String path = checkUri((String) params.pop());
try {
System.out.print("Getting properties '" +
path + "': ");
Enumeration propertyValues =
webdavResource.propfindMethod(path, properties);
if (propertyValues.hasMoreElements()){
while (propertyValues.hasMoreElements()){
System.out.println(
propertyValues.nextElement());
}
} else {
System.out.println("failed.");
System.out.println(
webdavResource.getStatusMessage());
}
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
System.err.println("Error: check! " +
e.getMessage());
}
} else
if (todo.equalsIgnoreCase("propput")) {
if (params.size() == 3) {
String propertyValue = (String) params.pop();
String propertyName = (String) params.pop();
String path = checkUri((String) params.pop());
try {
System.out.print("Putting property(" +
propertyName + ", " + propertyValue +
") to '" + path + "': ");
if (webdavResource.proppatchMethod(
path, propertyName, propertyValue)) {
System.out.println("succeeded.");
System.out.println
("�� WebDAV dead property doesn't work.");
} else {
System.out.println("failed.");
System.out.println(
webdavResource.getStatusMessage());
}
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
System.err.println("Error: check! " +
e.getMessage());
}
}
} else
// TODO: more than 2, the mput command is easy to use.
if (todo.equalsIgnoreCase("put")) {
int count = params.size();
if (count == 1 || count == 2) {
String dest = dest = checkUri((String) params.pop());
String src = (count == 1) ? HttpURL.getName(dest)
: (String) params.pop();
try {
File file = new File(src);
if (file.exists()) {
System.out.print("Uploading '" + dest +
"' to '" + src + "': ");
if (webdavResource.putMethod(dest, file)) {
System.out.println("succeeded.");
} else {
System.out.println("failed.");
System.out.println(
webdavResource.getStatusMessage());
}
} else
System.err.println
("Warning: File not exists");
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
System.err.println("Error: check! " +
e.getMessage());
}
}
} else
// TODO: more than 2, the mget command is easy to use.
if (todo.equalsIgnoreCase("get")) {
int count = params.size();
if (count == 1 || count == 2) {
// The resource on the remote.
String src = null;
// The file on the local.
String dest = null;
if (count == 1) {
src = checkUri((String) params.pop());
dest = HttpURL.getName(src);
} else {
dest = (String) params.pop();
src = checkUri((String) params.pop());
}
try {
// For the overwrite operation;
String y = "y";
File file = new File(dest);
// Checking the local file.
if (file.exists()) {
System.out.print("Aleady exists. " +
"Do you want to overwrite it(Y/n)? ");
y = in.readLine().trim();
}
if (y.equalsIgnoreCase("y") ||
(y != null && y.length() == 0)) {
System.out.print("Downloading '" + src +
"' to '" + dest + "': ");
if (webdavResource.getMethod(src, file)) {
System.out.println("succeeded.");
} else {
System.out.println("failed.");
System.out.println(
webdavResource.getStatusMessage());
}
}
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
System.err.println("Error: check! " +
e.getMessage());
}
}
} else
if (todo.equalsIgnoreCase("delete") ||
todo.equalsIgnoreCase("del") ||
todo.equalsIgnoreCase("rm")) {
int count = params.size();
for (int i = 0; i < count; i++) {
String path = checkUri((String) params.pop());
try {
System.out.print("Deleting '" + path + "': ");
if (webdavResource.deleteMethod(path)) {
System.out.println("succeeded.");
} else {
System.out.println("failed.");
System.out.println(
webdavResource.getStatusMessage());
}
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
System.err.println("Error: check! " +
e.getMessage());
}
}
} else
if (todo.equalsIgnoreCase("mkcol") ||
todo.equalsIgnoreCase("mkdir")) {
int count = params.size();
for (int i = 0; i < count; i++) {
String path = checkUri((String) params.pop());
try {
System.out.print("Making '" + path +
"' collection: ");
if (webdavResource.mkcolMethod(path)) {
System.out.println("succeeded.");
} else {
System.out.println("failed.");
System.out.println(
webdavResource.getStatusMessage());
}
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
System.err.println("Error: check! " +
e.getMessage());
}
}
} else
if (todo.equalsIgnoreCase("copy") ||
todo.equalsIgnoreCase("cp")) {
if (params.size() == 2) {
String dst = checkUri((String) params.pop());
String src = checkUri((String) params.pop());
try {
System.out.print("Copying '" + src +
"' to '" + dst + "': ");
if (webdavResource.copyMethod(src, dst)) {
System.out.println("succeeded.");
} else {
System.out.println("failed.");
System.out.println(
webdavResource.getStatusMessage());
}
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
System.err.println("Error: check! " +
e.getMessage());
}
}
} else
if (todo.equalsIgnoreCase("move") ||
todo.equalsIgnoreCase("mv")) {
if (params.size() == 2) {
String dst = checkUri((String) params.pop());
String src = checkUri((String) params.pop());
try {
System.out.print("Moving '" + src +
"' to '" + dst + "': ");
if (webdavResource.moveMethod(src, dst)) {
System.out.println("succeeded.");
} else {
System.out.println("failed.");
System.out.println(
webdavResource.getStatusMessage());
}
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
System.err.println("Error: check! " +
e.getMessage());
}
}
} else
if (todo.equalsIgnoreCase("lock")) {
if (params.size() == 1) {
String path = checkUri((String) params.pop());
try {
System.out.print("Locking '" + path + "': ");
if (webdavResource.lockMethod(path)) {
System.out.println("succeeded.");
} else {
System.out.println("failed.");
System.out.println(
webdavResource.getStatusMessage());
}
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
System.err.println("Error: check! " +
e.getMessage());
}
}
} else
if (todo.equalsIgnoreCase("unlock")) {
if (params.size() == 1) {
String path = checkUri((String) params.pop());
try {
System.out.print("Unlocking '" + path + "': ");
if (webdavResource.unlockMethod(path)) {
System.out.println("succeeded.");
} else {
System.out.println("failed.");
System.out.println(
webdavResource.getStatusMessage());
}
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
System.err.println("Error: check! " +
e.getMessage());
}
}
} else
if (todo.equalsIgnoreCase("options")) {
int count = params.size();
String path = null;
if (count > 0)
path = checkUri((String) params.pop());
try {
boolean succeeded = webdavResource.optionsMethod(
path != null ? path : "*");
if (succeeded) {
System.out.print
("Allowed methods by http OPTIONS: ");
Enumeration allowed =
webdavResource.getAllowedMethods();
while (allowed.hasMoreElements()) {
System.out.print(allowed.nextElement());
if (allowed.hasMoreElements())
System.out.print(", ");
}
Enumeration davCapabilities =
webdavResource.getDavCapabilities();
if (davCapabilities.hasMoreElements())
System.out.print("\nDAV: ");
while (davCapabilities.hasMoreElements()) {
System.out.print
(davCapabilities.nextElement());
if (davCapabilities.hasMoreElements())
System.out.print(", ");
}
System.out.println();
} else {
System.out.println("failed.");
System.out.println(
webdavResource.getStatusMessage());
}
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
System.err.println("Error: check! " + e.getMessage());
}
}
} while (true);
} catch (Exception e) {
System.err.println("Fatal Error: " + e.getMessage());
e.printStackTrace();
System.err.println
("Please, email to slide-user@jakarta.apache.org");
}
} // The end of processCommands().
/**
* Determine which URI to use at the prompt.
*
* @param uri the path to be set.
* @return the absolute path.
*/
private String checkUri(String uri) {
if (!uri.startsWith("/")) {
uri = getPath() + uri;
}
return normalize(uri);
}
/**
* Set the path.
*
* @param path the path string.
*/
private void setPath(String path) {
if (!path.endsWith("/")) {
path = path + "/";
}
this.path = normalize(path);
}
/**
* Get the path.
*
* @return the path string.
*/
private String getPath() {
return path;
}
/**
* Update the command prompt for the display.
*
* @param path the path string
*/
private void updatePrompt(String path) {
StringBuffer buff = new StringBuffer();
try {
buff.append("[" + httpUrl.getHost().toUpperCase() + "] ");
buff.append(path);
} catch (Exception e) {
buff.append("[ Slide ]");
}
buff.append(" $ ");
commandPrompt = buff.toString();
}
/**
* Get the prompt.
*
* @return the prompt to be displayed.
*/
private String getPrompt() {
return commandPrompt;
}
/**
* Return a context-relative path, beginning with a "/", that represents
* the canonical version of the specified path after ".." and "." elements
* are resolved out. If the specified path attempts to go outside the
* boundaries of the current context (i.e. too many ".." path elements
* are present), return <code>null</code> instead.
*
* @param path the path to be normalized.
* @return the normalized path.
*/
private String normalize(String path) {
if (path == null)
return null;
String normalized = path;
// Normalize the slashes and add leading slash if necessary
if (normalized.indexOf('\\') >= 0)
normalized = normalized.replace('\\', '/');
if (!normalized.startsWith("/"))
normalized = "/" + normalized;
// Resolve occurrences of "/./" in the normalized path
while (true) {
int index = normalized.indexOf("/./");
if (index < 0)
break;
normalized = normalized.substring(0, index) +
normalized.substring(index + 2);
}
// Resolve occurrences of "/../" in the normalized path
while (true) {
int index = normalized.indexOf("/../");
if (index < 0)
break;
if (index == 0)
return (null); // Trying to go outside our context
int index2 = normalized.lastIndexOf('/', index - 1);
normalized = normalized.substring(0, index2) +
normalized.substring(index + 3);
}
// Resolve occurrences of "//" in the normalized path
while (true) {
int index = normalized.indexOf("//");
if (index < 0)
break;
normalized = normalized.substring(0, index) +
normalized.substring(index + 1);
}
// Return the normalized path that we have completed
return (normalized);
}
/**
* Print the commands options from startup
*/
private static void printCmdLineUsage() {
System.out.println("Usage: Slide [-vh] " +
"[http://][username:password@]hostname[:port]/path");
System.out.println
(" Default protocol: http, port: 80, default path: /");
System.out.println("Options:");
System.out.println(" -v: Print version information.");
System.out.println(" -h: Print this help message.");
System.out.println(
"Please, email bug reports to slide-user@jakarta.apache.org");
}
/**
* Print the Slide client commands for use
*/
private static void printSlideClientUsage() {
System.out.println(version + " commands:");
System.out.println(" open [http_URL] " +
"Connect to specified URL");
System.out.println(" close " +
"Close current connection");
System.out.println(" exit " +
"Exit Slide");
System.out.println(" help " +
"Print this help message");
System.out.println(" url " +
"Print working URL");
System.out.println(" status " +
"Print latest http status message");
System.out.println(" pwc " +
"Print working collection");
System.out.println(" cc [path] " +
"Change working collection");
System.out.println(" ls [-lF] [path] " +
"List contents of collection");
System.out.println(" propget path property ... " +
"Print value of specified property");
System.out.println(" propput path property value " +
"Set property with given value");
System.out.println(" get path [file] " +
"Get a resource to a file");
System.out.println(" put file path " +
"Put a file to path");
System.out.println(" delete path ... " +
"Delete resources");
System.out.println(" mkcol path ... " +
"Make new collections");
System.out.println(" copy source destination " +
"Copy resource from source to destination path");
System.out.println(" move source destination " +
"Move resource from source to destination path");
System.out.println(" lock path " +
"Lock specified resource");
System.out.println(" unlock path " +
"Unlock specified resource");
System.out.println(" options [path] " +
"Print available http methods");
System.out.println("\nAliases: help=?, ls=dir, pwc=pwd, cc=cd, " +
"copy=cp, move=mv, delete=del=rm,\n mkcol=mkdir, " +
"exit=quit");
}
/**
* Sleep
*/
private static void pause(int secs) {
try {
Thread.sleep( secs * 1000 );
} catch( InterruptedException ex ) {
}
}
}