public class BatchManagerComponent extends DefaultComponent implements BatchManager
BatchManager
service with the TransientStore
.Modifier and Type | Field and Description |
---|---|
protected static String |
DEFAULT_CONTEXT |
protected static org.apache.commons.logging.Log |
log |
protected static String |
TRANSIENT_STORE_NAME |
protected AtomicInteger |
uploadInProgress |
lastModified
Constructor and Description |
---|
BatchManagerComponent() |
Modifier and Type | Method and Description |
---|---|
void |
addStream(String batchId,
String idx,
InputStream is,
int chunkCount,
int chunkIdx,
String name,
String mime,
long fileSize)
Adds an inputStream as a chunk to a batch.
|
void |
addStream(String batchId,
String idx,
InputStream is,
String name,
String mime)
Adds an inputStream as a blob to a batch.
|
void |
clean(String batchId)
Cleanup the temporary storage associated to the batch
|
protected Object |
execute(Object blobInput,
String chainOrOperationId,
CoreSession session,
Map<String,Object> contextParams,
Map<String,Object> operationParams) |
Object |
execute(String batchId,
String chainOrOperationId,
CoreSession session,
Map<String,Object> contextParams,
Map<String,Object> operationParams)
Executes the chain or operation on the
Blobs from the given batchId . |
Object |
execute(String batchId,
String fileIdx,
String chainOrOperationId,
CoreSession session,
Map<String,Object> contextParams,
Map<String,Object> operationParams)
Executes the chain or operation on the
Blob from the given batchId and fileIdx . |
Object |
executeAndClean(String batchId,
String chainOrOperationId,
CoreSession session,
Map<String,Object> contextParams,
Map<String,Object> operationParams)
Executes the chain or operation on the
Blobs from the given batchId . |
protected Blob |
getBatchBlob(String batchId,
String fileId) |
Blob |
getBlob(String batchId,
String fileId) |
Blob |
getBlob(String batchId,
String fileId,
int timeoutS) |
List<Blob> |
getBlobs(String batchId)
Get Blobs associated to a given batch.
|
List<Blob> |
getBlobs(String batchId,
int timeoutS)
Get Blobs associated to a given batch.
|
List<BatchFileEntry> |
getFileEntries(String batchId) |
BatchFileEntry |
getFileEntry(String batchId,
String fileId) |
TransientStore |
getTransientStore()
Returns the
TransientStore backing the batches. |
protected int |
getUploadWaitTimeout() |
boolean |
hasBatch(String batchId)
Returns true if there is a batch for the given
batchId , false otherwise. |
String |
initBatch()
Initialize a batch by with an automatically generated id.
|
String |
initBatch(String batchId,
String contextName)
Initialize a batch with a given batchId and Context Name If batchId is not provided, it will be automatically
generated
|
protected Batch |
initBatchInternal(String batchId,
String contextName) |
activate, applicationStarted, deactivate, getAdapter, getApplicationStartedOrder, getLastModified, registerContribution, registerExtension, setLastModified, setModifiedNow, unregisterContribution, unregisterExtension
protected static final String DEFAULT_CONTEXT
protected static final org.apache.commons.logging.Log log
protected static final String TRANSIENT_STORE_NAME
protected final AtomicInteger uploadInProgress
public BatchManagerComponent()
public TransientStore getTransientStore()
BatchManager
TransientStore
backing the batches.getTransientStore
in interface BatchManager
public String initBatch()
BatchManager
initBatch
in interface BatchManager
public String initBatch(String batchId, String contextName)
BatchManager
initBatch
in interface BatchManager
protected Batch initBatchInternal(String batchId, String contextName)
public void addStream(String batchId, String idx, InputStream is, String name, String mime) throws IOException
BatchManager
Batch
if needed.
Streams are persisted as temporary files.
addStream
in interface BatchManager
IOException
public void addStream(String batchId, String idx, InputStream is, int chunkCount, int chunkIdx, String name, String mime, long fileSize) throws IOException
BatchManager
Batch
if needed.
Streams are persisted as temporary files.
addStream
in interface BatchManager
IOException
public boolean hasBatch(String batchId)
BatchManager
batchId
, false otherwise.hasBatch
in interface BatchManager
public List<Blob> getBlobs(String batchId)
BatchManager
getBlobs
in interface BatchManager
public List<Blob> getBlobs(String batchId, int timeoutS)
BatchManager
getBlobs
in interface BatchManager
public Blob getBlob(String batchId, String fileId)
getBlob
in interface BatchManager
public Blob getBlob(String batchId, String fileId, int timeoutS)
getBlob
in interface BatchManager
protected Blob getBatchBlob(String batchId, String fileId)
public List<BatchFileEntry> getFileEntries(String batchId)
getFileEntries
in interface BatchManager
public BatchFileEntry getFileEntry(String batchId, String fileId)
getFileEntry
in interface BatchManager
public void clean(String batchId)
BatchManager
clean
in interface BatchManager
public Object execute(String batchId, String chainOrOperationId, CoreSession session, Map<String,Object> contextParams, Map<String,Object> operationParams)
BatchManager
Blobs
from the given batchId
.
This method does not clean the temporary storage associated to the batchId
.
execute
in interface BatchManager
public Object execute(String batchId, String fileIdx, String chainOrOperationId, CoreSession session, Map<String,Object> contextParams, Map<String,Object> operationParams)
BatchManager
Blob
from the given batchId
and fileIdx
.
This method does not clean the temporary storage associated to the batchId
.
execute
in interface BatchManager
protected Object execute(Object blobInput, String chainOrOperationId, CoreSession session, Map<String,Object> contextParams, Map<String,Object> operationParams)
protected int getUploadWaitTimeout()
public Object executeAndClean(String batchId, String chainOrOperationId, CoreSession session, Map<String,Object> contextParams, Map<String,Object> operationParams)
BatchManager
Blobs
from the given batchId
.
This method clean the temporary storage associated to the batchId
after the execution.
executeAndClean
in interface BatchManager
Copyright © 2015 Nuxeo SA. All rights reserved.