Class BatchManagerComponent
java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.ecm.automation.server.jaxrs.batch.BatchManagerComponent
- All Implemented Interfaces:
BatchManager,Adaptable,Component,Extensible,TimestampedService
Runtime Component implementing the
BatchManager service with the TransientStore.- Since:
- 5.4.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final StringThe default batch handler name.protected Map<String,BatchHandler> protected final AtomicIntegerstatic final StringFields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBlob(String batchId, String index, Blob blob, int chunkCount, int chunkIndex, String name, String mime, long fileSize) Adds a blob as a chunk to a batch.voidAdds a blob to a batch.voidaddStream(String batchId, String index, InputStream is, int chunkCount, int chunkIndex, String name, String mime, long fileSize) Adds an inputStream as a chunk to a batch.voidAdds an inputStream as a blob to a batch.voidCleans up the temporary storage associated to the batch.protected Objectexecute(Object blobInput, String chainOrOperationId, CoreSession session, Map<String, Object> contextParams, Map<String, Object> operationParams) execute(String batchId, String fileIndex, String chainOrOperationId, CoreSession session, Map<String, Object> contextParams, Map<String, Object> operationParams) Executes the chain or operation on theBlobfrom the givenbatchIdandfileIndex.execute(String batchId, String chainOrOperationId, CoreSession session, Map<String, Object> contextParams, Map<String, Object> operationParams) Executes the chain or operation on theBlobsfrom the givenbatchId.executeAndClean(String batchId, String chainOrOperationId, CoreSession session, Map<String, Object> contextParams, Map<String, Object> operationParams) Executes the chain or operation on theBlobsfrom the givenbatchId.Fetches information about a batch.protected BlobgetBatchBlob(String batchId, String fileIndex) Gets Blobs associated to a given batch.Gets Blobs associated to a given batch.getFileEntries(String batchId) getFileEntry(String batchId, String fileIndex) getHandler(String handlerName) Gets a batch handler.Returns the supported batch handler names.Deprecated.protected intbooleanReturns true if there is a batch for the givenbatchId, false otherwise.Initializes a batch by with an automatically generated id.Initiates a new batch with the given handler.protected BatchinitBatchInternal(String batchId) booleanremoveFileEntry(String batchId, String filedIdx) Removes a file from a batch.voidstart(ComponentContext context) Start the component.voidstop(ComponentContext context) Stop the component.Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, registerExtension, setLastModified, setModifiedNow, setName, unregister, unregisterContribution, unregisterExtensionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.nuxeo.runtime.model.Component
getApplicationStartedOrder
-
Field Details
-
CLIENT_BATCH_ID_FLAG
- See Also:
-
DEFAULT_BATCH_HANDLER
The default batch handler name.- Since:
- 10.1
- See Also:
-
XP_BATCH_HANDLER
- Since:
- 10.1
- See Also:
-
handlers
-
uploadInProgress
-
-
Constructor Details
-
BatchManagerComponent
public BatchManagerComponent()
-
-
Method Details
-
start
Description copied from interface:ComponentStart the component. This method is called after all the components were resolved and activated- Specified by:
startin interfaceComponent- Overrides:
startin classDefaultComponent
-
stop
Description copied from interface:ComponentStop the component.- Specified by:
stopin interfaceComponent- Overrides:
stopin classDefaultComponent- Throws:
InterruptedException
-
getTransientStore
Deprecated.Description copied from interface:BatchManagerReturns theTransientStorebacking the batches of the default handler.- Specified by:
getTransientStorein interfaceBatchManager
-
getSupportedHandlers
Description copied from interface:BatchManagerReturns the supported batch handler names.- Specified by:
getSupportedHandlersin interfaceBatchManager- Returns:
- the supported batch handler names
-
getHandler
Description copied from interface:BatchManagerGets a batch handler.- Specified by:
getHandlerin interfaceBatchManager- Parameters:
handlerName- the batch handler name- Returns:
- the batch handler, or
nullif it doesn't exist
-
initBatch
Description copied from interface:BatchManagerInitializes a batch by with an automatically generated id.- Specified by:
initBatchin interfaceBatchManager- Returns:
- the batch id
-
initBatchInternal
-
initBatch
Description copied from interface:BatchManagerInitiates a new batch with the given handler.- Specified by:
initBatchin interfaceBatchManager- Parameters:
handlerName- the batch handler name- Returns:
- the newly created batch
-
getBatch
Description copied from interface:BatchManagerFetches information about a batch.- Specified by:
getBatchin interfaceBatchManager- Parameters:
batchId- the batch id- Returns:
- the batch, or
nullif it doesn't exist
-
addStream
public void addStream(String batchId, String index, InputStream is, String name, String mime) throws IOException Description copied from interface:BatchManagerAdds an inputStream as a blob to a batch. Will create a newBatchif needed.Streams are persisted as temporary files.
- Specified by:
addStreamin interfaceBatchManager- Throws:
IOException
-
addBlob
public void addBlob(String batchId, String index, Blob blob, String name, String mime) throws IOException Description copied from interface:BatchManagerAdds a blob to a batch. Will create a newBatchif needed.- Specified by:
addBlobin interfaceBatchManager- Throws:
IOException
-
addStream
public void addStream(String batchId, String index, InputStream is, int chunkCount, int chunkIndex, String name, String mime, long fileSize) throws IOException Description copied from interface:BatchManagerAdds an inputStream as a chunk to a batch. Will create a newBatchif needed.Streams are persisted as temporary files.
- Specified by:
addStreamin interfaceBatchManager- Throws:
IOException
-
addBlob
public void addBlob(String batchId, String index, Blob blob, int chunkCount, int chunkIndex, String name, String mime, long fileSize) throws IOException Description copied from interface:BatchManagerAdds a blob as a chunk to a batch. Will create a newBatchif needed.- Specified by:
addBlobin interfaceBatchManager- Throws:
IOException
-
hasBatch
Description copied from interface:BatchManagerReturns true if there is a batch for the givenbatchId, false otherwise.- Specified by:
hasBatchin interfaceBatchManager
-
getBlobs
Description copied from interface:BatchManagerGets Blobs associated to a given batch. Returns null if batch does not exist.- Specified by:
getBlobsin interfaceBatchManager
-
getBlobs
Description copied from interface:BatchManagerGets Blobs associated to a given batch. Returns null if batch does not exist. Waits for upload in progress if needed.- Specified by:
getBlobsin interfaceBatchManager
-
getBlob
- Specified by:
getBlobin interfaceBatchManager
-
getBlob
- Specified by:
getBlobin interfaceBatchManager
-
getBatchBlob
-
getFileEntries
- Specified by:
getFileEntriesin interfaceBatchManager
-
getFileEntry
- Specified by:
getFileEntryin interfaceBatchManager
-
clean
Description copied from interface:BatchManagerCleans up the temporary storage associated to the batch.- Specified by:
cleanin interfaceBatchManager
-
execute
public Object execute(String batchId, String chainOrOperationId, CoreSession session, Map<String, Object> contextParams, Map<String, Object> operationParams) Description copied from interface:BatchManagerExecutes the chain or operation on theBlobsfrom the givenbatchId.This method does not clean the temporary storage associated to the
batchId.- Specified by:
executein interfaceBatchManager
-
execute
public Object execute(String batchId, String fileIndex, String chainOrOperationId, CoreSession session, Map<String, Object> contextParams, Map<String, Object> operationParams) Description copied from interface:BatchManagerExecutes the chain or operation on theBlobfrom the givenbatchIdandfileIndex.This method does not clean the temporary storage associated to the
batchId.- Specified by:
executein interfaceBatchManager
-
execute
-
getUploadWaitTimeout
protected int getUploadWaitTimeout() -
executeAndClean
public Object executeAndClean(String batchId, String chainOrOperationId, CoreSession session, Map<String, Object> contextParams, Map<String, Object> operationParams) Description copied from interface:BatchManagerExecutes the chain or operation on theBlobsfrom the givenbatchId.This method cleans the temporary storage associated to the
batchIdafter the execution.- Specified by:
executeAndCleanin interfaceBatchManager
-
removeFileEntry
Description copied from interface:BatchManagerRemoves a file from a batch.- Specified by:
removeFileEntryin interfaceBatchManager
-