Skip to content

Commit

Permalink
Organizes the GeoIP processor Java packages. Use plugins.geoip as the…
Browse files Browse the repository at this point in the history
… root package and then move processor-specific classes into plugins.geoip.processor. (opensearch-project#4240)

Signed-off-by: David Venable <[email protected]>
  • Loading branch information
dlvenable authored Mar 6, 2024
1 parent 8c5bb54 commit 5d1edb6
Show file tree
Hide file tree
Showing 71 changed files with 282 additions and 283 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor;
package org.opensearch.dataprepper.plugins.geoip;

public enum GeoIPDatabase {
CITY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor;
package org.opensearch.dataprepper.plugins.geoip;

import java.util.Arrays;
import java.util.HashSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.databaseenrich;
package org.opensearch.dataprepper.plugins.geoip.databaseenrich;

import org.opensearch.dataprepper.plugins.processor.GeoIPDatabase;
import org.opensearch.dataprepper.plugins.processor.GeoIPField;
import org.opensearch.dataprepper.plugins.geoip.GeoIPDatabase;
import org.opensearch.dataprepper.plugins.geoip.GeoIPField;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.databaseenrich;
package org.opensearch.dataprepper.plugins.geoip.databaseenrich;

import com.maxmind.geoip2.DatabaseReader;
import com.maxmind.geoip2.exception.GeoIp2Exception;
Expand All @@ -16,13 +16,13 @@
import com.maxmind.geoip2.record.Postal;
import com.maxmind.geoip2.record.RepresentedCountry;
import com.maxmind.geoip2.record.Subdivision;
import org.opensearch.dataprepper.plugins.processor.GeoIPDatabase;
import org.opensearch.dataprepper.plugins.processor.GeoIPField;
import org.opensearch.dataprepper.plugins.processor.exception.DatabaseReaderInitializationException;
import org.opensearch.dataprepper.plugins.processor.exception.EnrichFailedException;
import org.opensearch.dataprepper.plugins.processor.exception.NoValidDatabaseFoundException;
import org.opensearch.dataprepper.plugins.processor.extension.databasedownload.GeoIPFileManager;
import org.opensearch.dataprepper.plugins.processor.extension.databasedownload.DatabaseReaderBuilder;
import org.opensearch.dataprepper.plugins.geoip.GeoIPDatabase;
import org.opensearch.dataprepper.plugins.geoip.GeoIPField;
import org.opensearch.dataprepper.plugins.geoip.exception.DatabaseReaderInitializationException;
import org.opensearch.dataprepper.plugins.geoip.exception.EnrichFailedException;
import org.opensearch.dataprepper.plugins.geoip.exception.NoValidDatabaseFoundException;
import org.opensearch.dataprepper.plugins.geoip.extension.databasedownload.DatabaseReaderBuilder;
import org.opensearch.dataprepper.plugins.geoip.extension.databasedownload.GeoIPFileManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -39,7 +39,7 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

import static org.opensearch.dataprepper.plugins.processor.extension.MaxMindDatabaseConfig.GEOIP2_ENTERPRISE;
import static org.opensearch.dataprepper.plugins.geoip.extension.MaxMindDatabaseConfig.GEOIP2_ENTERPRISE;

public class GeoIP2DatabaseReader implements GeoIPDatabaseReader, AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(GeoIP2DatabaseReader.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.databaseenrich;
package org.opensearch.dataprepper.plugins.geoip.databaseenrich;

import com.maxmind.geoip2.model.AsnResponse;
import com.maxmind.geoip2.record.City;
Expand All @@ -13,8 +13,8 @@
import com.maxmind.geoip2.record.Postal;
import com.maxmind.geoip2.record.RepresentedCountry;
import com.maxmind.geoip2.record.Subdivision;
import org.opensearch.dataprepper.plugins.processor.GeoIPDatabase;
import org.opensearch.dataprepper.plugins.processor.GeoIPField;
import org.opensearch.dataprepper.plugins.geoip.GeoIPDatabase;
import org.opensearch.dataprepper.plugins.geoip.GeoIPField;

import java.io.File;
import java.net.InetAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.databaseenrich;
package org.opensearch.dataprepper.plugins.geoip.databaseenrich;

import com.maxmind.geoip2.DatabaseReader;
import com.maxmind.geoip2.exception.GeoIp2Exception;
Expand All @@ -17,14 +17,14 @@
import com.maxmind.geoip2.record.Postal;
import com.maxmind.geoip2.record.RepresentedCountry;
import com.maxmind.geoip2.record.Subdivision;
import org.opensearch.dataprepper.plugins.processor.GeoIPDatabase;
import org.opensearch.dataprepper.plugins.processor.GeoIPField;
import org.opensearch.dataprepper.plugins.processor.exception.DatabaseReaderInitializationException;
import org.opensearch.dataprepper.plugins.processor.exception.EngineFailureException;
import org.opensearch.dataprepper.plugins.processor.exception.EnrichFailedException;
import org.opensearch.dataprepper.plugins.processor.exception.NoValidDatabaseFoundException;
import org.opensearch.dataprepper.plugins.processor.extension.databasedownload.GeoIPFileManager;
import org.opensearch.dataprepper.plugins.processor.extension.databasedownload.DatabaseReaderBuilder;
import org.opensearch.dataprepper.plugins.geoip.GeoIPDatabase;
import org.opensearch.dataprepper.plugins.geoip.GeoIPField;
import org.opensearch.dataprepper.plugins.geoip.exception.DatabaseReaderInitializationException;
import org.opensearch.dataprepper.plugins.geoip.exception.EngineFailureException;
import org.opensearch.dataprepper.plugins.geoip.exception.EnrichFailedException;
import org.opensearch.dataprepper.plugins.geoip.exception.NoValidDatabaseFoundException;
import org.opensearch.dataprepper.plugins.geoip.extension.databasedownload.DatabaseReaderBuilder;
import org.opensearch.dataprepper.plugins.geoip.extension.databasedownload.GeoIPFileManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -40,9 +40,9 @@
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;

import static org.opensearch.dataprepper.plugins.processor.extension.MaxMindDatabaseConfig.GEOLITE2_ASN;
import static org.opensearch.dataprepper.plugins.processor.extension.MaxMindDatabaseConfig.GEOLITE2_CITY;
import static org.opensearch.dataprepper.plugins.processor.extension.MaxMindDatabaseConfig.GEOLITE2_COUNTRY;
import static org.opensearch.dataprepper.plugins.geoip.extension.MaxMindDatabaseConfig.GEOLITE2_ASN;
import static org.opensearch.dataprepper.plugins.geoip.extension.MaxMindDatabaseConfig.GEOLITE2_CITY;
import static org.opensearch.dataprepper.plugins.geoip.extension.MaxMindDatabaseConfig.GEOLITE2_COUNTRY;

public class GeoLite2DatabaseReader implements GeoIPDatabaseReader, AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(GeoLite2DatabaseReader.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.exception;
package org.opensearch.dataprepper.plugins.geoip.exception;

public class DatabaseReaderInitializationException extends EngineFailureException {
public DatabaseReaderInitializationException(final String exceptionMsg) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.exception;
package org.opensearch.dataprepper.plugins.geoip.exception;

/**
* Implementation class for DownloadFailedException Custom exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.exception;
package org.opensearch.dataprepper.plugins.geoip.exception;

public class EngineFailureException extends RuntimeException {
public EngineFailureException(final String exceptionMsg) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.exception;
package org.opensearch.dataprepper.plugins.geoip.exception;

/**
* Implementation class for EnrichFailedException Custom exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.exception;
package org.opensearch.dataprepper.plugins.geoip.exception;

public class InvalidIPAddressException extends EnrichFailedException {
public InvalidIPAddressException(final String exceptionMsg) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.exception;
package org.opensearch.dataprepper.plugins.geoip.exception;

public class NoValidDatabaseFoundException extends EngineFailureException {
public NoValidDatabaseFoundException(final String exceptionMsg) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.extension;
package org.opensearch.dataprepper.plugins.geoip.extension;

import java.util.Map;
import java.util.UUID;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.constraints.Size;
import software.amazon.awssdk.arns.Arn;
Expand All @@ -17,6 +15,9 @@
import software.amazon.awssdk.services.sts.auth.StsAssumeRoleCredentialsProvider;
import software.amazon.awssdk.services.sts.model.AssumeRoleRequest;

import java.util.Map;
import java.util.UUID;

/**
* An implementation class AWS Authentication configuration
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.extension;
package org.opensearch.dataprepper.plugins.geoip.extension;

import org.opensearch.dataprepper.plugins.processor.extension.databasedownload.GeoIPDatabaseManager;
import org.opensearch.dataprepper.plugins.geoip.extension.databasedownload.GeoIPDatabaseManager;

import java.util.Optional;
import java.util.concurrent.locks.ReentrantReadWriteLock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.extension;
package org.opensearch.dataprepper.plugins.geoip.extension;

import org.opensearch.dataprepper.plugins.processor.databaseenrich.GeoIPDatabaseReader;
import org.opensearch.dataprepper.plugins.processor.extension.databasedownload.GeoIPDatabaseManager;
import org.opensearch.dataprepper.plugins.geoip.databaseenrich.GeoIPDatabaseReader;
import org.opensearch.dataprepper.plugins.geoip.extension.databasedownload.GeoIPDatabaseManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.extension;
package org.opensearch.dataprepper.plugins.geoip.extension;

import org.opensearch.dataprepper.model.annotations.DataPrepperExtensionPlugin;
import org.opensearch.dataprepper.model.annotations.DataPrepperPluginConstructor;
import org.opensearch.dataprepper.model.plugin.ExtensionPlugin;
import org.opensearch.dataprepper.model.plugin.ExtensionPoints;
import org.opensearch.dataprepper.plugins.processor.extension.databasedownload.GeoIPFileManager;
import org.opensearch.dataprepper.plugins.processor.extension.databasedownload.DatabaseReaderBuilder;
import org.opensearch.dataprepper.plugins.processor.extension.databasedownload.GeoIPDatabaseManager;
import org.opensearch.dataprepper.plugins.processor.utils.LicenseTypeCheck;
import org.opensearch.dataprepper.plugins.geoip.extension.databasedownload.DatabaseReaderBuilder;
import org.opensearch.dataprepper.plugins.geoip.extension.databasedownload.GeoIPDatabaseManager;
import org.opensearch.dataprepper.plugins.geoip.extension.databasedownload.GeoIPFileManager;
import org.opensearch.dataprepper.plugins.geoip.utils.LicenseTypeCheck;

import java.util.concurrent.locks.ReentrantReadWriteLock;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.extension;
package org.opensearch.dataprepper.plugins.geoip.extension;

import org.opensearch.dataprepper.model.plugin.ExtensionProvider;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.extension;
package org.opensearch.dataprepper.plugins.geoip.extension;

import java.util.Optional;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.extension;
package org.opensearch.dataprepper.plugins.geoip.extension;

import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.Valid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.extension;
package org.opensearch.dataprepper.plugins.geoip.extension;

import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.Valid;
import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.Min;
import org.hibernate.validator.constraints.time.DurationMax;
import org.hibernate.validator.constraints.time.DurationMin;
import org.opensearch.dataprepper.plugins.processor.utils.DatabaseSourceIdentification;
import org.opensearch.dataprepper.plugins.geoip.utils.DatabaseSourceIdentification;

import java.io.File;
import java.net.URI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.extension;
package org.opensearch.dataprepper.plugins.geoip.extension;

import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.constraints.AssertTrue;
import org.opensearch.dataprepper.plugins.processor.extension.databasedownload.DBSourceOptions;
import org.opensearch.dataprepper.plugins.processor.utils.DatabaseSourceIdentification;
import org.opensearch.dataprepper.plugins.geoip.extension.databasedownload.DBSourceOptions;
import org.opensearch.dataprepper.plugins.geoip.utils.DatabaseSourceIdentification;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.extension.databasedownload;
package org.opensearch.dataprepper.plugins.geoip.extension.databasedownload;

import javax.net.ssl.TrustManager;
import javax.net.ssl.SSLContext;
import javax.net.ssl.X509TrustManager;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.extension.databasedownload;
package org.opensearch.dataprepper.plugins.geoip.extension.databasedownload;

import com.fasterxml.jackson.annotation.JsonCreator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.extension.databasedownload;
package org.opensearch.dataprepper.plugins.geoip.extension.databasedownload;

import com.maxmind.db.CHMCache;
import com.maxmind.db.Reader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.extension.databasedownload;
package org.opensearch.dataprepper.plugins.geoip.extension.databasedownload;

import com.linecorp.armeria.client.retry.Backoff;
import org.opensearch.dataprepper.plugins.processor.databaseenrich.AutoCountingDatabaseReader;
import org.opensearch.dataprepper.plugins.processor.databaseenrich.GeoIP2DatabaseReader;
import org.opensearch.dataprepper.plugins.processor.databaseenrich.GeoIPDatabaseReader;
import org.opensearch.dataprepper.plugins.processor.databaseenrich.GeoLite2DatabaseReader;
import org.opensearch.dataprepper.plugins.processor.exception.DownloadFailedException;
import org.opensearch.dataprepper.plugins.processor.exception.NoValidDatabaseFoundException;
import org.opensearch.dataprepper.plugins.processor.extension.MaxMindConfig;
import org.opensearch.dataprepper.plugins.processor.extension.MaxMindDatabaseConfig;
import org.opensearch.dataprepper.plugins.processor.utils.DatabaseSourceIdentification;
import org.opensearch.dataprepper.plugins.processor.utils.LicenseTypeCheck;
import org.opensearch.dataprepper.plugins.geoip.databaseenrich.AutoCountingDatabaseReader;
import org.opensearch.dataprepper.plugins.geoip.databaseenrich.GeoIP2DatabaseReader;
import org.opensearch.dataprepper.plugins.geoip.databaseenrich.GeoIPDatabaseReader;
import org.opensearch.dataprepper.plugins.geoip.databaseenrich.GeoLite2DatabaseReader;
import org.opensearch.dataprepper.plugins.geoip.exception.DownloadFailedException;
import org.opensearch.dataprepper.plugins.geoip.exception.NoValidDatabaseFoundException;
import org.opensearch.dataprepper.plugins.geoip.extension.MaxMindConfig;
import org.opensearch.dataprepper.plugins.geoip.extension.MaxMindDatabaseConfig;
import org.opensearch.dataprepper.plugins.geoip.utils.DatabaseSourceIdentification;
import org.opensearch.dataprepper.plugins.geoip.utils.LicenseTypeCheck;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.dataprepper.plugins.processor.extension.databasedownload;
package org.opensearch.dataprepper.plugins.geoip.extension.databasedownload;

import java.io.File;

Expand Down
Loading

0 comments on commit 5d1edb6

Please sign in to comment.