Source Code Cross Referenced for Monitor.java in  » Search-Engine » BDDBot » bdd » search » 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 » Search Engine » BDDBot » bdd.search 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package bdd.search;
002:
003:        import java.awt.Frame;
004:        import java.awt.Panel;
005:        import java.awt.List;
006:        import java.awt.BorderLayout;
007:        import java.awt.FlowLayout;
008:        import java.awt.Label;
009:        import java.awt.Checkbox;
010:        import java.awt.GridLayout;
011:        import java.awt.Button;
012:        import java.awt.Event;
013:        import java.net.URL;
014:        import bdd.search.spider.Crawler;
015:        import bdd.search.query.QueryWebServer;
016:
017:        /** Written by Tim Macinta 1997                           <br>
018:         *  Distributed under the GNU Public License
019:         *       (a copy of which is enclosed with the source).   <br>
020:         *                                                        <br> 
021:         *  Provides a graphical monitor to watch the progress of
022:         *  the crawler and the search engine.
023:         */
024:
025:        public class Monitor extends Frame {
026:
027:            EnginePrefs prefs; // preferences
028:            List query_list; // list of queries
029:            List url_list; // list of indexed URLs
030:            List error_list; // list of URLs with errors
031:            Checkbox track_queries;
032:            Checkbox track_urls;
033:            Button clear_urls;
034:            Button clear_queries;
035:            Button start_crawler;
036:            Label current_url;
037:            Label bytes_indexed;
038:
039:            /** Starts a monitor with the custom web server running on the default
040:             *  port.  */
041:            public Monitor() {
042:                this (EnginePrefs.port);
043:            }
044:
045:            /** Starts a monitor with the custom web server running on the
046:             *  specified port.         */
047:            public Monitor(int port) {
048:                super ("BDDBot");
049:                prefs = new EnginePrefs();
050:                Panel p = new Panel();
051:                setLayout(new GridLayout(0, 1));
052:
053:                // set up query monitor
054:
055:                add(p);
056:                p.setLayout(new BorderLayout());
057:                Panel p2 = new Panel();
058:                p2.setLayout(new FlowLayout());
059:                p.add("North", p2);
060:                p.add("Center", query_list = new List());
061:                p2
062:                        .add(track_queries = new Checkbox("Watch Queries",
063:                                null, true));
064:                p2.add(clear_queries = new Button("Clear List"));
065:                p2.add(start_crawler = new Button("Start Crawler"));
066:                p.add("South", new Label("_______________________________",
067:                        Label.CENTER));
068:
069:                // set up spider monitor
070:
071:                add(p = new Panel());
072:                p.setLayout(new BorderLayout());
073:                p.add("North", p2 = new Panel());
074:                p2.setLayout(new GridLayout(0, 1));
075:                p2.add(current_url = new Label("Current URL:"));
076:                p2.add(bytes_indexed = new Label("Total Bytes:  0"));
077:                p.add("Center", url_list = new List());
078:                add(p = new Panel());
079:                p.setLayout(new BorderLayout());
080:                p.add("Center", error_list = new List());
081:                p2 = new Panel();
082:                p2.setLayout(new FlowLayout());
083:                p2.add(track_urls = new Checkbox("Watch Indexed URLs", null,
084:                        true));
085:                p2.add(clear_urls = new Button("Clear URL List"));
086:                p.add("South", p2);
087:
088:                // work around a bug in the Java 1.0 List
089:
090:                for (int i = 0; i < 200; i++) {
091:                    query_list.addItem("");
092:                    url_list.addItem("");
093:                    error_list.addItem("");
094:                }
095:                resize(408, 469);
096:                show(); // display this monitor
097:                clearQueryList();
098:                clearURLList();
099:                clearErrorList();
100:
101:                // register this monitor and start the web server
102:
103:                prefs.monitor = this ;
104:                new QueryWebServer(port, prefs);
105:            }
106:
107:            public boolean action(Event evt, Object what) {
108:                if (evt.target == clear_urls) {
109:                    clearURLList();
110:                    clearErrorList();
111:                } else if (evt.target == clear_queries) {
112:                    clearQueryList();
113:                } else if (evt.target == start_crawler) {
114:                    start_crawler.disable();
115:                    Crawler.main(prefs.getStartingFile(), prefs);
116:                }
117:                return super .action(evt, what);
118:            }
119:
120:            /** Call this method when a new URL is being indexed.  */
121:            public void indexing(URL current_url) {
122:                if (track_urls.getState()) {
123:                    String u = current_url.toString();
124:                    url_list.addItem(u);
125:                    this .current_url.setText("Current URL:  " + u);
126:                    this .url_list.makeVisible(this .url_list.countItems() - 1);
127:                }
128:            }
129:
130:            /** Call this method when a new query is being placed.  */
131:            public void querying(String words) {
132:                if (track_queries.getState()) {
133:                    query_list.addItem(words);
134:                    if (query_list.countItems() > 201) {
135:                        query_list.delItem(2);
136:                    }
137:                    query_list.makeVisible(query_list.countItems() - 1);
138:                }
139:            }
140:
141:            /** Call this method to report an error during crawling. */
142:            public void reportError(URL bad_url) {
143:                if (track_urls.getState()) {
144:                    error_list.addItem(bad_url.toString());
145:                    error_list.makeVisible(error_list.countItems() - 1);
146:                }
147:            }
148:
149:            /** Call this method when a crawler has finished crawling. */
150:            public void crawlerDone(Crawler c) {
151:                start_crawler.enable();
152:            }
153:
154:            public void clearURLList() {
155:                url_list.clear();
156:                url_list.addItem("Processed");
157:                url_list.addItem("---------");
158:            }
159:
160:            public void clearErrorList() {
161:                error_list.clear();
162:                error_list.addItem("Errors");
163:                error_list.addItem("------");
164:            }
165:
166:            public void clearQueryList() {
167:                query_list.clear();
168:                query_list.addItem("Queries");
169:                query_list.addItem("-------");
170:            }
171:
172:            public void bytesIndexed(long total_bytes) {
173:                this .bytes_indexed.setText("Total Bytes:  " + total_bytes);
174:            }
175:
176:            public static void main(String arg[]) {
177:                new Monitor();
178:            }
179:
180:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.