Source Code Cross Referenced for FullTextSettings.java in  » Database-DBMS » h2database » org » h2 » fulltext » 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 » Database DBMS » h2database » org.h2.fulltext 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
003:         * (http://h2database.com/html/license.html).
004:         * Initial Developer: H2 Group
005:         */
006:        package org.h2.fulltext;
007:
008:        import java.sql.Connection;
009:        import java.sql.PreparedStatement;
010:        import java.sql.ResultSet;
011:        import java.sql.SQLException;
012:        import java.sql.Statement;
013:        import java.util.HashMap;
014:        import java.util.HashSet;
015:
016:        import org.h2.util.ObjectUtils;
017:
018:        /**
019:         * The global settings of a full text search.
020:         */
021:        public class FullTextSettings {
022:
023:            private static HashMap settings = new HashMap();
024:
025:            private HashSet ignoreList = new HashSet();
026:            private HashMap words = new HashMap();
027:            private HashMap indexes = new HashMap();
028:            private PreparedStatement prepSelectMapByWordId;
029:            private PreparedStatement prepSelectRowById;
030:
031:            private FullTextSettings() {
032:            }
033:
034:            HashSet getIgnoreList() {
035:                return ignoreList;
036:            }
037:
038:            public HashMap getWordList() {
039:                return words;
040:            }
041:
042:            IndexInfo getIndexInfo(long indexId) {
043:                return (IndexInfo) indexes.get(ObjectUtils.getLong(indexId));
044:            }
045:
046:            void addIndexInfo(IndexInfo index) {
047:                indexes.put(ObjectUtils.getLong(index.id), index);
048:            }
049:
050:            public String convertWord(String word) {
051:                // TODO this is locale specific, document
052:                word = word.toUpperCase();
053:                if (ignoreList.contains(word)) {
054:                    return null;
055:                }
056:                return word;
057:            }
058:
059:            static FullTextSettings getInstance(Connection conn)
060:                    throws SQLException {
061:                String path = getIndexPath(conn);
062:                FullTextSettings setting = (FullTextSettings) settings
063:                        .get(path);
064:                if (setting == null) {
065:                    setting = new FullTextSettings();
066:                    settings.put(path, setting);
067:                }
068:                return setting;
069:            }
070:
071:            private static String getIndexPath(Connection conn)
072:                    throws SQLException {
073:                Statement stat = conn.createStatement();
074:                ResultSet rs = stat
075:                        .executeQuery("CALL IFNULL(DATABASE_PATH(), 'MEM:' || DATABASE())");
076:                rs.next();
077:                String path = rs.getString(1);
078:                if ("MEM:UNNAMED".equals(path)) {
079:                    throw new SQLException("FULLTEXT",
080:                            "Fulltext search for private (unnamed) in-memory databases is not supported.");
081:                }
082:                rs.close();
083:                return path;
084:            }
085:
086:            public PreparedStatement getPrepSelectMapByWordId() {
087:                return prepSelectMapByWordId;
088:            }
089:
090:            public void setPrepSelectMapByWordId(
091:                    PreparedStatement prepSelectMapByWordId) {
092:                this .prepSelectMapByWordId = prepSelectMapByWordId;
093:            }
094:
095:            public PreparedStatement getPrepSelectRowById() {
096:                return prepSelectRowById;
097:            }
098:
099:            public void setPrepSelectRowById(PreparedStatement prepSelectRowById) {
100:                this.prepSelectRowById = prepSelectRowById;
101:            }
102:
103:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.