KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > networkplaces > DefaultNetworkPlace


1 /*
2  * SSL-Explorer
3  *
4  * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */

19             
20 package com.sslexplorer.networkplaces;
21
22 import java.util.Calendar JavaDoc;
23
24 import com.sslexplorer.boot.Util;
25 import com.sslexplorer.policyframework.AbstractResource;
26 import com.sslexplorer.policyframework.LaunchSession;
27 import com.sslexplorer.security.SessionInfo;
28 import com.sslexplorer.vfs.utils.URI.MalformedURIException;
29
30 public class DefaultNetworkPlace extends AbstractResource implements NetworkPlace {
31     // Private instance variables
32

33     private String JavaDoc host;
34     private String JavaDoc uri;
35     private int port;
36     private String JavaDoc username;
37     private String JavaDoc password;
38     private int type;
39     private boolean readOnly;
40     private boolean showHidden;
41     private boolean allowResursive;
42     private boolean noDelete;
43     private String JavaDoc scheme;
44
45     public DefaultNetworkPlace(int realmID, int uniqueId, String JavaDoc scheme, String JavaDoc shortName, String JavaDoc description, String JavaDoc uri, int type, boolean readOnly,
46                                boolean allowResursive, boolean noDelete, boolean showHidden,
47                                Calendar JavaDoc dateCreated, Calendar JavaDoc dateAmended) throws MalformedURIException {
48         super(realmID, NetworkPlacePlugin.NETWORK_PLACE_RESOURCE_TYPE, uniqueId, shortName, description, dateCreated,
49                         dateAmended);
50         this.host = "";
51         this.uri = uri;
52         this.port = 0;
53         this.username = "";
54         this.password = "";
55         this.scheme = scheme;
56         this.type = type;
57         this.readOnly = readOnly;
58         this.showHidden = showHidden;
59         this.allowResursive = allowResursive;
60         this.noDelete = noDelete;
61     }
62     
63     public DefaultNetworkPlace(int realmID, int uniqueId, String JavaDoc scheme, String JavaDoc shortName, String JavaDoc description, String JavaDoc host, String JavaDoc uri, int port, String JavaDoc username, String JavaDoc password, int type, boolean readOnly,
64                                boolean allowResursive, boolean noDelete, boolean showHidden,
65                                Calendar JavaDoc dateCreated, Calendar JavaDoc dateAmended) throws MalformedURIException {
66         super(realmID, NetworkPlacePlugin.NETWORK_PLACE_RESOURCE_TYPE, uniqueId, shortName, description, dateCreated,
67                         dateAmended);
68         this.host = host;
69         this.uri = uri;
70         this.port = port;
71         this.username = username;
72         this.password = password;
73         this.scheme = scheme;
74         this.type = type;
75         this.readOnly = readOnly;
76         this.showHidden = showHidden;
77         this.allowResursive = allowResursive;
78         this.noDelete = noDelete;
79     }
80     
81     public void replaceParameters(SessionInfo session) {
82         
83     }
84
85     public String JavaDoc getPath() {
86         return uri;
87     }
88
89     public void setPath(String JavaDoc uri) {
90         this.uri = uri;
91     }
92
93     public int getType() {
94         return type;
95     }
96
97     public void setType(int type) {
98         this.type = type;
99     }
100
101     public boolean isAllowRecursive() {
102         return allowResursive;
103     }
104
105     public void setAllowResursive(boolean allowResursive) {
106         this.allowResursive = allowResursive;
107     }
108
109     public boolean isNoDelete() {
110         return noDelete;
111     }
112
113     public void setNoDelete(boolean noDelete) {
114         this.noDelete = noDelete;
115     }
116
117     public boolean isReadOnly() {
118         return readOnly;
119     }
120
121     public void setReadOnly(boolean readOnly) {
122         this.readOnly = readOnly;
123     }
124
125     public boolean isShowHidden() {
126         return showHidden;
127     }
128
129     public void setShowHidden(boolean showHidden) {
130         this.showHidden = showHidden;
131     }
132
133     public String JavaDoc getScheme() {
134         return scheme;
135     }
136
137     public void setScheme(String JavaDoc scheme) {
138         this.scheme = scheme;
139     }
140
141     public String JavaDoc getPassword() {
142         return password;
143     }
144
145     public void setPassword(String JavaDoc password) {
146         this.password = password;
147     }
148
149     public String JavaDoc getUsername() {
150         return username;
151     }
152
153     public void setUsername(String JavaDoc username) {
154         this.username = username;
155     }
156
157     public String JavaDoc getHost() {
158         return host;
159     }
160
161     public void setHost(String JavaDoc host) {
162         this.host = host;
163     }
164     
165     public int getPort() {
166         return port;
167     }
168
169     public void setPort(int port) {
170         this.port = port;
171     }
172
173     public boolean paramsRequirePassword() {
174         if (uri.contains("${session:password}")){
175             return true;
176         }
177         else{
178             return false;
179         }
180     }
181
182     public String JavaDoc getLaunchUri(LaunchSession launchSession) {
183         return "fileSystem.do?actionTarget=launch&" + LaunchSession.LAUNCH_ID + "=" + launchSession.getId() + "&path=" +
184         Util.urlEncode(((NetworkPlace)launchSession.getResource()).getScheme() + "/" + launchSession.getResource().getResourceName());
185     }
186     
187 }
188
Popular Tags