Java Doc for JdbcDirectory.java in  » Search-Engine » compass-2.0 » org » apache » lucene » store » jdbc » 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 » compass 2.0 » org.apache.lucene.store.jdbc 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.lucene.store.jdbc.JdbcDirectory

JdbcDirectory
public class JdbcDirectory extends Directory implements MultiDeleteDirectory(Code)
A Jdbc based implementation of a Lucene Directory allowing the storage of a Lucene index within a database. Uses a jdbc DataSource, Dialect specific for the database used, and an optional JdbcDirectorySettings and JdbcTable for configuration.

The directory works against a single table, where the binary data is stored in Blob. Each "file" has an entry in the database, and different FileEntryHandler can be defines for different files (or files groups).

Most of the files will not be deleted from the database when the directory delete method is called, but will only be marked to be deleted (see org.apache.lucene.store.jdbc.handler.MarkDeleteFileEntryHandler . It is done since other readers or searchers might be working with the database, and still use the files. The ability to purge mark deleted files based on a "delta" is acheived using JdbcDirectory.deleteMarkDeleted() and JdbcDirectory.deleteMarkDeleted(long) . Note, the purging process is not called by the directory code, so it will have to be managed by the application using the jdbc directory.

For transaction management, all the operations performed against the database do not call commit or rollback. They simply open a connection (using org.apache.lucene.store.jdbc.datasource.DataSourceUtils.getConnection(javax.sql.DataSource) ), and close it using org.apache.lucene.store.jdbc.datasource.DataSourceUtils.releaseConnection(java.sql.Connection) ). This results in the fact that transcation management is simple and wraps the directory operations, allowing it to span as many operations as needed.

For none managed applications (i.e. applications that do not use JTA or Spring transaction manager), the jdbc directory implementation comes with org.apache.lucene.store.jdbc.datasource.TransactionAwareDataSourceProxy which wraps a DataSource (should be a pooled one, like Jakartat DBCP). Using it with the org.apache.lucene.store.jdbc.datasource.DataSourceUtils , or the provided DirectoryTemplate should make integrating or using jdbc directory simple.

Also, for none managed applications, there is an option working with autoCommit=true mode. The system will work much slower, and it is only supported on a portion of the databases, but any existing code that uses Lucene with any other Directory implemenation should work as is.

If working within managed environments, an external transaction management should be performed (using JTA for example). Simple solutions can be using CMT or Spring Framework abstraction of transaction managers. Currently, the jdbc directory implementation does not implement a transaction management abstraction, since there is a very good solution out there already (Spring and JTA). Note, when using Spring and the DataSourceTransactionManager, to provide the jdbc directory with a Spring's TransactionAwareDataSourceProxy.
author:
   kimchy




Constructor Summary
public  JdbcDirectory(DataSource dataSource, String tableName)
     Creates a new jdbc directory.
public  JdbcDirectory(DataSource dataSource, Dialect dialect, String tableName)
     Creates a new jdbc directory.
public  JdbcDirectory(DataSource dataSource, JdbcDirectorySettings settings, String tableName)
     Creates a new jdbc directory.
public  JdbcDirectory(DataSource dataSource, Dialect dialect, JdbcDirectorySettings settings, String tableName)
     Creates a new jdbc directory.
public  JdbcDirectory(DataSource dataSource, JdbcTable table)
     Creates a new jdbc directory.

Method Summary
public  voidclose()
     Closes the directory.
public  voidcreate()
     Creates a new database table.
protected  LockcreateLock()
    
public  IndexOutputcreateOutput(String name)
    
public  voiddelete()
     Deletes the database table (drops it) from the database.
public  voiddeleteContent()
     Deletes the contents of the database, except for the commit and write lock.
public  voiddeleteFile(String name)
    
public  ListdeleteFiles(List names)
    
public  voiddeleteMarkDeleted()
     Delets all the file entries that are marked to be deleted, and they were marked "delta" time ago (base on database time, if possible by dialect).
public  voiddeleteMarkDeleted(long delta)
     Delets all the file entries that are marked to be deleted, and they were marked "delta" time ago (base on database time, if possible by dialect).
public  booleanfileExists(String name)
    
public  longfileLength(String name)
    
public  longfileModified(String name)
    
public  DataSourcegetDataSource()
    
public  DialectgetDialect()
    
protected  FileEntryHandlergetFileEntryHandler(String name)
    
public  JdbcTemplategetJdbcTemplate()
    
