|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.neo4j.kernel.impl.transaction.xaframework.XaDataSource
org.neo4j.index.lucene.LuceneDataSource
public class LuceneDataSource
An XaDataSource
optimized for the LuceneIndexService
.
This class is public because the XA framework requires it.
Field Summary | |
---|---|
static org.apache.lucene.analysis.Analyzer |
LOWER_CASE_WHITESPACE_ANALYZER
Default Analyzer for fulltext parsing. |
Constructor Summary | |
---|---|
LuceneDataSource(Map<Object,Object> params)
Constructs this data source. |
Method Summary | |
---|---|
void |
applyLog(ReadableByteChannel byteChannel)
Attempts to apply a logical log to this data source. |
void |
close()
Closes this data source. |
protected void |
deleteDocumentsUsingWriter(org.apache.lucene.index.IndexWriter writer,
long nodeId,
Object value)
|
boolean |
deleteLogicalLog(long version)
Deletes a log specific logical log. |
protected void |
fillDocument(org.apache.lucene.document.Document document,
long nodeId,
String key,
Object value)
|
protected org.apache.lucene.analysis.Analyzer |
getAnalyzer()
|
long |
getCreationTime()
Returns a timestamp when this data source was created. |
long |
getCurrentLogVersion()
Returns the current version of this data source. |
protected String |
getDeleteDocumentsKey()
|
LuceneIndexService |
getIndexService()
|
protected org.apache.lucene.document.Field.Index |
getIndexStrategy(String key,
Object value)
|
ReadableByteChannel |
getLogicalLog(long version)
Returns a readable byte channel of the specified logical log. |
long |
getRandomIdentifier()
Returns a random identifier that gets generated when the data source is created. |
org.neo4j.kernel.impl.transaction.xaframework.XaConnection |
getXaConnection()
Creates a XA connection to the resource this data source represents. |
boolean |
hasLogicalLog(long version)
Tests if a specific logical log exists. |
void |
keepLogicalLogs(boolean keep)
Sets wether logical logs should be saved upon rotation or not. |
void |
makeBackupSlave()
Makes this data source a backup slave. |
void |
rotateLogicalLog()
Rotates this logical log. |
void |
setAutoRotate(boolean rotate)
Turns off/on auto rotate of logical logs. |
protected void |
setIndexService(LuceneIndexService indexService)
This is here so that LuceneIndexService.formQuery(String, Object)
can be used when getting stuff from inside a transaction. |
void |
setLogicalLogTargetSize(long size)
Sets the target size of the logical log that will cause a rotation of the log if XaDataSource.setAutoRotate(boolean) is set to true . |
Methods inherited from class org.neo4j.kernel.impl.transaction.xaframework.XaDataSource |
---|
getBranchId, getName, setBranchId, setName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.apache.lucene.analysis.Analyzer LOWER_CASE_WHITESPACE_ANALYZER
Analyzer
for fulltext parsing.
Constructor Detail |
---|
public LuceneDataSource(Map<Object,Object> params) throws InstantiationException
params
- XA parameters.
InstantiationException
- if the data source couldn't be
instantiatedMethod Detail |
---|
protected void setIndexService(LuceneIndexService indexService)
LuceneIndexService.formQuery(String, Object)
can be used when getting stuff from inside a transaction.
indexService
- the LuceneIndexService
instance which
created it.public LuceneIndexService getIndexService()
public void close()
org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
getXaConnection
after
this method has been invoked is illegal.
close
in class org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
public org.neo4j.kernel.impl.transaction.xaframework.XaConnection getXaConnection()
org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
getXaConnection
in class org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
protected org.apache.lucene.analysis.Analyzer getAnalyzer()
protected void deleteDocumentsUsingWriter(org.apache.lucene.index.IndexWriter writer, long nodeId, Object value)
protected String getDeleteDocumentsKey()
protected void fillDocument(org.apache.lucene.document.Document document, long nodeId, String key, Object value)
protected org.apache.lucene.document.Field.Index getIndexStrategy(String key, Object value)
public void keepLogicalLogs(boolean keep)
org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
false
.
keepLogicalLogs
in class org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
keep
- true
means save, false
means
deletepublic long getCreationTime()
org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
Creation time together with random identifier can be used to uniqley identify a data source (since it is possible to have multiple sources of same type).
getCreationTime
in class org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
public long getRandomIdentifier()
org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
Creation time together with random identifier can be used to uniqley identify a data source (since it is possible to have multiple sources of same type).
getRandomIdentifier
in class org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
public long getCurrentLogVersion()
org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
XaDataSource.rotateLogicalLog()
when XaDataSource.keepLogicalLogs(boolean)
is
set to true
will result in a log with that version created.
getCurrentLogVersion
in class org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
public void applyLog(ReadableByteChannel byteChannel) throws IOException
org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
applyLog
in class org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
byteChannel
- readable channel containing the logical log data
IOException
- if a problem with reading the log occurspublic void rotateLogicalLog() throws IOException
org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
XaDataSource.keepLogicalLogs(boolean)
is
configured to true the log will be saved and can be retrieved with the
XaDataSource.getLogicalLog(long)
method. If not it will be deleted. Active
transactions get copied to a new logical log.
rotateLogicalLog
in class org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
IOException
- if unable to read old log or write to new onepublic ReadableByteChannel getLogicalLog(long version) throws IOException
org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
getLogicalLog
in class org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
version
- version of the logical log
IOException
- if no such log existpublic boolean hasLogicalLog(long version)
org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
hasLogicalLog
in class org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
version
- the version of the logical log
true
if the log existspublic boolean deleteLogicalLog(long version)
org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
deleteLogicalLog
in class org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
version
- version of log to delete
public void setAutoRotate(boolean rotate)
org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
true
.
setAutoRotate
in class org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
rotate
- true
to turn onpublic void setLogicalLogTargetSize(long size)
org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
XaDataSource.setAutoRotate(boolean)
is set to true
.
setLogicalLogTargetSize
in class org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
size
- target size in bytespublic void makeBackupSlave()
org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
makeBackupSlave
in class org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |