Source Code Cross Referenced for IndexConfig.java in  » Search-Engine » regain » net » sf » regain » search » config » 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 » Search Engine » regain » net.sf.regain.search.config 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * CVS information:
003:         *  $RCSfile$
004:         *   $Source$
005:         *     $Date: 2005-04-15 10:47:04 +0200 (Fr, 15 Apr 2005) $
006:         *   $Author: til132 $
007:         * $Revision: 132 $
008:         */
009:        package net.sf.regain.search.config;
010:
011:        import java.util.Properties;
012:
013:        import net.sf.regain.RegainException;
014:        import net.sf.regain.RegainToolkit;
015:        import net.sf.regain.search.access.SearchAccessController;
016:
017:        /**
018:         * The configuration for one index.
019:         * 
020:         * @author Tilman Schneider, STZ-IDA an der FH Karlsruhe
021:         */
022:        public class IndexConfig {
023:
024:            /** Default list of index fields to search in. */
025:            protected static final String[] DEFAULT_SEARCH_FIELD_LIST = {
026:                    "content", "title", "headlines" };
027:
028:            /** The name of the index. */
029:            private String mName;
030:
031:            /** The directory where the index is located. */
032:            private String mDirectory;
033:
034:            /**
035:             * The regular expression that identifies URLs that should be opened in a new
036:             * window.
037:             */
038:            private String mOpenInNewWindowRegex;
039:
040:            /** Whether the file-to-http-bridge should be used. */
041:            private boolean mUseFileToHttpBridge;
042:
043:            /**
044:             * The index fields to search by default.
045:             * <p>
046:             * NOTE: The user may search in other fields also using the "field:"-operator.
047:             * Read the
048:             * <a href="http://jakarta.apache.org/lucene/docs/queryparsersyntax.html">lucene query syntax</a>
049:             * for details.
050:             */
051:            private String[] mSearchFieldList;
052:
053:            /**
054:             * The URL rewrite rules.
055:             * <p>
056:             * Contains pairs of URL prefixes: The first prefix will be replaced by the
057:             * second.
058:             * <p>
059:             * E.g.:
060:             * <pre>
061:             * new String[][] {
062:             *   { "file://c:/webcontent", "http://www.mydomain.de" },
063:             *   { "file://n:/docs", "file://///fileserver/public/docs" },
064:             * };
065:             * </pre>
066:             */
067:            private String[][] mRewriteRules;
068:
069:            /** The SearchAccessController to use. May be <code>null</code>. */
070:            private SearchAccessController mSearchAccessController;
071:
072:            /**
073:             * Creates a new instance of IndexConfig.
074:             * 
075:             * @param name The name of the index.
076:             * @param directory The directory where the index is located.
077:             * @param openInNewWindowRegex The regular expression that identifies URLs
078:             *        that should be opened in a new window.
079:             * @param useFileToHttpBridge Whether the file-to-http-bridge should be used.
080:             *        See {@link #getUseFileToHttpBridge()} for details.
081:             * @param searchFieldList The index fields to search by default.
082:             * @param rewriteRules The URL rewrite rules. Contains pairs of URL prefixes:
083:             *        The first prefix will be replaced by the second.
084:             * @param searchAccessControllerClass The class name of the
085:             *        {@link SearchAccessController} to use.
086:             * @param searchAccessControllerJar The name of jar file to load the
087:             *        {@link SearchAccessController} from.
088:             * @param searchAccessControllerConfig The configuration for the
089:             *        {@link SearchAccessController}.
090:             * @throws RegainException If loading the SearchAccessController failed.
091:             */
092:            public IndexConfig(String name, String directory,
093:                    String openInNewWindowRegex, boolean useFileToHttpBridge,
094:                    String[] searchFieldList, String[][] rewriteRules,
095:                    String searchAccessControllerClass,
096:                    String searchAccessControllerJar,
097:                    Properties searchAccessControllerConfig)
098:                    throws RegainException {
099:                mName = name;
100:                mDirectory = directory;
101:                mOpenInNewWindowRegex = openInNewWindowRegex;
102:                mUseFileToHttpBridge = useFileToHttpBridge;
103:                mSearchFieldList = searchFieldList;
104:                mRewriteRules = rewriteRules;
105:
106:                if (searchAccessControllerClass != null) {
107:                    mSearchAccessController = (SearchAccessController) RegainToolkit
108:                            .createClassInstance(searchAccessControllerClass,
109:                                    SearchAccessController.class,
110:                                    searchAccessControllerJar);
111:
112:                    if (searchAccessControllerConfig == null) {
113:                        searchAccessControllerConfig = new Properties();
114:                    }
115:                    mSearchAccessController.init(searchAccessControllerConfig);
116:                }
117:            }
118:
119:            /**
120:             * Gets the name of the index.
121:             * 
122:             * @return The name of the index.
123:             */
124:            public String getName() {
125:                return mName;
126:            }
127:
128:            /**
129:             * Gets the directory where the index is located.
130:             * 
131:             * @return The directory where the index is located.
132:             */
133:            public String getDirectory() {
134:                return mDirectory;
135:            }
136:
137:            /**
138:             * Gets the regular expression that identifies URLs that should be opened in
139:             * a new window.
140:             * 
141:             * @return The regular expression that identifies URLs that should be opened
142:             *         in a new window.
143:             */
144:            public String getOpenInNewWindowRegex() {
145:                return mOpenInNewWindowRegex;
146:            }
147:
148:            /**
149:             * Gets whether the file-to-http-bridge should be used for file-URLs.
150:             * <p>
151:             * Mozilla browsers have a security mechanism that blocks loading file-URLs
152:             * from pages loaded via http. To be able to load files from the search
153:             * results, regain offers the file-to-http-bridge that provides all files that
154:             * are listed in the index via http.
155:             * 
156:             * @return Whether the file-to-http-bridge should be used.
157:             */
158:            public boolean getUseFileToHttpBridge() {
159:                return mUseFileToHttpBridge;
160:            }
161:
162:            /**
163:             * Gets the index fields to search by default.
164:             * <p>
165:             * NOTE: The user may search in other fields also using the "field:"-operator.
166:             * Read the
167:             * <a href="http://jakarta.apache.org/lucene/docs/queryparsersyntax.html">lucene query syntax</a>
168:             * for details.
169:             * 
170:             * @return The index fields to search by default.
171:             */
172:            public String[] getSearchFieldList() {
173:                return mSearchFieldList;
174:            }
175:
176:            /**
177:             * Gets the URL rewrite rules.
178:             * <p>
179:             * The returned array contains pairs of URL prefixes: The first prefix will be
180:             * replaced by the second.
181:             * <p>
182:             * E.g.:
183:             * <pre>
184:             * new String[][] {
185:             *   { "file://c:/webcontent", "http://www.mydomain.de" },
186:             *   { "file://n:/docs", "file://///fileserver/public/docs" },
187:             * };
188:             * </pre>
189:             *
190:             * @return The URL rewrite rules. May be null;
191:             */
192:            public String[][] getRewriteRules() {
193:                return mRewriteRules;
194:            }
195:
196:            /**
197:             * Gets the SearchAccessController to use. Returns <code>null</code> if no
198:             * SearchAccessController should be used.
199:             * 
200:             * @return The SearchAccessController. 
201:             */
202:            public SearchAccessController getSearchAccessController() {
203:                return mSearchAccessController;
204:            }
205:
206:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.