001: /* -----------------------------------------------------------------------------
002: * Copyright (c) 2001, Low Kin Onn
003: * All rights reserved.
004: * Redistribution and use in source and binary forms, with or without
005: * modification, are permitted provided that the following conditions are met:
006: *
007: *
008: * Redistributions of source code must retain the above copyright notice, this
009: * list of conditions and the following disclaimer.
010: *
011: * Redistributions in binary form must reproduce the above copyright notice,
012: * this list of conditions and the following disclaimer in the documentation
013: * and/or other materials provided with the distribution.
014: *
015: * Neither name of the Scioworks Pte. Ltd. nor the names of its contributors
016: * may beused to endorse or promote products derived from this software without
017: * specific prior written permission.
018: *
019: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
020: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
021: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
022: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
023: * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
024: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
025: * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
026: * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
027: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
028: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
029: *
030: * -----------------------------------------------------------------------------
031: */
032:
033: package scioworks.imap.spec;
034:
035: import com.lutris.util.Config;
036: import com.lutris.util.ConfigException;
037: import com.lutris.appserver.server.Enhydra;
038:
039: public class ImapWebConstant {
040:
041: private static ImapWebConstant fSingleton;
042:
043: private String fDomain;
044: private String fSmtpHost;
045: private String fImapHost;
046: private int fImapPort;
047:
048: private String fFolderSent;
049: private String fFolderTrash;
050:
051: private String fFileTmpDir;
052: private int fFileCount;
053: private int fFileTotalSize;
054:
055: private ImapWebConstant() {
056:
057: Config config = Enhydra.getApplication().getConfig();
058:
059: try {
060: fDomain = config.getString("ImapWeb.Server.Domain");
061: fSmtpHost = config.getString("ImapWeb.Server.SmtpHost");
062: fImapHost = config.getString("ImapWeb.Server.ImapHost");
063: fImapPort = config.getInt("ImapWeb.Server.ImapPort");
064:
065: fFolderSent = config.getString("ImapWeb.Folder.FolderSent");
066: fFolderTrash = config
067: .getString("ImapWeb.Folder.FolderTrash");
068:
069: fFileTmpDir = config
070: .getString("ImapWeb.Attachment.FileTmpDir");
071: fFileCount = config.getInt("ImapWeb.Attachment.FileCount");
072: fFileTotalSize = config
073: .getInt("ImapWeb.Attachment.FileTotalSize");
074:
075: } catch (ConfigException e) {
076: e.printStackTrace();
077: }
078:
079: // Currently values are hard-coded
080: /*
081: fDomain = "scioworks.com";
082: fSmtpHost = "gecko.scioworks.com";
083: fImapHost = "gecko.scioworks.com";
084: fImapPort = 143;
085:
086: fFolderSent = "Sent";
087: fFolderTrash = "Trash";
088:
089: fFileTmpDir = "c:\\temp\\";
090: fFileCount = 3;
091: fFileTotalSize = 10 * 1024 * 1024; // size in bytes
092: */
093: }
094:
095: public static synchronized ImapWebConstant singleton() {
096: if (fSingleton == null) {
097: fSingleton = new ImapWebConstant();
098: }
099: return fSingleton;
100: }
101:
102: // Attributes retrieval methods goes here
103:
104: public String domain() {
105: return fDomain;
106: }
107:
108: public String smtpHost() {
109: return fSmtpHost;
110: }
111:
112: public String imapHost() {
113: return fImapHost;
114: }
115:
116: public int imapPort() {
117: return fImapPort;
118: }
119:
120: public String folderSent() {
121: return fFolderSent;
122: }
123:
124: public String folderTrash() {
125: return fFolderTrash;
126: }
127:
128: public String fileTmpDir() {
129: return fFileTmpDir;
130: }
131:
132: public int fileCount() {
133: return fFileCount;
134: }
135:
136: public int fileTotalSize() {
137: return fFileTotalSize;
138: }
139: }
|