001: package com.sun.portal.netfile.applet.java2.model;
002:
003: import java.util.Hashtable;
004:
005: public class SystemNode extends NetFileNode {
006:
007: private static final String ICON_NAME = "host16.gif";
008: private static final String OPEN_ICON_NAME = "host16.gif";
009: private static final String DENIED_HOST_ICON_NAME = "deniedHost16.gif";
010:
011: private String type;
012: private String domain;
013: private String userId;
014: private String password;
015: private String canonicalEncodingName;
016: private String encodingString;
017: private boolean allowedSystemNode;
018: private boolean isCommonHost;
019:
020: public SystemNode(String name, String type, String domain,
021: String userName, String password, String encodingCanonName,
022: String encodingString) {
023: this (name, type, domain, userName, password, encodingCanonName,
024: encodingString, true);
025: }
026:
027: public SystemNode(String name, String type, String domain,
028: String userName, String password, String encodingCanonName,
029: String encodingString, boolean allowedSystemNode) {
030: super (name, ICON_NAME, OPEN_ICON_NAME);
031: this .type = type;
032: this .domain = domain;
033: this .userId = userName;
034: this .password = password;
035: this .canonicalEncodingName = encodingCanonName;
036: this .encodingString = encodingString;
037: this .allowedSystemNode = allowedSystemNode;
038: this .isCommonHost = false;
039: if (!allowedSystemNode) {
040: setIconNames(DENIED_HOST_ICON_NAME, DENIED_HOST_ICON_NAME);
041: }
042:
043: }
044:
045: public String getDomain() {
046: return (domain == null) ? "" : domain;
047: }
048:
049: public void setDomain(String domain) {
050: this .domain = domain;
051: }
052:
053: public String getType() {
054: return (type == null) ? "" : type;
055: }
056:
057: public void setType(String type) {
058: this .type = type;
059: }
060:
061: public String getUserName() {
062: return (userId == null) ? "" : userId;
063: }
064:
065: public String getPassword() {
066: return (password == null) ? "" : password;
067: }
068:
069: public void setUserName(String userName) {
070: this .userId = userName;
071:
072: }
073:
074: public void setPassword(String password) {
075: this .password = password;
076: }
077:
078: public void setCommonHost() {
079: isCommonHost = true;
080: }
081:
082: public boolean isCommonHost() {
083: return isCommonHost;
084: }
085:
086: public String getCharSet() {
087: return encodingString;
088: }
089:
090: public void setCharSet(String charSetString) {
091: this .encodingString = charSetString;
092: }
093:
094: public String getCanonicalEncodingName() {
095: return canonicalEncodingName;
096: }
097:
098: public void setCanonicalEncodingName(String canonicalEncoding) {
099: this .canonicalEncodingName = canonicalEncoding;
100: }
101:
102: public boolean isAllowedSystemNode() {
103: return this .allowedSystemNode;
104: }
105:
106: public void addShareNode(ShareNode shareNode) {
107: addChildNode(shareNode);
108: }
109:
110: public ShareNode getShareNode(String shareName) {
111: return (ShareNode) getChildNode(shareName);
112: }
113:
114: public ShareNode removeShareNode(String shareName) {
115: return (ShareNode) removeChildNode(shareName);
116:
117: }
118:
119: public ShareNode[] getAllShareNodes() {
120: return (ShareNode[]) getAllChildren(new ShareNode[0]);
121: }
122:
123: public Hashtable toHashtable() {
124:
125: Hashtable ret = new Hashtable(6);
126: ret.put("SystemName", getName());
127: ret.put("NTDomName", getDomain());
128: ret.put("UserID", getUserName());
129: ret.put("Pwd", getPassword());
130: ret.put("SysType", getType());
131: ret.put("CharSet", getCharSetKey());
132: return ret;
133:
134: }
135:
136: private String getCharSetKey() {
137: if (canonicalEncodingName == null) {
138: return null;
139: }
140:
141: //String ret = charSet.substring(charSet.indexOf("(") + 1, charSet.indexOf(")"));
142: //return ret;
143: return canonicalEncodingName;
144: }
145:
146: }
|