001: /*
002: *
003: * Copyright (c) 2004 SourceTap - www.sourcetap.com
004: *
005: * The contents of this file are subject to the SourceTap Public License
006: * ("License"); You may not use this file except in compliance with the
007: * License. You may obtain a copy of the License at http://www.sourcetap.com/license.htm
008: * Software distributed under the License is distributed on an "AS IS" basis,
009: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
010: * the specific language governing rights and limitations under the License.
011: *
012: * The above copyright notice and this permission notice shall be included
013: * in all copies or substantial portions of the Software.
014: *
015: */
016:
017: package com.sourcetap.sfa.util;
018:
019: import java.util.HashMap;
020: import java.util.Map;
021: import java.util.ResourceBundle;
022:
023: /**
024: * Generic Entity - Entity Group Definition Reader
025: *
026: * @author <a href="mailto:jonesde@ofbiz.org">David E. Jones</a>
027: * @created May 15, 2001
028: * @version 1.0
029: */
030: public class EmailProperties {
031: private static EmailProperties emailProperties_ = null;
032: public static final String SFA_PROPERTIES_FILE = "sfa";
033: public Map emailPropertiesTable = new HashMap();
034: public String relayHost = "localhost";
035: public boolean smtpDebug = false;
036: public String notifyLink = "http://localhost:8080/sfa/control/leadDetail?action=show&leadId=";
037: public boolean sendEmail = true;
038: public String sendEmailFrom = "admin@sourcetap.com";
039: public boolean sendSMS = true;
040: public String sendSMSFrom = "admin@sourcetap.com";
041:
042: public EmailProperties() {
043: ResourceBundle res = ResourceBundle
044: .getBundle(SFA_PROPERTIES_FILE);
045:
046: if (res != null) {
047: try {
048: String value = res.getString("smtp.relay.host");
049:
050: if (value != null) {
051: relayHost = value;
052: }
053: } catch (Exception e) {
054: }
055:
056: try {
057: String value = res.getString("lead.notify.link.url");
058:
059: if (value != null) {
060: notifyLink = value;
061: }
062: } catch (Exception e) {
063: }
064:
065: try {
066: String value = res.getString("lead.notify.email.from");
067:
068: if (value != null) {
069: sendEmailFrom = value;
070: }
071: } catch (Exception e) {
072: }
073:
074: try {
075: String value = res.getString("lead.notify.sms.from");
076:
077: if (value != null) {
078: sendSMSFrom = value;
079: }
080: } catch (Exception e) {
081: }
082:
083: try {
084: String value = res.getString("lead.notify.smtp.debug");
085:
086: if (value != null) {
087: smtpDebug = "true".equals(value);
088: }
089: } catch (Exception e) {
090: }
091:
092: try {
093: String value = res.getString("lead.notify.email.send");
094:
095: if (value != null) {
096: sendEmail = "true".equals(value);
097: }
098: } catch (Exception e) {
099: }
100:
101: try {
102: String value = res.getString("lead.notify.sms.send");
103:
104: if (value != null) {
105: sendSMS = "true".equals(value);
106: }
107: } catch (Exception e) {
108: }
109: }
110: }
111:
112: /**
113: * DOCUMENT ME!
114: *
115: * @return
116: */
117: public static EmailProperties getInstance() {
118: if (emailProperties_ == null) {
119: synchronized (EmailProperties.class) {
120: if (emailProperties_ == null) {
121: emailProperties_ = new EmailProperties();
122: }
123: }
124: }
125:
126: return emailProperties_;
127: }
128: }
|