Source Code Cross Referenced for AdvancedLogModelImpl.java in  » Portal » Open-Portal » com » sun » portal » search » admin » model » 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.model 
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.model;
007:
008:        import java.io.*;
009:        import java.util.*;
010:        import java.util.logging.Level;
011:        import java.util.logging.Logger;
012:
013:        import javax.servlet.http.HttpServletRequest;
014:
015:        import com.iplanet.jato.model.*;
016:
017:        import com.sun.portal.search.admin.CSConfig;
018:        import com.sun.portal.search.util.SearchConfig;
019:        import com.sun.portal.log.common.PortalLogger;
020:        import com.iplanet.am.console.base.model.AMModelBase;
021:        import com.iplanet.am.console.components.view.html.DynamicGUI;
022:
023:        /**
024:         *
025:         *
026:         *
027:         */
028:        public class AdvancedLogModelImpl extends AMModelBase implements 
029:                AdvancedLogModel {
030:            // Create a Logger for this class
031:            private static Logger debugLogger = PortalLogger
032:                    .getLogger(AdvancedLogModelImpl.class);
033:
034:            /** constructor
035:             *
036:             * @param req  HTTP Servlet Request
037:             * @param rbName  resource bundle name
038:             */
039:            public AdvancedLogModelImpl(HttpServletRequest req, String rbName) {
040:                super (req, rbName);
041:                init(req);
042:            }
043:
044:            /** initializes */
045:            protected void init(HttpServletRequest req) {
046:                load();
047:            }
048:
049:            public String getSearchRDMLog() {
050:                return SearchConfig.getValue(SearchConfig.RDM_LOGFN);
051:            }
052:
053:            public void setSearchRDMLog(String value) {
054:                debugLogger.log(Level.FINER, "PSSH_CSPSAM0001", value);
055:                SearchConfig.setValue(SearchConfig.RDM_LOGFN, value);
056:            }
057:
058:            /**
059:             * getting boolean state of property disable-rdm-log in search.conf
060:             */
061:            public boolean getSearchLogState() {
062:                String stateStr = (String) SearchConfig
063:                        .getValue(SearchConfig.RDM_DISABLE_LOG);
064:                if (stateStr != null && stateStr.equals("true")) {
065:                    debugLogger.log(Level.FINER, "PSSH_CSPSAM0002",
066:                            new String[] { SearchConfig.RDM_DISABLE_LOG,
067:                                    stateStr });
068:                    return true;
069:                } else {
070:                    return false;
071:                }
072:            }
073:
074:            /**
075:             * setting boolean state of property disable-rdm-log in search.conf
076:             */
077:            public void setSearchLogState(boolean value) {
078:                if (value) {
079:                    debugLogger
080:                            .log(Level.FINER, "PSSH_CSPSAM0003", new String[] {
081:                                    SearchConfig.RDM_DISABLE_LOG, "true" });
082:                    SearchConfig.setValue(SearchConfig.RDM_DISABLE_LOG, "true");
083:                } else {
084:                    debugLogger.log(Level.FINER, "PSSH_CSPSAM0003",
085:                            new String[] { SearchConfig.RDM_DISABLE_LOG,
086:                                    "false" });
087:                    SearchConfig
088:                            .setValue(SearchConfig.RDM_DISABLE_LOG, "false");
089:                }
090:            }
091:
092:            public String getIndexMaintenanceLog() {
093:                return SearchConfig.getValue(SearchConfig.SENGINE_LOGFN);
094:            }
095:
096:            public void setIndexMaintenanceLog(String value) {
097:                SearchConfig.setValue(SearchConfig.SENGINE_LOGFN, value);
098:            }
099:
100:            public String getRdMgrLog() {
101:                return SearchConfig.getValue(SearchConfig.RDMGR_LOGFN);
102:            }
103:
104:            public void setRdMgrLog(String value) {
105:                SearchConfig.setValue(SearchConfig.RDMGR_LOGFN, value);
106:            }
107:
108:            public String getRdmDebugLog() {
109:                return SearchConfig.getValue(SearchConfig.DEBUG_LOGFN);
110:            }
111:
112:            public void setRdmDebugLog(String value) {
113:                SearchConfig.setValue(SearchConfig.DEBUG_LOGFN, value);
114:            }
115:
116:            public String getRdmDebugLevel() {
117:                return SearchConfig.getValue(SearchConfig.DEBUG_LOGLV);
118:            }
119:
120:            public void setRdmDebugLevel(String value) {
121:                SearchConfig.setValue(SearchConfig.DEBUG_LOGLV, value);
122:            }
123:
124:            ////////////////////////////////////////////////////////////////////////////////
125:            // Model execution methods
126:            ////////////////////////////////////////////////////////////////////////////////
127:
128:            /**
129:             *
130:             *
131:             */
132:            public Object execute(ModelExecutionContext context)
133:                    throws ModelControlException {
134:                String operationName = null;
135:                if (context != null) {
136:                    operationName = context.getOperationName();
137:                } else {
138:                    operationName = ModelExecutionContext.OPERATION_RETRIEVE;
139:                }
140:                Object result = null;
141:                if (operationName
142:                        .equals(ModelExecutionContext.OPERATION_RETRIEVE)) {
143:                    result = retrieve(context);
144:                }
145:
146:                return result;
147:            }
148:
149:            /**
150:             * 1. reads extract the location of the search.conf file
151:             * 2. open the search.conf
152:             * 3. populate AdvancedLogModelImpl object
153:             *
154:             */
155:            public Object retrieve(ModelExecutionContext context)
156:                    throws ModelControlException {
157:                // loading the Properties from the file search.conf
158:                debugLogger.finer("PSSH_CSPSAM0004");
159:                load();
160:
161:                return null;
162:            }
163:
164:            /**
165:             * loading the model from file
166:             */
167:            public void load() {
168:                // getting the ServerRoot directory
169:                String serverRoot = CSConfig.getServerRoot();
170:                if (serverRoot == null) {
171:                    serverRoot = ".";
172:                }
173:
174:                // opening the search.conf file
175:                String csidFilePath = serverRoot + csidFileRelativPath;
176:                try {
177:                    debugLogger.log(Level.FINER, "PSSH_CSPSAM0005",
178:                            csidFilePath);
179:                    // init the SearchConfig object
180:                    SearchConfig.init(csidFilePath);
181:                } catch (Exception e) {
182:                    debugLogger.log(Level.INFO, "PSSH_CSPSAM0006", e
183:                            .getMessage());
184:                }
185:
186:            }
187:
188:            /**
189:             * storing the model in file search.conf
190:             */
191:            public void store() {
192:                String serverRoot = CSConfig.getServerRoot();
193:                String csidFilePath = serverRoot + csidFileRelativPath;
194:                debugLogger.log(Level.FINER, "PSSH_CSPSAM0007", csidFilePath);
195:                try {
196:                    // writing the file "search.conf"
197:                    FileWriter fw = new FileWriter(csidFilePath);
198:                    // writing the header
199:                    fw.write(SearchConfig.SEARCH_CONF_HEADER);
200:                    // writing the configuration elements
201:                    StringBuffer sb = new StringBuffer();
202:                    HashMap map = SearchConfig.getMap();
203:                    Iterator keysIterator = map.keySet().iterator();
204:                    String key = null;
205:                    String value = null;
206:                    while (keysIterator.hasNext()) {
207:                        key = (String) keysIterator.next();
208:                        value = (String) map.get(key);
209:                        debugLogger.log(Level.FINER, "PSSH_CSPSAM0008",
210:                                new String[] { key, value });
211:                        sb.append(key);
212:                        sb.append("=");
213:                        sb.append(value);
214:                        sb.append("\n");
215:                    }
216:                    debugLogger.log(Level.FINER, "PSSH_CSPSAM0009",
217:                            csidFilePath);
218:                    fw.write(sb.toString());
219:                    debugLogger.log(Level.FINER, "PSSH_CSPSAM0010",
220:                            csidFilePath);
221:                    fw.close();
222:                } catch (Exception e) {
223:                    debugLogger.log(Level.FINER, "PSSH_CSPSAM0011", e
224:                            .getMessage());
225:                }
226:            }
227:
228:            public static final String csidFileRelativPath = File.separator
229:                    + "config" + File.separator + SearchConfig.SEARCH_CONF;
230:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.