Package org.apache.nifi.lookup.maxmind
Class IPLookupService
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.controller.AbstractControllerService
org.apache.nifi.lookup.maxmind.IPLookupService
- All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent,org.apache.nifi.controller.ControllerService,LookupService<Record>,RecordLookupService
@Tags({"lookup","enrich","ip","geo","ipgeo","maxmind","isp","domain","cellular","anonymous","tor"})
@CapabilityDescription("A lookup service that provides several types of enrichment information for IP addresses. The service is configured by providing a MaxMind Database file and specifying which types of enrichment should be provided for an IP Address or Hostname. Each type of enrichment is a separate lookup, so configuring the service to provide all of the available enrichment data may be slower than returning only a portion of the available enrichments. In order to use this service, a lookup must be performed using key of \'ip\' and a value that is a valid IP address or hostname. View the Usage of this component and choose to view Additional Details for more information, such as the Schema that pertains to the information that is returned.")
public class IPLookupService
extends org.apache.nifi.controller.AbstractControllerService
implements RecordLookupService
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprivate Stringprivate longprivate com.maxmind.geoip2.DatabaseReaderprivate final Lock(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final String(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprivate RecordcreateContainerRecord(Record geoRecord, Record ispRecord, String domainName, String connectionType, Record anonymousIpRecord) (package private) com.maxmind.geoip2.DatabaseReadercreateDatabaseReader(File dbFile) private RecordcreateRecord(com.maxmind.geoip2.model.AnonymousIpResponse anonymousIp) private RecordcreateRecord(com.maxmind.geoip2.model.CityResponse city) private RecordcreateRecord(com.maxmind.geoip2.model.IspResponse isp) private RecordcreateRecord(com.maxmind.geoip2.record.Country country) private RecordcreateRecord(com.maxmind.geoip2.record.Subdivision subdivision) private StringgetChecksum(File file) protected List<org.apache.nifi.components.PropertyDescriptor> private voidloadDatabase(File dbFile, String dbFileChecksum) voidonEnabled(org.apache.nifi.controller.ConfigurationContext context) private voidprivate booleanMethods 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, getSupportedDynamicPropertyDescriptor, 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, migratePropertiesMethods inherited from interface org.apache.nifi.lookup.LookupService
lookupMethods inherited from interface org.apache.nifi.lookup.RecordLookupService
getValueType
-
Field Details
-
databaseFile
-
IP_KEY
- See Also:
-
REQUIRED_KEYS
-
databaseReader
private volatile com.maxmind.geoip2.DatabaseReader databaseReader -
databaseChecksum
-
databaseLastRefreshAttempt
private volatile long databaseLastRefreshAttempt -
dbWriteLock
-
REFRESH_THRESHOLD_MS
static final long REFRESH_THRESHOLD_MS- See Also:
-
GEO_DATABASE_FILE
static final org.apache.nifi.components.PropertyDescriptor GEO_DATABASE_FILE -
LOOKUP_CITY
static final org.apache.nifi.components.PropertyDescriptor LOOKUP_CITY -
LOOKUP_ISP
static final org.apache.nifi.components.PropertyDescriptor LOOKUP_ISP -
LOOKUP_DOMAIN
static final org.apache.nifi.components.PropertyDescriptor LOOKUP_DOMAIN -
LOOKUP_CONNECTION_TYPE
static final org.apache.nifi.components.PropertyDescriptor LOOKUP_CONNECTION_TYPE -
LOOKUP_ANONYMOUS_IP_INFO
static final org.apache.nifi.components.PropertyDescriptor LOOKUP_ANONYMOUS_IP_INFO
-
-
Constructor Details
-
IPLookupService
public IPLookupService()
-
-
Method Details
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classorg.apache.nifi.components.AbstractConfigurableComponent
-
onEnabled
@OnEnabled public void onEnabled(org.apache.nifi.controller.ConfigurationContext context) throws IOException - Throws:
IOException
-
getChecksum
- Throws:
IOException
-
closeReader
- Throws:
IOException
-
getRequiredKeys
- Specified by:
getRequiredKeysin interfaceLookupService<Record>
-
lookup
- Specified by:
lookupin interfaceLookupService<Record>- Throws:
LookupFailureException
-
doLookup
private Optional<Record> doLookup(com.maxmind.geoip2.DatabaseReader databaseReader, Map<String, Object> coordinates) throws LookupFailureException, com.maxmind.db.InvalidDatabaseException- Throws:
LookupFailureExceptioncom.maxmind.db.InvalidDatabaseException
-
shouldAttemptDatabaseRefresh
private boolean shouldAttemptDatabaseRefresh() -
refreshDatabase
- Throws:
IOException
-
loadDatabase
- Throws:
IOException
-
createRecord
-
createRecord
-
createRecord
-
createRecord
-
createRecord
-
createContainerRecord
-
createDatabaseReader
- Throws:
IOException
-