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 di...@apache.org on 2002/01/11 14:29:41 UTC

cvs commit: jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd Spool.java Slide.java Client.java Client.g

dirkv       02/01/11 05:29:41

  Modified:    src/webdav/client/src/org/apache/webdav/cmd Spool.java
                        Slide.java Client.java Client.g
  Log:
  whitespace fix  (remove tabs)
  
  Revision  Changes    Path
  1.2       +167 -167  jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Spool.java
  
  Index: Spool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Spool.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Spool.java	11 Jan 2002 13:24:45 -0000	1.1
  +++ Spool.java	11 Jan 2002 13:29:41 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Spool.java,v 1.1 2002/01/11 13:24:45 dirkv Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/01/11 13:24:45 $
  + * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Spool.java,v 1.2 2002/01/11 13:29:41 dirkv Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/01/11 13:29:41 $
    *
    * ====================================================================
    *
  @@ -78,168 +78,168 @@
    */
   public class Spool 
   {
  -	private InputStream  in   = System.in;
  -	private OutputStream out  = System.out;
  -	private OutputStream spool= null;
  -
  -	private InputStream  wrappedInputStream;
  -	private OutputStream wrappedOutputStream;
  -	
  -	private boolean echo=false;
  -
  -	/**
  -	 * Create a spool for these two streams
  -	 */
  -	public Spool(InputStream in, OutputStream out) 
  -	{
  -		this();
  -		this.in=in;
  -		this.out=out;
  -	}
  -
  -	/**
  -	 * Create a spool for System.in and System.out
  -	 */
  -	public Spool() 
  -	{
  -		wrappedInputStream = new InputStream() 
  -		{
  -		    public int read(byte b[]) throws IOException {
  -				int bytesRead = in.read(b);
  -				if (echo)
  -					out.write(b,0,bytesRead);
  -				if (spool!=null)
  -					spool.write(b,0,bytesRead);
  -				return bytesRead;
  -		    }
  -		    public int read(byte b[], int off, int len) throws IOException {
  -				int bytesRead = in.read(b,off,len);
  -				if (echo)
  -					out.write(b,off,bytesRead);
  -				if (spool!=null)
  -					spool.write(b,off,bytesRead);
  -			    return bytesRead;
  -		    }
  -			public int read() throws IOException {
  -				int nextByte = in.read();
  -				if ((nextByte!=-1) && (echo))
  -					out.write(nextByte);
  -				if ((nextByte!=-1) && (spool!=null))
  -					spool.write(nextByte);
  -				return nextByte;
  -			}
  -		    public long skip(long n) throws IOException {
  -				return in.skip(n);
  -		    }
  -		    public int available() throws IOException {
  -				return in.available();
  -		    }
  -		    public void close() throws IOException {
  -				in.close();
  -			}
  -		    public synchronized void mark(int readlimit) {
  -				in.mark(readlimit);
  -			}
  -		    public synchronized void reset() throws IOException {
  -				in.reset();
  -		    }
  -		    public boolean markSupported() {
  -				return in.markSupported();
  -		    }
  -		};
  -		wrappedOutputStream = new OutputStream() 
  -		{
  -			public void write(int b) throws IOException {
  -				out.write(b);
  -				if (spool!=null)
  -					spool.write(b);
  -			}
  -			public void write(byte b[]) throws IOException {
  -				out.write(b);
  -				if (spool!=null)
  -					spool.write(b);
  -			}
  -			public void write(byte b[], int off, int len) throws IOException {
  -				out.write(b,off,len);
  -				if (spool!=null)
  -					spool.write(b,off,len);
  -			}
  -			public void flush() throws IOException {
  -				out.flush();
  -				if (spool!=null)
  -					spool.flush();
  -			}
  -			public void close() throws IOException {
  -				out.close();
  -			}
  -		};
  -	}
  -
  -	/**
  -	 * Echo the input stream to the output stream.
  -	 */	
  -	public void setEcho(boolean isEnabled)
  -	{
  -		this.echo=isEnabled;
  -	}
  -	
  -	/**
  -	 * Enable spooling and spool to the given filename.
  -	 */
  -	public void enable(String filename) throws FileNotFoundException
  -	{
  -		enable(new FileOutputStream(filename));
  -	}
  -
  -	/**
  -	 * Enable Spooling and spool to the given OutputStream.
  -	 */
  -	public void enable(OutputStream spool)
  -	{
  -		if (isEnabled())
  -			disable();
  -		this.spool = spool;
  -	}
  -	
  -	/**
  -	 * Disable spooling
  -	 */
  -	public void disable() 
  -	{
  -		try 
  -		{
  -			if (spool!=null) 
  -				spool.close();
  -		}
  -		catch (IOException ex) 
  -		{
  -		}
  -		spool=null;	
  -	}
  -	
  -	/**
  -	 * Returns if spooling is enabled.
  -	 */
  -	public boolean isEnabled()
  -	{
  -		return (spool!=null);
  -	}
  -	
  -	/**
  -	 * Returns an InputStream wrapped around the real InputStream.
  -	 * Use this stream to read from.
  -	 */
  -	public InputStream getInputStream() 
  -	{
  -		return wrappedInputStream;
  -	}
  -	
  -	/**
  -	 * Returns an OutputStream wrapped around the real OutputStream.
  -	 * Use this stream to write to.
  -	 */
  -	public OutputStream getOutputStream() 
  -	{
  -		return wrappedOutputStream;
  -	}
  +    private InputStream  in   = System.in;
  +    private OutputStream out  = System.out;
  +    private OutputStream spool= null;
  +
  +    private InputStream  wrappedInputStream;
  +    private OutputStream wrappedOutputStream;
  +    
  +    private boolean echo=false;
  +
  +    /**
  +     * Create a spool for these two streams
  +     */
  +    public Spool(InputStream in, OutputStream out) 
  +    {
  +        this();
  +        this.in=in;
  +        this.out=out;
  +    }
  +
  +    /**
  +     * Create a spool for System.in and System.out
  +     */
  +    public Spool() 
  +    {
  +        wrappedInputStream = new InputStream() 
  +        {
  +            public int read(byte b[]) throws IOException {
  +                int bytesRead = in.read(b);
  +                if (echo)
  +                    out.write(b,0,bytesRead);
  +                if (spool!=null)
  +                    spool.write(b,0,bytesRead);
  +                return bytesRead;
  +            }
  +            public int read(byte b[], int off, int len) throws IOException {
  +                int bytesRead = in.read(b,off,len);
  +                if (echo)
  +                    out.write(b,off,bytesRead);
  +                if (spool!=null)
  +                    spool.write(b,off,bytesRead);
  +                return bytesRead;
  +            }
  +            public int read() throws IOException {
  +                int nextByte = in.read();
  +                if ((nextByte!=-1) && (echo))
  +                    out.write(nextByte);
  +                if ((nextByte!=-1) && (spool!=null))
  +                    spool.write(nextByte);
  +                return nextByte;
  +            }
  +            public long skip(long n) throws IOException {
  +                return in.skip(n);
  +            }
  +            public int available() throws IOException {
  +                return in.available();
  +            }
  +            public void close() throws IOException {
  +                in.close();
  +            }
  +            public synchronized void mark(int readlimit) {
  +                in.mark(readlimit);
  +            }
  +            public synchronized void reset() throws IOException {
  +                in.reset();
  +            }
  +            public boolean markSupported() {
  +                return in.markSupported();
  +            }
  +        };
  +        wrappedOutputStream = new OutputStream() 
  +        {
  +            public void write(int b) throws IOException {
  +                out.write(b);
  +                if (spool!=null)
  +                    spool.write(b);
  +            }
  +            public void write(byte b[]) throws IOException {
  +                out.write(b);
  +                if (spool!=null)
  +                    spool.write(b);
  +            }
  +            public void write(byte b[], int off, int len) throws IOException {
  +                out.write(b,off,len);
  +                if (spool!=null)
  +                    spool.write(b,off,len);
  +            }
  +            public void flush() throws IOException {
  +                out.flush();
  +                if (spool!=null)
  +                    spool.flush();
  +            }
  +            public void close() throws IOException {
  +                out.close();
  +            }
  +        };
  +    }
  +
  +    /**
  +     * Echo the input stream to the output stream.
  +     */    
  +    public void setEcho(boolean isEnabled)
  +    {
  +        this.echo=isEnabled;
  +    }
  +    
  +    /**
  +     * Enable spooling and spool to the given filename.
  +     */
  +    public void enable(String filename) throws FileNotFoundException
  +    {
  +        enable(new FileOutputStream(filename));
  +    }
  +
  +    /**
  +     * Enable Spooling and spool to the given OutputStream.
  +     */
  +    public void enable(OutputStream spool)
  +    {
  +        if (isEnabled())
  +            disable();
  +        this.spool = spool;
  +    }
  +    
  +    /**
  +     * Disable spooling
  +     */
  +    public void disable() 
  +    {
  +        try 
  +        {
  +            if (spool!=null) 
  +                spool.close();
  +        }
  +        catch (IOException ex) 
  +        {
  +        }
  +        spool=null;    
  +    }
  +    
  +    /**
  +     * Returns if spooling is enabled.
  +     */
  +    public boolean isEnabled()
  +    {
  +        return (spool!=null);
  +    }
  +    
  +    /**
  +     * Returns an InputStream wrapped around the real InputStream.
  +     * Use this stream to read from.
  +     */
  +    public InputStream getInputStream() 
  +    {
  +        return wrappedInputStream;
  +    }
  +    
  +    /**
  +     * Returns an OutputStream wrapped around the real OutputStream.
  +     * Use this stream to write to.
  +     */
  +    public OutputStream getOutputStream() 
  +    {
  +        return wrappedOutputStream;
  +    }
   }
  
  
  
  1.47      +64 -64    jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Slide.java
  
  Index: Slide.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Slide.java,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- Slide.java	11 Jan 2002 13:25:24 -0000	1.46
  +++ Slide.java	11 Jan 2002 13:29:41 -0000	1.47
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Slide.java,v 1.46 2002/01/11 13:25:24 dirkv Exp $
  - * $Revision: 1.46 $
  - * $Date: 2002/01/11 13:25:24 $
  + * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Slide.java,v 1.47 2002/01/11 13:29:41 dirkv Exp $
  + * $Revision: 1.47 $
  + * $Date: 2002/01/11 13:29:41 $
    *
    * ====================================================================
    *
  @@ -78,68 +78,68 @@
        */
       public final static String version = "Slide client $$VERSION$$";
   
  -	public static void main(String[] args) {
  -		Client client = new Client(System.in,System.out);
  +    public static void main(String[] args) {
  +        Client client = new Client(System.in,System.out);
   
  -		////////////  BEGIN Command line arguments //////////////
  -		String argOptions = null;
  +        ////////////  BEGIN Command line arguments //////////////
  +        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];
  -				client.connect(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;
  -		            case 'd':
  -		                client.setDebug(Client.DEBUG_ON);
  -		                break;
  -		            default:
  -		                System.exit(-1);
  -		        }
  -		    }
  -		}
  -		////////////  END Command line arguments //////////////
  -		
  -		client.run();
  -	}
  -
  -	/**
  -	 * Print the commands options from startup
  -	 */
  -	private static void printCmdLineUsage() 
  -	{
  -
  -	    System.out.println("Usage: Slide [-vdh] " +
  -	        "http://hostname[:port][/path]");
  -	    System.out.println
  -	        ("  Default protocol: http, port: 80, path: /");
  -	    System.out.println("Options:");
  -	    System.out.println("  -v: Print version information.");
  -	    System.out.println("  -d: Debug.");
  -	    System.out.println("  -h: Print this help message.");
  -	    System.out.println(
  -	        "Please, email bug reports to slide-user@jakarta.apache.org");
  -	}
  +        // 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];
  +                client.connect(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;
  +                    case 'd':
  +                        client.setDebug(Client.DEBUG_ON);
  +                        break;
  +                    default:
  +                        System.exit(-1);
  +                }
  +            }
  +        }
  +        ////////////  END Command line arguments //////////////
  +        
  +        client.run();
  +    }
  +
  +    /**
  +     * Print the commands options from startup
  +     */
  +    private static void printCmdLineUsage() 
  +    {
  +
  +        System.out.println("Usage: Slide [-vdh] " +
  +            "http://hostname[:port][/path]");
  +        System.out.println
  +            ("  Default protocol: http, port: 80, path: /");
  +        System.out.println("Options:");
  +        System.out.println("  -v: Print version information.");
  +        System.out.println("  -d: Debug.");
  +        System.out.println("  -h: Print this help message.");
  +        System.out.println(
  +            "Please, email bug reports to slide-user@jakarta.apache.org");
  +    }
   }
   
  
  
  
  1.2       +1445 -1445jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Client.java
  
  Index: Client.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Client.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Client.java	11 Jan 2002 13:25:24 -0000	1.1
  +++ Client.java	11 Jan 2002 13:29:41 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Client.java,v 1.1 2002/01/11 13:25:24 dirkv Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/01/11 13:25:24 $
  + * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Client.java,v 1.2 2002/01/11 13:29:41 dirkv Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/01/11 13:29:41 $
    *
    * ====================================================================
    *
  @@ -114,23 +114,23 @@
    */
   final class Client {
   
  -	
  -	private Spool spool;
  -	private InputStream in;
  -	private PrintStream out;
  -	private boolean displayPrompt = true;
  +    
  +    private Spool spool;
  +    private InputStream in;
  +    private PrintStream out;
  +    private boolean displayPrompt = true;
   
       /** The path for the display information. */
       private String path = "";
   
       /** The command prompt for the display information. */
       private String commandPrompt = null;
  -	
  +    
       /** The http URL on the client connection. */
       private HttpURL httpURL;
  -	
  +    
       /** The debug level. */
  -    private int debugLevel = 0;	
  +    private int debugLevel = 0;    
   
       /** The WebDAV resource. */
       private WebdavResource webdavResource = null;
  @@ -138,173 +138,173 @@
       /** The current path on the local system. */
       private File dir = new File(".");
   
  -	/////////////////////////////////////////////////////////////////
  -	
  -	Client(InputStream in, PrintStream out) 
  -	{
  -		this.spool = new Spool(in,out);
  -		this.in  = in;
  -		this.out = new PrintStream(spool.getOutputStream());
  -		updatePrompt(getPath());
  -	}
  -
  -	void run()
  -	{
  -		try {
  -			InputStream in=spool.getInputStream();
  -			ClientLexer lexer = new ClientLexer(new DataInputStream(in));
  -			ClientParser parser = new ClientParser(lexer);
  -			parser.setClient(this);
  -			parser.commands();
  -		}
  -		catch(TokenStreamException ex) {
  -			if ("exit".equals(ex.getMessage())) {
  -				// normal exit
  -				out.println("Exit...");
  -			}
  -			else  {
  -				handleException(ex);
  -			}
  -		}
  -		catch(RecognitionException ex) {
  -			handleException(ex);
  -		}
  -		// TODO test EOF  ???
  -	}
  -
  -	///////////////////////////////////////////////////////////////////
  -	// Helper funtions for the parser and error handlers
  -	///////////////////////////////////////////////////////////////////
  -
  -	void printInvalidCommand(String command)
  -	{
  -		out.println("Error: invalid command: " + command);
  -	}
  -	
  -	void printUsage(String command) 
  -	{
  -		out.println("Syntax error. \"help\" for more info");
  -//		out.println("Usage: " + command + " ...");
  -//		out.println
  -//		    ("[Help] open " +
  -//		     "http://hostname[:port][/path]");
  -//		out.println("Syntax: grant <namespace> <permission> on <path> to <principal>");
  -//		out.println("Syntax: revoke <namespace> <permission> on <path> from <principal>");
  -//		out.println("Syntax: deny <namespace> <permission> on <path> to <principal>");
  +    /////////////////////////////////////////////////////////////////
  +    
  +    Client(InputStream in, PrintStream out) 
  +    {
  +        this.spool = new Spool(in,out);
  +        this.in  = in;
  +        this.out = new PrintStream(spool.getOutputStream());
  +        updatePrompt(getPath());
  +    }
  +
  +    void run()
  +    {
  +        try {
  +            InputStream in=spool.getInputStream();
  +            ClientLexer lexer = new ClientLexer(new DataInputStream(in));
  +            ClientParser parser = new ClientParser(lexer);
  +            parser.setClient(this);
  +            parser.commands();
  +        }
  +        catch(TokenStreamException ex) {
  +            if ("exit".equals(ex.getMessage())) {
  +                // normal exit
  +                out.println("Exit...");
  +            }
  +            else  {
  +                handleException(ex);
  +            }
  +        }
  +        catch(RecognitionException ex) {
  +            handleException(ex);
  +        }
  +        // TODO test EOF  ???
  +    }
  +
  +    ///////////////////////////////////////////////////////////////////
  +    // Helper funtions for the parser and error handlers
  +    ///////////////////////////////////////////////////////////////////
  +
  +    void printInvalidCommand(String command)
  +    {
  +        out.println("Error: invalid command: " + command);
  +    }
  +    
  +    void printUsage(String command) 
  +    {
  +        out.println("Syntax error. \"help\" for more info");
  +//        out.println("Usage: " + command + " ...");
  +//        out.println
  +//            ("[Help] open " +
  +//             "http://hostname[:port][/path]");
  +//        out.println("Syntax: grant <namespace> <permission> on <path> to <principal>");
  +//        out.println("Syntax: revoke <namespace> <permission> on <path> from <principal>");
  +//        out.println("Syntax: deny <namespace> <permission> on <path> to <principal>");
   //        out.println("Syntax: lock <path>");
   //        out.println("Syntax: unlock <path>");
  -//	out.println("Syntax: vc/VersionControl <path>");
  -//	    else out.println("Syntax: eReport path");
  -//	    else out.println("Syntax: lReport <property> \n History URLs are needed");
  -
  -	}
  -	
  -	void prompt() 
  -	{
  -		if (displayPrompt)
  -			out.print(getPrompt());
  -	}
  -
  -	private void handleException(Exception ex)
  -	{
  -		if (ex instanceof HttpException) {
  -			if (((HttpException) ex).getStatusCode() == HttpStatus.SC_METHOD_NOT_ALLOWED) {
  -	            out.println("Warning: Not WebDAV-enabled?");
  -	        }
  -			else if (((HttpException) ex).getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
  -				out.println("Warning: Unauthorized");
  -			}
  -			else {
  -				out.println("Warning: " + ex.getMessage());
  -			}
  -		}
  -		else if (ex instanceof IOException) {
  -			out.println("Error: " + ex.getMessage());
  -		}
  -		else {
  -			out.println("Fatal Error: " + ex.getMessage());
  -	        ex.printStackTrace(out);
  -	        out.println("Please, email to slide-user@jakarta.apache.org");
  -			System.exit(-1);
  -		}
  -	}
  -
  -	/////////////////////////////////////////////////////////////////
  -	// Commands available on the command line
  -	/////////////////////////////////////////////////////////////////
  -	
  -	void setEchoEnabled(boolean isEnabled) 
  -	{
  -		spool.setEcho(isEnabled);
  -		setDisplayPrompt(isEnabled);
  -		
  -		// if this is an interactive client keep the prompt
  -		if (this.in==System.in)
  -			setDisplayPrompt(true);
  -	}
  -	
  -	void executeScript(String scriptname) 
  -	{
  -		try {
  -			FileInputStream script = new FileInputStream(scriptname);
  -			Client scriptClient = new Client(script,out);
  -			scriptClient.setDisplayPrompt(false);
  -			out.println("Executing script: " + scriptname);
  -			scriptClient.run();
  -			out.println("Script " + scriptname + " complete.");
  -			script.close();
  -		}
  -		catch (FileNotFoundException ex) {
  -			out.println("Error: Script " + scriptname + " not found.");
  -		}
  -		catch (IOException ex) {
  -			out.println("Error: " + ex.toString() + " during execution of " + scriptname);
  -		}
  -	}
  -	
  -	void enableSpoolToFile(String filename)
  -	{
  -		out.println("Spool to file: " + filename);
  -		try {
  -			spool.enable(filename);
  -		}
  -		catch (FileNotFoundException ex) {
  -			out.println("Error: Could not spool to file: " + filename);
  -			disableSpoolToFile();
  -		}
  -	}
  -	
  -	void disableSpoolToFile()
  -	{
  -		spool.disable();
  -		out.println("Spooling disabled");
  -	}
  -	
  -
  -	/** Debug level for all debug messages */
  -	final static int DEBUG_ON  = Integer.MAX_VALUE;
  -	
  -	/** Debug level for no debug messages */
  -	final static int DEBUG_OFF = 0;
  -
  -	/**
  -	 * Set the debug level
  -	 */
  -	void setDebug(int level)
  -	{
  -		this.debugLevel=level;
  -		webdavResource.setDebug(debugLevel);
  -		
  -		switch (level) {
  -			case DEBUG_ON:  out.println("The debug flag is on.");  break;
  -			case DEBUG_OFF: out.println("The debug flag is off."); break;
  -			default: out.println("The debug lebel is " + level); break;
  -		}
  -	}
  -	
  -	void connect(String uri)
  -	{
  -		out.println("connect " + uri);
  +//    out.println("Syntax: vc/VersionControl <path>");
  +//        else out.println("Syntax: eReport path");
  +//        else out.println("Syntax: lReport <property> \n History URLs are needed");
  +
  +    }
  +    
  +    void prompt() 
  +    {
  +        if (displayPrompt)
  +            out.print(getPrompt());
  +    }
  +
  +    private void handleException(Exception ex)
  +    {
  +        if (ex instanceof HttpException) {
  +            if (((HttpException) ex).getStatusCode() == HttpStatus.SC_METHOD_NOT_ALLOWED) {
  +                out.println("Warning: Not WebDAV-enabled?");
  +            }
  +            else if (((HttpException) ex).getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
  +                out.println("Warning: Unauthorized");
  +            }
  +            else {
  +                out.println("Warning: " + ex.getMessage());
  +            }
  +        }
  +        else if (ex instanceof IOException) {
  +            out.println("Error: " + ex.getMessage());
  +        }
  +        else {
  +            out.println("Fatal Error: " + ex.getMessage());
  +            ex.printStackTrace(out);
  +            out.println("Please, email to slide-user@jakarta.apache.org");
  +            System.exit(-1);
  +        }
  +    }
  +
  +    /////////////////////////////////////////////////////////////////
  +    // Commands available on the command line
  +    /////////////////////////////////////////////////////////////////
  +    
  +    void setEchoEnabled(boolean isEnabled) 
  +    {
  +        spool.setEcho(isEnabled);
  +        setDisplayPrompt(isEnabled);
  +        
  +        // if this is an interactive client keep the prompt
  +        if (this.in==System.in)
  +            setDisplayPrompt(true);
  +    }
  +    
  +    void executeScript(String scriptname) 
  +    {
  +        try {
  +            FileInputStream script = new FileInputStream(scriptname);
  +            Client scriptClient = new Client(script,out);
  +            scriptClient.setDisplayPrompt(false);
  +            out.println("Executing script: " + scriptname);
  +            scriptClient.run();
  +            out.println("Script " + scriptname + " complete.");
  +            script.close();
  +        }
  +        catch (FileNotFoundException ex) {
  +            out.println("Error: Script " + scriptname + " not found.");
  +        }
  +        catch (IOException ex) {
  +            out.println("Error: " + ex.toString() + " during execution of " + scriptname);
  +        }
  +    }
  +    
  +    void enableSpoolToFile(String filename)
  +    {
  +        out.println("Spool to file: " + filename);
  +        try {
  +            spool.enable(filename);
  +        }
  +        catch (FileNotFoundException ex) {
  +            out.println("Error: Could not spool to file: " + filename);
  +            disableSpoolToFile();
  +        }
  +    }
  +    
  +    void disableSpoolToFile()
  +    {
  +        spool.disable();
  +        out.println("Spooling disabled");
  +    }
  +    
  +
  +    /** Debug level for all debug messages */
  +    final static int DEBUG_ON  = Integer.MAX_VALUE;
  +    
  +    /** Debug level for no debug messages */
  +    final static int DEBUG_OFF = 0;
  +
  +    /**
  +     * Set the debug level
  +     */
  +    void setDebug(int level)
  +    {
  +        this.debugLevel=level;
  +        webdavResource.setDebug(debugLevel);
  +        
  +        switch (level) {
  +            case DEBUG_ON:  out.println("The debug flag is on.");  break;
  +            case DEBUG_OFF: out.println("The debug flag is off."); break;
  +            default: out.println("The debug lebel is " + level); break;
  +        }
  +    }
  +    
  +    void connect(String uri)
  +    {
  +        out.println("connect " + uri);
   
           try {
               // Set up for processing WebDAV resources
  @@ -318,17 +318,17 @@
               }
               setPath(webdavResource.getPath());
           }
  -		catch (HttpException we) {
  +        catch (HttpException we) {
               if (we.getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
                   try {
  -	                out.print("UserName: ");
  -					BufferedReader in =
  -						new BufferedReader(new InputStreamReader(System.in));
  -	                String userName = in.readLine();
  -	                if ((userName==null) || (userName.length()==0)) {
  -						disconnect();
  -						return;
  -	                }
  +                    out.print("UserName: ");
  +                    BufferedReader in =
  +                        new BufferedReader(new InputStreamReader(System.in));
  +                    String userName = in.readLine();
  +                    if ((userName==null) || (userName.length()==0)) {
  +                        disconnect();
  +                        return;
  +                    }
                       userName = userName.trim();
                       System.out.print("Password: ");
                       String password = in.readLine();
  @@ -349,308 +349,308 @@
                       webdavResource.setDebug(debugLevel);
                       setPath(webdavResource.getPath());
                   } 
  -				catch (Exception ex) {
  -					handleException(ex);
  -	                httpURL = null;
  -					webdavResource = null;
  +                catch (Exception ex) {
  +                    handleException(ex);
  +                    httpURL = null;
  +                    webdavResource = null;
                   }
               }
  -			else  {
  -				handleException(we);
  -				httpURL = null;
  -				webdavResource = null;
  -			}
  -        }		
  -		catch (Exception ex) {
  +            else  {
  +                handleException(we);
  +                httpURL = null;
  +                webdavResource = null;
  +            }
  +        }        
  +        catch (Exception ex) {
               handleException(ex);
  -			webdavResource = null;
  +            webdavResource = null;
  +            httpURL = null;
  +        }
  +        updatePrompt(getPath());
  +    }
  +    
  +    void disconnect()
  +    {
  +        out.println("disconnect");
  +        try {
  +            webdavResource.close();
  +        } catch (IOException e) {
  +        } finally {
  +            // Make sure the connection closed.
               httpURL = null;
  +            webdavResource = null;
           }
           updatePrompt(getPath());
  -	}
  -	
  -	void disconnect()
  -	{
  -		out.println("disconnect");
  -		try {
  -		    webdavResource.close();
  -		} catch (IOException e) {
  -		} finally {
  -		    // Make sure the connection closed.
  -		    httpURL = null;
  -		    webdavResource = null;
  -		}
  -		updatePrompt(getPath());
  -	}
  -	
  -	void options(String path)
  -	{
  -		out.println("options " + path);
  -		
  -		String param = path;
  -		try {
  -		    boolean succeeded = false;
  -		    if (param != null) {
  -		        if (!param.startsWith("/")) {
  -		            httpURL = new HttpURL(param);
  -		            Enumeration enum = null;
  -		            try {
  -		                // OPTIONS business logic
  -		                enum =
  -		                    webdavResource.optionsMethod(httpURL);
  -		                while (enum.hasMoreElements()) {
  -		                    out.print(enum.nextElement());
  -		                    if (enum.hasMoreElements()) {
  -		                        out.print(", ");
  -		                    } else {
  -		                        out.println();
  -		                    }
  -		                }
  -		            } catch (HttpException we) {
  -		                if (we.getStatusCode() ==
  -		                    HttpStatus.SC_UNAUTHORIZED) {
  -		                    BufferedReader in =
  -		                    	new BufferedReader(new InputStreamReader(System.in));
  -		                    out.print("UserName: ");
  -		                    String userName = in.readLine();
  -		                    if (userName != null &&
  -		                        userName.length() > 0) {
  -		                        userName = userName.trim();
  -		                        out.print("Password: ");
  -		                        String password = in.readLine();
  -		                        if (password != null)
  -		                            password= password.trim();
  -		                        try {
  -		                            // OPTIONS business logic
  -		                            httpURL.setUserInfo(userName,
  -		                                password);
  -		                            enum = webdavResource.
  -		                                optionsMethod(httpURL);
  -		                            while (
  -		                                enum.hasMoreElements()) {
  -		                                out.print
  -		                                    (enum.nextElement());
  -		                                if (enum.
  -		                                    hasMoreElements()) {
  -		                                    out.print
  -		                                        (", ");
  -		                                } else {
  -		                                    out.println();
  -		                                }
  -		                            }
  -		                        } catch (Exception e) {
  -		                            out.println("Error: "
  -		                                + e.getMessage());
  -		                        }
  -		                    }
  -		                } else {
  -		                    out.println("Error: " +
  -		                            we.getMessage());
  -		                }
  -		            } catch (IOException e) {
  -		                out.println(
  -		                    "Error: Check! " + e.getMessage());
  -		            }
  -		            httpURL = null;
  -		            return;
  -		        } else
  -		        if (webdavResource != null) {
  -		            succeeded =
  -		                webdavResource.optionsMethod(param);
  -		        } else {
  -		            out.println("Not connected yet.");
  -		        }
  -		    } else
  -		    if (webdavResource != null) {
  -		        succeeded = webdavResource.optionsMethod("*");
  -		    } else {
  -		        out.println("Not connected yet.");
  -		    }
  -
  -		    if (succeeded) {
  -		        out.print
  -		            ("Allowed methods by http OPTIONS: ");
  -		        Enumeration allowed =
  -		            webdavResource.getAllowedMethods();
  -		        while (allowed.hasMoreElements()) {
  -		            out.print(allowed.nextElement());
  -		            if (allowed.hasMoreElements())
  -		                out.print(", ");
  -		         }
  -		        Enumeration davCapabilities =
  -		            webdavResource.getDavCapabilities();
  -		        if (davCapabilities.hasMoreElements())
  -		            out.print("\nDAV: ");
  -		        while (davCapabilities.hasMoreElements()) {
  -		            out.print
  -		                (davCapabilities.nextElement());
  -		            if (davCapabilities.hasMoreElements())
  -		                out.print(", ");
  -		        }
  -		        out.println();
  -		    }
  -		} 
  -		catch (Exception ex) {
  -			handleException(ex);
  -		}
  -	}
  -	
  -	void help(String topic)
  -	{
  -		if (topic==null) {
  -			printSlideClientUsage();
  -		}
  -		else {
  -			out.println("No help available on " + topic);
  -		}
  -	}	
  -
  -	void lpwd()
  -	{
  -		try {
  -			out.println(dir.getCanonicalPath());
  -		}
  -		catch (IOException ex) {
  -			out.println("Warning: Not found the path");
  -		}
  -	}		
  -
  -	void lcd(String path)
  -	{
  -		try 
  -		{
  -			out.println("lcd " + path);
  -		    File anotherDir = (path.startsWith("/") ||
  -	        	path.startsWith("\\")) ? new File(path) : 
  -				new File(dir.getCanonicalPath(), path);
  -
  -		    if (anotherDir.isDirectory()) {
  -		        dir = anotherDir;
  -		    } else {
  -		        out.println("Warning: Not found the path");
  -		    }
  -		}
  -		catch (IOException ex)
  -		{
  -			out.println("Warning: Not found the path");
  -		}
  -	}	
  -
  -	void lls(String options, String path)
  -	{
  -		// set default option.
  -		char option = 'F';
  +    }
  +    
  +    void options(String path)
  +    {
  +        out.println("options " + path);
  +        
  +        String param = path;
  +        try {
  +            boolean succeeded = false;
  +            if (param != null) {
  +                if (!param.startsWith("/")) {
  +                    httpURL = new HttpURL(param);
  +                    Enumeration enum = null;
  +                    try {
  +                        // OPTIONS business logic
  +                        enum =
  +                            webdavResource.optionsMethod(httpURL);
  +                        while (enum.hasMoreElements()) {
  +                            out.print(enum.nextElement());
  +                            if (enum.hasMoreElements()) {
  +                                out.print(", ");
  +                            } else {
  +                                out.println();
  +                            }
  +                        }
  +                    } catch (HttpException we) {
  +                        if (we.getStatusCode() ==
  +                            HttpStatus.SC_UNAUTHORIZED) {
  +                            BufferedReader in =
  +                                new BufferedReader(new InputStreamReader(System.in));
  +                            out.print("UserName: ");
  +                            String userName = in.readLine();
  +                            if (userName != null &&
  +                                userName.length() > 0) {
  +                                userName = userName.trim();
  +                                out.print("Password: ");
  +                                String password = in.readLine();
  +                                if (password != null)
  +                                    password= password.trim();
  +                                try {
  +                                    // OPTIONS business logic
  +                                    httpURL.setUserInfo(userName,
  +                                        password);
  +                                    enum = webdavResource.
  +                                        optionsMethod(httpURL);
  +                                    while (
  +                                        enum.hasMoreElements()) {
  +                                        out.print
  +                                            (enum.nextElement());
  +                                        if (enum.
  +                                            hasMoreElements()) {
  +                                            out.print
  +                                                (", ");
  +                                        } else {
  +                                            out.println();
  +                                        }
  +                                    }
  +                                } catch (Exception e) {
  +                                    out.println("Error: "
  +                                        + e.getMessage());
  +                                }
  +                            }
  +                        } else {
  +                            out.println("Error: " +
  +                                    we.getMessage());
  +                        }
  +                    } catch (IOException e) {
  +                        out.println(
  +                            "Error: Check! " + e.getMessage());
  +                    }
  +                    httpURL = null;
  +                    return;
  +                } else
  +                if (webdavResource != null) {
  +                    succeeded =
  +                        webdavResource.optionsMethod(param);
  +                } else {
  +                    out.println("Not connected yet.");
  +                }
  +            } else
  +            if (webdavResource != null) {
  +                succeeded = webdavResource.optionsMethod("*");
  +            } else {
  +                out.println("Not connected yet.");
  +            }
  +
  +            if (succeeded) {
  +                out.print
  +                    ("Allowed methods by http OPTIONS: ");
  +                Enumeration allowed =
  +                    webdavResource.getAllowedMethods();
  +                while (allowed.hasMoreElements()) {
  +                    out.print(allowed.nextElement());
  +                    if (allowed.hasMoreElements())
  +                        out.print(", ");
  +                 }
  +                Enumeration davCapabilities =
  +                    webdavResource.getDavCapabilities();
  +                if (davCapabilities.hasMoreElements())
  +                    out.print("\nDAV: ");
  +                while (davCapabilities.hasMoreElements()) {
  +                    out.print
  +                        (davCapabilities.nextElement());
  +                    if (davCapabilities.hasMoreElements())
  +                        out.print(", ");
  +                }
  +                out.println();
  +            }
  +        } 
  +        catch (Exception ex) {
  +            handleException(ex);
  +        }
  +    }
  +    
  +    void help(String topic)
  +    {
  +        if (topic==null) {
  +            printSlideClientUsage();
  +        }
  +        else {
  +            out.println("No help available on " + topic);
  +        }
  +    }    
  +
  +    void lpwd()
  +    {
  +        try {
  +            out.println(dir.getCanonicalPath());
  +        }
  +        catch (IOException ex) {
  +            out.println("Warning: Not found the path");
  +        }
  +    }        
  +
  +    void lcd(String path)
  +    {
  +        try 
  +        {
  +            out.println("lcd " + path);
  +            File anotherDir = (path.startsWith("/") ||
  +                path.startsWith("\\")) ? new File(path) : 
  +                new File(dir.getCanonicalPath(), path);
  +
  +            if (anotherDir.isDirectory()) {
  +                dir = anotherDir;
  +            } else {
  +                out.println("Warning: Not found the path");
  +            }
  +        }
  +        catch (IOException ex)
  +        {
  +            out.println("Warning: Not found the path");
  +        }
  +    }    
  +
  +    void lls(String options, String path)
  +    {
  +        // set default option.
  +        char option = 'F';
           if ((options!=null) && (options.indexOf('l') > 0))
               option = 'l';
   
  -		File temp =  (path != null) ? new File(dir, path) : dir;
  -		if (!temp.exists()) {
  -		    out.println("Warning: Not found the path");
  -		    return;
  -		}
  -
  -		String[] list = temp.list();
  -		// TODO: consider of options like '-a' for all and so on.
  -		switch (option) {
  -		case 'l':
  -		    for (int i = 0; i < list.length; i++) {
  -		        String s = list[i];
  -		        File file = new File(temp, s);
  -		        for (int j = 0; j < 4; j++) {
  -		            switch (j)  {
  -		                case 0:
  -		                    // Print the filename.
  -		                    out.print(s);
  -		                    for (int k = list[i].length();
  -		                        k < 35; k++)
  -		                        out.print(" ");
  -		                    break;
  -		                case 1:
  -		                    s = Long.toString(file.length());
  -		                    for (int k = 10 - s.length();
  -		                        k > 0 ; k--)
  -		                        out.print(" ");
  -		                    // don't cut the size.
  -		                    out.print(s + " ");
  -		                    break;
  -		                case 2:
  -		                    // cut the description.
  -		                    s = file.isDirectory() ?
  -		                        "DIR" : "";
  -		                    out.print(" " +
  -		                        ((s.length() > 5) ?
  -		                        s.substring(0, 5) : s));
  -		                    for (int k = s.length(); k < 5; k++)
  -		                        out.print(" ");
  -		                    break;
  -		                case 3:
  -		                    s = new SimpleDateFormat().format(
  -		                        new Date(file.lastModified()));
  -		                    out.print(" " + s);
  -		                default:
  -		            }
  -		        }
  -		        // Start with a new line.
  -		        out.println();
  -		    }
  -		    break;
  -		case 'F':
  -		    int i = 0;
  -		    for (; i < list.length; i++) {
  -		        out.print(list[i] + " ");
  -		        for (int j = list[i].length();
  -		            j < 25; j++) {
  -		            out.print(" ");
  -		        }
  -		        if (i % 3 == 2)
  -		           out.println();
  -		    }
  -		    if (list.length > 0 && i % 3 != 0) {
  -		        out.println();
  -		    }
  -		    break;
  -		default:
  -		} // end of switch
  -
  -	}
  -	
  -	void pwd()
  -	{
  -		out.println(getPath());
  -	}		
  -	
  -	void cd(String path)
  -	{
  -		try {
  -		    String cdPath = checkUri(path + "/");
  -		    webdavResource.setPath(cdPath);
  -		    if (webdavResource.exists()) {
  -		        if (webdavResource.isCollection()) {
  -		            setPath(webdavResource.getPath());
  -		        } else {
  -		            out.println("Warning: Not a collection");
  -		        }
  -		    } else {
  -		        out.println("Warning: Not found the path");
  -		    }
  -		} 
  -		catch (Exception ex) {
  -			handleException(ex);
  -		} 
  -		updatePrompt(getPath());
  -	}	
  -	
  -	void ls(String options, String path)
  -	{
  -		// set default option.
  -		char option = 'F';
  -		if ((options!=null) && (options.indexOf('l') > 0))
  -		    option = 'l';
  +        File temp =  (path != null) ? new File(dir, path) : dir;
  +        if (!temp.exists()) {
  +            out.println("Warning: Not found the path");
  +            return;
  +        }
  +
  +        String[] list = temp.list();
  +        // TODO: consider of options like '-a' for all and so on.
  +        switch (option) {
  +        case 'l':
  +            for (int i = 0; i < list.length; i++) {
  +                String s = list[i];
  +                File file = new File(temp, s);
  +                for (int j = 0; j < 4; j++) {
  +                    switch (j)  {
  +                        case 0:
  +                            // Print the filename.
  +                            out.print(s);
  +                            for (int k = list[i].length();
  +                                k < 35; k++)
  +                                out.print(" ");
  +                            break;
  +                        case 1:
  +                            s = Long.toString(file.length());
  +                            for (int k = 10 - s.length();
  +                                k > 0 ; k--)
  +                                out.print(" ");
  +                            // don't cut the size.
  +                            out.print(s + " ");
  +                            break;
  +                        case 2:
  +                            // cut the description.
  +                            s = file.isDirectory() ?
  +                                "DIR" : "";
  +                            out.print(" " +
  +                                ((s.length() > 5) ?
  +                                s.substring(0, 5) : s));
  +                            for (int k = s.length(); k < 5; k++)
  +                                out.print(" ");
  +                            break;
  +                        case 3:
  +                            s = new SimpleDateFormat().format(
  +                                new Date(file.lastModified()));
  +                            out.print(" " + s);
  +                        default:
  +                    }
  +                }
  +                // Start with a new line.
  +                out.println();
  +            }
  +            break;
  +        case 'F':
  +            int i = 0;
  +            for (; i < list.length; i++) {
  +                out.print(list[i] + " ");
  +                for (int j = list[i].length();
  +                    j < 25; j++) {
  +                    out.print(" ");
  +                }
  +                if (i % 3 == 2)
  +                   out.println();
  +            }
  +            if (list.length > 0 && i % 3 != 0) {
  +                out.println();
  +            }
  +            break;
  +        default:
  +        } // end of switch
  +
  +    }
  +    
  +    void pwd()
  +    {
  +        out.println(getPath());
  +    }        
  +    
  +    void cd(String path)
  +    {
  +        try {
  +            String cdPath = checkUri(path + "/");
  +            webdavResource.setPath(cdPath);
  +            if (webdavResource.exists()) {
  +                if (webdavResource.isCollection()) {
  +                    setPath(webdavResource.getPath());
  +                } else {
  +                    out.println("Warning: Not a collection");
  +                }
  +            } else {
  +                out.println("Warning: Not found the path");
  +            }
  +        } 
  +        catch (Exception ex) {
  +            handleException(ex);
  +        } 
  +        updatePrompt(getPath());
  +    }    
  +    
  +    void ls(String options, String path)
  +    {
  +        // set default option.
  +        char option = 'F';
  +        if ((options!=null) && (options.indexOf('l') > 0))
  +            option = 'l';
   
           try {
               // Check that the path is ok.
               if (path != null) {
  -	            path = checkUri(path + "/");
  +                path = checkUri(path + "/");
                   webdavResource.setPath(path);
               } else {
                   path = checkUri("./");
  @@ -713,63 +713,63 @@
               default:
               } // end of switch
           }
  -		catch (Exception ex) {
  -			handleException(ex);
  -		}
  -	}
  -	
  -	void propfind(String path, Vector properties) 
  -	{
  -		try {
  -		    path = checkUri(path);
  -		    out.print("Getting properties '" + path + "': ");
  -
  -		    Enumeration propertyValues =
  -		        webdavResource.propfindMethod(path, properties);
  -		    if (propertyValues.hasMoreElements()){
  -		        while (propertyValues.hasMoreElements()){
  -		            out.println(propertyValues.nextElement());
  -		        }
  -		    } 
  -			else {
  -		        out.println("failed.");
  -		        out.println(webdavResource.getStatusMessage());
  -		    }
  -		} 
  -		catch (Exception ex) {
  -		    handleException(ex);
  -		}
  -	}
  -	
  -	void propfindall(String path) 
  -	{
  -		try {
  -		    path=checkUri(path);
  -		    out.print("Getting properties '" + path + "': ");
  -		    Enumeration responses = webdavResource.propfindMethod(path, DepthSupport.DEPTH_0);
  -		    if (!responses.hasMoreElements()) {
  -		        out.println("failed (no response received).");
  -		        out.println(webdavResource.getStatusMessage());
  -		        return;
  -		    }
  -		    else {
  -		        out.println();
  -		    }
  -		    ResponseEntity response = (ResponseEntity) responses.nextElement();
  -		    Enumeration properties = response.getProperties();
  -		    while (properties.hasMoreElements()){
  -		        Property property = (Property)properties.nextElement();
  -		        out.println("   " + property.getName() + " : " + property.getPropertyAsString());
  -		    }
  -		}
  -		catch (Exception ex) {
  -		    handleException(ex);
  -		}
  -	}
  -	
  -	void proppatch(String path, String prop, String value)
  -	{
  -		String name=prop;
  +        catch (Exception ex) {
  +            handleException(ex);
  +        }
  +    }
  +    
  +    void propfind(String path, Vector properties) 
  +    {
  +        try {
  +            path = checkUri(path);
  +            out.print("Getting properties '" + path + "': ");
  +
  +            Enumeration propertyValues =
  +                webdavResource.propfindMethod(path, properties);
  +            if (propertyValues.hasMoreElements()){
  +                while (propertyValues.hasMoreElements()){
  +                    out.println(propertyValues.nextElement());
  +                }
  +            } 
  +            else {
  +                out.println("failed.");
  +                out.println(webdavResource.getStatusMessage());
  +            }
  +        } 
  +        catch (Exception ex) {
  +            handleException(ex);
  +        }
  +    }
  +    
  +    void propfindall(String path) 
  +    {
  +        try {
  +            path=checkUri(path);
  +            out.print("Getting properties '" + path + "': ");
  +            Enumeration responses = webdavResource.propfindMethod(path, DepthSupport.DEPTH_0);
  +            if (!responses.hasMoreElements()) {
  +                out.println("failed (no response received).");
  +                out.println(webdavResource.getStatusMessage());
  +                return;
  +            }
  +            else {
  +                out.println();
  +            }
  +            ResponseEntity response = (ResponseEntity) responses.nextElement();
  +            Enumeration properties = response.getProperties();
  +            while (properties.hasMoreElements()){
  +                Property property = (Property)properties.nextElement();
  +                out.println("   " + property.getName() + " : " + property.getPropertyAsString());
  +            }
  +        }
  +        catch (Exception ex) {
  +            handleException(ex);
  +        }
  +    }
  +    
  +    void proppatch(String path, String prop, String value)
  +    {
  +        String name=prop;
           try {
               out.print("Putting property(" + name + ", " + value +
                   ") to '" + path + "': ");
  @@ -780,33 +780,33 @@
                   out.println("failed.");
                   out.println(webdavResource.getStatusMessage());
               }
  -		}
  -		catch (Exception ex) {
  -		    handleException(ex);
  -		}
  -	}
  -	
  -	void get(String path, String filename)
  -	{
  -        try {
  -	        // The resource on the remote.
  -	        String src = checkUri(path);
  -	        // The file on the local.
  -	        String dest = (filename!=null) ? filename : HttpURL.getName(src);
  +        }
  +        catch (Exception ex) {
  +            handleException(ex);
  +        }
  +    }
  +    
  +    void get(String path, String filename)
  +    {
  +        try {
  +            // The resource on the remote.
  +            String src = checkUri(path);
  +            // The file on the local.
  +            String dest = (filename!=null) ? filename : HttpURL.getName(src);
   
  -	        out.println("get " + src + " " + dest);
  +            out.println("get " + src + " " + dest);
   
               // For the overwrite operation;
               String y = "y";
               File file = new File(dest);
               // Checking the local file.
               if (file.exists()) {
  -			
  -				// FIXME: interactive ?
  +            
  +                // FIXME: interactive ?
                   out.print("Aleady exists. " +
                       "Do you want to overwrite it(Y/n)? ");
  -		        BufferedReader in =
  -		            new BufferedReader(new InputStreamReader(System.in));
  +                BufferedReader in =
  +                    new BufferedReader(new InputStreamReader(System.in));
                   y = in.readLine();
               }
               if (y.trim().equalsIgnoreCase("y") ||
  @@ -824,11 +824,11 @@
           catch (Exception ex) {
               handleException(ex);
           }
  -	}
  -	
  -	void put(String filename, String path)
  -	{
  -		out.println("put " + filename + " " + path);
  +    }
  +    
  +    void put(String filename, String path)
  +    {
  +        out.println("put " + filename + " " + path);
   
   // FIXME upload URLs !!!!
   //                if ((count == 2 && src.indexOf(":") > 1) ||
  @@ -847,49 +847,49 @@
   //                }
   
           try {
  -			String src = filename;
  -			String dest =  checkUri(path);
  +            String src = filename;
  +            String dest =  checkUri(path);
               File file = new File(dir.getCanonicalPath(), src);
               if (file.exists()) {
                   out.print("Uploading  '" + src + "' to '" + dest + "': ");
                   if (webdavResource.putMethod(dest, file)) {
                       out.println("succeeded.");
                   } 
  -				else {
  +                else {
                       out.println("failed.");
                       out.println(webdavResource.getStatusMessage());
                   }
               } 
  -			else {
  +            else {
                   out.println("Warning: File not exists");
  -			}
  +            }
  +        } 
  +        catch (Exception ex) {
  +            handleException(ex);
  +        }
  +    }
  +
  +    // TODO multi
  +    void delete(String path) 
  +    {
  +        try {
  +            path = checkUri(path);
  +            out.print("Deleting '" + path + "': ");
  +            if (webdavResource.deleteMethod(path)) {
  +                out.println("succeeded.");
  +            } else {
  +                out.println("failed.");
  +                out.println(webdavResource.getStatusMessage());
  +            }
           } 
  -		catch (Exception ex) {
  +        catch (Exception ex) {
               handleException(ex);
           }
  -	}
  +    }
   
  -	// TODO multi
  -	void delete(String path) 
  -	{
  -	    try {
  -	        path = checkUri(path);
  -	        out.print("Deleting '" + path + "': ");
  -	        if (webdavResource.deleteMethod(path)) {
  -	            out.println("succeeded.");
  -	        } else {
  -	            out.println("failed.");
  -	            out.println(webdavResource.getStatusMessage());
  -	        }
  -	    } 
  -		catch (Exception ex) {
  -	        handleException(ex);
  -	    }
  -	}
  -
  -	// TODO multi
  -	void mkdir(String path)
  -	{
  +    // TODO multi
  +    void mkdir(String path)
  +    {
           try {
               path = checkUri(path);
               out.print("Making '" + path + "' collection: ");
  @@ -900,13 +900,13 @@
                   out.println(webdavResource.getStatusMessage());
               }
           } 
  -		catch (Exception ex) {
  +        catch (Exception ex) {
               handleException(ex);
           }
  -	}
  +    }
   
  -	void copy(String src, String dst)
  -	{
  +    void copy(String src, String dst)
  +    {
           try {
               src = checkUri(src);
               dst = checkUri(dst);
  @@ -921,10 +921,10 @@
           catch (Exception ex) {
               handleException(ex);
           }
  -	}
  +    }
   
  -	void move(String src, String dst)
  -	{
  +    void move(String src, String dst)
  +    {
           try {
               src = checkUri(src);
               dst = checkUri(dst);
  @@ -935,32 +935,32 @@
                   out.println("failed.");
                   out.println(webdavResource.getStatusMessage());
               }
  -		}
  -		catch (Exception ex) {
  -		    handleException(ex);
  -		}
  -	}
  -
  -	void locks(String path) 
  -	{
  -		try {
  +        }
  +        catch (Exception ex) {
  +            handleException(ex);
  +        }
  +    }
  +
  +    void locks(String path) 
  +    {
  +        try {
               path=checkUri(path);
  -	        LockDiscoveryProperty lockDiscoveryProperty=webdavResource.lockDiscoveryPropertyFindMethod(path);
  -	        if (lockDiscoveryProperty==null) {
  -	            out.println("Server did not return a LockDiscoveryProperty.");
  -	            out.println(webdavResource.getStatusMessage());
  -	            return;
  -	        }
  -	        Lock[] locks=lockDiscoveryProperty.getActiveLocks();
  -	        showLocks(path,locks);
  -		}
  -		catch (Exception ex) {
  -		    handleException(ex);
  -		}
  -	}
  +            LockDiscoveryProperty lockDiscoveryProperty=webdavResource.lockDiscoveryPropertyFindMethod(path);
  +            if (lockDiscoveryProperty==null) {
  +                out.println("Server did not return a LockDiscoveryProperty.");
  +                out.println(webdavResource.getStatusMessage());
  +                return;
  +            }
  +            Lock[] locks=lockDiscoveryProperty.getActiveLocks();
  +            showLocks(path,locks);
  +        }
  +        catch (Exception ex) {
  +            handleException(ex);
  +        }
  +    }
   
  -	void lock(String path) 
  -	{
  +    void lock(String path) 
  +    {
           try {
               path = checkUri(path);
               out.print("Locking '" + path + "': ");
  @@ -970,14 +970,14 @@
                   out.println("failed.");
                   out.println(webdavResource.getStatusMessage());
               }
  -		}
  -		catch (Exception ex) {
  -		    handleException(ex);
  -		}
  -	}
  +        }
  +        catch (Exception ex) {
  +            handleException(ex);
  +        }
  +    }
   
  -	void unlock(String path) 
  -	{
  +    void unlock(String path) 
  +    {
           try {
               path = checkUri(path);
               out.print("Unlocking '" + path + "': ");
  @@ -987,133 +987,133 @@
                   out.println("failed.");
                   out.println(webdavResource.getStatusMessage());
               }
  -		}
  -		catch (Exception ex) {
  -		    handleException(ex);
  -		}
  -	}
  -
  -	void grant(String permission,String path, String principal)
  -	{
  -		grant(new QName("DAV:",permission),path,principal);
  -
  -		// FIME lookup permission ?
  -//	            if (namespace==null) {
  -//	        namespace=resolveNamespace(permission);
  -//	        if (namespace==null) {
  -//	            out.println("Could not resolve namespace for permission " + permission);
  -//	            continue;
  -//	        }
  -//	    }
  -	}
  -
  -	void grant(QName permission,String path, String principal) 
  -	{
  -		try  {
  -		    principal=checkPrincipal(principal,webdavResource,path);
  -		    grant(webdavResource, permission, path, principal);
  -		}
  -		catch (Exception ex) {
  -			handleException(ex);
  -		}
  -	}
  -
  -	void deny(String permission,String path, String principal)
  -	{
  -		deny(new QName("DAV:",permission),path,principal);
  -	}
  -		
  -	void deny(QName permission,String path, String principal) 
  -	{
  -		try  {
  -		    principal=checkPrincipal(principal,webdavResource,path);
  -		    deny(webdavResource, permission, path, principal);
  -		}
  -		catch (Exception ex) {
  -			handleException(ex);
  -		}
  -	}
  -
  -	void revoke(String permission,String path, String principal)
  -	{
  -		revoke(new QName("DAV:",permission),path,principal);
  -	}
  -		
  -	void revoke(QName permission,String path, String principal) 
  -	{
  -		try  {
  -		    principal=checkPrincipal(principal,webdavResource,path);
  -		    revoke(webdavResource, permission, path, principal);
  -		}
  -		catch (Exception ex) {
  -			handleException(ex);
  -		}
  -	}
  -
  -	void acl(String path)
  -	{
  -		try 
  -		{
  -	        AclProperty acl=null;
  -	        if (path!=null) {
  -	            path=checkUri(path);
  -	        }
  -	        else {
  -	            path=webdavResource.getPath();
  -	        }
  -	        acl = webdavResource.aclfindMethod(path);
  -
  -	        if (acl==null)
  -	        {
  -	            out.println("Error: PropFind didn't return an AclProperty!");
  -				return;
  -	        }
  -	        out.println();
  -	        showAces(path, acl.getAces());
  -		}
  -		catch (Exception ex)
  -		{
  -			handleException(ex);
  -		}
  -	}
  -
  -	void principalcollectionset(String path)
  -	{
  -		try 
  -		{
  -			PrincipalCollectionSetProperty set=null;
  -			if (path!=null) {
  -			    path=checkUri(path);
  -			}
  -			else {
  -			    path=webdavResource.getPath();
  -			}
  -			set = webdavResource.principalCollectionSetFindMethod(path);
  -
  -			if (set==null)
  -			{
  -			    out.println("Error: PropFind didn't return an PrincipalCollectionSetProperty!");
  -			    return;
  -			}
  -			String[] hrefs=set.getHrefs();
  -			if (hrefs==null) {
  -			    out.println("No PrincipalCollectionSet for " + path);
  -			}
  -			out.println();
  -			out.println("PrincipalCollectionSet for " + path + ":");
  -			for (int i=0 ; i<hrefs.length ; i++)
  -			    out.println("   " + hrefs[i]);
  -			out.println();    
  -		}
  -		catch (Exception ex)
  -		{
  -		}
  -	}
  +        }
  +        catch (Exception ex) {
  +            handleException(ex);
  +        }
  +    }
  +
  +    void grant(String permission,String path, String principal)
  +    {
  +        grant(new QName("DAV:",permission),path,principal);
  +
  +        // FIME lookup permission ?
  +//                if (namespace==null) {
  +//            namespace=resolveNamespace(permission);
  +//            if (namespace==null) {
  +//                out.println("Could not resolve namespace for permission " + permission);
  +//                continue;
  +//            }
  +//        }
  +    }
  +
  +    void grant(QName permission,String path, String principal) 
  +    {
  +        try  {
  +            principal=checkPrincipal(principal,webdavResource,path);
  +            grant(webdavResource, permission, path, principal);
  +        }
  +        catch (Exception ex) {
  +            handleException(ex);
  +        }
  +    }
  +
  +    void deny(String permission,String path, String principal)
  +    {
  +        deny(new QName("DAV:",permission),path,principal);
  +    }
  +        
  +    void deny(QName permission,String path, String principal) 
  +    {
  +        try  {
  +            principal=checkPrincipal(principal,webdavResource,path);
  +            deny(webdavResource, permission, path, principal);
  +        }
  +        catch (Exception ex) {
  +            handleException(ex);
  +        }
  +    }
  +
  +    void revoke(String permission,String path, String principal)
  +    {
  +        revoke(new QName("DAV:",permission),path,principal);
  +    }
  +        
  +    void revoke(QName permission,String path, String principal) 
  +    {
  +        try  {
  +            principal=checkPrincipal(principal,webdavResource,path);
  +            revoke(webdavResource, permission, path, principal);
  +        }
  +        catch (Exception ex) {
  +            handleException(ex);
  +        }
  +    }
  +
  +    void acl(String path)
  +    {
  +        try 
  +        {
  +            AclProperty acl=null;
  +            if (path!=null) {
  +                path=checkUri(path);
  +            }
  +            else {
  +                path=webdavResource.getPath();
  +            }
  +            acl = webdavResource.aclfindMethod(path);
   
  -	///////////////////////////////////////////////////////////////////
  +            if (acl==null)
  +            {
  +                out.println("Error: PropFind didn't return an AclProperty!");
  +                return;
  +            }
  +            out.println();
  +            showAces(path, acl.getAces());
  +        }
  +        catch (Exception ex)
  +        {
  +            handleException(ex);
  +        }
  +    }
  +
  +    void principalcollectionset(String path)
  +    {
  +        try 
  +        {
  +            PrincipalCollectionSetProperty set=null;
  +            if (path!=null) {
  +                path=checkUri(path);
  +            }
  +            else {
  +                path=webdavResource.getPath();
  +            }
  +            set = webdavResource.principalCollectionSetFindMethod(path);
  +
  +            if (set==null)
  +            {
  +                out.println("Error: PropFind didn't return an PrincipalCollectionSetProperty!");
  +                return;
  +            }
  +            String[] hrefs=set.getHrefs();
  +            if (hrefs==null) {
  +                out.println("No PrincipalCollectionSet for " + path);
  +            }
  +            out.println();
  +            out.println("PrincipalCollectionSet for " + path + ":");
  +            for (int i=0 ; i<hrefs.length ; i++)
  +                out.println("   " + hrefs[i]);
  +            out.println();    
  +        }
  +        catch (Exception ex)
  +        {
  +        }
  +    }
  +
  +    ///////////////////////////////////////////////////////////////////
   
  -	void versioncontrol(String path)
  -	{
  +    void versioncontrol(String path)
  +    {
           try {
               path = checkUri(path);
               out.print("setting up VersionControl '" + path + "': ");
  @@ -1124,13 +1124,13 @@
                   out.println(webdavResource.getStatusMessage());
               }
           } 
  -		catch (Exception ex) {
  -			handleException(ex);
  +        catch (Exception ex) {
  +            handleException(ex);
           }
  -	}
  +    }
   
  -	void versioncontrol(String target, String path)
  -	{
  +    void versioncontrol(String target, String path)
  +    {
           try {
               path = checkUri(path);
               out.print("creating versioncontroled Resource '" + target + "' based on '" + path + "' : ");
  @@ -1141,365 +1141,365 @@
                   out.println(webdavResource.getStatusMessage());
               }
           } 
  -		catch (Exception ex) {
  +        catch (Exception ex) {
               handleException(ex);
           }
       }
   
  -	void report(String path, Vector properties) 
  -	{
  -		Enumeration propertyValues;
  -	    try {
  -	        path = checkUri(path);
  -	        out.println("Getting version-tree Report of '" + path + "':");
  -
  -			if ((properties!=null) && (properties.size()>0)) {
  -		        propertyValues =
  -		            webdavResource.reportMethod(new HttpURL(path), properties, 1);
  -			}
  -			else  {
  -		        propertyValues =
  -		            webdavResource.reportMethod(new HttpURL(path), 1);
  -			}
  -	         
  -	        if (propertyValues.hasMoreElements()){
  -	            while (propertyValues.hasMoreElements()){
  -	                out.println(propertyValues.nextElement().toString());
  -	            }
  -			} 
  -			else {
  -	            out.println("failed.");
  -	            out.println(webdavResource.getStatusMessage());
  -	        }
  -	    } 
  -		catch (Exception ex) {
  -			handleException(ex);
  -	    }
  -	}
  -	
  -	void ereport(String path, String srcFilename)
  -	{
  -	    try {
  -		    String sQuery ="";
  -			if (srcFilename==null) {
  -			    sQuery = "<D:expand-property xmlns:D='DAV:'><D:property name='version-history'><D:property name='version-set'><D:property name='successor-set'><D:property name='comment'/></D:property></D:property></D:property></D:expand-property>";
  -			}
  -			else  {
  -				File file = new File(dir.getCanonicalPath(), srcFilename);
  -			    if (!file.exists()) {
  -					out.println("report src file not found");
  -					return;
  -			    }
  -		        InputStream isQuery = new FileInputStream(file);
  -		        BufferedReader reader = new BufferedReader(new InputStreamReader(isQuery));
  -
  -		        while (reader.ready()) {
  -		            sQuery += reader.readLine();
  -		        }
  -				reader.close();
  -		        
  -		        sQuery.replace('\t',' ');
  -				out.println (sQuery);
  -			}
  -
  -		    path = checkUri(path);
  -	        out.println("expand-property Report of '" + path + "':");
  -	         
  -	        Enumeration propertyValues =
  -	            webdavResource.reportMethod(new HttpURL(path), sQuery, 1);
  -	        if (propertyValues.hasMoreElements()){
  -	            while (propertyValues.hasMoreElements()){
  -	                out.println(displayXML(propertyValues.nextElement().toString(), 0));
  -	            }
  -	        } 
  -			else {
  -	            out.println("failed.");
  -	            out.println(webdavResource.getStatusMessage());
  -	        }
  -	    } 
  -		catch (Exception ex) {
  -	        handleException(ex);
  -	    }
  -	}		
  -
  -	/**
  -	 * lreport path properties on historyUris
  -	 */
  -	void lreport(String path, Vector properties, Vector historyUris)
  -	{
  -	    try {
  -	        path = checkUri(path);
  -	        out.println("Getting version-tree Report of '" + path + "':");
  -	         
  -	        Enumeration propertyValues =
  -	            webdavResource.reportMethod(new HttpURL(path), properties, historyUris, 1);
  -	        if (propertyValues.hasMoreElements()) {
  -	            while (propertyValues.hasMoreElements()) {
  -	                out.println(propertyValues.nextElement().toString());
  -	            }
  -			}
  -			else {
  -	            out.println("failed.");
  -	            out.println(webdavResource.getStatusMessage());
  -	        }
  -	    }
  -		catch (Exception ex) {
  -	        handleException(ex);
  -	    }
  -	}
  +    void report(String path, Vector properties) 
  +    {
  +        Enumeration propertyValues;
  +        try {
  +            path = checkUri(path);
  +            out.println("Getting version-tree Report of '" + path + "':");
   
  -	void mkws(String path)
  -	{
  +            if ((properties!=null) && (properties.size()>0)) {
  +                propertyValues =
  +                    webdavResource.reportMethod(new HttpURL(path), properties, 1);
  +            }
  +            else  {
  +                propertyValues =
  +                    webdavResource.reportMethod(new HttpURL(path), 1);
  +            }
  +             
  +            if (propertyValues.hasMoreElements()){
  +                while (propertyValues.hasMoreElements()){
  +                    out.println(propertyValues.nextElement().toString());
  +                }
  +            } 
  +            else {
  +                out.println("failed.");
  +                out.println(webdavResource.getStatusMessage());
  +            }
  +        } 
  +        catch (Exception ex) {
  +            handleException(ex);
  +        }
  +    }
  +    
  +    void ereport(String path, String srcFilename)
  +    {
  +        try {
  +            String sQuery ="";
  +            if (srcFilename==null) {
  +                sQuery = "<D:expand-property xmlns:D='DAV:'><D:property name='version-history'><D:property name='version-set'><D:property name='successor-set'><D:property name='comment'/></D:property></D:property></D:property></D:expand-property>";
  +            }
  +            else  {
  +                File file = new File(dir.getCanonicalPath(), srcFilename);
  +                if (!file.exists()) {
  +                    out.println("report src file not found");
  +                    return;
  +                }
  +                InputStream isQuery = new FileInputStream(file);
  +                BufferedReader reader = new BufferedReader(new InputStreamReader(isQuery));
  +
  +                while (reader.ready()) {
  +                    sQuery += reader.readLine();
  +                }
  +                reader.close();
  +                
  +                sQuery.replace('\t',' ');
  +                out.println (sQuery);
  +            }
  +
  +            path = checkUri(path);
  +            out.println("expand-property Report of '" + path + "':");
  +             
  +            Enumeration propertyValues =
  +                webdavResource.reportMethod(new HttpURL(path), sQuery, 1);
  +            if (propertyValues.hasMoreElements()){
  +                while (propertyValues.hasMoreElements()){
  +                    out.println(displayXML(propertyValues.nextElement().toString(), 0));
  +                }
  +            } 
  +            else {
  +                out.println("failed.");
  +                out.println(webdavResource.getStatusMessage());
  +            }
  +        } 
  +        catch (Exception ex) {
  +            handleException(ex);
  +        }
  +    }        
  +
  +    /**
  +     * lreport path properties on historyUris
  +     */
  +    void lreport(String path, Vector properties, Vector historyUris)
  +    {
  +        try {
  +            path = checkUri(path);
  +            out.println("Getting version-tree Report of '" + path + "':");
  +             
  +            Enumeration propertyValues =
  +                webdavResource.reportMethod(new HttpURL(path), properties, historyUris, 1);
  +            if (propertyValues.hasMoreElements()) {
  +                while (propertyValues.hasMoreElements()) {
  +                    out.println(propertyValues.nextElement().toString());
  +                }
  +            }
  +            else {
  +                out.println("failed.");
  +                out.println(webdavResource.getStatusMessage());
  +            }
  +        }
  +        catch (Exception ex) {
  +            handleException(ex);
  +        }
  +    }
  +
  +    void mkws(String path)
  +    {
           try {
               path = checkUri(path);
               out.print("Making '" + path + "' workspace: ");
               if (webdavResource.mkWorkspaceMethod(path)) {
                   out.println("succeeded.");
               } 
  -			else {
  +            else {
                   out.println("failed.");
                   out.println(webdavResource.getStatusMessage());
               }
           } 
  -		catch (Exception ex) {
  +        catch (Exception ex) {
               handleException(ex);
           }
  -	}
  +    }
  +
  +    
  +    ///////////////////////////////////////////////////////////////////
  +    // Support methods
  +    ///////////////////////////////////////////////////////////////////
  +
  +    private void setDisplayPrompt(boolean displayPrompt)
  +    {
  +        this.displayPrompt = displayPrompt;
  +    }
   
  -	
  -	///////////////////////////////////////////////////////////////////
  -	// Support methods
  -	///////////////////////////////////////////////////////////////////
  -
  -	private void setDisplayPrompt(boolean displayPrompt)
  -	{
  -		this.displayPrompt = displayPrompt;
  -	}
  -
  -	/**
  -	 * Determine which URI to use at the prompt.
  -	 *
  -	 * @param uri the path to be set.
  -	 * @return the absolute path.
  -	 */
  -	private String checkUri(String uri) throws IOException
  -	{
  +    /**
  +     * Determine which URI to use at the prompt.
  +     *
  +     * @param uri the path to be set.
  +     * @return the absolute path.
  +     */
  +    private String checkUri(String uri) throws IOException
  +    {
   
           if (webdavResource == null) {
               throw new IOException("Not connected yet.");
           }
   
  -	    if (uri==null) {
  -	        uri=webdavResource.getPath();
  -	    }
  -
  -	    if (!uri.startsWith("/")) {
  -	        uri = getPath() + uri;
  -	    }
  -
  -	    return normalize(uri);
  -	}
  -
  -	private String checkPrincipal(String principal, WebdavResource webdavResource, String path) throws HttpException,IOException
  -	{
  -	    // Do not complete reserved words    
  -	    String[] types={"all","authenticated","unauthenticated","property","self"};
  -	    for (int i=0; i<types.length ; i++)
  -	    {
  -	        if (types[i].equals(principal))
  -	            return principal;
  -	    }
  -	
  -	    // FIXME: when search support is complete enhance this
  -	    //        to really search for the principal
  -	    if (!principal.startsWith("/") && !principal.startsWith("http")) {
  -	        PrincipalCollectionSetProperty set = webdavResource.principalCollectionSetFindMethod(path);
  -	        if ((set!=null) && (set.getHrefs()!=null) && (set.getHrefs().length==1))
  -	            principal = set.getHrefs()[0] + "/" + principal;
  -	    }
  -	    return normalize(principal);
  -	}
  -
  -	/**
  -	 * 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 ("/");  // The only left path is the root.
  -	        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 Slide client commands for use
  -	 */
  -	private void printSlideClientUsage() 
  -	{
  -	    out.println("Commands:");
  -	    out.println("  options {http_URL|path}       " +
  -	        "Print available http methods");
  -	    out.println("  open [http_URL]               " +
  -	        "Connect to specified URL");
  -	    out.println("  close                         " +
  -	        "Close current connection");
  -	    out.println("  exit                          " +
  -	        "Exit Slide");
  -	    out.println("  help                          " +
  -	        "Print this help message");
  -	    out.println("  lpwd                          " +
  -	        "Print local working directory");
  -	    out.println("  lcd [path]                    " +
  -	        "Change local working directory");
  -	    out.println("  lls [-lF] [path]              " +
  -	        "List contents of local directory");
  -	    out.println("  pwc                           " +
  -	        "Print working collection");
  -	    out.println("  cc [path]                     " +
  -	        "Change working collection");
  -	    out.println("  ls [-lF] [path]               " +
  -	        "List contents of collection");
  -	    out.println("  url                           " +
  -	        "Print working URL");
  -	    out.println("  status                        " +
  -	        "Print latest http status message");
  -	    out.println("  get path [file]               " +
  -	        "Get a resource to a file");
  -	    out.println("  put {URL|file} [path]         " +
  -	        "Put a given file or URL to path");
  -	    out.println("  mkcol path ...                " +
  -	        "Make new collections");
  -	    out.println("  delete path ...               " +
  -	        "Delete resources");
  -	    out.println("  copy source destination       " +
  -	        "Copy resource from source to destination path");
  -	    out.println("  move source destination       " +
  -	        "Move resource from source to destination path");
  -	    out.println("  lock path                     " +
  -	        "Lock specified resource");
  -	    out.println("  unlock path                   " +
  -	        "Unlock specified resource");
  -	    out.println("  locks [<path>]                " +
  -	        "Displays locks on specified resource");
  -	    out.println("  propget path property ...     " +
  -	        "Print value of specified property");
  -	    out.println("  propgetall [<path>]           " +
  -	        "Print value of all properties");
  -	    out.println("  propput path property value   " +
  -	        "Set property with given value");
  -	    out.println("  set URLencode {on|off}        " +
  -	        "Set URL encoding flag, default: on");
  -	    out.println("  set debug {on|off}            " +
  -	        "Set debug level, default: off");
  -	    out.println("  acl [<path>]                  " +
  -	        "Displays the ACL of path");
  -	    out.println("  principalcol [<path>]         " +
  -	        "Displays the principal collection set of path");
  -	    out.println("  grant  [<namespace>] <permission> [on <path>] to <principal>");
  -	    out.println("  deny   [<namespace>] <permission> [on <path>] to <principal>");
  -	    out.println("  revoke [<namespace>] <permission> [on <path>] from <principal>");
  +        if (uri==null) {
  +            uri=webdavResource.getPath();
  +        }
  +
  +        if (!uri.startsWith("/")) {
  +            uri = getPath() + uri;
  +        }
  +
  +        return normalize(uri);
  +    }
  +
  +    private String checkPrincipal(String principal, WebdavResource webdavResource, String path) throws HttpException,IOException
  +    {
  +        // Do not complete reserved words    
  +        String[] types={"all","authenticated","unauthenticated","property","self"};
  +        for (int i=0; i<types.length ; i++)
  +        {
  +            if (types[i].equals(principal))
  +                return principal;
  +        }
  +    
  +        // FIXME: when search support is complete enhance this
  +        //        to really search for the principal
  +        if (!principal.startsWith("/") && !principal.startsWith("http")) {
  +            PrincipalCollectionSetProperty set = webdavResource.principalCollectionSetFindMethod(path);
  +            if ((set!=null) && (set.getHrefs()!=null) && (set.getHrefs().length==1))
  +                principal = set.getHrefs()[0] + "/" + principal;
  +        }
  +        return normalize(principal);
  +    }
  +
  +    /**
  +     * 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 ("/");  // The only left path is the root.
  +            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 Slide client commands for use
  +     */
  +    private void printSlideClientUsage() 
  +    {
  +        out.println("Commands:");
  +        out.println("  options {http_URL|path}       " +
  +            "Print available http methods");
  +        out.println("  open [http_URL]               " +
  +            "Connect to specified URL");
  +        out.println("  close                         " +
  +            "Close current connection");
  +        out.println("  exit                          " +
  +            "Exit Slide");
  +        out.println("  help                          " +
  +            "Print this help message");
  +        out.println("  lpwd                          " +
  +            "Print local working directory");
  +        out.println("  lcd [path]                    " +
  +            "Change local working directory");
  +        out.println("  lls [-lF] [path]              " +
  +            "List contents of local directory");
  +        out.println("  pwc                           " +
  +            "Print working collection");
  +        out.println("  cc [path]                     " +
  +            "Change working collection");
  +        out.println("  ls [-lF] [path]               " +
  +            "List contents of collection");
  +        out.println("  url                           " +
  +            "Print working URL");
  +        out.println("  status                        " +
  +            "Print latest http status message");
  +        out.println("  get path [file]               " +
  +            "Get a resource to a file");
  +        out.println("  put {URL|file} [path]         " +
  +            "Put a given file or URL to path");
  +        out.println("  mkcol path ...                " +
  +            "Make new collections");
  +        out.println("  delete path ...               " +
  +            "Delete resources");
  +        out.println("  copy source destination       " +
  +            "Copy resource from source to destination path");
  +        out.println("  move source destination       " +
  +            "Move resource from source to destination path");
  +        out.println("  lock path                     " +
  +            "Lock specified resource");
  +        out.println("  unlock path                   " +
  +            "Unlock specified resource");
  +        out.println("  locks [<path>]                " +
  +            "Displays locks on specified resource");
  +        out.println("  propget path property ...     " +
  +            "Print value of specified property");
  +        out.println("  propgetall [<path>]           " +
  +            "Print value of all properties");
  +        out.println("  propput path property value   " +
  +            "Set property with given value");
  +        out.println("  set URLencode {on|off}        " +
  +            "Set URL encoding flag, default: on");
  +        out.println("  set debug {on|off}            " +
  +            "Set debug level, default: off");
  +        out.println("  acl [<path>]                  " +
  +            "Displays the ACL of path");
  +        out.println("  principalcol [<path>]         " +
  +            "Displays the principal collection set of path");
  +        out.println("  grant  [<namespace>] <permission> [on <path>] to <principal>");
  +        out.println("  deny   [<namespace>] <permission> [on <path>] to <principal>");
  +        out.println("  revoke [<namespace>] <permission> [on <path>] from <principal>");
           out.println("  versioncontrol path           "+
               "set a versionable resource under versioncontrol");
           out.println("  versioncontrol URL path       "+
  @@ -1519,367 +1519,367 @@
               "getting report (locate-by-history)");
           out.println("  mkws path ...                 " +
               "Make new workspace");
  -	    out.println
  -	        ("Aliases: help=?, open=connect, ls=dir, pwc=pwd, cc=cd, " +
  -	         "lls=ldir, copy=cp,\n move=mv, delete=del=rm, mkcol=mkdir, " +
  -	         "propget=propfind, propput=proppatch,\n exit=quit=bye");
  -	    out.println("Comment : Once executed, the debug mode will " +
  -	                       "be active.\n\t\tBecause it's not triggered by " +
  -	                       "methods yet.");
  -	}
  +        out.println
  +            ("Aliases: help=?, open=connect, ls=dir, pwc=pwd, cc=cd, " +
  +             "lls=ldir, copy=cp,\n move=mv, delete=del=rm, mkcol=mkdir, " +
  +             "propget=propfind, propput=proppatch,\n exit=quit=bye");
  +        out.println("Comment : Once executed, the debug mode will " +
  +                           "be active.\n\t\tBecause it's not triggered by " +
  +                           "methods yet.");
  +    }
   
   
  -	/**
  -	 * Sleep
  -	 */
  -//	private static void pause(int secs) 
  -//	{
  +    /**
  +     * Sleep
  +     */
  +//    private static void pause(int secs) 
  +//    {
   //
  -//	    try {
  -//	        Thread.sleep( secs * 1000 );
  -//	    } catch( InterruptedException ex ) {
  -//	    }
  -//	}
  -
  -//	private String resolveNamespace(String permission)
  -//	{
  -//	    String DEFAULT_NAMESPACE = "DAV:";
  -//	    String SLIDE_NAMESPACE = "http://jakarta.apache.org/slide/";
  -//	    String namespace=null;
  +//        try {
  +//            Thread.sleep( secs * 1000 );
  +//        } catch( InterruptedException ex ) {
  +//        }
  +//    }
  +
  +//    private String resolveNamespace(String permission)
  +//    {
  +//        String DEFAULT_NAMESPACE = "DAV:";
  +//        String SLIDE_NAMESPACE = "http://jakarta.apache.org/slide/";
  +//        String namespace=null;
   //
  -//	    if (permission==null)
  -//	        return null;
  -//	    
  -//	    if ((permission.equalsIgnoreCase("all")) ||
  -//	        (permission.equalsIgnoreCase("read")) ||
  -//	        (permission.equalsIgnoreCase("write")) ||
  -//	        (permission.equalsIgnoreCase("read-acl")) ||
  -//	        (permission.equalsIgnoreCase("write-acl")))
  -//	    {
  -//	        namespace=DEFAULT_NAMESPACE;
  -//	    }
  -//	    
  -//	    if ((permission.equalsIgnoreCase("read-object")) ||
  -//	        (permission.equalsIgnoreCase("read-revision-metadata")) ||
  -//	        (permission.equalsIgnoreCase("read-revision-content")) ||
  -//	        (permission.equalsIgnoreCase("create-object")) ||
  -//	        (permission.equalsIgnoreCase("remove-object")) ||
  -//	        (permission.equalsIgnoreCase("lock-object")) ||
  -//	        (permission.equalsIgnoreCase("read-locks")) ||
  -//	        (permission.equalsIgnoreCase("create-revision-metadata")) ||
  -//	        (permission.equalsIgnoreCase("modify-revision-metadata")) ||
  -//	        (permission.equalsIgnoreCase("remove-revision-metadata")) ||
  -//	        (permission.equalsIgnoreCase("create-revision-content")) ||
  -//	        (permission.equalsIgnoreCase("modify-revision-content")) ||
  -//	        (permission.equalsIgnoreCase("remove-revision-content")) ||
  -//	        (permission.equalsIgnoreCase("grant-permission")) ||
  -//	        (permission.equalsIgnoreCase("revoke-permission")))
  -//	    {
  -//	        namespace=SLIDE_NAMESPACE;
  -//	    }
  -//	    
  -//	    return namespace;
  -//	}
  -
  -	private boolean grant(WebdavResource webdavResource, QName permission, String path, String principal) throws HttpException, IOException
  -	{
  -	    out.println("grant " + permission + " on " + path + " to " + principal);
  -	    return addPermission(webdavResource, permission, path, principal, false);
  -	}
  -
  -	private boolean deny(WebdavResource webdavResource, QName permission, String path, String principal) throws HttpException, IOException
  -	{
  -	    out.println("deny " + permission + " on " + path + " to " + principal);
  -	    return addPermission(webdavResource, permission, path, principal, true);
  -	}
  -
  -	private boolean revoke(WebdavResource webdavResource, QName permission, String path, String principal) throws HttpException, IOException
  -	{
  -	    out.println("revoke " + permission + " on " + path + " from " + principal);
  -	    return removePermission(webdavResource, permission, path, principal);
  -	}
  -
  -	private boolean addPermission(WebdavResource webdavResource, QName permission, String path, String principal, boolean negative) throws HttpException, IOException
  -	{
  -
  -	    AclProperty acl = webdavResource.aclfindMethod(path);
  -	    if (acl==null)
  -	    {
  -	        out.println("Error: PropFind didn't return an AclProperty!");
  -	        return false;
  -	    }
  -	    Ace[] aces=acl.getAces();
  -	    
  -	    if (aces==null)
  -	        aces=new Ace[0];
  -	            
  -	    if (debugLevel>5) {
  -	        out.println();
  -	        out.println("ACL from server");
  -	        showAces(path, aces);
  -	    }
  -	    
  -	    Ace ace=null;
  -	    for (int i=0; i<aces.length && (ace==null); i++)
  -	    {
  -	        if ((aces[i].isNegative()==negative) && !aces[i].isProtected() 
  -	            && !aces[i].isInherited() && aces[i].getPrincipal().equals(principal))
  -	        {
  -	            if (debugLevel>5)
  -	                out.println("found ace");
  -	            ace=aces[i];
  -	        }
  -	    }
  -	    if (ace==null)
  -	    {
  -	        Ace[] oldAces=aces;
  -	        aces=new Ace[oldAces.length+1];
  -	        System.arraycopy(oldAces,0,aces,0,oldAces.length);
  -	        ace=new Ace(principal, negative, false, false,null);
  -	        aces[oldAces.length]=ace;
  -	    }
  -	    
  -	    Privilege privilege=new Privilege(permission.getNamespaceURI(), permission.getLocalName(), null);
  -	    ace.addPrivilege(privilege);
  -	    
  -	    if (debugLevel>5) {
  -	        out.println();
  -	        out.println("ACL with updated privileges");
  -	        showAces(path, aces);
  -	    }
  -
  -	    boolean success = webdavResource.aclMethod(path,aces);
  -	
  -	    if (!success)
  -	        out.println(webdavResource.getStatusMessage());    
  -
  -	    if (debugLevel>5) {
  -	        acl = webdavResource.aclfindMethod(path);
  -	        if (acl==null)
  -	            out.println("Error: PropFind didn't return an AclProperty!");
  -	        else 
  -	        {    
  -	            aces=acl.getAces();
  -	            out.println();
  -	            out.println("ACL from server after update");
  -	            showAces(path, aces);
  -	        }
  -	    }
  -	        
  -	    return success;
  -	}
  -
  -	private boolean removePermission(WebdavResource webdavResource, QName permission, String path, String principal) throws HttpException, IOException
  -	{
  -	    AclProperty acl = webdavResource.aclfindMethod(path);
  -	    if (acl==null)
  -	    {
  -	        out.println("Error: PropFind didn't return an AclProperty!");
  -	        return false;
  -	    }
  -	    Ace[] aces=acl.getAces();
  -
  -	    if (aces==null) 
  -	    {
  -	        out.println("Privilege not found");
  -	        return false;
  -	    }
  -
  -	    if (debugLevel>5) {
  -	        out.println();
  -	        out.println("ACL from server");
  -	        showAces(path, aces);
  -	    }
  -	    
  -	    boolean found=false;
  -	    Privilege privilege=new Privilege(permission.getNamespaceURI(), permission.getLocalName(), null);
  -	    for (int i=0; i<aces.length; i++)
  -	    {
  -	        if (!aces[i].isProtected() && !aces[i].isInherited() && aces[i].getPrincipal().equals(principal))
  -	        {
  -	            if (debugLevel>5)
  -	                out.println("found ace");
  -	            boolean removed = aces[i].removePrivilege(privilege);
  -	            found = found || removed;
  -	            if (removed)
  -	                out.println("Privilege removed");
  -	        }
  -	    }
  -	    
  -	    if (!found) 
  -	    {
  -	        out.println("Privilege not found");
  -	        return false;
  -	    }
  -	    
  -	    if (debugLevel>5) {
  -	        out.println();
  -	        out.println("ACL with updated privileges");
  -	        showAces(path, aces);
  -	    }
  -
  -	    boolean success = webdavResource.aclMethod(path,aces);
  -	
  -	    if (!success)
  -	        out.println(webdavResource.getStatusMessage());    
  -
  -	    if (debugLevel>5) {
  -	        acl = webdavResource.aclfindMethod(path);
  -	        if (acl==null)
  -	            out.println("Error: PropFind didn't return an AclProperty!");
  -	        else 
  -	        {    
  -	            aces=acl.getAces();
  -	            out.println();
  -	            out.println("ACL from server after update");
  -	            showAces(path, aces);
  -	        }
  -	    }
  -	        
  -	    return success;
  -	}
  -	
  -	private void showAces(String path, Ace[] aces)
  -	{
  -	    if ((aces==null) || (aces.length==0)) {
  -	        out.println("ACL for " + path + " is empty.");
  -	        return;
  -	    }
  -	    
  -	    out.println("ACL for " + path + ":");
  -	    out.println("------------------------------------------------------------");
  -	    for (int i=0; i<aces.length ; i++) 
  -	    {
  -	        Ace ace=aces[i];
  -	        out.println((!ace.isNegative()?"granted":"denied") + 
  -	            " to " + ace.getPrincipal() + " " + 
  -	            "   (" + (ace.isProtected()?"protected":"not protected") + ")" +
  -	            "   (" + (ace.isInherited()? ("inherited from '" + ace.getInheritedFrom() + "'"): "not inherited") +")");
  -	    
  -	        Enumeration privileges=ace.enumeratePrivileges();
  -	        while (privileges.hasMoreElements())
  -	        {
  -	            Privilege priv=(Privilege)privileges.nextElement();
  -	            out.println("   " + priv.getNamespace() + priv.getName() + "   " + (priv.getParameter()==null?"":("("+priv.getParameter()+")")));
  -	        }
  -	    }
  -	    out.println("------------------------------------------------------------");
  -	}
  -	
  -	private void showLocks(String path, Lock[] locks)
  -	{
  -	    if ((locks==null) || (locks.length==0)) {
  -	        out.println("No locks on " + path);
  -	        return;
  -	    }
  -	    
  -	    out.println("Locks for " + path + ":");
  -	    out.println("------------------------------------------------------------");
  -	    for (int i=0; i<locks.length ; i++)
  -	    {
  -	        int lockScope = locks[i].getLockScope();
  -	        if (lockScope==Lock.SCOPE_EXCLUSIVE) {
  -	            out.print("Exclusive ");
  -	        } 
  -	        else if (lockScope==Lock.SCOPE_SHARED) {
  -	            out.print("Shared ");
  -	        }
  -	        else if (lockScope==-1) {
  -	            out.print("Unknown scope ");
  -	        }
  -	        else {
  -	            out.println("!!! Internal error !!!");
  -	            return;
  -	        }
  -	        
  -	        int lockType = locks[i].getLockType();
  -	        if (lockType==Lock.TYPE_WRITE) {
  -	            out.println("write lock");
  -	        }
  -	        else if (lockType==-1) {
  -	            out.println("unknown type");
  -	        }
  -	        else {
  -	            out.println("!!! Internal error !!!");
  -	            return;
  -	        }
  -	        
  -	        int depth=locks[i].getDepth();
  -	        if (depth==DepthSupport.DEPTH_INFINITY) {
  -	            out.println("   depth: infinity");
  -	        }
  -	        else if (depth==-1) {
  -	            // unknown
  -	        }
  -	        else {
  -	            out.println("   depth: " + depth);
  -	        }            
  -
  -	        String owner=locks[i].getOwner();
  -	        if (owner!=null) 
  -	            out.println("   owner: " + owner);
  -	            
  -	        long timeout=locks[i].getTimeout();
  -	        if (timeout!=-1)
  -	            out.println("   timeout: " + timeout);
  -	        
  -	        String token=locks[i].getLockToken();
  -	        if (token!=null) 
  -	            out.println("   token: " + token);
  -	    }
  -	}
  -
  -	private String displayXML(String xmlString, int count)
  -	{
  -	    String sResult ="";
  -	            
  -	    if(xmlString.startsWith("</")) {
  -	        count --;
  -	        //out.println("cl: " + count);
  -	        for (int cc = count; cc > 0; cc--) {
  -	            sResult += "\t";
  -	        }
  -
  -	        try {
  -	            sResult += xmlString.substring(0, xmlString.indexOf(">") + 1)+"\n";
  -	            xmlString = xmlString.substring(xmlString.indexOf(">") + 1);
  -	            //count --;
  -	            sResult += displayXML(xmlString, count);
  -	        }
  -			catch (Exception any) {
  -	            //sResult += "endtag" + any;
  -			}
  -	        
  -	    }
  -		else if (xmlString.startsWith("<")) {
  -	        //out.println("op: " + count);
  -	        for (int cc = count; cc > 0; cc--) {
  -	            sResult += "\t";
  -	        }
  -	        try {
  -	            sResult += xmlString.substring(0, xmlString.indexOf(">") + 1)+"\n";
  -	            xmlString = xmlString.substring(xmlString.indexOf(">") + 1);
  -	            count ++;
  -	            sResult += displayXML(xmlString, count);
  -	        }
  -			catch (Exception any) {
  -	            //sResult += "starttag" + any;
  -	        }
  -	    }
  -		else {
  -	        //out.println("em: " + count);
  -	        for (int cc = count; cc > 0; cc--) {
  -	            sResult += "\t";
  -	        }
  -	        try {
  -	            sResult += xmlString.substring(0, xmlString.indexOf("<"))+ "\n";
  -	            xmlString = xmlString.substring(xmlString.indexOf("<"));
  -	            sResult += displayXML(xmlString, count);
  -	        }
  -			catch (Exception any) {
  -	            //sResult += any;
  -	        }
  -	    }
  -	    return sResult;
  -	}
  +//        if (permission==null)
  +//            return null;
  +//        
  +//        if ((permission.equalsIgnoreCase("all")) ||
  +//            (permission.equalsIgnoreCase("read")) ||
  +//            (permission.equalsIgnoreCase("write")) ||
  +//            (permission.equalsIgnoreCase("read-acl")) ||
  +//            (permission.equalsIgnoreCase("write-acl")))
  +//        {
  +//            namespace=DEFAULT_NAMESPACE;
  +//        }
  +//        
  +//        if ((permission.equalsIgnoreCase("read-object")) ||
  +//            (permission.equalsIgnoreCase("read-revision-metadata")) ||
  +//            (permission.equalsIgnoreCase("read-revision-content")) ||
  +//            (permission.equalsIgnoreCase("create-object")) ||
  +//            (permission.equalsIgnoreCase("remove-object")) ||
  +//            (permission.equalsIgnoreCase("lock-object")) ||
  +//            (permission.equalsIgnoreCase("read-locks")) ||
  +//            (permission.equalsIgnoreCase("create-revision-metadata")) ||
  +//            (permission.equalsIgnoreCase("modify-revision-metadata")) ||
  +//            (permission.equalsIgnoreCase("remove-revision-metadata")) ||
  +//            (permission.equalsIgnoreCase("create-revision-content")) ||
  +//            (permission.equalsIgnoreCase("modify-revision-content")) ||
  +//            (permission.equalsIgnoreCase("remove-revision-content")) ||
  +//            (permission.equalsIgnoreCase("grant-permission")) ||
  +//            (permission.equalsIgnoreCase("revoke-permission")))
  +//        {
  +//            namespace=SLIDE_NAMESPACE;
  +//        }
  +//        
  +//        return namespace;
  +//    }
  +
  +    private boolean grant(WebdavResource webdavResource, QName permission, String path, String principal) throws HttpException, IOException
  +    {
  +        out.println("grant " + permission + " on " + path + " to " + principal);
  +        return addPermission(webdavResource, permission, path, principal, false);
  +    }
  +
  +    private boolean deny(WebdavResource webdavResource, QName permission, String path, String principal) throws HttpException, IOException
  +    {
  +        out.println("deny " + permission + " on " + path + " to " + principal);
  +        return addPermission(webdavResource, permission, path, principal, true);
  +    }
  +
  +    private boolean revoke(WebdavResource webdavResource, QName permission, String path, String principal) throws HttpException, IOException
  +    {
  +        out.println("revoke " + permission + " on " + path + " from " + principal);
  +        return removePermission(webdavResource, permission, path, principal);
  +    }
  +
  +    private boolean addPermission(WebdavResource webdavResource, QName permission, String path, String principal, boolean negative) throws HttpException, IOException
  +    {
  +
  +        AclProperty acl = webdavResource.aclfindMethod(path);
  +        if (acl==null)
  +        {
  +            out.println("Error: PropFind didn't return an AclProperty!");
  +            return false;
  +        }
  +        Ace[] aces=acl.getAces();
  +        
  +        if (aces==null)
  +            aces=new Ace[0];
  +                
  +        if (debugLevel>5) {
  +            out.println();
  +            out.println("ACL from server");
  +            showAces(path, aces);
  +        }
  +        
  +        Ace ace=null;
  +        for (int i=0; i<aces.length && (ace==null); i++)
  +        {
  +            if ((aces[i].isNegative()==negative) && !aces[i].isProtected() 
  +                && !aces[i].isInherited() && aces[i].getPrincipal().equals(principal))
  +            {
  +                if (debugLevel>5)
  +                    out.println("found ace");
  +                ace=aces[i];
  +            }
  +        }
  +        if (ace==null)
  +        {
  +            Ace[] oldAces=aces;
  +            aces=new Ace[oldAces.length+1];
  +            System.arraycopy(oldAces,0,aces,0,oldAces.length);
  +            ace=new Ace(principal, negative, false, false,null);
  +            aces[oldAces.length]=ace;
  +        }
  +        
  +        Privilege privilege=new Privilege(permission.getNamespaceURI(), permission.getLocalName(), null);
  +        ace.addPrivilege(privilege);
  +        
  +        if (debugLevel>5) {
  +            out.println();
  +            out.println("ACL with updated privileges");
  +            showAces(path, aces);
  +        }
  +
  +        boolean success = webdavResource.aclMethod(path,aces);
  +    
  +        if (!success)
  +            out.println(webdavResource.getStatusMessage());    
  +
  +        if (debugLevel>5) {
  +            acl = webdavResource.aclfindMethod(path);
  +            if (acl==null)
  +                out.println("Error: PropFind didn't return an AclProperty!");
  +            else 
  +            {    
  +                aces=acl.getAces();
  +                out.println();
  +                out.println("ACL from server after update");
  +                showAces(path, aces);
  +            }
  +        }
  +            
  +        return success;
  +    }
  +
  +    private boolean removePermission(WebdavResource webdavResource, QName permission, String path, String principal) throws HttpException, IOException
  +    {
  +        AclProperty acl = webdavResource.aclfindMethod(path);
  +        if (acl==null)
  +        {
  +            out.println("Error: PropFind didn't return an AclProperty!");
  +            return false;
  +        }
  +        Ace[] aces=acl.getAces();
  +
  +        if (aces==null) 
  +        {
  +            out.println("Privilege not found");
  +            return false;
  +        }
  +
  +        if (debugLevel>5) {
  +            out.println();
  +            out.println("ACL from server");
  +            showAces(path, aces);
  +        }
  +        
  +        boolean found=false;
  +        Privilege privilege=new Privilege(permission.getNamespaceURI(), permission.getLocalName(), null);
  +        for (int i=0; i<aces.length; i++)
  +        {
  +            if (!aces[i].isProtected() && !aces[i].isInherited() && aces[i].getPrincipal().equals(principal))
  +            {
  +                if (debugLevel>5)
  +                    out.println("found ace");
  +                boolean removed = aces[i].removePrivilege(privilege);
  +                found = found || removed;
  +                if (removed)
  +                    out.println("Privilege removed");
  +            }
  +        }
  +        
  +        if (!found) 
  +        {
  +            out.println("Privilege not found");
  +            return false;
  +        }
  +        
  +        if (debugLevel>5) {
  +            out.println();
  +            out.println("ACL with updated privileges");
  +            showAces(path, aces);
  +        }
  +
  +        boolean success = webdavResource.aclMethod(path,aces);
  +    
  +        if (!success)
  +            out.println(webdavResource.getStatusMessage());    
  +
  +        if (debugLevel>5) {
  +            acl = webdavResource.aclfindMethod(path);
  +            if (acl==null)
  +                out.println("Error: PropFind didn't return an AclProperty!");
  +            else 
  +            {    
  +                aces=acl.getAces();
  +                out.println();
  +                out.println("ACL from server after update");
  +                showAces(path, aces);
  +            }
  +        }
  +            
  +        return success;
  +    }
  +    
  +    private void showAces(String path, Ace[] aces)
  +    {
  +        if ((aces==null) || (aces.length==0)) {
  +            out.println("ACL for " + path + " is empty.");
  +            return;
  +        }
  +        
  +        out.println("ACL for " + path + ":");
  +        out.println("------------------------------------------------------------");
  +        for (int i=0; i<aces.length ; i++) 
  +        {
  +            Ace ace=aces[i];
  +            out.println((!ace.isNegative()?"granted":"denied") + 
  +                " to " + ace.getPrincipal() + " " + 
  +                "   (" + (ace.isProtected()?"protected":"not protected") + ")" +
  +                "   (" + (ace.isInherited()? ("inherited from '" + ace.getInheritedFrom() + "'"): "not inherited") +")");
  +        
  +            Enumeration privileges=ace.enumeratePrivileges();
  +            while (privileges.hasMoreElements())
  +            {
  +                Privilege priv=(Privilege)privileges.nextElement();
  +                out.println("   " + priv.getNamespace() + priv.getName() + "   " + (priv.getParameter()==null?"":("("+priv.getParameter()+")")));
  +            }
  +        }
  +        out.println("------------------------------------------------------------");
  +    }
  +    
  +    private void showLocks(String path, Lock[] locks)
  +    {
  +        if ((locks==null) || (locks.length==0)) {
  +            out.println("No locks on " + path);
  +            return;
  +        }
  +        
  +        out.println("Locks for " + path + ":");
  +        out.println("------------------------------------------------------------");
  +        for (int i=0; i<locks.length ; i++)
  +        {
  +            int lockScope = locks[i].getLockScope();
  +            if (lockScope==Lock.SCOPE_EXCLUSIVE) {
  +                out.print("Exclusive ");
  +            } 
  +            else if (lockScope==Lock.SCOPE_SHARED) {
  +                out.print("Shared ");
  +            }
  +            else if (lockScope==-1) {
  +                out.print("Unknown scope ");
  +            }
  +            else {
  +                out.println("!!! Internal error !!!");
  +                return;
  +            }
  +            
  +            int lockType = locks[i].getLockType();
  +            if (lockType==Lock.TYPE_WRITE) {
  +                out.println("write lock");
  +            }
  +            else if (lockType==-1) {
  +                out.println("unknown type");
  +            }
  +            else {
  +                out.println("!!! Internal error !!!");
  +                return;
  +            }
  +            
  +            int depth=locks[i].getDepth();
  +            if (depth==DepthSupport.DEPTH_INFINITY) {
  +                out.println("   depth: infinity");
  +            }
  +            else if (depth==-1) {
  +                // unknown
  +            }
  +            else {
  +                out.println("   depth: " + depth);
  +            }            
  +
  +            String owner=locks[i].getOwner();
  +            if (owner!=null) 
  +                out.println("   owner: " + owner);
  +                
  +            long timeout=locks[i].getTimeout();
  +            if (timeout!=-1)
  +                out.println("   timeout: " + timeout);
  +            
  +            String token=locks[i].getLockToken();
  +            if (token!=null) 
  +                out.println("   token: " + token);
  +        }
  +    }
  +
  +    private String displayXML(String xmlString, int count)
  +    {
  +        String sResult ="";
  +                
  +        if(xmlString.startsWith("</")) {
  +            count --;
  +            //out.println("cl: " + count);
  +            for (int cc = count; cc > 0; cc--) {
  +                sResult += "\t";
  +            }
  +
  +            try {
  +                sResult += xmlString.substring(0, xmlString.indexOf(">") + 1)+"\n";
  +                xmlString = xmlString.substring(xmlString.indexOf(">") + 1);
  +                //count --;
  +                sResult += displayXML(xmlString, count);
  +            }
  +            catch (Exception any) {
  +                //sResult += "endtag" + any;
  +            }
  +            
  +        }
  +        else if (xmlString.startsWith("<")) {
  +            //out.println("op: " + count);
  +            for (int cc = count; cc > 0; cc--) {
  +                sResult += "\t";
  +            }
  +            try {
  +                sResult += xmlString.substring(0, xmlString.indexOf(">") + 1)+"\n";
  +                xmlString = xmlString.substring(xmlString.indexOf(">") + 1);
  +                count ++;
  +                sResult += displayXML(xmlString, count);
  +            }
  +            catch (Exception any) {
  +                //sResult += "starttag" + any;
  +            }
  +        }
  +        else {
  +            //out.println("em: " + count);
  +            for (int cc = count; cc > 0; cc--) {
  +                sResult += "\t";
  +            }
  +            try {
  +                sResult += xmlString.substring(0, xmlString.indexOf("<"))+ "\n";
  +                xmlString = xmlString.substring(xmlString.indexOf("<"));
  +                sResult += displayXML(xmlString, count);
  +            }
  +            catch (Exception any) {
  +                //sResult += any;
  +            }
  +        }
  +        return sResult;
  +    }
   }
  
  
  
  1.2       +219 -219  jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Client.g
  
  Index: Client.g
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Client.g,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Client.g	11 Jan 2002 13:25:24 -0000	1.1
  +++ Client.g	11 Jan 2002 13:29:41 -0000	1.2
  @@ -1,9 +1,9 @@
   header 
   {
   /*
  - * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Client.g,v 1.1 2002/01/11 13:25:24 dirkv Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/01/11 13:25:24 $
  + * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Client.g,v 1.2 2002/01/11 13:29:41 dirkv Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/01/11 13:29:41 $
    *
    * ====================================================================
    *
  @@ -67,82 +67,82 @@
   
   // Import the necessary classes
   {
  -	import java.io.*;
  -	import java.util.*;
  -	import org.apache.util.QName;
  -	import org.apache.webdav.lib.PropertyName;
  +    import java.io.*;
  +    import java.util.*;
  +    import org.apache.util.QName;
  +    import org.apache.webdav.lib.PropertyName;
   }
   
   class ClientParser extends Parser;
   options {
  -	buildAST = false;	// uses CommonAST by default
  -	k=20;
  +    buildAST = false;    // uses CommonAST by default
  +    k=20;
   }
   
   ///////////////////////////////////////////////////////////////////////
   // Helper methods
   ///////////////////////////////////////////////////////////////////////
   {
  -	protected Client client;
  -	
  -	void setClient(Client client)
  -	{
  -		this.client=client;
  -	}
  -
  -	private String text(Token token)
  -	{
  -		if (token==null)
  -			return null;
  -		
  -		String tmp=token.getText();
  -		
  -		// strip " from strings like "a b"
  -		if (tmp.startsWith("\"") && tmp.endsWith("\"")) {
  -			return tmp.substring(1,tmp.length()-1);
  -		}
  -		
  -		return tmp;
  -	}
  -	
  -	private QName qname(Token token)
  -	{
  -		if (token==null)
  -			return null;
  -
  -		String tmp=token.getText();
  -		if (!tmp.startsWith("<")) {
  -			return new PropertyName("DAV:",text(token));
  -		}
  -
  -		String namespaceURI=tmp.substring(tmp.indexOf('"')+1,tmp.lastIndexOf('"'));
  -		String localName=tmp.substring(1,tmp.indexOf(' '));
  -		
  -		return new QName(namespaceURI,localName);
  -	}
  -	
  -	private PropertyName pname(Token token)
  -	{
  -		if (token==null)
  -			return null;
  -
  -		String tmp=token.getText();
  -		if (!tmp.startsWith("<")) {
  -			return new PropertyName("DAV:",text(token));
  -		}
  -
  -		String namespaceURI=tmp.substring(tmp.indexOf('"')+1,tmp.lastIndexOf('"'));
  -		String localName=tmp.substring(1,tmp.indexOf(' '));
  -		
  -		return new PropertyName(namespaceURI,localName);
  -	}
  -	
  -	private void printUsage(String command) throws RecognitionException,TokenStreamException
  -	{
  -		client.printUsage(command);
  -		skip(); // skip the rest of the line
  -	}
  -	
  +    protected Client client;
  +    
  +    void setClient(Client client)
  +    {
  +        this.client=client;
  +    }
  +
  +    private String text(Token token)
  +    {
  +        if (token==null)
  +            return null;
  +        
  +        String tmp=token.getText();
  +        
  +        // strip " from strings like "a b"
  +        if (tmp.startsWith("\"") && tmp.endsWith("\"")) {
  +            return tmp.substring(1,tmp.length()-1);
  +        }
  +        
  +        return tmp;
  +    }
  +    
  +    private QName qname(Token token)
  +    {
  +        if (token==null)
  +            return null;
  +
  +        String tmp=token.getText();
  +        if (!tmp.startsWith("<")) {
  +            return new PropertyName("DAV:",text(token));
  +        }
  +
  +        String namespaceURI=tmp.substring(tmp.indexOf('"')+1,tmp.lastIndexOf('"'));
  +        String localName=tmp.substring(1,tmp.indexOf(' '));
  +        
  +        return new QName(namespaceURI,localName);
  +    }
  +    
  +    private PropertyName pname(Token token)
  +    {
  +        if (token==null)
  +            return null;
  +
  +        String tmp=token.getText();
  +        if (!tmp.startsWith("<")) {
  +            return new PropertyName("DAV:",text(token));
  +        }
  +
  +        String namespaceURI=tmp.substring(tmp.indexOf('"')+1,tmp.lastIndexOf('"'));
  +        String localName=tmp.substring(1,tmp.indexOf(' '));
  +        
  +        return new PropertyName(namespaceURI,localName);
  +    }
  +    
  +    private void printUsage(String command) throws RecognitionException,TokenStreamException
  +    {
  +        client.printUsage(command);
  +        skip(); // skip the rest of the line
  +    }
  +    
   } 
   
   ///////////////////////////////////////////////////////////////////////
  @@ -158,237 +158,237 @@
             get | put | propfind | propfindall | proppatch |
             lock | unlock | locks |
             grant | deny | revoke | acl | principalcollectionset |
  -		  versioncontrol | report | ereport | lreport | mkws;
  +          versioncontrol | report | ereport | lreport | mkws;
   
   
   help: (HELP | QUESTION ) NL
   {   client.help(null); }
   exception catch [RecognitionException ex]
  -{	printUsage("help"); };
  -		  
  +{    printUsage("help"); };
  +          
   spool : SPOOL (file:STRING | OFF) NL
   {   
       if (file!=null) {
           client.enableSpoolToFile(text(file));
  -	}
  -	else {
  -		client.disableSpoolToFile();
  -	}
  +    }
  +    else {
  +        client.disableSpoolToFile();
  +    }
   }
   exception catch [RecognitionException ex]
  -{	printUsage("spool"); };		  
  -		  
  +{    printUsage("spool"); };          
  +          
   run : RUN script:STRING NL
   {   client.executeScript(text(script)); }
   exception catch [RecognitionException ex]
  -{	printUsage("run"); };
  +{    printUsage("run"); };
   
   echo : ECHO { boolean isEnabled; } 
          (ON { isEnabled=true; } | OFF { isEnabled=true; }) NL
   {   client.setEchoEnabled(isEnabled); }
   exception catch [RecognitionException ex]
  -{	printUsage("echo"); };
  +{    printUsage("echo"); };
   
   setdebug : {int level;} SET DEBUG (ON {level=Client.DEBUG_ON;} | OFF {level=Client.DEBUG_OFF;}) NL
   {   client.setDebug(level); }
   exception catch [RecognitionException ex]
  -{	printUsage("setdebug"); };
  -		  
  +{    printUsage("setdebug"); };
  +          
   optionsmethod : OPTIONS path:STRING NL
   {   client.options(text(path)); }
   exception catch [RecognitionException ex]
  -{	printUsage("options"); };
  +{    printUsage("options"); };
   
   connect: (CONNECT |OPEN ) uri:STRING NL
   {   client.connect(text(uri)); }
   exception catch [RecognitionException ex]
  -{	printUsage("connect"); };
  +{    printUsage("connect"); };
   
   disconnect: DISCONNECT NL
   {   client.disconnect(); }
   exception catch [RecognitionException ex]
  -{	printUsage("disconnect"); };
  +{    printUsage("disconnect"); };
   
   lpwd: LPWD NL
   {   client.lpwd(); }
   exception catch [RecognitionException ex]
  -{	printUsage("lpwd"); };
  +{    printUsage("lpwd"); };
   
   pwd: (PWD | PWC) NL
   {   client.pwd(); }
   exception catch [RecognitionException ex]
  -{	printUsage("pwd"); };
  +{    printUsage("pwd"); };
   
   lcd: LCD path:STRING NL
   {   client.lcd(text(path)); }
   exception catch [RecognitionException ex]
  -{	printUsage("lcd"); };
  +{    printUsage("lcd"); };
   
   cd: (CD | CC) path:STRING NL
   {   client.cd(text(path)); }
   exception catch [RecognitionException ex]
  -{	printUsage("cd"); };
  +{    printUsage("cd"); };
   
   lls: (LLS | LDIR) (option:OPTIONSTRING)? (path:STRING)? NL
   {   client.lls(text(option),text(path)); }
   exception catch [RecognitionException ex]
  -{	printUsage("lls"); };
  +{    printUsage("lls"); };
   
   ls: (LS | DIR) (option:OPTIONSTRING)? (path:STRING)? NL
   {   client.ls(text(option),text(path)); }
   exception catch [RecognitionException ex]
  -{	printUsage("ls"); };
  +{    printUsage("ls"); };
   
   mkdir : MKDIR path:STRING NL
   {   client.mkdir(text(path)); }
   exception catch [RecognitionException ex]
  -{	printUsage("mkdir"); };
  +{    printUsage("mkdir"); };
   
   move : MOVE source:STRING destination:STRING NL
   {   client.move(text(source),text(destination)); }
   exception catch [RecognitionException ex]
  -{	printUsage("move"); };
  +{    printUsage("move"); };
   
   copy : COPY source:STRING destination:STRING NL
   {   client.copy(text(source),text(destination)); }
   exception catch [RecognitionException ex]
  -{	printUsage("copy"); };
  +{    printUsage("copy"); };
   
   delete : (DELETE | DEL | RM) path:STRING NL
   {   client.delete(text(path)); }
   exception catch [RecognitionException ex]
  -{	printUsage("delete"); };
  +{    printUsage("delete"); };
   
   propfind : (PROPFIND | PROPGET) path:STRING 
              { Vector properties = new Vector(); }
  -		   (prop:STRING  { properties.add(pname(prop)); } | 
  -		    nsprop:QNAME { properties.add(pname(nsprop)); })+ NL
  +           (prop:STRING  { properties.add(pname(prop)); } | 
  +            nsprop:QNAME { properties.add(pname(nsprop)); })+ NL
   {   client.propfind(text(path),properties); }
   exception catch [RecognitionException ex]
  -{	printUsage("propfind"); };
  +{    printUsage("propfind"); };
   
   propfindall : (PROPFINDALL | PROPGETALL) (path:STRING)? NL
   {   client.propfindall(text(path)); }
   exception catch [RecognitionException ex]
  -{	printUsage("propfindall"); };
  +{    printUsage("propfindall"); };
   
   proppatch : (PROPPATCH | PROPSET) path:STRING prop:STRING value:STRING NL
   {   client.proppatch(text(path),text(prop),text(value)); }
   exception catch [RecognitionException ex]
  -{	printUsage("proppatch"); };
  +{    printUsage("proppatch"); };
   
   get : GET path:STRING (file:STRING)? NL
   {   client.get(text(path),text(file)); }
   exception catch [RecognitionException ex]
  -{	printUsage("get"); };
  +{    printUsage("get"); };
   
   put : PUT file:STRING (path:STRING)? NL
   {   client.put(text(file),text(path)); }
   exception catch [RecognitionException ex]
  -{	printUsage("put"); };
  +{    printUsage("put"); };
   
   lock : LOCK (path:STRING)? NL
   {   client.lock(text(path)); }
   exception catch [RecognitionException ex]
  -{	printUsage("lock"); };
  +{    printUsage("lock"); };
   
   unlock : UNLOCK (path:STRING)? NL
   {   client.unlock(text(path)); }
   exception catch [RecognitionException ex]
  -{	printUsage("unlock"); };
  +{    printUsage("unlock"); };
   
   locks : LOCKS (path:STRING)? NL
   {   client.locks(text(path)); }
   exception catch [RecognitionException ex]
  -{	printUsage("locks"); };
  +{    printUsage("locks"); };
   
   grant : GRANT (permission:STRING | nspermisssion:QNAME) (ON path:STRING)? TO principal:STRING NL
  -{	if (permission!=null)
  -		client.grant(text(permission),text(path),text(principal));
  -	else
  -		client.grant(qname(nspermisssion),text(path),text(principal));
  +{    if (permission!=null)
  +        client.grant(text(permission),text(path),text(principal));
  +    else
  +        client.grant(qname(nspermisssion),text(path),text(principal));
   }
   exception catch [RecognitionException ex]
  -{	client.printUsage("grant"); };
  +{    client.printUsage("grant"); };
   
   deny : DENY (permission:STRING | nspermisssion:QNAME) (ON path:STRING)? TO principal:STRING NL
  -{	if (permission!=null)
  -		client.deny(text(permission),text(path),text(principal));
  -	else
  -		client.deny(qname(nspermisssion),text(path),text(principal));
  +{    if (permission!=null)
  +        client.deny(text(permission),text(path),text(principal));
  +    else
  +        client.deny(qname(nspermisssion),text(path),text(principal));
   }
   exception catch [RecognitionException ex]
  -{	client.printUsage("deny"); };
  +{    client.printUsage("deny"); };
   
   revoke : REVOKE (permission:STRING | nspermisssion:QNAME) (ON path:STRING)? FROM principal:STRING NL
  -{	if (permission!=null)
  -		client.revoke(text(permission),text(path),text(principal));
  -	else
  -		client.revoke(qname(nspermisssion),text(path),text(principal));
  +{    if (permission!=null)
  +        client.revoke(text(permission),text(path),text(principal));
  +    else
  +        client.revoke(qname(nspermisssion),text(path),text(principal));
   }
   exception catch [RecognitionException ex]
  -{	client.printUsage("revoke"); };
  +{    client.printUsage("revoke"); };
   
   acl : ACL (path:STRING)? NL
   {   client.acl(text(path)); }
   exception catch [RecognitionException ex]
  -{	printUsage("acl"); };
  +{    printUsage("acl"); };
   
   principalcollectionset : PRINCIPALCOLLECTIONSET (path:STRING)? NL
   {   client.principalcollectionset(text(path)); }
   exception catch [RecognitionException ex]
  -{	printUsage("principalcollectionset"); };
  +{    printUsage("principalcollectionset"); };
   
   versioncontrol : VERSIONCONTROL (target:STRING)? path:STRING NL
   {
  -	if (target==null)
  -		client.versioncontrol(text(path));
  -	else
  -		client.versioncontrol(text(target),text(path));
  +    if (target==null)
  +        client.versioncontrol(text(path));
  +    else
  +        client.versioncontrol(text(target),text(path));
   }
   exception catch [RecognitionException ex]
  -{	printUsage("versioncontrol"); };
  +{    printUsage("versioncontrol"); };
   
   report : REPORT path:STRING 
              { Vector properties = new Vector(); }
  -		   (prop:STRING  { properties.add(pname(prop)); } | 
  -		    nsprop:QNAME { properties.add(pname(nsprop)); })+ NL
  +           (prop:STRING  { properties.add(pname(prop)); } | 
  +            nsprop:QNAME { properties.add(pname(nsprop)); })+ NL
   {   client.report(text(path),properties); }
   exception catch [RecognitionException ex]
  -{	printUsage("report"); };
  +{    printUsage("report"); };
   
   ereport : EREPORT path:STRING (filename:STRING)? NL
   {   client.ereport(text(path),text(filename)); }
   exception catch [RecognitionException ex]
  -{	printUsage("ereport"); };
  +{    printUsage("ereport"); };
   
   lreport : LREPORT path:STRING
              { Vector properties = new Vector(); }
  -		   (prop:STRING  { properties.add(pname(prop)); } | 
  -		    nsprop:QNAME { properties.add(pname(nsprop)); })+
  -		  ON
  -		  { Vector historyUris = new Vector(); }
  -		  (uri:STRING { historyUris.add(text(uri)); })+	NL
  +           (prop:STRING  { properties.add(pname(prop)); } | 
  +            nsprop:QNAME { properties.add(pname(nsprop)); })+
  +          ON
  +          { Vector historyUris = new Vector(); }
  +          (uri:STRING { historyUris.add(text(uri)); })+    NL
   {   client.lreport(text(path),properties,historyUris); } 
   exception catch [RecognitionException ex]
  -{	printUsage("lreport"); };
  +{    printUsage("lreport"); };
   
   mkws : MKWS path:STRING NL
   {   client.mkws(text(path)); }
   exception catch [RecognitionException ex]
  -{	printUsage("mkws"); };
  +{    printUsage("mkws"); };
   
   
   ////////////////////////////////////////////////////
   
   exit: (EXIT | QUIT | BYE) NL
   {
  -	throw new TokenStreamException("exit");
  +    throw new TokenStreamException("exit");
   };
   
   invalid : cmd:STRING (STRING)* NL
   {
  -	client.printInvalidCommand(text(cmd));
  +    client.printInvalidCommand(text(cmd));
   };
   
   nothing: NL;
  @@ -398,94 +398,94 @@
   
   all_tokens : EXIT | QUIT | BYE | HELP | QUESTION | RUN | SPOOL | 
                ECHO | ON | OFF | SET | DEBUG | OPTIONS | OPEN | 
  -			 CONNECT | CLOSE | DISCONNECT | LPWD | LCD | LLS | 
  -			 LDIR | PWC | PWD | CC | CD | LS | DIR | GET | PUT | 
  -			 MKCOL | MKDIR | DELETE | DEL | RM | COPY | CP | MOVE | 
  -			 MV | LOCK | UNLOCK | LOCKS | PROPGET | PROPFIND | 
  -			 PROPGETALL | PROPFINDALL | PROPPUT | PROPPATCH | ACL | 
  -			 PRINCIPALCOL | GRANT | DENY | REVOKE | TO | FROM | 
  -			 PRINCIPALCOLLECTIONSET | VERSIONCONTROL | REPORT | 
  -			 EREPORT | LREPORT | MKWS ;
  +             CONNECT | CLOSE | DISCONNECT | LPWD | LCD | LLS | 
  +             LDIR | PWC | PWD | CC | CD | LS | DIR | GET | PUT | 
  +             MKCOL | MKDIR | DELETE | DEL | RM | COPY | CP | MOVE | 
  +             MV | LOCK | UNLOCK | LOCKS | PROPGET | PROPFIND | 
  +             PROPGETALL | PROPFINDALL | PROPPUT | PROPPATCH | ACL | 
  +             PRINCIPALCOL | GRANT | DENY | REVOKE | TO | FROM | 
  +             PRINCIPALCOLLECTIONSET | VERSIONCONTROL | REPORT | 
  +             EREPORT | LREPORT | MKWS ;
   
   ////////////////////////////////////////////////////////
   
   class ClientLexer extends Lexer;
   options {
  -	k=20;
  -	caseSensitiveLiterals = false;
  -	charVocabulary='\u0000'..'\uFFFE';
  +    k=20;
  +    caseSensitiveLiterals = false;
  +    charVocabulary='\u0000'..'\uFFFE';
   }
   
   tokens 
   {
  -	EXIT         = "exit";
  -	QUIT         = "quit";
  -	BYE          = "bye";
  -	HELP         = "help";
  -	QUESTION     = "?";
  -	RUN          = "run";
  -	SPOOL        = "spool";
  +    EXIT         = "exit";
  +    QUIT         = "quit";
  +    BYE          = "bye";
  +    HELP         = "help";
  +    QUESTION     = "?";
  +    RUN          = "run";
  +    SPOOL        = "spool";
       ECHO         = "echo";
  -	ON           = "on";
  -	OFF          = "off";
  -	SET          = "set";
  -	DEBUG        = "debug";
  -
  -	OPTIONS      = "options";
  -	OPEN         = "open";
  -	CONNECT      = "connect";
  -	CLOSE        = "close";
  -	DISCONNECT   = "disconnect";
  -	LPWD         = "lpwd";
  -	LCD          = "lcd";
  -	LLS          = "lls";
  -	LDIR         = "ldir";
  -	PWC          = "pwc";
  -	PWD          = "pwd";
  -	CC           = "cc";
  -	CD           = "cd";
  -	LS           = "ls";
  -	DIR          = "dir";
  -	GET          = "get";
  -	PUT          = "put";
  -	MKCOL        = "mkcol";
  -	MKDIR        = "mkdir";
  -	DELETE       = "delete";
  -	DEL          = "del";
  -	RM           = "rm";
  -	COPY         = "copy";
  -	CP           = "cp";
  -	MOVE         = "move";
  -	MV           = "mv";
  -	LOCK         = "lock";
  -	UNLOCK       = "unlock";
  -	LOCKS        = "locks";
  -	PROPGET      = "propget";
  -	PROPFIND     = "propfind";
  -	PROPGETALL   = "propgetall";
  -	PROPFINDALL  = "propfindall";
  -	PROPPUT      = "propput";
  -	PROPPATCH    = "proppatch";
  -	ACL          = "acl";
  -	PRINCIPALCOL = "principalcol";
  -	GRANT        = "grant";
  -	DENY         = "deny";
  -	REVOKE       = "revoke";
  -	TO           = "to";
  -	FROM         = "from";
  -
  -	PRINCIPALCOLLECTIONSET = "principalcollectionset";
  -
  -	VERSIONCONTROL = "versioncontrol";
  -	REPORT         = "report";
  -	EREPORT        = "ereport";
  -	LREPORT        = "lreport";
  -	MKWS           = "mkws";
  +    ON           = "on";
  +    OFF          = "off";
  +    SET          = "set";
  +    DEBUG        = "debug";
  +
  +    OPTIONS      = "options";
  +    OPEN         = "open";
  +    CONNECT      = "connect";
  +    CLOSE        = "close";
  +    DISCONNECT   = "disconnect";
  +    LPWD         = "lpwd";
  +    LCD          = "lcd";
  +    LLS          = "lls";
  +    LDIR         = "ldir";
  +    PWC          = "pwc";
  +    PWD          = "pwd";
  +    CC           = "cc";
  +    CD           = "cd";
  +    LS           = "ls";
  +    DIR          = "dir";
  +    GET          = "get";
  +    PUT          = "put";
  +    MKCOL        = "mkcol";
  +    MKDIR        = "mkdir";
  +    DELETE       = "delete";
  +    DEL          = "del";
  +    RM           = "rm";
  +    COPY         = "copy";
  +    CP           = "cp";
  +    MOVE         = "move";
  +    MV           = "mv";
  +    LOCK         = "lock";
  +    UNLOCK       = "unlock";
  +    LOCKS        = "locks";
  +    PROPGET      = "propget";
  +    PROPFIND     = "propfind";
  +    PROPGETALL   = "propgetall";
  +    PROPFINDALL  = "propfindall";
  +    PROPPUT      = "propput";
  +    PROPPATCH    = "proppatch";
  +    ACL          = "acl";
  +    PRINCIPALCOL = "principalcol";
  +    GRANT        = "grant";
  +    DENY         = "deny";
  +    REVOKE       = "revoke";
  +    TO           = "to";
  +    FROM         = "from";
  +
  +    PRINCIPALCOLLECTIONSET = "principalcollectionset";
  +
  +    VERSIONCONTROL = "versioncontrol";
  +    REPORT         = "report";
  +    EREPORT        = "ereport";
  +    LREPORT        = "lreport";
  +    MKWS           = "mkws";
   }
   
  -WS	:	(' ' | '\t' | '\r')
  -		{ _ttype = Token.SKIP; }
  -	;
  +WS    :    (' ' | '\t' | '\r')
  +        { _ttype = Token.SKIP; }
  +    ;
   
   NL : '\n';
   
  @@ -493,14 +493,14 @@
   
   STRING: (CHARS)+ | '"' (CHARS| ' ')+ '"';
   
  -protected		
  +protected        
   CHARS: 'a'..'z' | 'A'..'Z' | '0'..'9' | '.' | ':' | '/';
   
   QNAME: '<' STRING " xmlns=\"" STRING "\">";
   
   
   //protected
  -//DIGIT :	'0'..'9' ;
  +//DIGIT :    '0'..'9' ;
   //
   //
  -//INT	: (DIGIT)+ ;
  +//INT    : (DIGIT)+ ;
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>