Source Code Cross Referenced for SearchOnlyDb.java in  » Portal » Open-Portal » com » sun » portal » search » db » 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.db 
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.db;
007:
008:        import com.sun.portal.search.rdm.*;
009:        import com.sun.portal.search.soif.*;
010:        import com.sun.portal.search.util.*;
011:
012:        import java.util.*;
013:        import java.io.*;
014:
015:        /**
016:         * SOIF Database API
017:         *
018:         * <p>- handles SOIF db i/o
019:         * <p>- provides a template for similar, non-SOIF layers, eg, XML, etc.
020:         * <p>- hides db implementation details (eg, db might not contain SOIF)
021:         * <p>- hides the mechanics of P/NP data
022:         */
023:        public class SearchOnlyDb implements  RDMDb {
024:
025:            NovaDb searchengine = new NovaDb(); // XXX need factory
026:
027:            // XXX Authentication???
028:
029:            /**
030:             * insert/replace RD in database, filtered by view
031:             */
032:            public void store(SToken st, SOIF insoif, Set view, int flags,
033:                    RDMTransaction t) throws RDMException {
034:
035:                if ((flags & NOINDEX) == 0) {
036:                    if (!insoif.contains(SOIFDb.NOREINDEX)) {
037:                        // need to reindex this SOIF
038:                        searchengine.store(st, insoif, view, flags, t);
039:                    } else
040:                        insoif.remove(SOIFDb.NOREINDEX);
041:                }
042:
043:            }
044:
045:            /**
046:             * delete RD from database XXX with View?
047:             */
048:            public void delete(SToken st, SOIF insoif, int flags,
049:                    RDMTransaction t) throws RDMException {
050:
051:                if ((flags & NOINDEX) == 0) {
052:                    int pflags = flags & 0xFF000000;
053:                    flags &= 0x00FFFFFF;
054:                    if ((pflags & RDMDb.PONLY) != 0) {
055:                        // P delete may require reindex
056:                        if (!insoif.contains(SOIFDb.NOREINDEX))
057:                            searchengine.store(st, insoif, null, flags, t);
058:                    } else
059:                        // Entire RD, or NP only delete implies index delete
060:                        searchengine.delete(st, insoif, null, flags, t);
061:                }
062:
063:            }
064:
065:            /**
066:             * Create a new db with the given name, partitions and indexes.
067:             * @param st	Security token for access control
068:             * @param rootdir	db home dir
069:             * @param dbname	logical database name
070:             * @param parts	database partitions
071:             * @param index	db index data
072:             * @throws RDMException
073:             */
074:            static public void create(SToken st, String rootdir, String dbname,
075:                    String parts[]) throws RDMException {
076:                ; // nothing
077:            }
078:
079:            /**
080:             * Delete the named db.
081:             * @param st
082:             * @param rootdir
083:             * @param dbname
084:             * @throws RDMException  */
085:            static public void drop(SToken st, String rootdir, String dbname)
086:                    throws RDMException {
087:                // XXX searchengine.drop();
088:            }
089:
090:            /**
091:             * Empty the database
092:             */
093:            public int purge(SToken st, RDMTransaction t) throws RDMException {
094:                return searchengine.purge(st, t);
095:            }
096:
097:            /**
098:             * open -- Opens a database
099:             * 	- rootdir -- db home dir
100:             * 	- dbname -- name of database from root.db (e.g., default)
101:             * 	- rw -- RDMDb.WRITER or RDMDb.WRCREAT or RDMDb.READER
102:             * 	- mode -- Unix mode
103:             */
104:            public void open(SToken st, String rootdir, String dbname, int rw,
105:                    int mode) throws RDMException {
106:                searchengine.open(st, rootdir, dbname, rw, mode);
107:            }
108:
109:            /**
110:             * Closes db and index extents
111:             * @param st
112:             * @throws RDMException
113:             */
114:            public void close(SToken st) throws RDMException {
115:                searchengine.close(st);
116:            }
117:
118:            public String getName() {
119:                //return searchengine.getName;
120:                return "Nova Search"; // XXX
121:            }
122:
123:            public RDMResultSet search(SToken st, String query, int numHits,
124:                    Set view, String sortOrder, RDMTransaction t)
125:                    throws RDMException {
126:                return searchengine.search(st, query, numHits, view, sortOrder,
127:                        t);
128:            }
129:
130:            /**
131:             * Delete a SOIF stream. Should do automatic batching if appropriate.
132:             */
133:            public void delete(SToken st, SOIF s, Set view, int flags,
134:                    RDMTransaction t) throws RDMException {
135:                searchengine.delete(st, s, view, flags, t);
136:            }
137:
138:            /**
139:             * Number of docs.
140:             */
141:            public int count(SToken st, RDMTransaction t) throws RDMException {
142:                return searchengine.count(st, t);
143:            }
144:
145:            /**
146:             * Store - creates a transaction for atomic indexing, if none supplied.
147:             * @param st
148:             * @param key
149:             * @param newdata
150:             * @param flags
151:             * @param t
152:             * @throws RDMException   */
153:            public void store(SToken st, Datum key, Datum newdata, int flags,
154:                    RDMTransaction t) throws RDMException {
155:                throw new RDMException("SearchOnlyDb: store() not implemented");
156:            }
157:
158:            public void store(SToken st, SOIF soif, int flags, RDMTransaction t)
159:                    throws RDMException {
160:                store(st, soif, null, flags, t);
161:            }
162:
163:            /**
164:             * update - update an RD XXX with View?
165:             */
166:            public void update(SToken st, SOIF insoif, Set view, int flags,
167:                    RDMTransaction t) throws RDMException {
168:                throw new RDMException("SearchOnlyDb: update() not implemented");
169:            }
170:
171:            /**
172:             * Delete - creates a transaction for atomic indexing, if none supplied.
173:             * @param st
174:             * @param key
175:             * @param flags
176:             * @param t
177:             * @throws RDMException   */
178:            public void delete(SToken st, Datum key, int flags, RDMTransaction t)
179:                    throws RDMException {
180:                throw new RDMException("SearchOnlyDb: delete() not implemented");
181:            }
182:
183:            /**
184:             * Returns 0 if present, or Db.DB_NOTFOUND or DBb.DB_KEYEMPTY (for missing recno key)
185:             * If result is null, simply checks for presence of key in db.
186:             * @param st
187:             * @param key
188:             * @param result
189:             * @param flags
190:             * @param t
191:             * @throws RDMException
192:             * @return   */
193:            public int fetch(SToken st, Datum key, Datum result, int flags,
194:                    RDMTransaction t) throws RDMException {
195:                throw new RDMException("SearchOnlyDb: fetch() not implemented");
196:            }
197:
198:            /**
199:             * retrieve RD from database, filtered by view
200:             */
201:            public SOIF fetch(SToken st, String url, Set view, int flags,
202:                    RDMTransaction t) throws RDMException {
203:                return searchengine.fetch(st, url, view, flags, t);
204:            }
205:
206:            public SOIF fetch(SToken st, String url, int flags, RDMTransaction t)
207:                    throws RDMException {
208:                return fetch(st, url, null, flags, t);
209:            }
210:
211:            /**
212:             * Create a new db with the given name, partitions and indexes.
213:             * @param st	Security token for access control
214:             * @param rootdir	db home dir
215:             * @param dbname	logical database name
216:             * @param parts	database partitions
217:             * @throws RDMException
218:             */
219:            public void create1(SToken st, String rootdir, String dbname,
220:                    String[] parts) throws RDMException {
221:                throw new RDMException(
222:                        "SearchOnlyDb: create1() not implemented");
223:            }
224:
225:            /**
226:             * Delete the named db.
227:             * @param st
228:             * @param rootdir
229:             * @param dbname
230:             * @throws RDMException   */
231:            public void drop1(SToken st, String rootdir, String dbname)
232:                    throws RDMException {
233:                throw new RDMException("SearchOnlyDb: drop1() not implemented");
234:            }
235:
236:            /**
237:             * Administer the db
238:             * @param st
239:             * @param cmd
240:             * @throws RDMException
241:             */
242:            public void admin(SToken st, String cmd) throws RDMException {
243:                throw new RDMException("SearchOnlyDb: admin() not implemented");
244:            }
245:
246:            /**
247:             * Query language support
248:             * @param st
249:             * @throws RDMException
250:             * @return Set of supported query languages (String)
251:             */
252:            public Set getSupportedQueryLanguages(SToken st)
253:                    throws RDMException {
254:                throw new RDMException(
255:                        "SearchOnlyDb: getSupportedQueryLanguages() not implemented");
256:            }
257:
258:            /**
259:             * Data type support XXX - or leave this up to the client(or server)?
260:             */
261:            public Set getSupportedDataTypes(SToken st) throws RDMException {
262:                throw new RDMException(
263:                        "SearchOnlyDb: getSupportedDataTypes() not implemented");
264:            }
265:
266:            /**
267:             * Optimize the db
268:             */
269:            public void optimize(SToken st) throws RDMException {
270:                searchengine.optimize(st);
271:            }
272:
273:            /**
274:             * Housekeep the db - general servicing, clean log files, create checkpoints, etc.
275:             */
276:            public void housekeep() throws RDMException {
277:                throw new RDMException(
278:                        "SearchOnlyDb: houseKeep() not implemented");
279:            }
280:
281:            public void setIndexBatchSize(SToken st, int n) throws RDMException {
282:                searchengine.setIndexBatchSize(st, n);
283:            }
284:
285:            public void indexBatch(SToken st) throws RDMException {
286:                searchengine.indexBatch(st);
287:            }
288:
289:            /**
290:             * Recover the db - must be run stand alone (ie, no one else has the db open)
291:             */
292:            public void recover(SToken st, String dbhome, boolean fatal)
293:                    throws RDMException {
294:            }
295:
296:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.