Class IpRangeParserTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
com.nerjal.ip_range_parser.gradle.IpRangeParserTask
All Implemented Interfaces:
Comparable<org.gradle.api.Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.TaskInternal, org.gradle.api.Named, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.util.Configurable<org.gradle.api.Task>

@DisableCachingByDefault public abstract class IpRangeParserTask extends org.gradle.api.DefaultTask
Abstract class representing a task for parsing IP range data from downloaded database files. This task handles downloading, extracting, and parsing CSV files into a consolidated JSON format. It operates with IPv4 and IPv6 database files, providing mechanisms to check for outdated files and download them if necessary.

This class extends DefaultTask and is intended to be used within the Gradle build system. Subclasses can implement any additional logic or extend functionality as needed.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.gradle.api.Named

    org.gradle.api.Named.Namer
  • Field Summary

    Fields inherited from interface org.gradle.api.Task

    TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for the IpRangeParserTask class.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract org.gradle.api.provider.Property<String>
    Retrieves the database code request key used for requesting specific database codes in API calls or configuration settings.
    abstract org.gradle.api.provider.Property<String>
    Retrieves the database code used for identifying the IPv4 range database.
    abstract org.gradle.api.provider.Property<String>
    Retrieves the database code used for identifying the IPv6 range database.
    abstract org.gradle.api.file.RegularFileProperty
    Retrieves the file property that represents the output file for this task.
    abstract org.gradle.api.provider.Property<String>
    Retrieves the token property required for authentication or API requests.
    abstract org.gradle.api.provider.Property<String>
    Retrieves the key used for identifying the token request parameter in API calls.
    abstract org.gradle.api.provider.Property<String>
    Retrieves the base URL property used for constructing API or resource endpoints.

    Methods inherited from class org.gradle.api.DefaultTask

    compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService

    Methods inherited from class org.gradle.api.internal.AbstractTask

    acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, setImpliesSubProjects

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.gradle.api.Task

    doNotTrackState, notCompatibleWithConfigurationCache
  • Constructor Details

    • IpRangeParserTask

      @Inject public IpRangeParserTask(IpRangeParserConf conf)
      Constructor for the IpRangeParserTask class.

      Initializes default conventions for key properties related to the processing of IP range databases. These conventions define the default values used for the following: - IPv4 database code, set to "DB1LITECSV". - IPv6 database code, set to "DB1LITECSVIPV6". - Base URL for downloading resources, set to "https://www.ip2location.com/download". - Token request key, set to "token". - Database code request key, set to "file".

      The constructor ensures these defaults are applied upon instantiation of the task, facilitating consistent behavior for downloading and processing IP range data unless overridden by specific configurations.

      Parameters:
      conf - the conf from which to extract the task values
  • Method Details

    • getToken

      @Input public abstract org.gradle.api.provider.Property<String> getToken()
      Retrieves the token property required for authentication or API requests.
      Returns:
      a Property containing the token as a String
    • getIpv4dbCode

      @Input public abstract org.gradle.api.provider.Property<String> getIpv4dbCode()
      Retrieves the database code used for identifying the IPv4 range database.
      Returns:
      a Property containing the IPv4 database code as a String
    • getIpv6dbCode

      @Input public abstract org.gradle.api.provider.Property<String> getIpv6dbCode()
      Retrieves the database code used for identifying the IPv6 range database.
      Returns:
      a Property containing the IPv6 database code as a String
    • getUrlBase

      @Input public abstract org.gradle.api.provider.Property<String> getUrlBase()
      Retrieves the base URL property used for constructing API or resource endpoints.
      Returns:
      a Property containing the base URL as a String
    • getTokenRequestKey

      @Input public abstract org.gradle.api.provider.Property<String> getTokenRequestKey()
      Retrieves the key used for identifying the token request parameter in API calls.
      Returns:
      a Property containing the token request key as a String.
    • getDbCodeRequestKey

      @Input public abstract org.gradle.api.provider.Property<String> getDbCodeRequestKey()
      Retrieves the database code request key used for requesting specific database codes in API calls or configuration settings.
      Returns:
      a Property containing the database code request key as a String.
    • getOutput

      @OutputFile public abstract org.gradle.api.file.RegularFileProperty getOutput()
      Retrieves the file property that represents the output file for this task.

      The output file is the destination where the processed data (e.g., a JSON file combining parsed IPv4 and IPv6 data) will be written after task execution.

      Returns:
      a RegularFileProperty representing the output file location.