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


001:        /*
002:         * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
003:         * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms.
004:         */
005:
006:        package com.sun.portal.search.admin;
007:
008:        import java.net.URL;
009:        import java.util.*;
010:        import java.util.logging.Level;
011:        import java.util.logging.Logger;
012:
013:        import com.sun.portal.search.admin.CSViewBeanBase;
014:        import com.sun.portal.search.robot.*;
015:        import com.sun.portal.log.common.PortalLogger;
016:
017:        import javax.servlet.http.HttpServletRequest;
018:
019:        import com.iplanet.jato.RequestContext;
020:
021:        import com.iplanet.jato.view.event.DisplayEvent;
022:        import com.iplanet.jato.view.event.RequestInvocationEvent;
023:
024:        import com.iplanet.jato.view.html.StaticTextField;
025:        import com.iplanet.jato.view.html.TextField;
026:        import com.iplanet.jato.view.html.CheckBox;
027:        import com.iplanet.jato.view.html.Button;
028:        import com.iplanet.jato.view.html.ListBox;
029:        import com.iplanet.jato.view.html.RadioButtonGroup;
030:
031:        import com.iplanet.jato.view.html.Option;
032:        import com.iplanet.jato.view.html.OptionList;
033:
034:        import com.iplanet.jato.view.View;
035:        import com.iplanet.jato.view.ViewBean;
036:        import com.iplanet.jato.view.ViewBeanBase;
037:
038:        import com.iplanet.jato.ViewBeanManager;
039:
040:        import com.iplanet.jato.model.ModelControlException;
041:
042:        import com.iplanet.am.console.components.view.html.IPlanetButton;
043:        import com.iplanet.am.console.components.view.html.DynamicGUI;
044:        import com.iplanet.am.console.components.view.html.DynamicGUIComp;
045:
046:        /**
047:         * iPS admin console view bean: TODO
048:         */
049:        public class SimulatorViewBean extends CSViewBeanBase {
050:            public static final String DEFAULT_DISPLAY_URL = "/ps/searchadmin/Simulator.jsp";
051:            public static final String PAGE_NAME = "Simulator";
052:            public static final String DNS_CHECKBOX = "checkDNS";
053:            public static final String REDIRECT_CHECKBOX = "checkRedirect";
054:            public static final String OK_BUTTON = "OKButton";
055:            public static final String RESET_BUTTON = "ResetButton";
056:            public static final String RUN_RESULT = "RunResult";
057:            public static final String TESTURL_LIST = "TestURLList";
058:            public static final String URLPOOL_LIST = "UrlPoolList";
059:
060:            public static final String ADD_BUTTON = "AddButton";
061:            public static final String DEL_BUTTON = "DelButton";
062:
063:            // Create a Logger for this class
064:            private static Logger debugLogger = PortalLogger
065:                    .getLogger(SimulatorViewBean.class);
066:
067:            /**
068:             * constructor
069:             *
070:             * @param PageName  of this view bean
071:             * @param displayURL  default display URL
072:             */
073:            public SimulatorViewBean() {
074:                super (PAGE_NAME);
075:                setDefaultDisplayURL(DEFAULT_DISPLAY_URL);
076:                registerChildren();
077:            }
078:
079:            /**
080:             * register child component
081:             */
082:            protected void registerChildren() {
083:                registerChild(DNS_CHECKBOX, CheckBox.class);
084:                registerChild(REDIRECT_CHECKBOX, CheckBox.class);
085:                registerChild(OK_BUTTON, IPlanetButton.class);
086:                registerChild(RESET_BUTTON, IPlanetButton.class);
087:                registerChild(RUN_RESULT, StaticTextField.class);
088:                registerChild(TESTURL_LIST, ListBox.class);
089:                registerChild(ADD_BUTTON, IPlanetButton.class);
090:                registerChild(DEL_BUTTON, IPlanetButton.class);
091:            }
092:
093:            /**
094:             * create child component
095:             *
096:             * @param name of component
097:             * @return child component
098:             */
099:            protected View createChild(String name) {
100:                View Headerchild = super .createChild(name);
101:                if (Headerchild != null)
102:                    return Headerchild;
103:                if (name.equals(DNS_CHECKBOX)) {
104:                    return new CheckBox(this , DNS_CHECKBOX, "true", "false",
105:                            true);
106:                }
107:                if (name.equals(REDIRECT_CHECKBOX)) {
108:                    return new CheckBox(this , REDIRECT_CHECKBOX, "true",
109:                            "false", true);
110:                }
111:                if (name.equals(OK_BUTTON)) {
112:                    IPlanetButton okButton = new IPlanetButton(this , OK_BUTTON,
113:                            "");
114:                    okButton.validate(true);
115:                    return okButton;
116:                }
117:                if (name.equals(ADD_BUTTON)) {
118:                    return new IPlanetButton(this , ADD_BUTTON, "");
119:                }
120:                if (name.equals(DEL_BUTTON)) {
121:                    return new IPlanetButton(this , DEL_BUTTON, "");
122:                }
123:                if (name.equals(RESET_BUTTON)) {
124:                    return new IPlanetButton(this , RESET_BUTTON, "");
125:                }
126:                if (name.equals(RUN_RESULT)) {
127:                    return new StaticTextField(this , RUN_RESULT, "");
128:                }
129:                if (name.equals(TESTURL_LIST)) {
130:                    return new ListBox(this , TESTURL_LIST, null);
131:                }
132:                throw new IllegalArgumentException("Invalid child name ["
133:                        + name + "]");
134:            }
135:
136:            public void beginDisplay(DisplayEvent event) {
137:                setPageEncoding();
138:                //setDisplayFieldValue(OK_BUTTON, getLocalizedString("ok.text"));
139:                setDisplayFieldValue(OK_BUTTON,
140:                        getLocalizedString("simulator.runbutton"));
141:                setDisplayFieldValue(RESET_BUTTON,
142:                        getLocalizedString("reset.text"));
143:                setDisplayFieldValue(ADD_BUTTON, getLocalizedString("add.text"));
144:                setDisplayFieldValue(DEL_BUTTON,
145:                        getLocalizedString("delete.text"));
146:
147:                if (getPageSessionAttribute("retrieved") == null) {
148:                    OptionList opts = new OptionList();
149:                    RobotConfig rc = CSConfig.getRobotConfig();
150:                    int size = rc.numRuleset();
151:                    for (int i = 0; i < size; i++) {
152:                        FilterRuleset frs = rc.GetRuleSet(i);
153:                        if (!frs.isEnabled())
154:                            continue;
155:                        int numOfSP = frs.numOfStartingPoints();
156:                        for (int j = 0; j < numOfSP; j++) {
157:                            String sp = frs.getStartingPointByIndex(j);
158:                            StringTokenizer st = new StringTokenizer(sp);
159:                            String url = st.nextToken();
160:                            opts.add(url, url);
161:                        }
162:                    }
163:                    ListBox child = (ListBox) this .getChild(TESTURL_LIST);
164:                    child.setOptions(opts);
165:                    setPageSessionAttribute("retrieved", "true");
166:                }
167:                ListBox child = (ListBox) this .getChild(TESTURL_LIST);
168:                OptionList opts = child.getOptions();
169:                opts.add("________________________________________", "");
170:                child.setValue(null);
171:            }
172:
173:            boolean isEnable(String buf) {
174:                if (buf.equalsIgnoreCase("true") || buf.equalsIgnoreCase("on")
175:                        || buf.equalsIgnoreCase("yes"))
176:                    return true;
177:                else
178:                    return false;
179:            }
180:
181:            public boolean get_shh() {
182:                ProcessConfig pConf = CSConfig.getRobotConfig().processConf;
183:                String tmp = (String) pConf.get("smart-host-heuristics");
184:                return isEnable(tmp);
185:            }
186:
187:            public void handleOKButtonRequest(RequestInvocationEvent event) {
188:                try {
189:                    ListBox child = (ListBox) getChild(TESTURL_LIST);
190:                    Object[] urlObjs = child.getValues();
191:                    ArrayList ua = new ArrayList();
192:                    for (int i = 0; i < urlObjs.length; i++) {
193:                        if (urlObjs[i] != null) {
194:                            String u = urlObjs[i].toString();
195:                            if (u != null && u.length() > 0) {
196:                                ua.add(u);
197:                            }
198:                        }
199:                    }
200:
201:                    String[] urls = (String[]) ua.toArray(new String[0]);
202:
203:                    if (urls != null) {
204:                        boolean checkDNS = isEnable((String) getDisplayFieldValue(DNS_CHECKBOX));
205:                        boolean checkRedirect = isEnable((String) getDisplayFieldValue(REDIRECT_CHECKBOX));
206:                        FilterSimulator frsim = new FilterSimulator(
207:                                getUserLocale());
208:                        String root = CSConfig.getServerRoot();
209:                        boolean is_shh = get_shh();
210:                        String result = "";
211:                        try {
212:                            result += "<hr>\n<br><table>\n";
213:                            result += frsim.runSimulator(is_shh, root, urls,
214:                                    checkDNS, checkRedirect);
215:                            result += "\n</table>\n";
216:                        } catch (Exception e) {
217:                            result = "<Strong>"
218:                                    + getLocalizedString("robot.siteprobe.fail")
219:                                    + "</Strong>";
220:                        }
221:                        setDisplayFieldValue(RUN_RESULT, result);
222:                        OptionList opts = new OptionList(urls, urls);
223:                        child.setOptions(opts);
224:
225:                    }
226:                } catch (Exception e) {
227:                    debugLogger.log(Level.INFO, "PSSH_CSPSA0010", e
228:                            .getMessage());
229:                    /* ignore error here*/
230:                }
231:                forwardTo();
232:            }
233:
234:            public void handleResetButtonRequest(RequestInvocationEvent event) {
235:                //child.reset();
236:                setDisplayFieldValue(DNS_CHECKBOX, "true");
237:                setDisplayFieldValue(REDIRECT_CHECKBOX, "true");
238:                clearPageSessionAttributes();
239:                forwardTo();
240:            }
241:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.