Package org.apache.nifi.lookup
Class RestLookupService
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.controller.AbstractControllerService
org.apache.nifi.lookup.RestLookupService
- All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent,org.apache.nifi.controller.ControllerService,LookupService<Record>,RecordLookupService
@Tags({"rest","lookup","json","xml","http"})
@CapabilityDescription("Use a REST service to look up values.")
@SupportsSensitiveDynamicProperties
@DynamicProperties(@DynamicProperty(name="*",value="*",description="All dynamic properties are added as HTTP headers with the name as the header name and the value as the header value.",expressionLanguageScope=FLOWFILE_ATTRIBUTES))
public class RestLookupService
extends org.apache.nifi.controller.AbstractControllerService
implements RecordLookupService
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.apache.nifi.components.PropertyDescriptorprivate Stringprivate String(package private) static final Stringprivate okhttp3.OkHttpClientprivate boolean(package private) static final String(package private) static final Stringstatic final org.apache.nifi.components.PropertyDescriptorprivate Optional<OAuth2AccessTokenProvider> static final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprivate static final List<org.apache.nifi.components.PropertyDescriptor> static final org.apache.nifi.components.PropertyDescriptorprivate static final ProxySpec[]private ProxyConfigurationServiceprivate RecordReaderFactory(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptorprivate RecordPathstatic final org.apache.nifi.components.PropertyDescriptorprivate ResponseHandlingStrategy(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptorprivate org.apache.nifi.components.PropertyValue -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidbuildHeaders(org.apache.nifi.controller.ConfigurationContext context) private okhttp3.RequestbuildRequest(String mimeType, String method, String body, String endpoint, Map<String, String> context) protected Stringprotected okhttp3.ResponseexecuteRequest(okhttp3.Request request) protected org.apache.nifi.components.PropertyDescriptorgetSupportedDynamicPropertyDescriptor(String propertyDescriptorName) protected List<org.apache.nifi.components.PropertyDescriptor> Class<?> private RecordhandleResponse(InputStream is, long inputLength, Map<String, String> context) voidmigrateProperties(org.apache.nifi.migration.PropertyConfiguration config) voidvoidonEnabled(org.apache.nifi.controller.ConfigurationContext context) private voidsetAuthenticator(okhttp3.OkHttpClient.Builder okHttpClientBuilder, org.apache.nifi.controller.ConfigurationContext context) private voidsetProxy(okhttp3.OkHttpClient.Builder builder) protected voidvalidateVerb(String method) Methods inherited from class org.apache.nifi.controller.AbstractControllerService
abstractClearConfigContext, abstractStoreConfigContext, disabled, enabled, getConfigurationContext, getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, getProperty, getStateManager, init, initialize, isEnabledMethods inherited from class org.apache.nifi.components.AbstractConfigurableComponent
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, onPropertyModified, toString, validateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.nifi.components.ConfigurableComponent
getIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateMethods inherited from interface org.apache.nifi.controller.ControllerService
initialize, isStateful
-
Field Details
-
URL
static final org.apache.nifi.components.PropertyDescriptor URL -
RECORD_READER
static final org.apache.nifi.components.PropertyDescriptor RECORD_READER -
RECORD_PATH
static final org.apache.nifi.components.PropertyDescriptor RECORD_PATH -
SSL_CONTEXT_SERVICE
static final org.apache.nifi.components.PropertyDescriptor SSL_CONTEXT_SERVICE -
AUTHENTICATION_STRATEGY
public static final org.apache.nifi.components.PropertyDescriptor AUTHENTICATION_STRATEGY -
OAUTH2_ACCESS_TOKEN_PROVIDER
public static final org.apache.nifi.components.PropertyDescriptor OAUTH2_ACCESS_TOKEN_PROVIDER -
PROP_BASIC_AUTH_USERNAME
public static final org.apache.nifi.components.PropertyDescriptor PROP_BASIC_AUTH_USERNAME -
PROP_BASIC_AUTH_PASSWORD
public static final org.apache.nifi.components.PropertyDescriptor PROP_BASIC_AUTH_PASSWORD -
PROP_DIGEST_AUTH
public static final org.apache.nifi.components.PropertyDescriptor PROP_DIGEST_AUTH -
PROP_CONNECT_TIMEOUT
public static final org.apache.nifi.components.PropertyDescriptor PROP_CONNECT_TIMEOUT -
PROP_READ_TIMEOUT
public static final org.apache.nifi.components.PropertyDescriptor PROP_READ_TIMEOUT -
RESPONSE_HANDLING_STRATEGY
public static final org.apache.nifi.components.PropertyDescriptor RESPONSE_HANDLING_STRATEGY -
PROXY_SPECS
-
PROXY_CONFIGURATION_SERVICE
public static final org.apache.nifi.components.PropertyDescriptor PROXY_CONFIGURATION_SERVICE -
MIME_TYPE_KEY
- See Also:
-
BODY_KEY
- See Also:
-
METHOD_KEY
- See Also:
-
PROPERTY_DESCRIPTORS
-
KEYS
-
VALID_VERBS
-
proxyConfigurationService
-
readerFactory
-
recordPath
-
client
private volatile okhttp3.OkHttpClient client -
headers
-
urlTemplate
private volatile org.apache.nifi.components.PropertyValue urlTemplate -
basicUser
-
basicPass
-
isDigest
private volatile boolean isDigest -
responseHandlingStrategy
-
oauth2AccessTokenProviderOptional
-
-
Constructor Details
-
RestLookupService
public RestLookupService()
-
-
Method Details
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classorg.apache.nifi.components.AbstractConfigurableComponent
-
onEnabled
@OnEnabled public void onEnabled(org.apache.nifi.controller.ConfigurationContext context) -
onDisabled
@OnDisabled public void onDisabled() -
buildHeaders
private void buildHeaders(org.apache.nifi.controller.ConfigurationContext context) -
setProxy
private void setProxy(okhttp3.OkHttpClient.Builder builder) -
lookup
- Specified by:
lookupin interfaceLookupService<Record>- Throws:
LookupFailureException
-
lookup
public Optional<Record> lookup(Map<String, Object> coordinates, Map<String, throws LookupFailureExceptionString> context) - Specified by:
lookupin interfaceLookupService<Record>- Throws:
LookupFailureException
-
migrateProperties
public void migrateProperties(org.apache.nifi.migration.PropertyConfiguration config) - Specified by:
migratePropertiesin interfaceorg.apache.nifi.controller.ControllerService
-
validateVerb
- Throws:
LookupFailureException
-
determineEndpoint
-
getSupportedDynamicPropertyDescriptor
protected org.apache.nifi.components.PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName) - Overrides:
getSupportedDynamicPropertyDescriptorin classorg.apache.nifi.components.AbstractConfigurableComponent
-
executeRequest
- Throws:
IOException
-
handleResponse
private Record handleResponse(InputStream is, long inputLength, Map<String, String> context) throws SchemaNotFoundException, MalformedRecordException, IOException -
buildRequest
-
setAuthenticator
private void setAuthenticator(okhttp3.OkHttpClient.Builder okHttpClientBuilder, org.apache.nifi.controller.ConfigurationContext context) -
getValueType
- Specified by:
getValueTypein interfaceLookupService<Record>- Specified by:
getValueTypein interfaceRecordLookupService
-
getRequiredKeys
- Specified by:
getRequiredKeysin interfaceLookupService<Record>
-