~ubuntu-branches/ubuntu/lucid/tuxguitar/lucid-updates

« back to all changes in this revision

Viewing changes to TuxGuitar-browser-ftp/src/org/herac/tuxguitar/gui/tools/browser/ftp/TGBrowserDataImpl.java

  • Committer: Bazaar Package Importer
  • Author(s): Philippe Coval
  • Date: 2009-04-25 19:49:27 UTC
  • mfrom: (1.1.3 upstream) (2.1.7 jaunty)
  • Revision ID: james.westby@ubuntu.com-20090425194927-pblqed0zxp0pmyeq
Tags: 1.1-1
* New Upstream Release (Closes: #489859) (LP: #366476)
* Merged patch : tuxguitar_1.0.dak-1ubuntu1.patch
* debian/README.txt
  - suggests to install tuxguitar-jsa

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
        
9
9
        private static final String STRING_SEPARATOR = ";";
10
10
        
 
11
        private String name;
11
12
        private String host;
12
13
        private String path;
13
14
        private String username;
14
15
        private String password;
 
16
        private String proxyUser;
 
17
        private String proxyPwd;
 
18
        private String proxyHost;
 
19
        private int proxyPort;
15
20
        
16
 
        public TGBrowserDataImpl(String host,String path,String username,String password){
 
21
        public TGBrowserDataImpl(String name, String host, String path, String username, String password, String proxyUser, String proxyPwd, String proxyHost, int proxyPort) {
 
22
                this.name = name;
17
23
                this.host = host;
18
24
                this.path = path;
19
25
                this.username = username;
20
26
                this.password = password;
 
27
                this.proxyUser = proxyUser;
 
28
                this.proxyPwd = proxyPwd;
 
29
                this.proxyHost = proxyHost;
 
30
                this.proxyPort = proxyPort;
 
31
        }
 
32
        
 
33
        public String getName() {
 
34
                return this.name;
21
35
        }
22
36
        
23
37
        public String getHost() {
29
43
        }
30
44
        
31
45
        public String getPassword() {
32
 
                return ((this.username != null && this.username.length() > 0)?this.password:"anonymous");
 
46
                return ((this.username != null && this.username.length() > 0)?this.password:TGBrowserFTPClient.DEFAULT_USER_PASSWORD);
33
47
        }
34
48
        
35
49
        public String getUsername() {
36
 
                return ((this.username != null && this.username.length() > 0)?this.username:"anonymous");
 
50
                return ((this.username != null && this.username.length() > 0)?this.username:TGBrowserFTPClient.DEFAULT_USER_NAME);
37
51
        }
38
52
        
39
53
        public String getTitle(){
40
 
                return (getHost() + ":" + getPath());
 
54
                return getName();
41
55
        }
42
56
        
 
57
        public String getProxyHost() {
 
58
                return this.proxyHost;
 
59
        }
 
60
 
 
61
        public int getProxyPort() {
 
62
                return this.proxyPort;
 
63
        }
 
64
 
 
65
        public String getProxyUser() {
 
66
                return this.proxyUser;
 
67
        }
 
68
 
 
69
        public String getProxyPwd() {
 
70
                return this.proxyPwd;
 
71
        }
 
72
 
43
73
        public String toString(){
44
74
                String username = new String( Base64Encoder.encode( getUsername().getBytes() ) );
45
75
                String password = new String( Base64Encoder.encode( getPassword().getBytes() ) );
46
 
                return getHost() + STRING_SEPARATOR + getPath() + STRING_SEPARATOR + username + STRING_SEPARATOR + password;
 
76
                String  proxyUser = new String( Base64Encoder.encode( getProxyUser().getBytes() ));
 
77
                String  proxyPwd = new String( Base64Encoder.encode( getProxyPwd().getBytes() ));
 
78
                
 
79
                return getName() + STRING_SEPARATOR + getHost() + STRING_SEPARATOR
 
80
                                + getPath() + STRING_SEPARATOR + username + STRING_SEPARATOR
 
81
                                + password + STRING_SEPARATOR + proxyUser + STRING_SEPARATOR
 
82
                                + proxyPwd + STRING_SEPARATOR + getProxyHost()
 
83
                                + STRING_SEPARATOR + getProxyPort();
47
84
        }
48
85
        
49
86
        public static TGBrowserData fromString(String string) {
50
87
                String[] data = string.split(STRING_SEPARATOR);
51
 
                if(data.length == 4){
52
 
                        String username = new String( Base64Decoder.decode( data[2].getBytes() ) );
53
 
                        String password = new String( Base64Decoder.decode( data[3].getBytes() ) );
54
 
                        return new TGBrowserDataImpl(data[0],data[1],username,password);
 
88
                if(data.length == 9){
 
89
                        String username = new String( Base64Decoder.decode( data[3].getBytes() ) );
 
90
                        String password = new String( Base64Decoder.decode( data[4].getBytes() ) );
 
91
                        String proxyUser = new String( Base64Decoder.decode( data[5].getBytes() ));
 
92
                        String proxyPwd = new String( Base64Decoder.decode( data[6].getBytes() ) );
 
93
                        return new TGBrowserDataImpl(data[0], data[1], data[2], username, password,  proxyUser, proxyPwd, data[7], Integer.parseInt(data[8]));
55
94
                }
56
95
                return null;
57
96
        }