public class StandardSchedulingContext extends java.lang.Object implements SchedulingContext
Constructor and Description |
---|
StandardSchedulingContext(ProcessContext processContext,
ControllerServiceProvider serviceProvider,
ProcessorNode processorNode,
StateManager stateManager) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
decrypt(java.lang.String encrypted)
Decrypts the given value using the password provided in the NiFi
Properties
|
java.lang.String |
encrypt(java.lang.String unencrypted)
Encrypts the given value using the password provided in the NiFi
Properties
|
java.util.Map<java.lang.String,java.lang.String> |
getAllProperties() |
java.lang.String |
getAnnotationData() |
java.util.Set<Relationship> |
getAvailableRelationships() |
ControllerServiceLookup |
getControllerServiceLookup() |
int |
getMaxConcurrentTasks() |
java.lang.String |
getName() |
java.util.Map<PropertyDescriptor,java.lang.String> |
getProperties() |
PropertyValue |
getProperty(PropertyDescriptor descriptor)
Retrieves the current value set for the given descriptor, if a value is
set - else uses the descriptor to determine the appropriate default value
|
PropertyValue |
getProperty(java.lang.String propertyName)
Retrieves the current value set for the given descriptor, if a value is
set - else uses the descriptor to determine the appropriate default value
|
StateManager |
getStateManager() |
boolean |
hasConnection(Relationship relationship) |
boolean |
hasIncomingConnection() |
boolean |
hasNonLoopConnection() |
boolean |
isExpressionLanguagePresent(PropertyDescriptor property) |
void |
leaseControllerService(java.lang.String identifier)
Indicates to the framework that the Controller Service with the given
identifier will be used by this Processor.
|
PropertyValue |
newPropertyValue(java.lang.String rawValue)
Creates and returns a
PropertyValue object that can be used for
evaluating the value of the given String |
void |
yield()
Causes the Processor not to be scheduled for some pre-configured amount
of time.
|
public StandardSchedulingContext(ProcessContext processContext, ControllerServiceProvider serviceProvider, ProcessorNode processorNode, StateManager stateManager)
public void leaseControllerService(java.lang.String identifier)
SchedulingContext
Indicates to the framework that the Controller Service with the given identifier will be used by this Processor. This will prevent any Data Flow Manager from disabling the Controller Service while this Processor is still running.
Generally, a Controller Service is accessed by indicating in a
PropertyDescriptor
that the PropertyDescriptor identifies a
Controller Service via the
identifiesControllerService(Class)
method and then calling
PropertyContext.getProperty(PropertyDescriptor)
.asControllerService(Class)
.
In this case, it is not necessary to lease the Controller Service, as the
Framework will handle this.
There are, however, cases in which a Controller Service must be accessed
in a different way, via the ControllerServiceLookup
(accessed via
ProcessContext.getControllerServiceLookup()
). In this case, the
Controller Service that is obtained from the ControllerServiceLookup can
be disabled by a Data Flow Manager while it is still in use by a
Processor, causing IllegalStateException to be thrown whenever the
Processor attempts to interact with the service. This method provides a
mechanism by which a Processor is able to indicate that the Controller
Service with the given identifier should not be disabled while this
Processor is running.
For any Controller Service that is leased by calling this method, the lease will automatically be terminated, allowing the Controller Service to be disabled, whenever the Processor is stopped.
leaseControllerService
in interface SchedulingContext
public PropertyValue getProperty(PropertyDescriptor descriptor)
PropertyContext
getProperty
in interface PropertyContext
descriptor
- to lookup the value ofpublic PropertyValue getProperty(java.lang.String propertyName)
ProcessContext
getProperty
in interface ProcessContext
propertyName
- of the property to lookup the value forpublic PropertyValue newPropertyValue(java.lang.String rawValue)
ProcessContext
PropertyValue
object that can be used for
evaluating the value of the given StringnewPropertyValue
in interface ProcessContext
rawValue
- the raw input before any property evaluation has occurredPropertyValue
object that can be used for
evaluating the value of the given Stringpublic void yield()
ProcessContext
Causes the Processor not to be scheduled for some pre-configured amount of time. The duration of time for which the processor will not be scheduled is configured in the same manner as the processor's scheduling period.
Note: This is NOT a blocking call and does not suspend execution of the current thread.
yield
in interface ProcessContext
public int getMaxConcurrentTasks()
getMaxConcurrentTasks
in interface ProcessContext
public java.lang.String getAnnotationData()
getAnnotationData
in interface ProcessContext
public java.util.Map<PropertyDescriptor,java.lang.String> getProperties()
getProperties
in interface ProcessContext
public java.util.Map<java.lang.String,java.lang.String> getAllProperties()
getAllProperties
in interface PropertyContext
public java.lang.String encrypt(java.lang.String unencrypted)
ProcessContext
encrypt
in interface ProcessContext
unencrypted
- plaintext valuepublic java.lang.String decrypt(java.lang.String encrypted)
ProcessContext
decrypt
in interface ProcessContext
encrypted
- the encrypted valuepublic ControllerServiceLookup getControllerServiceLookup()
getControllerServiceLookup
in interface ProcessContext
ControllerServiceLookup
that can be used to obtain a
Controller Servicepublic java.util.Set<Relationship> getAvailableRelationships()
getAvailableRelationships
in interface ProcessContext
public boolean hasIncomingConnection()
hasIncomingConnection
in interface ProcessContext
public boolean hasNonLoopConnection()
hasNonLoopConnection
in interface ProcessContext
true
if the processor has one or more incoming connections for
which the source of the connection is NOT the processor; returns false
if
the processor has no incoming connections or if all incoming connections are self-loops
(i.e., the processor is also the source of all incoming connections).public boolean hasConnection(Relationship relationship)
hasConnection
in interface ProcessContext
relationship
- a relationship to check for connectionspublic boolean isExpressionLanguagePresent(PropertyDescriptor property)
isExpressionLanguagePresent
in interface ProcessContext
property
- the Property whose value should be inspected to determined if it contains an Expression Language Expressiontrue
if the value of the given Property contains a NiFi Expression
Language Expression, false
if it does not. Note that false
will be returned if the Property Descriptor
does not allow the Expression Language, even if a seemingly valid Expression is present in the value.public StateManager getStateManager()
getStateManager
in interface ProcessContext
public java.lang.String getName()
getName
in interface ProcessContext