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
-
Field Summary
Modifier and TypeFieldDescriptionprotected final BlobInfoFetcher
protected boolean
protected int
protected boolean
protected RandomDocumentMessageProducer.DocType
protected static final String[]
protected static final String[]
protected static final String[]
protected static final String[]
protected static final String[]
protected static final String[]
protected int
protected int
protected int
protected int
protected int
protected static RandomTextGenerator
protected int
protected int
protected final long
protected int
protected final Random
Fields inherited from class org.nuxeo.lib.stream.pattern.producer.AbstractProducer
producerId
-
Constructor Summary
ConstructorDescriptionRandomDocumentMessageProducer
(int producerId, long nbDocuments, String lang, BlobInfoFetcher blobInfoFetcher) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
capitalize
(String line) void
close()
countFolderAsDocument
(boolean value) protected DocumentMessage
createDocument
(String parentPath, Set<String> exclude) protected DocumentMessage
createFolder
(String parentPath, Set<String> exclude) protected DocumentMessage
protected String
protected String
getDocumentTypeForMimeType
(String mimeType) protected String
getGaussian
(String[] words) protected String
int
getPartition
(DocumentMessage message, int partitions) Returns a partition associated with theMessage
.protected Blob
protected DocumentMessage
getRandomNode
(String type, String parentPath, boolean withBlob) protected DocumentMessage
getRandomNodeWithExclusion
(String type, String parentPath, boolean withBlob, Set<String> exclude) protected DocumentMessage
getRandomNodeWithPrefix
(String prefix, String type, String parentPath) protected HashMap<String,
Serializable> getRandomProperties
(String title) protected String
getTitle()
boolean
hasNext()
next()
setMaxDocumentsPerFolder
(int max) setMaxFoldersPerFolder
(int max) withBlob
(int sizeKB, boolean onlyText) Methods inherited from class org.nuxeo.lib.stream.pattern.producer.AbstractProducer
getProducerId
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
Methods 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:ProducerIterator
Returns 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:
close
in interfaceAutoCloseable
- Overrides:
close
in classAbstractProducer<DocumentMessage>
- Throws:
Exception
-