public  JdbcDirectorySettingsgetSettings()
    
public  JdbcTablegetTable()
    
public  String[]list()
    
public  LockmakeLock(String name)
    
public  IndexInputopenInput(String name)
    
public  voidrenameFile(String from, String to)
    
public  booleantableExists()
     Returns true if the database table exists.
public  voidtouchFile(String name)
    


Constructor Detail
JdbcDirectory
public JdbcDirectory(DataSource dataSource, String tableName) throws JdbcStoreException(Code)
Creates a new jdbc directory. Creates new JdbcDirectorySettings using it's default values. Uses DialectResolver to try and automatically reolve the Dialect .
Parameters:
  dataSource - The data source to use
Parameters:
  tableName - The table name
throws:
  JdbcStoreException -



JdbcDirectory
public JdbcDirectory(DataSource dataSource, Dialect dialect, String tableName)(Code)
Creates a new jdbc directory. Creates new JdbcDirectorySettings using it's default values.
Parameters:
  dataSource - The data source to use
Parameters:
  dialect - The dialect
Parameters:
  tableName - The table name



JdbcDirectory
public JdbcDirectory(DataSource dataSource, JdbcDirectorySettings settings, String tableName) throws JdbcStoreException(Code)
Creates a new jdbc directory. Uses DialectResolver to try and automatically reolve the Dialect .
Parameters:
  dataSource - The data source to use
Parameters:
  settings - The settings to configure the directory
Parameters:
  tableName - The table name that will be used



JdbcDirectory
public JdbcDirectory(DataSource dataSource, Dialect dialect, JdbcDirectorySettings settings, String tableName)(Code)
Creates a new jdbc directory.
Parameters:
  dataSource - The data source to use
Parameters:
  dialect - The dialect
Parameters:
  settings - The settings to configure the directory
Parameters:
  tableName - The table name that will be used



JdbcDirectory
public JdbcDirectory(DataSource dataSource, JdbcTable table)(Code)
Creates a new jdbc directory.
Parameters:
  dataSource - The data source to use
Parameters:
  table - The Jdbc table definitions




Method Detail
close
public void close() throws IOException(Code)
Closes the directory.



create
public void create() throws IOException(Code)
Creates a new database table. Drops it before hand.
throws:
  IOException -



createLock
protected Lock createLock() throws IOException(Code)



createOutput
public IndexOutput createOutput(String name) throws IOException(Code)



delete
public void delete() throws IOException(Code)
Deletes the database table (drops it) from the database.
throws:
  IOException -



deleteContent
public void deleteContent() throws IOException(Code)
Deletes the contents of the database, except for the commit and write lock.
throws:
  IOException -



deleteFile
public void deleteFile(String name) throws IOException(Code)



deleteFiles
public List deleteFiles(List names) throws IOException(Code)



deleteMarkDeleted
public void deleteMarkDeleted() throws IOException(Code)
Delets all the file entries that are marked to be deleted, and they were marked "delta" time ago (base on database time, if possible by dialect). The delta is taken from org.apache.lucene.store.jdbc.JdbcDirectorySettings.getDeleteMarkDeletedDelta .



deleteMarkDeleted
public void deleteMarkDeleted(long delta) throws IOException(Code)
Delets all the file entries that are marked to be deleted, and they were marked "delta" time ago (base on database time, if possible by dialect).



fileExists
public boolean fileExists(String name) throws IOException(Code)



fileLength
public long fileLength(String name) throws IOException(Code)



fileModified
public long fileModified(String name) throws IOException(Code)



getDataSource
public DataSource getDataSource()(Code)



getDialect
public Dialect getDialect()(Code)



getFileEntryHandler
protected FileEntryHandler getFileEntryHandler(String name)(Code)



getJdbcTemplate
public JdbcTemplate getJdbcTemplate()(Code)



getSettings
public JdbcDirectorySettings getSettings()(Code)



getTable
public JdbcTable getTable()(Code)



list
public String[] list() throws IOException(Code)



makeLock
public Lock makeLock(String name)(Code)



openInput
public IndexInput openInput(String name) throws IOException(Code)



renameFile
public void renameFile(String from, String to) throws IOException(Code)



tableExists
public boolean tableExists() throws IOException, UnsupportedOperationException(Code)
Returns true if the database table exists. true if the database table exists, false otherwise
throws:
  IOException -
throws:
  UnsupportedOperationException - If the database dialect does not support it



touchFile
public void touchFile(String name) throws IOException(Code)



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.