Source Code Cross Referenced for PurgeViewBean.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.lang.*;
009:        import java.util.logging.Logger;
010:
011:        import javax.servlet.*;
012:        import javax.servlet.http.*;
013:
014:        import com.iplanet.jato.RequestContext;
015:        import com.iplanet.jato.RequestHandler;
016:
017:        import com.iplanet.jato.view.event.DisplayEvent;
018:        import com.iplanet.jato.view.event.RequestInvocationEvent;
019:
020:        import com.iplanet.jato.view.html.OptionList;
021:        import com.iplanet.jato.view.html.Option;
022:        import com.iplanet.jato.view.html.CheckBox;
023:        import com.iplanet.jato.view.html.TextField;
024:        import com.iplanet.jato.view.html.ListBox;
025:        import com.iplanet.jato.view.html.StaticTextField;
026:
027:        import com.iplanet.jato.view.View;
028:        import com.iplanet.jato.view.ViewBean;
029:        import com.iplanet.jato.view.ViewBeanBase;
030:
031:        import com.iplanet.jato.ViewBeanManager;
032:
033:        import com.iplanet.jato.model.ModelControlException;
034:
035:        import com.iplanet.am.console.components.view.html.IPlanetButton;
036:
037:        import com.sun.portal.search.admin.model.PurgeModel;
038:        import com.sun.portal.search.util.SearchConfig;
039:        import com.sun.portal.search.admin.cli.RobotController;
040:        import com.sun.portal.log.common.PortalLogger;
041:
042:        /**
043:         */
044:
045:        public class PurgeViewBean extends CSViewBeanBase implements 
046:                RequestHandler {
047:
048:            // The "logical" name for this page.
049:            public static final String PAGE_NAME = "Purge";
050:            public static final String DEFAULT_DISPLAY_URL = "/ps/searchadmin/Purge.jsp";
051:
052:            // String constants for child field names.  This is simply good coding practice
053:            // to minimize use of string literals.
054:            public static final String CHK_PURGE = "purge";
055:            public static final String BTN_OK = "ok";
056:            public static final String STATUS1 = "status1";
057:            public static final String STATUS2 = "status2";
058:            public static final String STATUS3 = "status3";
059:            public static final String STATUS4 = "status4";
060:
061:            private PurgeModel model;
062:
063:            // Create a Logger for this class
064:            private static Logger debugLogger = PortalLogger
065:                    .getLogger(PurgeViewBean.class);
066:
067:            /*
068:             * Default constructor
069:             *
070:             */
071:            public PurgeViewBean() {
072:                super (PAGE_NAME);
073:                setDefaultDisplayURL(DEFAULT_DISPLAY_URL);
074:                registerChildren();
075:            }
076:
077:            /**
078:             * Child methods 
079:             */
080:            protected void registerChildren() {
081:                // Add an entry for each child. Note, the children are not instantiated 
082:                // at this time. Instead, child instantiation is handled in a lazy fashion.
083:
084:                registerChild(CHK_PURGE, CheckBox.class);
085:                registerChild(BTN_OK, IPlanetButton.class);
086:                registerChild(STATUS1, StaticTextField.class);
087:                registerChild(STATUS2, StaticTextField.class);
088:                registerChild(STATUS3, StaticTextField.class);
089:                registerChild(STATUS4, StaticTextField.class);
090:            }
091:
092:            protected View createChild(String name) {
093:                // Create HeaderView Child
094:                View child = super .createChild(name);
095:                if (child != null) {
096:                    return child;
097:
098:                } else if (name.equals(BTN_OK)) {
099:                    return new IPlanetButton(this , BTN_OK, "");
100:
101:                } else if (name.equals(CHK_PURGE)) {
102:                    return new CheckBox(this , CHK_PURGE, "true", "false", true);
103:
104:                } else if (name.equals(STATUS1)) {
105:                    return new StaticTextField(this , STATUS1, "");
106:
107:                } else if (name.equals(STATUS2)) {
108:                    return new StaticTextField(this , STATUS2, "");
109:
110:                } else if (name.equals(STATUS3)) {
111:                    return new StaticTextField(this , STATUS3, "");
112:
113:                } else if (name.equals(STATUS4)) {
114:                    return new StaticTextField(this , STATUS4, "");
115:
116:                } else
117:                    throw new IllegalArgumentException("Invalid child name \""
118:                            + name + "\"");
119:            }
120:
121:            /* 
122:             * Begin displaying page. we set the required information
123:             * @param event   display event
124:             * @throws ModelControlException  if problem access value of component
125:             **/
126:            public void beginDisplay(DisplayEvent event)
127:                    throws ModelControlException {
128:                setPageEncoding();
129:                setDisplayFieldValue(BTN_OK, getLocalizedString("ok.text"));
130:
131:                CheckBox c1 = (CheckBox) getChild(CHK_PURGE);
132:                c1.setChecked(false);
133:            }
134:
135:            public boolean beginProgressDisplay() {
136:                /*
137:                   if (model.getOutput().equals(""))
138:                   return false;
139:                   else 
140:                 */
141:                return true;
142:            }
143:
144:            public String endProgressDisplay() {
145:                model = getModel();
146:                return model.getOutput();
147:            }
148:
149:            /*
150:             * Request event handler methods - for button and HREF fields
151:             *
152:             */
153:            public void handleOkRequest(RequestInvocationEvent event)
154:                    throws ServletException {
155:                model = getModel();
156:
157:                if (!getDisplayFieldBooleanValue(CHK_PURGE)) {
158:                    forwardTo();
159:                    return;
160:                }
161:
162:                // Do a purge, display result status
163:                //	if (model.purgeDatabase("compass")) // XXX hardwired dbname
164:                if (model.purgeDatabase(SearchConfig
165:                        .getValue(SearchConfig.DBNAME))) {// XXX hardwired dbname
166:                    setDisplayFieldValue(PurgeViewBean.STATUS1,
167:                            getLocalizedString("db.purge.success")); // XXX move text to jsp/props
168:                    RobotController robotController = new RobotController(
169:                            CSConfig.getServerRoot(), CSConfig.getBinPath(),
170:                            CSConfig.getLibDir(), CSConfig.getLibPath(), null,
171:                            null, null);
172:                    if (!robotController.remove_status_files()) {
173:                        setDisplayFieldValue(
174:                                PurgeViewBean.STATUS2,
175:                                getLocalizedString("db.purge.robotstatuswarning"));
176:                    }
177:                } else
178:                    setDisplayFieldValue(PurgeViewBean.STATUS1,
179:                            getLocalizedString("db.purge.error"));
180:
181:                forwardTo();
182:            }
183:
184:            /*
185:             * handles invocation of Reset Button
186:             *
187:             * @param event   request invocation event
188:             */
189:            public void handleResetRequest(RequestInvocationEvent event) {
190:                forwardTo();
191:            }
192:
193:            protected synchronized PurgeModel getModel() {
194:                if (model == null) {
195:                    debugLogger.finer("PSSH_CSPSA0069");
196:                    model = new PurgeModel();
197:                }
198:                return model;
199:            }
200:
201:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.