1 19 20 package com.sslexplorer.networkplaces; 21 22 import java.util.Calendar ; 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 33 private String host; 34 private String uri; 35 private int port; 36 private String username; 37 private String password; 38 private int type; 39 private boolean readOnly; 40 private boolean showHidden; 41 private boolean allowResursive; 42 private boolean noDelete; 43 private String scheme; 44 45 public DefaultNetworkPlace(int realmID, int uniqueId, String scheme, String shortName, String description, String uri, int type, boolean readOnly, 46 boolean allowResursive, boolean noDelete, boolean showHidden, 47 Calendar dateCreated, Calendar 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 scheme, String shortName, String description, String host, String uri, int port, String username, String password, int type, boolean readOnly, 64 boolean allowResursive, boolean noDelete, boolean showHidden, 65 Calendar dateCreated, Calendar 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 getPath() { 86 return uri; 87 } 88 89 public void setPath(String 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 getScheme() { 134 return scheme; 135 } 136 137 public void setScheme(String scheme) { 138 this.scheme = scheme; 139 } 140 141 public String getPassword() { 142 return password; 143 } 144 145 public void setPassword(String password) { 146 this.password = password; 147 } 148 149 public String getUsername() { 150 return username; 151 } 152 153 public void setUsername(String username) { 154 this.username = username; 155 } 156 157 public String getHost() { 158 return host; 159 } 160 161 public void setHost(String 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 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
|