@Tags(value={"rest","lookup","json","xml","http"}) @CapabilityDescription(value="Use a REST service to look up values.") @DynamicProperties(value=@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.")) public class RestLookupService extends AbstractControllerService implements RecordLookupService
| Constructor and Description |
|---|
RestLookupService() |
| Modifier and Type | Method and Description |
|---|---|
private void |
buildHeaders(ConfigurationContext context) |
private okhttp3.Request |
buildRequest(String mimeType,
String method,
String body,
String endpoint) |
protected String |
determineEndpoint(Map<String,Object> coordinates) |
protected okhttp3.Response |
executeRequest(okhttp3.Request request) |
Set<String> |
getRequiredKeys() |
protected PropertyDescriptor |
getSupportedDynamicPropertyDescriptor(String propertyDescriptorName) |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
Class<?> |
getValueType() |
private Record |
handleResponse(InputStream is,
long inputLength,
Map<String,String> context) |
Optional<Record> |
lookup(Map<String,Object> coordinates) |
Optional<Record> |
lookup(Map<String,Object> coordinates,
Map<String,String> context) |
void |
onDisabled() |
void |
onEnabled(ConfigurationContext context) |
private void |
setAuthenticator(okhttp3.OkHttpClient.Builder okHttpClientBuilder,
ConfigurationContext context) |
private void |
setProxy(okhttp3.OkHttpClient.Builder builder) |
protected void |
validateVerb(String method) |
abstractClearConfigContext, abstractStoreConfigContext, disabled, enabled, getConfigurationContext, getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, getProperty, getStateManager, init, initialize, isEnabledcustomValidate, equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, onPropertyModified, toString, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitinitializegetIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validatestatic final PropertyDescriptor URL
static final PropertyDescriptor RECORD_READER
static final PropertyDescriptor RECORD_PATH
static final PropertyDescriptor SSL_CONTEXT_SERVICE
public static final PropertyDescriptor PROP_BASIC_AUTH_USERNAME
public static final PropertyDescriptor PROP_BASIC_AUTH_PASSWORD
public static final PropertyDescriptor PROP_DIGEST_AUTH
public static final PropertyDescriptor PROP_CONNECT_TIMEOUT
public static final PropertyDescriptor PROP_READ_TIMEOUT
private static final ProxySpec[] PROXY_SPECS
public static final PropertyDescriptor PROXY_CONFIGURATION_SERVICE
static final String MIME_TYPE_KEY
static final String BODY_KEY
static final String METHOD_KEY
static final List<PropertyDescriptor> DESCRIPTORS
static final List VALID_VERBS
private volatile ProxyConfigurationService proxyConfigurationService
private volatile RecordReaderFactory readerFactory
private volatile RecordPath recordPath
private volatile okhttp3.OkHttpClient client
private volatile PropertyValue urlTemplate
private volatile String basicUser
private volatile String basicPass
private volatile boolean isDigest
protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponent@OnEnabled public void onEnabled(ConfigurationContext context)
@OnDisabled public void onDisabled()
private void buildHeaders(ConfigurationContext context)
private void setProxy(okhttp3.OkHttpClient.Builder builder)
public Optional<Record> lookup(Map<String,Object> coordinates) throws LookupFailureException
lookup in interface LookupService<Record>LookupFailureExceptionpublic Optional<Record> lookup(Map<String,Object> coordinates, Map<String,String> context) throws LookupFailureException
lookup in interface LookupService<Record>LookupFailureExceptionprotected void validateVerb(String method) throws LookupFailureException
LookupFailureExceptionprotected PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName)
getSupportedDynamicPropertyDescriptor in class AbstractConfigurableComponentprotected okhttp3.Response executeRequest(okhttp3.Request request)
throws IOException
IOExceptionprivate Record handleResponse(InputStream is, long inputLength, Map<String,String> context) throws SchemaNotFoundException, MalformedRecordException, IOException
private okhttp3.Request buildRequest(String mimeType, String method, String body, String endpoint)
private void setAuthenticator(okhttp3.OkHttpClient.Builder okHttpClientBuilder,
ConfigurationContext context)
public Class<?> getValueType()
getValueType in interface LookupService<Record>getValueType in interface RecordLookupServicepublic Set<String> getRequiredKeys()
getRequiredKeys in interface LookupService<Record>Copyright © 2020 Apache NiFi Project. All rights reserved.