KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > jayasoft > ivy > resolver > SshResolver


1 package fr.jayasoft.ivy.resolver;
2
3 import fr.jayasoft.ivy.repository.ssh.SshRepository;
4
5 /**
6  * Resolver for SSH resolver for ivy
7  */

8 public class SshResolver extends AbstractSshBasedResolver {
9     
10     public SshResolver() {
11         setRepository(new SshRepository());
12     }
13     /**
14      * sets the path separator used on the target system. Not sure if this is used or if '/' is used
15      * on all implementation. default is to use '/'
16      * @param sep file separator to use on the target system
17      */

18     public void setFileSeparator(String JavaDoc sep) {
19         if(sep == null || sep.length() != 1)
20             throw new IllegalArgumentException JavaDoc("File Separator has to be a single character and not "+sep);
21         ((SshRepository)getRepository()).setFileSeparator(sep.trim().charAt(0));
22     }
23     
24     /**
25      * set the command to get a directory listing
26      * the command has to be a shell command working on the target system
27      * and has to produce a listing of filenames, with each filename on a new line
28      * the term %arg can be used in the command to substitue the path to be listed
29      * (e.g. "ls -1 %arg | grep -v CVS" to get a listing without CVS directory)
30      * if %arg is not part of the command, the path will be appended to the command
31      * default is: "ls -1"
32      */

33     public void setListCommand(String JavaDoc cmd) {
34         ((SshRepository)getRepository()).setListCommand(cmd);
35     }
36
37     /**
38      * set the command to check for existence of a file
39      * the command has to be a shell command working on the target system
40      * and has to create an exit status of 0 for an existent file
41      * and <> 0 for a non existing file given as argument
42      * the term %arg can be used in the command to substitue the path to be listed
43      * if %arg is not part of the command, the path will be appended to the command
44      * default is: "ls"
45      */

46     public void setExistCommand(String JavaDoc cmd) {
47         ((SshRepository)getRepository()).setExistCommand(cmd);
48     }
49
50     /**
51      * set the command to create a directory on the target system
52      * the command has to be a shell command working on the target system
53      * and has to create a directory with the given argument
54      * the term %arg can be used in the command to substitue the path to be listed
55      * if %arg is not part of the command, the path will be appended to the command
56      * default is: "mkdir"
57      */

58     public void setCreateDirCommand(String JavaDoc cmd) {
59         ((SshRepository)getRepository()).setExistCommand(cmd);
60     }
61
62     public String JavaDoc getTypeName() {
63         return "ssh";
64     }
65 }
66
Popular Tags