An open API service indexing awesome lists of open source software.

https://github.com/yegorkozlov/maxmind-aem

Sample Integration of MaxMind GeoIP2 Database in AEM
https://github.com/yegorkozlov/maxmind-aem

adobe-experience-manager aem geoip2 java maxmind maxmind-geoip osgi

Last synced: about 1 month ago
JSON representation

Sample Integration of MaxMind GeoIP2 Database in AEM

Awesome Lists containing this project

README

        

# AEM MaxMind Integration

The AEM [Maxmind](https://www.maxmind.com/) integration allows retrieving geolocation information using the MaxMind GeoIP2 or GeoLite2 databases.

You can download the free MaxMind GeoLite2 City and ASN databases directly from MaxMind at [https://dev.maxmind.com/geoip/geoip2/geolite2/](https://dev.maxmind.com/geoip/geoip2/geolite2/)

## Installation Instructions

Upload the MaxMind GeoIP2 or GeoLite2 database in DAM, e.g. at `/content/dam/maxmind/GeoLite2-City.mmdb`

### Configuration
AEM MaxMind Integration requires an OSGi configuration before it gets active.
To enable it create a configuration for PID `com.ykozlov.aem.maxmind.impl.GeoIPServiceImpl`, e.g.
```text
/apps/my-app/config/com.ykozlov.aem.maxmind.impl.GeoIPServiceImpl
```
and set the `dbPath` property to point to the GeoIP2 database in DAM:
```xml

```

## Usage

### Postal Code by IP

```java
GeoIPService geoService = sling.getService(GeoIPService.class);
InetAddress ipAddress = InetAddress.getByName("128.101.101.101");
String postalCode = geoService.getPostalCode(ipAddress);

```

## How to build

To build all the modules run in the project root directory the following command with Maven 3:

mvn clean install

To build all the modules and deploy the `all` package to a local instance of AEM, run in the project root directory the following command:

mvn clean install -PautoInstallPackage