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
Modifier and TypeFieldDescriptionstatic final String
static final String
The default batch handler name.protected Map<String,
BatchHandler> protected final AtomicInteger
static final String
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBlob
(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.void
Adds a blob to a batch.void
addStream
(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.void
Adds an inputStream as a blob to a batch.void
Cleans up the temporary storage associated to the batch.protected Object
execute
(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 theBlob
from the givenbatchId
andfileIndex
.execute
(String batchId, String chainOrOperationId, CoreSession session, Map<String, Object> contextParams, Map<String, Object> operationParams) Executes the chain or operation on theBlobs
from the givenbatchId
.executeAndClean
(String batchId, String chainOrOperationId, CoreSession session, Map<String, Object> contextParams, Map<String, Object> operationParams) Executes the chain or operation on theBlobs
from the givenbatchId
.Fetches information about a batch.protected Blob
getBatchBlob
(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 int
boolean
Returns 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 Batch
initBatchInternal
(String batchId) boolean
removeFileEntry
(String batchId, String filedIdx) Removes a file from a batch.void
start
(ComponentContext context) Start the component.void
stop
(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, unregisterExtension
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:Component
Start the component. This method is called after all the components were resolved and activated- Specified by:
start
in interfaceComponent
- Overrides:
start
in classDefaultComponent
-
stop
Description copied from interface:Component
Stop the component.- Specified by:
stop
in interfaceComponent
- Overrides:
stop
in classDefaultComponent
- Throws:
InterruptedException
-
getTransientStore
Deprecated.Description copied from interface:BatchManager
Returns theTransientStore
backing the batches of the default handler.- Specified by:
getTransientStore
in interfaceBatchManager
-
getSupportedHandlers
Description copied from interface:BatchManager
Returns the supported batch handler names.- Specified by:
getSupportedHandlers
in interfaceBatchManager
- Returns:
- the supported batch handler names
-
getHandler
Description copied from interface:BatchManager
Gets a batch handler.- Specified by:
getHandler
in interfaceBatchManager
- Parameters:
handlerName
- the batch handler name- Returns:
- the batch handler, or
null
if it doesn't exist
-
initBatch
Description copied from interface:BatchManager
Initializes a batch by with an automatically generated id.- Specified by:
initBatch
in interfaceBatchManager
- Returns:
- the batch id
-
initBatchInternal
-
initBatch
Description copied from interface:BatchManager
Initiates a new batch with the given handler.- Specified by:
initBatch
in interfaceBatchManager
- Parameters:
handlerName
- the batch handler name- Returns:
- the newly created batch
-
getBatch
Description copied from interface:BatchManager
Fetches information about a batch.- Specified by:
getBatch
in interfaceBatchManager
- Parameters:
batchId
- the batch id- Returns:
- the batch, or
null
if it doesn't exist
-
addStream
public void addStream(String batchId, String index, InputStream is, String name, String mime) throws IOException Description copied from interface:BatchManager
Adds an inputStream as a blob to a batch. Will create a newBatch
if needed.Streams are persisted as temporary files.
- Specified by:
addStream
in interfaceBatchManager
- Throws:
IOException
-
addBlob
public void addBlob(String batchId, String index, Blob blob, String name, String mime) throws IOException Description copied from interface:BatchManager
Adds a blob to a batch. Will create a newBatch
if needed.- Specified by:
addBlob
in 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:BatchManager
Adds an inputStream as a chunk to a batch. Will create a newBatch
if needed.Streams are persisted as temporary files.
- Specified by:
addStream
in 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:BatchManager
Adds a blob as a chunk to a batch. Will create a newBatch
if needed.- Specified by:
addBlob
in interfaceBatchManager
- Throws:
IOException
-
hasBatch
Description copied from interface:BatchManager
Returns true if there is a batch for the givenbatchId
, false otherwise.- Specified by:
hasBatch
in interfaceBatchManager
-
getBlobs
Description copied from interface:BatchManager
Gets Blobs associated to a given batch. Returns null if batch does not exist.- Specified by:
getBlobs
in interfaceBatchManager
-
getBlobs
Description copied from interface:BatchManager
Gets Blobs associated to a given batch. Returns null if batch does not exist. Waits for upload in progress if needed.- Specified by:
getBlobs
in interfaceBatchManager
-
getBlob
- Specified by:
getBlob
in interfaceBatchManager
-
getBlob
- Specified by:
getBlob
in interfaceBatchManager
-
getBatchBlob
-
getFileEntries
- Specified by:
getFileEntries
in interfaceBatchManager
-
getFileEntry
- Specified by:
getFileEntry
in interfaceBatchManager
-
clean
Description copied from interface:BatchManager
Cleans up the temporary storage associated to the batch.- Specified by:
clean
in interfaceBatchManager
-
execute
public Object execute(String batchId, String chainOrOperationId, CoreSession session, Map<String, Object> contextParams, Map<String, Object> operationParams) Description copied from interface:BatchManager
Executes the chain or operation on theBlobs
from the givenbatchId
.This method does not clean the temporary storage associated to the
batchId
.- Specified by:
execute
in 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:BatchManager
Executes the chain or operation on theBlob
from the givenbatchId
andfileIndex
.This method does not clean the temporary storage associated to the
batchId
.- Specified by:
execute
in 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:BatchManager
Executes the chain or operation on theBlobs
from the givenbatchId
.This method cleans the temporary storage associated to the
batchId
after the execution.- Specified by:
executeAndClean
in interfaceBatchManager
-
removeFileEntry
Description copied from interface:BatchManager
Removes a file from a batch.- Specified by:
removeFileEntry
in interfaceBatchManager
-