Source Code Cross Referenced for RobotPropertyBean.java in  » Portal » Open-Portal » com » sun » portal » admin » console » 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 » Portal » Open Portal » com.sun.portal.admin.console.search 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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:        import java.util.logging.Level;
016:        import java.io.IOException;
017:        import java.text.*;
018:
019:        import javax.faces.application.FacesMessage;
020:        import javax.faces.component.UIComponent;
021:        import javax.faces.validator.*;
022:        import javax.faces.context.FacesContext;
023:        import javax.faces.el.ValueBinding;
024:        import javax.management.ObjectName;
025:        import javax.management.MBeanServerConnection;
026:
027:        import com.sun.data.provider.DataProvider;
028:        import com.sun.data.provider.impl.ObjectListDataProvider;
029:        import com.sun.web.ui.component.RadioButton;
030:        import com.sun.web.ui.model.Option;
031:        import com.sun.web.ui.model.OptionsList;
032:
033:        import com.sun.portal.admin.common.util.AdminClientUtil;
034:        import com.sun.portal.admin.console.common.PSBaseBean;
035:
036:        public class RobotPropertyBean extends PSBaseBean {
037:
038:            //Crawling properties
039:            private String serverDelay = "0";
040:            private String maxConn = "8";
041:            private String maxConnSite = "2";
042:            private String rdIndex = "30";
043:
044:            private String scriptLaunch = "cmdHook0";
045:            private String afterProcess = "idle";
046:            private String contactEmail = "";
047:
048:            private String logLevel = "1";
049:
050:            private String userAgent = "User Agent";
051:            private String robotsTxt = "false";
052:
053:            private String performAuth = "true";
054:            private String robotUser = "";
055:            private String robotPass = "";
056:            private String proxyUser = "";
057:            private String proxyPass = "";
058:
059:            private String proxyType = "direct";
060:            private String autoProxy = "local";
061:            private String autoProxyLoc = "";
062:            private String httpProxy = "";
063:            private String httpsProxy = "";
064:            private String ftpProxy = "";
065:
066:            private String useCookies = "false";
067:            private String useIP = "true";
068:            private String smartHost = "false";
069:            private String resolveHost = "false";
070:            private String anyHost = "false";
071:            private String defaultStart = "10";
072:            private String workDir = "";
073:            private String stateDir = "";
074:
075:            private String linkFromHtml = "true";
076:            private String linkFromPlain = "false";
077:            private String maxHtmlLinks = "1024";
078:            private String maxPlainLinks = "1024";
079:
080:            //Indexing properties
081:            private String index = "partial";
082:            private String extract = "4096";
083:            private String extractTOC = "true";
084:            private String extractMETA = "true";
085:            private String allowNoClass = "true";
086:            private String convertTimeout = "600";
087:            private ArrayList converters = new ArrayList();
088:
089:            //UI Options 
090:            private Option[] serverdelayOption;
091:            private Option[] maxconnOption;
092:            private Option[] maxconnsiteOption;
093:            private Option[] rdindexOption;
094:            private Option[] scriptOption;
095:            private Option[] processOption;
096:            private Option[] loglevelOption;
097:            private Option[] performauthOption;
098:            private Option[] proxytypeOption;
099:            private Option[] autoproxyOption;
100:            private Option[] defaultstartOption;
101:            private Option[] indexOption;
102:            private Option[] converterOption;
103:
104:            private Option[] radioOption;
105:
106:            //private data
107:            private HashMap crawlingConfig = new HashMap();
108:            private HashMap indexingConfig = new HashMap();
109:            private String[] converterSelected;
110:            private int selectedNum;
111:
112:            public RobotPropertyBean() {
113:
114:                try {
115:                    LinkedList path = new LinkedList();
116:                    path.addFirst(AdminClientUtil.DEFAULT_DOMAIN);
117:                    path
118:                            .addFirst((String) getSessionAttribute("search.server.selected"));
119:                    path.addFirst("robot");
120:                    ObjectName on = AdminClientUtil.getResourceMBeanObjectName(
121:                            AdminClientUtil.SEARCH_ROBOT_MBEAN_TYPE, path);
122:
123:                    Object[] params = {};
124:                    String[] signatures = {};
125:                    crawlingConfig = (HashMap) getMBeanServerConnection()
126:                            .invoke(on, "retrieveCrawlingConfigMap", params,
127:                                    signatures);
128:                    indexingConfig = (HashMap) getMBeanServerConnection()
129:                            .invoke(on, "retrieveIndexingConfigMap", params,
130:                                    signatures);
131:                    converters = (ArrayList) getMBeanServerConnection().invoke(
132:                            on, "listConverters", params, signatures);
133:
134:                } catch (Exception e) {
135:                    log(
136:                            Level.SEVERE,
137:                            "RobotPropertyBean.init() failed to get crawling or indexing configurations",
138:                            e);
139:                }
140:
141:                Boolean r = null;
142:                r = getCrawlingConfig();
143:                r = getIndexingConfig();
144:
145:            }
146:
147:            public Boolean getCrawlingConfig() {
148:
149:                serverDelay = (String) crawlingConfig.get("server-delay");
150:                maxConn = (String) crawlingConfig.get("max-connections");
151:                maxConnSite = (String) crawlingConfig
152:                        .get("site-max-connections");
153:                rdIndex = (String) crawlingConfig.get("index-after-ngenerated");
154:                scriptLaunch = (String) crawlingConfig.get("cmd-Hook");
155:                afterProcess = (String) crawlingConfig.get("onCompletion");
156:                contactEmail = (String) crawlingConfig.get("email");
157:                logLevel = (String) crawlingConfig.get("loglevel");
158:                userAgent = (String) crawlingConfig.get("user-agent");
159:                String robotstxt = (String) crawlingConfig
160:                        .get("enable-robots-txt");
161:                if (robotstxt.equals("true"))
162:                    robotsTxt = "false";
163:                else
164:                    robotsTxt = "true";
165:                performAuth = (String) crawlingConfig
166:                        .get("perform-authentication");
167:                robotUser = (String) crawlingConfig.get("username");
168:                robotPass = (String) crawlingConfig.get("password");
169:                proxyUser = (String) crawlingConfig.get("proxy-username");
170:                proxyPass = (String) crawlingConfig.get("proxy-password");
171:                proxyType = (String) crawlingConfig.get("proxy-type");
172:                autoProxy = (String) crawlingConfig.get("proxy-loc");
173:                autoProxyLoc = (String) crawlingConfig.get("auto_serv");
174:                httpProxy = (String) crawlingConfig.get("http_proxy");
175:                httpsProxy = (String) crawlingConfig.get("https_proxy");
176:                ftpProxy = (String) crawlingConfig.get("ftp_proxy");
177:                useCookies = (String) crawlingConfig.get("enable-cookie");
178:                useIP = (String) crawlingConfig.get("enable-ip");
179:                smartHost = (String) crawlingConfig
180:                        .get("smart-host-heuristics");
181:                resolveHost = (String) crawlingConfig.get("use-dns-cname");
182:                anyHost = (String) crawlingConfig.get("remote-access");
183:                defaultStart = (String) crawlingConfig.get("depth");
184:                workDir = (String) crawlingConfig.get("tmpdir");
185:                stateDir = (String) crawlingConfig.get("robot-state-dir");
186:                linkFromHtml = (String) crawlingConfig.get("htmlLink");
187:                linkFromPlain = (String) crawlingConfig.get("plainLink");
188:                maxHtmlLinks = (String) crawlingConfig.get("maxHtmlLink");
189:                maxPlainLinks = (String) crawlingConfig.get("maxPlainLink");
190:
191:                return Boolean.TRUE;
192:            }
193:
194:            public void setCrawlingConfig() {
195:
196:                crawlingConfig.put("server-delay", serverDelay);
197:                crawlingConfig.put("max-connections", maxConn);
198:                crawlingConfig.put("site-max-connections", maxConnSite);
199:                crawlingConfig.put("index-after-ngenerated", rdIndex);
200:                crawlingConfig.put("cmd-Hook", scriptLaunch);
201:                crawlingConfig.put("onCompletion", afterProcess);
202:                crawlingConfig.put("email", contactEmail);
203:                crawlingConfig.put("loglevel", logLevel);
204:                crawlingConfig.put("user-agent", userAgent);
205:                if (robotsTxt.equals("false"))
206:                    crawlingConfig.put("enable-robots-txt", "true");
207:                else
208:                    crawlingConfig.put("enable-robots-txt", "false");
209:                crawlingConfig.put("perform-authentication", performAuth);
210:                crawlingConfig.put("username", robotUser);
211:                crawlingConfig.put("password", robotPass);
212:                crawlingConfig.put("proxy-username", proxyUser);
213:                crawlingConfig.put("proxy-password", proxyPass);
214:                crawlingConfig.put("proxy-type", proxyType);
215:                crawlingConfig.put("proxy-loc", autoProxy);
216:                crawlingConfig.put("auto_serv", autoProxyLoc);
217:                crawlingConfig.put("http_proxy", httpProxy);
218:                crawlingConfig.put("https_proxy", httpsProxy);
219:                crawlingConfig.put("ftp_proxy", ftpProxy);
220:                crawlingConfig.put("enable-cookie", useCookies);
221:                crawlingConfig.put("enable-ip", useIP);
222:                crawlingConfig.put("smart-host-heuristics", smartHost);
223:                crawlingConfig.put("use-dns-cname", resolveHost);
224:                crawlingConfig.put("remote-access", anyHost);
225:                crawlingConfig.put("depth", defaultStart);
226:                crawlingConfig.put("tmpdir", workDir);
227:                crawlingConfig.put("robot-state-dir", stateDir);
228:                crawlingConfig.put("htmlLink", linkFromHtml);
229:                crawlingConfig.put("plainLink", linkFromPlain);
230:                crawlingConfig.put("maxHtmlLink", maxHtmlLinks);
231:                crawlingConfig.put("maxPlainLink", maxPlainLinks);
232:
233:            }
234:
235:            public Boolean getIndexingConfig() {
236:
237:                index = (String) indexingConfig.get("Index");
238:                extract = (String) indexingConfig.get("IndexBytes");
239:                extractTOC = (String) indexingConfig.get("ExtractTOC");
240:                extractMETA = (String) indexingConfig.get("ExtractMETA");
241:                allowNoClass = (String) indexingConfig.get("AllowNoClass");
242:                convertTimeout = (String) indexingConfig.get("ConvertTimeout");
243:
244:                //populate converter option list now
245:                selectedNum = 0;
246:                converterOption = new Option[converters.size()];
247:                converterSelected = new String[converters.size()];
248:                for (int i = 0; i < converters.size(); i++) {
249:                    LinkedList converter = (LinkedList) converters.get(i);
250:                    String label = (String) converter.get(0);
251:                    converterOption[i] = new Option();
252:                    converterOption[i].setValue(label);
253:                    converterOption[i].setLabel(label);
254:                    Boolean check = (Boolean) converter.get(1);
255:                    if (check.booleanValue()) {
256:                        converterSelected[selectedNum] = label;
257:                        selectedNum++;
258:                    }
259:                }
260:
261:                return Boolean.TRUE;
262:            }
263:
264:            public void setIndexingConfig() {
265:
266:                indexingConfig.put("Index", index);
267:                indexingConfig.put("IndexBytes", extract);
268:                indexingConfig.put("ExtractTOC", extractTOC);
269:                indexingConfig.put("ExtractMETA", extractMETA);
270:                indexingConfig.put("AllowNoClass", allowNoClass);
271:                indexingConfig.put("ConvertTimeout", convertTimeout);
272:
273:                ArrayList newconverters = new ArrayList();
274:                for (int i = 0; i < converters.size(); i++) {
275:                    LinkedList converter = (LinkedList) converters.get(i);
276:                    converter.set(1, Boolean.FALSE);
277:                    String label = (String) converter.get(0);
278:                    for (int j = 0; j < converterSelected.length; j++) {
279:                        if (label.equalsIgnoreCase(converterSelected[j])) {
280:                            converter.set(1, Boolean.TRUE);
281:                            break;
282:                        }
283:                    }
284:                    newconverters.add(converter);
285:                }
286:                this .converters = newconverters;
287:
288:            }
289:
290:            /*
291:             * Action methods
292:             */
293:            public String saveProperty() {
294:
295:                setCrawlingConfig();
296:                setIndexingConfig();
297:
298:                try {
299:                    LinkedList path = new LinkedList();
300:                    path.addFirst(AdminClientUtil.DEFAULT_DOMAIN);
301:                    path
302:                            .addFirst((String) getSessionAttribute("search.server.selected"));
303:                    path.addFirst("robot");
304:                    ObjectName on = AdminClientUtil.getResourceMBeanObjectName(
305:                            AdminClientUtil.SEARCH_ROBOT_MBEAN_TYPE, path);
306:
307:                    Object[] params = { crawlingConfig };
308:                    String[] signature = { "java.util.HashMap" };
309:
310:                    getMBeanServerConnection().invoke(on,
311:                            "setCrawlingConfigMap", params, signature);
312:
313:                    Object[] params2 = { indexingConfig };
314:                    getMBeanServerConnection().invoke(on,
315:                            "setIndexingConfigMap", params2, signature);
316:
317:                    Object[] params3 = { converters };
318:                    String[] signature2 = { "java.util.ArrayList" };
319:                    getMBeanServerConnection().invoke(on, "setConverters",
320:                            params3, signature2);
321:
322:                } catch (Exception e) {
323:                    log(
324:                            Level.SEVERE,
325:                            "RobotPropertyBean.saveProperty() failed to set crawling or indexing configurations",
326:                            e);
327:                }
328:
329:                return "gotoRobotPropertiesHome";
330:            }
331:
332:            public String reset() {
333:                return "gotoRobotPropertiesHome";
334:            }
335:
336:            public void validateMaxLink(FacesContext fc, UIComponent component,
337:                    Object value) throws ValidatorException {
338:
339:                String maxlink = value.toString();
340:                if (!Validators.isNumber(maxlink, true)) {
341:                    String msgString = getLocalizedString("search.error.positivenumber");
342:                    FacesMessage msg = new FacesMessage(msgString);
343:                    throw new ValidatorException(msg);
344:                }
345:
346:            }
347:
348:            public void validateLength(FacesContext fc, UIComponent component,
349:                    Object value) throws ValidatorException {
350:
351:                String extractlength = value.toString();
352:                if (!Validators.isNumber(extractlength, true)) {
353:                    String msgString = getLocalizedString("search.error.positivenumber");
354:                    FacesMessage msg = new FacesMessage(msgString);
355:                    throw new ValidatorException(msg);
356:                }
357:
358:            }
359:
360:            public void validateTimeout(FacesContext fc, UIComponent component,
361:                    Object value) throws ValidatorException {
362:
363:                String timeout = value.toString();
364:                if (!Validators.isNumber(timeout, true)) {
365:                    String msgString = getLocalizedString("search.error.positivenumber");
366:                    FacesMessage msg = new FacesMessage(msgString);
367:                    throw new ValidatorException(msg);
368:                }
369:
370:            }
371:
372:            /*
373:             * Methods to Get and Set Crawling Properties
374:             */
375:            public String getServerDelay() {
376:                return serverDelay;
377:            }
378:
379:            public void setServerDelay(String s) {
380:                serverDelay = s;
381:            }
382:
383:            public String getMaxConn() {
384:                return maxConn;
385:            }
386:
387:            public void setMaxConn(String s) {
388:                maxConn = s;
389:            }
390:
391:            public String getMaxConnSite() {
392:                return maxConnSite;
393:            }
394:
395:            public void setMaxConnSite(String s) {
396:                maxConnSite = s;
397:            }
398:
399:            public String getRdIndex() {
400:                return rdIndex;
401:            }
402:
403:            public void setRdIndex(String s) {
404:                rdIndex = s;
405:            }
406:
407:            public String getScriptLaunch() {
408:                return scriptLaunch;
409:            }
410:
411:            public void setScriptLaunch(String s) {
412:                scriptLaunch = s;
413:            }
414:
415:            public String getAfterProcess() {
416:                return afterProcess;
417:            }
418:
419:            public void setAfterProcess(String s) {
420:                afterProcess = s;
421:            }
422:
423:            public String getContactEmail() {
424:                return contactEmail;
425:            }
426:
427:            public void setContactEmail(String s) {
428:                contactEmail = s;
429:            }
430:
431:            public String getLogLevel() {
432:                return logLevel;
433:            }
434:
435:            public void setLogLevel(String s) {
436:                logLevel = s;
437:            }
438:
439:            public String getUserAgent() {
440:                return userAgent;
441:            }
442:
443:            public void setUserAgent(String s) {
444:                userAgent = s;
445:            }
446:
447:            public String getRobotsTxt() {
448:                return robotsTxt;
449:            }
450:
451:            public void setRobotsTxt(String s) {
452:                if (s == null)
453:                    robotsTxt = "false";
454:                else
455:                    robotsTxt = s;
456:            }
457:
458:            public String getPerformAuth() {
459:                return performAuth;
460:            }
461:
462:            public void setPerformAuth(String s) {
463:                performAuth = s;
464:            }
465:
466:            public String getRobotUser() {
467:                return robotUser;
468:            }
469:
470:            public void setRobotUser(String s) {
471:                robotUser = s;
472:            }
473:
474:            public String getRobotPass() {
475:                return robotPass;
476:            }
477:
478:            public void setRobotPass(String s) {
479:                robotPass = s;
480:            }
481:
482:            public String getProxyUser() {
483:                return proxyUser;
484:            }
485:
486:            public void setProxyUser(String s) {
487:                proxyUser = s;
488:            }
489:
490:            public String getProxyPass() {
491:                return proxyPass;
492:            }
493:
494:            public void setProxyPass(String s) {
495:                proxyPass = s;
496:            }
497:
498:            public String getProxyType() {
499:                return proxyType;
500:            }
501:
502:            public void setProxyType(String s) {
503:                proxyType = s;
504:            }
505:
506:            public String getAutoProxy() {
507:                return autoProxy;
508:            }
509:
510:            public void setAutoProxy(String s) {
511:                autoProxy = s;
512:            }
513:
514:            public String getAutoProxyLoc() {
515:                return autoProxyLoc;
516:            }
517:
518:            public void setAutoProxyLoc(String s) {
519:                autoProxyLoc = s;
520:            }
521:
522:            public String getHttpProxy() {
523:                return httpProxy;
524:            }
525:
526:            public void setHttpProxy(String s) {
527:                httpProxy = s;
528:            }
529:
530:            public String getHttpsProxy() {
531:                return httpsProxy;
532:            }
533:
534:            public void setHttpsProxy(String s) {
535:                httpsProxy = s;
536:            }
537:
538:            public String getFtpProxy() {
539:                return ftpProxy;
540:            }
541:
542:            public void setFtpProxy(String s) {
543:                ftpProxy = s;
544:            }
545:
546:            public String getUseCookies() {
547:                return useCookies;
548:            }
549:
550:            public void setUseCookies(String s) {
551:                if (s == null)
552:                    useCookies = "false";
553:                else
554:                    useCookies = s;
555:            }
556:
557:            public String getUseIP() {
558:                return useIP;
559:            }
560:
561:            public void setUseIP(String s) {
562:                if (s == null)
563:                    useIP = "false";
564:                else
565:                    useIP = s;
566:            }
567:
568:            public String getSmartHost() {
569:                return smartHost;
570:            }
571:
572:            public void setSmartHost(String s) {
573:                if (s == null)
574:                    smartHost = "false";
575:                else
576:                    smartHost = s;
577:            }
578:
579:            public String getResolveHost() {
580:                return resolveHost;
581:            }
582:
583:            public void setResolveHost(String s) {
584:                if (s == null)
585:                    resolveHost = "false";
586:                else
587:                    resolveHost = s;
588:            }
589:
590:            public String getAnyHost() {
591:                return anyHost;
592:            }
593:
594:            public void setAnyHost(String s) {
595:                if (s == null)
596:                    anyHost = "false";
597:                else
598:                    anyHost = s;
599:            }
600:
601:            public String getDefaultStart() {
602:                return defaultStart;
603:            }
604:
605:            public void setDefaultStart(String s) {
606:                defaultStart = s;
607:            }
608:
609:            public String getWorkDir() {
610:                return workDir;
611:            }
612:
613:            public void setWorkDir(String s) {
614:                workDir = s;
615:            }
616:
617:            public String getStateDir() {
618:                return stateDir;
619:            }
620:
621:            public void setStateDir(String s) {
622:                stateDir = s;
623:            }
624:
625:            public String getLinkFromHtml() {
626:                return linkFromHtml;
627:            }
628:
629:            public void setLinkFromHtml(String s) {
630:                if (s == null)
631:                    linkFromHtml = "false";
632:                else
633:                    linkFromHtml = s;
634:            }
635:
636:            public String getLinkFromPlain() {
637:                return linkFromPlain;
638:            }
639:
640:            public void setLinkFromPlain(String s) {
641:                if (s == null)
642:                    linkFromPlain = "false";
643:                else
644:                    linkFromPlain = s;
645:            }
646:
647:            public String getMaxHtmlLinks() {
648:                return maxHtmlLinks;
649:            }
650:
651:            public void setMaxHtmlLinks(String s) {
652:                maxHtmlLinks = s;
653:            }
654:
655:            public String getMaxPlainLinks() {
656:                return maxPlainLinks;
657:            }
658:
659:            public void setMaxPlainLinks(String s) {
660:                maxPlainLinks = s;
661:            }
662:
663:            /*
664:             * Methods to Get and Set Indexing Properties
665:             */
666:            public String getIndex() {
667:                return index;
668:            }
669:
670:            public void setIndex(String s) {
671:                index = s;
672:            }
673:
674:            public String getExtract() {
675:                return extract;
676:            }
677:
678:            public void setExtract(String s) {
679:                extract = s;
680:            }
681:
682:            public String getExtractTOC() {
683:                return extractTOC;
684:            }
685:
686:            public void setExtractTOC(String s) {
687:                if (s == null)
688:                    extractTOC = "false";
689:                else
690:                    extractTOC = s;
691:            }
692:
693:            public String getExtractMETA() {
694:                return extractMETA;
695:            }
696:
697:            public void setExtractMETA(String s) {
698:                if (s == null)
699:                    extractMETA = "false";
700:                else
701:                    extractMETA = s;
702:            }
703:
704:            public String getAllowNoClass() {
705:                return allowNoClass;
706:            }
707:
708:            public void setAllowNoClass(String s) {
709:                if (s == null)
710:                    allowNoClass = "false";
711:                else
712:                    allowNoClass = s;
713:            }
714:
715:            public String getConvertTimeout() {
716:                return convertTimeout;
717:            }
718:
719:            public void setConvertTimeout(String s) {
720:                convertTimeout = s;
721:            }
722:
723:            public ArrayList getConverters() {
724:                return converters;
725:            }
726:
727:            public void setConverters(ArrayList s) {
728:                converters = s;
729:            }
730:
731:            /*
732:             * Populate all UI Options
733:             */
734:            public Option[] getServerdelayOption() {
735:
736:                String sv = serverdelaylistvalue;
737:                String sl = getLocalizedString("robot.crawling.speed.serverdelaylistlabel");
738:                serverdelayOption = getOptionList(getStringList(sv),
739:                        getStringList(sl));
740:                return serverdelayOption;
741:            }
742:
743:            public Option[] getMaxconnOption() {
744:
745:                String mv = maxconnlistvalue;
746:                String ml = getLocalizedString("robot.crawling.speed.maxconnlistlabel");
747:                maxconnOption = getOptionList(getStringList(mv),
748:                        getStringList(ml));
749:
750:                return maxconnOption;
751:            }
752:
753:            public Option[] getMaxconnsiteOption() {
754:
755:                String mv = maxconnsitelistvalue;
756:                String ml = getLocalizedString("robot.crawling.speed.maxconnsitelistlabel");
757:                maxconnsiteOption = getOptionList(getStringList(mv),
758:                        getStringList(ml));
759:                return maxconnsiteOption;
760:            }
761:
762:            public Option[] getRdindexOption() {
763:
764:                String rv = speedindexlistvalue;
765:                String rl = getLocalizedString("robot.crawling.speed.indexlistlabel");
766:                rdindexOption = getOptionList(getStringList(rv),
767:                        getStringList(rl));
768:                return rdindexOption;
769:            }
770:
771:            public Option[] getScriptOption() {
772:
773:                ArrayList options = null;
774:
775:                try {
776:                    LinkedList path = new LinkedList();
777:                    path.addFirst(AdminClientUtil.DEFAULT_DOMAIN);
778:                    path
779:                            .addFirst((String) getSessionAttribute("search.server.selected"));
780:                    path.addFirst("robot");
781:                    ObjectName on = AdminClientUtil.getResourceMBeanObjectName(
782:                            AdminClientUtil.SEARCH_ROBOT_MBEAN_TYPE, path);
783:
784:                    Object[] params = {};
785:                    String[] signatures = {};
786:                    options = (ArrayList) getMBeanServerConnection().invoke(on,
787:                            "retrieveScriptLaunchOptions", params, signatures);
788:
789:                } catch (Exception e) {
790:                    log(
791:                            Level.SEVERE,
792:                            "RobotPropertyBean.getScriptOption() failed to get the script launch options",
793:                            e);
794:                }
795:
796:                String sl = getLocalizedString("robot.crawling.completion.scriptlaunch.default");
797:
798:                if (options != null) {
799:                    scriptOption = new Option[options.size() + 1];
800:                    scriptOption[0] = new Option("", sl);
801:                    for (int i = 0; i < options.size(); i++) {
802:                        HashMap map = (HashMap) options.get(i);
803:                        String value = (String) map.get("OptionValue");
804:                        String label = (String) map.get("OptionLabel");
805:                        scriptOption[i + 1] = new Option(value, label);
806:                    }
807:                } else {
808:                    //String sv = "cmdHook0";
809:                    scriptOption = new Option[1];
810:                    scriptOption[0] = new Option("", sl);
811:                    //scriptOption[0] = new Option(sv, sl);
812:                }
813:                return scriptOption;
814:            }
815:
816:            public Option[] getProcessOption() {
817:
818:                String pv = afterprocesslistvalue;
819:                String pl = getLocalizedString("robot.crawling.completion.afterprocesslistlabel");
820:                processOption = getOptionList(getStringList(pv),
821:                        getStringList(pl));
822:                return processOption;
823:            }
824:
825:            public Option[] getLoglevelOption() {
826:
827:                String lv = loglevellistvalue;
828:                String ll = getLocalizedString("robot.crawling.log.levellistlabel");
829:                loglevelOption = getOptionList(getStringList(lv),
830:                        getStringList(ll));
831:                return loglevelOption;
832:            }
833:
834:            public Option[] getPerformauthOption() {
835:
836:                String pv = performradiovalue;
837:                String pl = getLocalizedString("robot.crawling.authentication.performradiolabel");
838:                performauthOption = getOptionList(getStringList(pv),
839:                        getStringList(pl));
840:                return performauthOption;
841:            }
842:
843:            public Option[] getProxytypeOption() {
844:
845:                String pv = proxytyperadiovalue;
846:                String pl = getLocalizedString("robot.crawling.proxy.typeradiolabel");
847:                proxytypeOption = getOptionList(getStringList(pv),
848:                        getStringList(pl));
849:                return proxytypeOption;
850:            }
851:
852:            public Option[] getAutoproxyOption() {
853:
854:                String av = autoconfigtyperadiovalue;
855:                String al = getLocalizedString("robot.crawling.proxy.autoconfig.typeradiolabel");
856:                autoproxyOption = getOptionList(getStringList(av),
857:                        getStringList(al));
858:                return autoproxyOption;
859:            }
860:
861:            public Option[] getDefaultstartOption() {
862:
863:                String dv = defaultstartlistvalue;
864:
865:                String dl = getLocalizedString("robot.crawling.advanced.defaultstartlistlabel");
866:                defaultstartOption = getOptionList(getStringList(dv),
867:                        getStringList(dl));
868:                return defaultstartOption;
869:            }
870:
871:            public Option[] getIndexOption() {
872:
873:                String iv = extractindexlistvalue;
874:                String il = getLocalizedString("robot.indexing.extraction.indexlistlabel");
875:                indexOption = getOptionList(getStringList(iv),
876:                        getStringList(il));
877:                return indexOption;
878:            }
879:
880:            public Option[] getConverterOption() {
881:
882:                return converterOption;
883:            }
884:
885:            public Option[] getRadioOption() {
886:
887:                radioOption = new Option[2];
888:                radioOption[0] = new Option("true",
889:                        getLocalizedString("search.radiolabel.yes"));
890:                radioOption[1] = new Option("false",
891:                        getLocalizedString("search.radiolabel.no"));
892:                return radioOption;
893:            }
894:
895:            public String[] getConverterSelected() {
896:                return converterSelected;
897:            }
898:
899:            public void setConverterSelected(String[] selection) {
900:                this .converterSelected = selection;
901:            }
902:
903:            /*
904:             * private methods
905:             */
906:            private Option[] getOptionList(ArrayList values, ArrayList labels) {
907:
908:                if (!values.isEmpty() && !labels.isEmpty()) {
909:
910:                    Option[] options = new Option[values.size()];
911:
912:                    for (int i = 0; i < values.size(); i++) {
913:                        options[i] = new Option((String) values.get(i),
914:                                (String) labels.get(i));
915:                    }
916:
917:                    return options;
918:                }
919:                return null;
920:            }
921:
922:            private ArrayList getStringList(String s) {
923:
924:                ArrayList s_list = new ArrayList();
925:                StringTokenizer st = new StringTokenizer(s, ",");
926:                while (st.hasMoreTokens()) {
927:                    String label = st.nextToken();
928:                    s_list.add(label);
929:                }
930:                return s_list;
931:            }
932:
933:            private String getLocalizedString(String key) {
934:                return super .getLocalizedString("search", key);
935:            }
936:
937:            private static String serverdelaylistvalue = "0,1,2,5,10,30,60,300";
938:            private static String maxconnlistvalue = "1,2,4,8,10,12,16,20";
939:            private static String maxconnsitelistvalue = "-1,1,2,4,8,10,12,16,20";
940:            private static String speedindexlistvalue = "3,5,10,15,30,60,120,240,480";
941:            private static String afterprocesslistvalue = "idle,quit,loop";
942:            private static String loglevellistvalue = "0,1,2,3,4,5";
943:            private static String defaultstartlistvalue = "1,2,3,4,5,6,7,8,9,10,-1";
944:            private static String extractindexlistvalue = "full,partial";
945:            private static String autoconfigtyperadiovalue = "local,server";
946:            private static String proxytyperadiovalue = "direct,auto,manual";
947:            private static String performradiovalue = "true,false";
948:
949:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.