Class RandomDocumentMessageProducer
java.lang.Object
org.nuxeo.lib.stream.pattern.producer.AbstractProducer<DocumentMessage>
org.nuxeo.importer.stream.producer.RandomDocumentMessageProducer
- All Implemented Interfaces:
AutoCloseable,Iterator<DocumentMessage>,ProducerIterator<DocumentMessage>
- Since:
- 9.1
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final BlobInfoFetcherprotected booleanprotected intprotected booleanprotected RandomDocumentMessageProducer.DocTypeprotected static final String[]protected static final String[]protected static final String[]protected static final String[]protected static final String[]protected static final String[]protected intprotected intprotected intprotected intprotected intprotected static RandomTextGeneratorprotected intprotected intprotected final longprotected intprotected final RandomFields inherited from class org.nuxeo.lib.stream.pattern.producer.AbstractProducer
producerId -
Constructor Summary
ConstructorsConstructorDescriptionRandomDocumentMessageProducer(int producerId, long nbDocuments, String lang, BlobInfoFetcher blobInfoFetcher) -
Method Summary
Modifier and TypeMethodDescriptionprotected Stringcapitalize(String line) voidclose()countFolderAsDocument(boolean value) protected DocumentMessagecreateDocument(String parentPath, Set<String> exclude) protected DocumentMessagecreateFolder(String parentPath, Set<String> exclude) protected DocumentMessageprotected Stringprotected StringgetDocumentTypeForMimeType(String mimeType) protected StringgetGaussian(String[] words) protected StringintgetPartition(DocumentMessage message, int partitions) Returns a partition associated with theMessage.protected Blobprotected DocumentMessagegetRandomNode(String type, String parentPath, boolean withBlob) protected DocumentMessagegetRandomNodeWithExclusion(String type, String parentPath, boolean withBlob, Set<String> exclude) protected DocumentMessagegetRandomNodeWithPrefix(String prefix, String type, String parentPath) protected HashMap<String, Serializable> getRandomProperties(String title) protected StringgetTitle()booleanhasNext()next()setMaxDocumentsPerFolder(int max) setMaxFoldersPerFolder(int max) withBlob(int sizeKB, boolean onlyText) Methods inherited from class org.nuxeo.lib.stream.pattern.producer.AbstractProducer
getProducerIdMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemainingMethods inherited from interface org.nuxeo.lib.stream.pattern.producer.ProducerIterator
remove
-
Field Details
-
nbDocuments
protected final long nbDocuments -
blobInfoFetcher
-
countFolderAsDocument
protected boolean countFolderAsDocument -
maxFoldersPerFolder
protected int maxFoldersPerFolder -
maxDocumentsPerFolder
protected int maxDocumentsPerFolder -
blobSizeKB
protected int blobSizeKB -
blobOnlyText
protected boolean blobOnlyText -
documentCount
protected int documentCount -
folderCount
protected int folderCount -
rand
-
gen
-
DC_NATURE
-
DC_SUBJECTS
-
DC_RIGHTS
-
DC_LANGUAGE
-
DC_SOURCE
-
DC_COVERAGE
-
foldersInCurrentFolderLimit
protected int foldersInCurrentFolderLimit -
documentInCurrentFolderLimit
protected int documentInCurrentFolderLimit -
currentType
-
parentIndex
protected int parentIndex -
parents
-
folderishChildren
-
children
-
documentInCurrentFolderCount
protected int documentInCurrentFolderCount
-
-
Constructor Details
-
RandomDocumentMessageProducer
public RandomDocumentMessageProducer(int producerId, long nbDocuments, String lang, BlobInfoFetcher blobInfoFetcher)
-
-
Method Details
-
setMaxFoldersPerFolder
-
setMaxDocumentsPerFolder
-
countFolderAsDocument
-
withBlob
-
getPartition
Description copied from interface:ProducerIteratorReturns a partition associated with theMessage. The value returned must be between 0 and lower than partitions.- Parameters:
message- the message to shardpartitions- the number of partitions
-
hasNext
public boolean hasNext() -
next
-
createRoot
-
createFolder
-
createDocument
-
getRandomNodeWithExclusion
protected DocumentMessage getRandomNodeWithExclusion(String type, String parentPath, boolean withBlob, Set<String> exclude) -
getRandomNode
-
getDocumentTypeForMimeType
-
getRandomNodeWithPrefix
-
getRandomBlob
-
getBlobMimeType
-
getName
-
getTitle
-
capitalize
-
getRandomProperties
-
getGaussian
-
close
- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classAbstractProducer<DocumentMessage>- Throws:
Exception
-