Package org.apache.maven.index.reader
Class IndexWriter
java.lang.Object
org.apache.maven.index.reader.IndexWriter
- All Implemented Interfaces:
- Closeable,- AutoCloseable
Maven Index writer that writes chunk and maintains published property file. Instances of this class MUST BE handled
 as resources (have them closed once done with them), it is user responsibility to close them, ideally in
 try-with-resource block.
 
 Currently no incremental update is supported, as the deletion states should be maintained by
 caller. Hence, this writer will always produce the "main" chunk only.
- Since:
- 5.1.2
- 
Constructor SummaryConstructorsConstructorDescriptionIndexWriter(WritableResourceHandler local, String indexId, boolean incrementalSupported) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Closes the underlyingResourceHandlerand synchronizes published index properties, so remote clients becomes able to consume newly published index.Returns the chain id of published index.Returns the index context ID that published index has set.Returns the next chunk name about to be published.Returns theDatewhen index was last published ornullif this is first publishing.booleanReturnstrueif incremental publish is about to happen.intwriteChunk(Iterator<Map<String, String>> iterator) Writes out the record iterator and returns the written record count.
- 
Constructor Details- 
IndexWriterpublic IndexWriter(WritableResourceHandler local, String indexId, boolean incrementalSupported) throws IOException - Throws:
- IOException
 
 
- 
- 
Method Details- 
getIndexIdReturns the index context ID that published index has set.
- 
getPublishedTimestampReturns theDatewhen index was last published ornullif this is first publishing. In other words,returnsnullwhenisIncremental()returnsfalse. After this writer is closed, the return value is updated to "now" (inmethod.
- 
isIncrementalpublic boolean isIncremental()Returnstrueif incremental publish is about to happen.
- 
getChainIdReturns the chain id of published index. IfisIncremental()isfalse, this is the newly generated chain ID.
- 
getNextChunkNameReturns the next chunk name about to be published.
- 
writeChunkWrites out the record iterator and returns the written record count.- Throws:
- IOException
 
- 
closeCloses the underlyingResourceHandlerand synchronizes published index properties, so remote clients becomes able to consume newly published index. If sync is not desired (ie. due to aborted publish), then this method should NOT be invoked, but rather theResourceHandlerthat caller provided in constructor of this class should be closed manually.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Throws:
- IOException
 
 
-