001: /**
002: * Copyright 2005 Sun Microsystems, Inc. All
003: * rights reserved. Use of this product is subject
004: * to license terms. Federal Acquisitions:
005: * Commercial Software -- Government Users
006: * Subject to Standard License Terms and
007: * Conditions.
008: *
009: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
010: * are trademarks or registered trademarks of Sun Microsystems,
011: * Inc. in the United States and other countries.
012: */package com.sun.portal.admin.console.search;
013:
014: import java.util.*;
015:
016: import com.sun.portal.admin.console.common.PSBaseBean;
017:
018: public class ImportAgentBean extends PSBaseBean {
019:
020: public String id = "";
021: public boolean enabled = false;
022: public String destinationDatabase = "";
023: public String inputFile = "";
024: public String inputFileExists = "";
025: public String nickName = "";
026: public String characterSet = "";
027: public boolean compass301x = false;
028: public boolean ssl = false;
029: public String server = "";
030: public String port = "";
031: public String instance = "";
032: public String uri = "";
033: public String database = "";
034: public String user = "";
035: public String password = "";
036: public boolean searchQuery = false;
037: public String scope = "";
038: public String viewAttributes = "";
039: public String viewHits = "";
040: public String lastCollectionTime = "";
041: public String timeOut = "";
042:
043: public void initialize(Properties p) {
044: id = getStringValue(p, "id");
045: enabled = getBooleanValue(p, "enabled");
046: destinationDatabase = getStringValue(p, "destination-database");
047: inputFile = getStringValue(p, "input-file");
048: inputFileExists = getStringValue(p, "input-file-exists");
049: nickName = getStringValue(p, "nickname");
050: characterSet = getStringValue(p, "character-set");
051: compass301x = getBooleanValue(p, "is-compass301x");
052: ssl = getBooleanValue(p, "is-ssl");
053: server = getStringValue(p, "server");
054: port = getStringValue(p, "port");
055: instance = getStringValue(p, "instance");
056: uri = getStringValue(p, "uri");
057: database = getStringValue(p, "database");
058: user = getStringValue(p, "user");
059: password = getStringValue(p, "password");
060: searchQuery = getBooleanValue(p, "is-search-query");
061: scope = getStringValue(p, "scope");
062: viewAttributes = getStringValue(p, "view-attributes");
063: viewHits = getStringValue(p, "view-hits");
064: lastCollectionTime = getStringValue(p, "last-collection-time");
065: timeOut = getStringValue(p, "timeout");
066: }
067:
068: public String getId() {
069: return id;
070: }
071:
072: public void setId(String id) {
073: this .id = id;
074: }
075:
076: public String getAgent() {
077: return (!nickName.equals("")) ? nickName : inputFile;
078: }
079:
080: public void setAgent(String agent) {
081: if (!nickName.equals("")) {
082: nickName = agent;
083: } else {
084: inputFile = agent;
085: }
086: }
087:
088: public String getEnabled() {
089: return (enabled) ? getLocalizedString("search",
090: "search.general.enabled") : getLocalizedString(
091: "search", "search.general.disabled");
092: }
093:
094: public void setEnabled(String enabled) {
095: this .enabled = (enabled.equals(getLocalizedString("search",
096: "search.general.enabled"))) ? true : false;
097: }
098:
099: public boolean getInputFileMissing() {
100: return (inputFileExists.equals("false")) ? true : false;
101: }
102:
103: private String getStringValue(Properties p, String key) {
104: if (p.containsKey(key)) {
105: return p.getProperty(key);
106: } else {
107: return "";
108: }
109: }
110:
111: private boolean getBooleanValue(Properties p, String key) {
112: if (p.containsKey(key)) {
113: return p.getProperty(key).equals("true") ? true : false;
114: } else {
115: return false;
116: }
117: }
118:
119: }
|