Source Code Cross Referenced for Pooka.java in  » Mail-Clients » pooka » net » suberic » pooka » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Mail Clients » pooka » net.suberic.pooka 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.suberic.pooka;
002:
003:        import net.suberic.pooka.gui.*;
004:        import net.suberic.util.VariableBundle;
005:        import net.suberic.pooka.resource.*;
006:
007:        import java.awt.*;
008:        import javax.swing.*;
009:        import javax.help.*;
010:        import java.util.logging.*;
011:
012:        public class Pooka {
013:
014:            /** The configuration for this instance of Pooka. */
015:            public static PookaManager sManager;
016:
017:            /**
018:             * Runs Pooka.  Takes the following arguments:
019:             *
020:             * -nf 
021:             * --noOpenSavedFolders    don't open saved folders on startup.
022:             * 
023:             * -rc [FILE]
024:             * --rcfile [FILE]    use the given file as the pooka startup file.
025:             *
026:             * --http [URL]   runs with a configuration file loaded via http
027:             *
028:             * --help shows these options.
029:             */
030:            static public void main(String argv[]) {
031:                sManager = new PookaManager();
032:                sStartupManager = new StartupManager(sManager);
033:                sStartupManager.runPooka(argv);
034:            }
035:
036:            public static StartupManager sStartupManager = null;
037:
038:            /**
039:             * Loads the initial resources for Pooka.  These are used during startup.
040:             */
041:            public static void loadInitialResources() {
042:                try {
043:                    ClassLoader cl = new Pooka().getClass().getClassLoader();
044:                    java.net.URL url;
045:                    if (cl == null) {
046:                        url = ClassLoader
047:                                .getSystemResource("net/suberic/pooka/Pookarc");
048:                    } else {
049:                        url = cl.getResource("net/suberic/pooka/Pookarc");
050:                    }
051:
052:                    if (url == null) {
053:                        //sigh
054:                        url = new Pooka().getClass().getResource(
055:                                "/net/suberic/pooka/Pookarc");
056:                    }
057:
058:                    java.io.InputStream is = url.openStream();
059:                    VariableBundle resources = new net.suberic.util.VariableBundle(
060:                            is, "net.suberic.pooka.Pooka");
061:                    sManager.setResources(resources);
062:                } catch (Exception e) {
063:                    System.err
064:                            .println("caught exception loading system resources:  "
065:                                    + e);
066:                    e.printStackTrace();
067:                    System.exit(-1);
068:                }
069:            }
070:
071:            /**
072:             * Loads all the resources for Pooka.
073:             */
074:            public static void loadResources(boolean pUseLocalFiles,
075:                    boolean pUseHttp) {
076:                if (sManager == null || sManager.getResources() == null) {
077:                    System.err
078:                            .println("Error starting up Pooka:  No system resource files found.");
079:                    System.exit(-1);
080:                }
081:
082:                try {
083:                    net.suberic.util.VariableBundle pookaDefaultBundle = sManager
084:                            .getResources();
085:                    ResourceManager resourceManager = null;
086:
087:                    if (!pUseLocalFiles
088:                            || pookaDefaultBundle.getProperty(
089:                                    "Pooka.useLocalFiles", "true")
090:                                    .equalsIgnoreCase("false")) {
091:                        resourceManager = new DisklessResourceManager();
092:                    } else {
093:                        resourceManager = new FileResourceManager();
094:                    }
095:
096:                    sManager.setResourceManager(resourceManager);
097:
098:                    // if localrc hasn't been set, use the user's home directory.
099:                    if (sManager.getLocalrc() == null) {
100:                        String localrc = new String(System
101:                                .getProperty("user.home")
102:                                + System.getProperty("file.separator")
103:                                + ".pookarc");
104:                        sManager.setLocalrc(localrc);
105:                    }
106:                    sManager.setResources(sManager.getResourceManager()
107:                            .createVariableBundle(sManager.getLocalrc(),
108:                                    pookaDefaultBundle));
109:                } catch (Exception e) {
110:                    System.err.println("caught exception:  " + e);
111:                    e.printStackTrace();
112:                }
113:
114:                if (pUseHttp
115:                        || sManager.getResources().getProperty(
116:                                "Pooka.httpConfig", "false").equalsIgnoreCase(
117:                                "true")) {
118:                    net.suberic.pooka.gui.LoadHttpConfigPooka configPooka = new net.suberic.pooka.gui.LoadHttpConfigPooka();
119:                    configPooka.start();
120:                }
121:            }
122:
123:            /**
124:             * Exits Pooka.  Attempts to close all stores first.
125:             */
126:            public static void exitPooka(int exitValue, Object pSource) {
127:                final int fExitValue = exitValue;
128:                final Object fSource = pSource;
129:                Runnable runMe = new Runnable() {
130:                    public void run() {
131:                        sStartupManager.stopMainPookaWindow(fSource);
132:                        System.exit(fExitValue);
133:                    }
134:                };
135:
136:                if (Pooka.getMainPanel() != null)
137:                    Pooka.getMainPanel().setCursor(
138:                            java.awt.Cursor
139:                                    .getPredefinedCursor(Cursor.WAIT_CURSOR));
140:
141:                Thread shutdownThread = new Thread(runMe);
142:                shutdownThread.start();
143:            }
144:
145:            /**
146:             * Convenience method for getting Pooka configuration properties.  Calls
147:             * getResources().getProperty(propName, defVal).
148:             */
149:            static public String getProperty(String propName, String defVal) {
150:                return (getResources().getProperty(propName, defVal));
151:            }
152:
153:            /**
154:             * Convenience method for getting Pooka configuration properties.  Calls
155:             * getResources().getProperty(propName).
156:             */
157:            static public String getProperty(String propName) {
158:                return (getResources().getProperty(propName));
159:            }
160:
161:            /**
162:             * Convenience method for setting Pooka configuration properties.  Calls
163:             * getResources().setProperty(propName, propValue).
164:             */
165:            static public void setProperty(String propName, String propValue) {
166:                getResources().setProperty(propName, propValue);
167:            }
168:
169:            /**
170:             * Returns the VariableBundle which provides all of the Pooka resources.
171:             */
172:            static public net.suberic.util.VariableBundle getResources() {
173:                return sManager.getResources();
174:            }
175:
176:            /**
177:             * Sets the VariableBundle which provides all of the Pooka resources.
178:             */
179:            static public void setResources(
180:                    net.suberic.util.VariableBundle pResources) {
181:                sManager.setResources(pResources);
182:            }
183:
184:            /**
185:             * Returns whether or not debug is enabled for this Pooka instance.
186:             * 
187:             * @deprecated Use Logger.getLogger("Pooka.debug") instead.
188:             * 
189:             */
190:            static public boolean isDebug() {
191:                if (getResources().getProperty("Pooka.debug", "true").equals(
192:                        "true"))
193:                    return true;
194:                else if (Logger.getLogger("Pooka.debug").isLoggable(Level.FINE))
195:                    return true;
196:                else
197:                    return false;
198:            }
199:
200:            /**
201:             * Returns the DateFormatter used by Pooka.
202:             */
203:            static public DateFormatter getDateFormatter() {
204:                return sManager.getDateFormatter();
205:            }
206:
207:            /**
208:             * Returns the mailcap command map.  This is what is used to determine
209:             * which external programs are used to handle files of various MIME
210:             * types.
211:             */
212:            static public javax.activation.CommandMap getMailcap() {
213:                return sManager.getMailcap();
214:            }
215:
216:            /**
217:             * Returns the Mime Types map.  This is used to map file extensions to
218:             * MIME types.
219:             */
220:            static public javax.activation.MimetypesFileTypeMap getMimeTypesMap() {
221:                return sManager.getMimeTypesMap();
222:            }
223:
224:            /**
225:             * Gets the default mail Session for Pooka.
226:             */
227:            static public javax.mail.Session getDefaultSession() {
228:                return sManager.getDefaultSession();
229:            }
230:
231:            /**
232:             * Gets the default authenticator for Pooka.
233:             */
234:            static public javax.mail.Authenticator getDefaultAuthenticator() {
235:                return sManager.getDefaultAuthenticator();
236:            }
237:
238:            /**
239:             * Gets the Folder Tracker thread.  This is the thread that monitors the
240:             * individual folders and checks to make sure that they stay connected,
241:             * checks for new email, etc.
242:             */
243:            static public net.suberic.pooka.thread.FolderTracker getFolderTracker() {
244:                return sManager.getFolderTracker();
245:            }
246:
247:            /**
248:             * Gets the Pooka Main Panel.  This is the root of the entire Pooka UI.
249:             */
250:            static public MainPanel getMainPanel() {
251:                return sManager.getMainPanel();
252:            }
253:
254:            /**
255:             * The Store Manager.  This tracks all of the Mail Stores that Pooka knows
256:             * about.
257:             */
258:            static public StoreManager getStoreManager() {
259:                return sManager.getStoreManager();
260:            }
261:
262:            /**
263:             * The Search Manager.  This manages the Search Terms that Pooka knows 
264:             * about, and also can be used to construct Search queries from sets
265:             * of properties.
266:             */
267:            static public SearchTermManager getSearchManager() {
268:                return sManager.getSearchManager();
269:            }
270:
271:            /**
272:             * The UIFactory for Pooka.  This is used to create just about all of the
273:             * graphical UI components for Pooka.  Usually this is either an instance
274:             * of PookaDesktopPaneUIFactory or PookaPreviewPaneUIFactory, for the
275:             * Desktop and Preview UI styles, respectively.
276:             */
277:            static public PookaUIFactory getUIFactory() {
278:                return sManager.getUIFactory();
279:            }
280:
281:            /**
282:             * The Search Thread.  This is the thread that folder searches are done
283:             * on.
284:             */
285:            static public net.suberic.util.thread.ActionThread getSearchThread() {
286:                return sManager.getSearchThread();
287:            }
288:
289:            /**
290:             * The Address Book Manager keeps track of all of the configured Address 
291:             * Books.
292:             */
293:            static public AddressBookManager getAddressBookManager() {
294:                return sManager.getAddressBookManager();
295:            }
296:
297:            /**
298:             * The ConnectionManager tracks the configured Network Connections.
299:             */
300:            static public NetworkConnectionManager getConnectionManager() {
301:                return sManager.getConnectionManager();
302:            }
303:
304:            /**
305:             * The OutgoingMailManager tracks the various SMTP server that Pooka can
306:             * use to send mail.
307:             */
308:            static public OutgoingMailServerManager getOutgoingMailManager() {
309:                return sManager.getOutgoingMailManager();
310:            }
311:
312:            /**
313:             * The EncryptionManager, not surprisingly, manages Pooka's encryption
314:             * facilities.
315:             */
316:            public static PookaEncryptionManager getCryptoManager() {
317:                return sManager.getCryptoManager();
318:            }
319:
320:            /**
321:             * The HelpBroker is used to bring up the Pooka help system.
322:             */
323:            static public HelpBroker getHelpBroker() {
324:                return sManager.getHelpBroker();
325:            }
326:
327:            /**
328:             * The ResourceManager controls access to resource files.
329:             */
330:            static public ResourceManager getResourceManager() {
331:                return sManager.getResourceManager();
332:            }
333:
334:            /**
335:             * The SSL Trust Manager.
336:             */
337:            static public net.suberic.pooka.ssl.PookaTrustManager getTrustManager() {
338:                return sManager.getTrustManager();
339:            }
340:
341:            /**
342:             * The SSL Trust Manager.
343:             */
344:            static public void setTrustManager(
345:                    net.suberic.pooka.ssl.PookaTrustManager pTrustManager) {
346:                sManager.setTrustManager(pTrustManager);
347:            }
348:
349:            /**
350:             * The Log Manager.
351:             */
352:            static public PookaLogManager getLogManager() {
353:                return sManager.getLogManager();
354:            }
355:
356:            /**
357:             * The Pooka configuration manager itself.
358:             */
359:            static public PookaManager getPookaManager() {
360:                return sManager;
361:            }
362:
363:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.