Source Code Cross Referenced for RDMContext.java in  » Portal » Open-Portal » com » sun » portal » search » rdmserver » 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.rdmserver 
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.rdmserver;
007:
008:        import com.sun.portal.search.rdm.*;
009:        import com.sun.portal.search.soif.*;
010:        import com.sun.portal.search.util.*;
011:        import com.sun.portal.log.common.PortalLogger;
012:        import com.sun.portal.log.common.PortalLogManager;
013:
014:        import com.sun.kt.search.*;
015:
016:        import java.io.*;
017:        import java.util.*;
018:        import java.util.logging.Logger;
019:        import java.util.logging.Level;
020:        import java.util.logging.LogRecord;
021:
022:        /**
023:         * RDMContext is a container for logging, configuration, schema, etc.
024:         */
025:        abstract public class RDMContext {
026:
027:            Map contextConfig; // RDM context configuration
028:            RDMConfig rdmConfig; // RDM config data
029:            //String logFile;		// RDM log file, eg, rdm.log
030:            //PrintWriter rdmLogStream;	// RDM log stream
031:
032:            /** @deprecated */
033:            boolean rdm_log_enabled = true;
034:
035:            // XXX This uses rdmConfig, but should really use RDMContextConfig
036:            // (for now, they are the same thing) - change for dsame, etc
037:            public RDMContext(RDMConfig rdmconf) throws Exception {
038:
039:                rdmConfig = rdmconf;
040:
041:                String rdmctx_conf = new File(rdmconf.getServerRoot(),
042:                        SearchConfig.CONFDIR + File.separator
043:                                + SearchConfig.SEARCH_CONF).getPath();
044:
045:                // Read the csid pblock config file
046:                try {
047:                    contextConfig = new HashMap();
048:                    PBlock.parsePBlockConfigFile(rdmctx_conf, contextConfig);
049:                } catch (Exception e) {
050:                    throw new Exception(
051:                            "rdm-init: failed to read config file: "
052:                                    + rdmctx_conf + ": " + e.getMessage());
053:                }
054:
055:                rdm_init_real();
056:            }
057:
058:            /** Container logging */
059:            abstract public void log(String msg);
060:
061:            /** Container logging */
062:            abstract public void log(String msg, Exception e);
063:
064:            /** RDM request/response logging */
065:            public void logrdm(String msg) {
066:                Logger rdmRootLogger = SearchLogger.getRDMLogger();
067:                if (rdmRootLogger != null) {
068:                    rdmRootLogger.log(Level.SEVERE, "PSSH_CSPSRDMS0137", msg);
069:                }
070:            }
071:
072:            /** @deprecated */
073:            public void rdmLogEnable(boolean enable) {
074:                rdm_log_enabled = enable;
075:            }
076:
077:            public RDMConfig getRDMConfig() {
078:                return rdmConfig;
079:            }
080:
081:            protected void rdm_init_real() throws Exception {
082:
083:                // Initialize rdmserver.log
084:                try {
085:                    SearchLogger.init(SearchConfig.RDMSERVER_LOGGER, rdmConfig
086:                            .getServerRoot());
087:                } catch (Exception e) {
088:                    System.err.println("Failed to initialise RDM error log: "
089:                            + e.getMessage());
090:                    throw new Exception("Failed to initialise RDM error log: "
091:                            + e.getMessage());
092:                }
093:
094:                String search_engine_log = (String) contextConfig
095:                        .get(SearchConfig.SENGINE_LOGFN);
096:                if (search_engine_log != null) {
097:
098:                    String debug_log_level = (String) contextConfig
099:                            .get(SearchConfig.DEBUG_LOGLV);
100:                    int loglevel = 0;
101:                    if (debug_log_level != null)
102:                        loglevel = Integer.parseInt(debug_log_level);
103:
104:                    try {
105:                        // Nova logging. XXX no rotation
106:                        Log log = Log.getLog();
107:                        OutputStream os = new FileOutputStream(
108:                                search_engine_log, true);
109:                        log.setStream(os);
110:                        log.setLevel(loglevel);
111:                        if (!Build.debug)
112:                            log.setLevel(Log.DEBUG, 0);
113:                    } catch (Exception e) {
114:                        if (SearchLogger.getLogger().isLoggable(Level.WARNING)) {
115:                            LogRecord rec = new LogRecord(Level.WARNING,
116:                                    "PSSH_CSPSRDMS0136");
117:                            Object[] obj = new Object[] { search_engine_log };
118:                            rec.setParameters(obj);
119:                            rec.setThrown(e);
120:                            rec.setLoggerName(SearchLogger.getLogger()
121:                                    .getName());
122:                            SearchLogger.getLogger().log(rec);
123:                        }
124:                        throw e;
125:                    }
126:                }
127:
128:                // Initialize rdm.log
129:                try {
130:                    rdm_log_init();
131:                } catch (Exception e) {
132:                    throw new Exception("Failed to initialise RDM error log: "
133:                            + e.getMessage());
134:                }
135:                schema_init();
136:
137:            }
138:
139:            /** logging support */
140:            protected void rdm_log_init() throws Exception {
141:                SearchLogger.rdmLogInit(SearchConfig.RDM_LOGGER, rdmConfig
142:                        .getServerRoot());
143:            }
144:
145:            public void schema_init() throws Exception {
146:                // XXX schema is part of CSID???
147:                // We're getting rid of csid concept. Schema will be shared by all dbs.
148:                String schemafn = null;
149:                try {
150:                    // XXX schema.rdm currently only defines the DOCUMENT object type.
151:                    // XXX It should either define all object types, or be renamed document.schema
152:                    schemafn = SearchConfig.getValue(SearchConfig.SCHEMA);
153:                    SOIFInputStream ss = new SOIFInputStream(schemafn);
154:                    SOIF s;
155:                    while ((s = ss.readSOIF()) != null) {
156:                        RDMSchema docSchema = RDMSchema.register(new RDMSchema(
157:                                s));
158:                        SearchLogger.getLogger().log(Level.INFO,
159:                                "PSSH_CSPSRDMS0039", docSchema.getName());
160:                    }
161:                    RDMSchema classSchema = RDMSchema.register(new RDMSchema(
162:                            RDMSchema.getClassificationSchemaSOIF()));
163:                    SearchLogger.getLogger().log(Level.INFO,
164:                            "PSSH_CSPSRDMS0040", classSchema.getName());
165:                } catch (Exception e) {
166:                    if (SearchLogger.getLogger().isLoggable(Level.WARNING)) {
167:                        LogRecord rec = new LogRecord(Level.WARNING,
168:                                "PSSH_CSPSRDMS0041");
169:                        Object[] obj = new Object[] { schemafn };
170:                        rec.setParameters(obj);
171:                        rec.setThrown(e);
172:                        rec.setLoggerName(SearchLogger.getLogger().getName());
173:                        SearchLogger.getLogger().log(rec);
174:                    }
175:                    throw e;
176:                }
177:            }
178:
179:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.