Package com.yahoo.docproc
Class Processing
- java.lang.Object
-
- com.yahoo.docproc.Processing
-
public class Processing extends java.lang.Object
A document processing. This contains the document(s) or document update(s) to process, a map of processing context data and the processing instance to invoke the next time any work needs to be done on this processing.- Author:
- bratseth
-
-
Constructor Summary
Constructors Constructor Description Processing()
Create a Processing with no documents.Processing(java.lang.String service, com.yahoo.document.DocumentOperation documentOperation, CallStack callStack)
Create a processing with one document.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDocumentOperation(com.yahoo.document.DocumentOperation documentOperation)
CallStack
callStack()
Returns the processors to call in this processingvoid
clearVariables()
Clears all context variables that have been setstatic Processing
createProcessingFromDocumentOperations(java.lang.String service, java.util.List<com.yahoo.document.DocumentOperation> documentsAndUpdates, CallStack callStack)
com.yahoo.component.provider.ComponentRegistry<DocprocService>
getDocprocServiceRegistry()
java.util.List<com.yahoo.document.DocumentOperation>
getDocumentOperations()
DocprocService
getService()
Convenience method for looking up and returning the service processing this.java.lang.String
getServiceName()
Returns the name of the service processing this.java.lang.Object
getVariable(java.lang.String name)
Returns a context variable, or null if it is not setjava.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Object>>
getVariableAndNameIterator()
Returns an iterator of all context variables that are setboolean
hasVariable(java.lang.String name)
Returns true if this variable is present, even if it is nullstatic Processing
of(com.yahoo.document.DocumentOperation documentOperation)
Create a Processing from the given document operationjava.lang.Object
removeVariable(java.lang.String name)
void
setDocprocServiceRegistry(com.yahoo.component.provider.ComponentRegistry<DocprocService> docprocServiceRegistry)
void
setServiceName(java.lang.String service)
Sets the name of the service processing this.void
setVariable(java.lang.String name, java.lang.Object value)
Sets a context variable.java.lang.String
toString()
-
-
-
Constructor Detail
-
Processing
public Processing()
Create a Processing with no documents. Useful with DocprocService.process(Processing). Note that the callstack is initially empty when using this constructor (but it is set by DocprocService.process(Processing).)
-
Processing
public Processing(java.lang.String service, com.yahoo.document.DocumentOperation documentOperation, CallStack callStack)
Create a processing with one document. The given document put or document update will be the single element indocumentOperations
.- Parameters:
service
- the unique name of the service processing thisdocumentOperation
- document operation (DocumentPut or DocumentUpdate)callStack
- the document processors to call in this processing. This tranfers ownership of this structure to this class. The caller must not modify it
-
-
Method Detail
-
of
public static Processing of(com.yahoo.document.DocumentOperation documentOperation)
Create a Processing from the given document operation
-
createProcessingFromDocumentOperations
public static Processing createProcessingFromDocumentOperations(java.lang.String service, java.util.List<com.yahoo.document.DocumentOperation> documentsAndUpdates, CallStack callStack)
- Parameters:
service
- the unique name of the service processing thisdocumentsAndUpdates
- the document operation list. This transfers ownership of this list to this class. The caller must not modify itcallStack
- the document processors to call in this processing. This transfers ownership of this structure to this class. The caller must not modify it
-
getDocprocServiceRegistry
public com.yahoo.component.provider.ComponentRegistry<DocprocService> getDocprocServiceRegistry()
-
setDocprocServiceRegistry
public void setDocprocServiceRegistry(com.yahoo.component.provider.ComponentRegistry<DocprocService> docprocServiceRegistry)
-
getServiceName
public java.lang.String getServiceName()
Returns the name of the service processing this. This will never return null
-
setServiceName
public void setServiceName(java.lang.String service)
Sets the name of the service processing this.
-
getService
public DocprocService getService()
Convenience method for looking up and returning the service processing this. This might return null if #getServiceName returns a name that is not registered inDocprocService
.- Returns:
- the service processing this, or null if unknown.
-
getVariable
public java.lang.Object getVariable(java.lang.String name)
Returns a context variable, or null if it is not set
-
getVariableAndNameIterator
public java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Object>> getVariableAndNameIterator()
Returns an iterator of all context variables that are set- Returns:
- an iterator over objects of type Map.Entry
-
clearVariables
public void clearVariables()
Clears all context variables that have been set
-
setVariable
public void setVariable(java.lang.String name, java.lang.Object value)
Sets a context variable.
-
removeVariable
public java.lang.Object removeVariable(java.lang.String name)
-
hasVariable
public boolean hasVariable(java.lang.String name)
Returns true if this variable is present, even if it is null
-
addDocumentOperation
public void addDocumentOperation(com.yahoo.document.DocumentOperation documentOperation)
-
getDocumentOperations
public java.util.List<com.yahoo.document.DocumentOperation> getDocumentOperations()
-
callStack
public CallStack callStack()
Returns the processors to call in this processing
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-