Skip to content

Commit

Permalink
updating build,links for maven and gradle in ready.
Browse files Browse the repository at this point in the history
  • Loading branch information
ankushs92 committed May 12, 2016
1 parent 96ecdfe commit dca495c
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 20 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,29 @@ A simple to use Java library for the freely available DB-IP [IP address to city
#Before you begin
The entire dataset is loaded into a [TreeMap](https://docs.oracle.com/javase/8/docs/api/allclasses-noframe.html) . Make sure that you have about **3 GB of Heap space** available to load it.

#Get

With maven :

```xml

<dependency>
<groupId>in.ankushs</groupId>
<artifactId>Java-DB-IP</artifactId>
<version>1.0</version>
</dependency>
```

Or gradle:

```groovy
compile('in.ankushs:Java-DB-IP:1.0')
```

The Javadocs for the latest release can be found [here](http://www.javadoc.io/doc/in.ankushs/Java-DB-IP/1.0)


#Instructions
In order to get geographical information for an ip address, just pass the `dbip-city-latest.csv.gz` as a File object to `DbIpClient` as follows:
Expand Down
16 changes: 8 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ archivesBaseName = "dbip"
version = '1.0'

jar {
baseName = "Java DB-IP"
baseName = "Java-DB-IP"
manifest {
attributes 'Implementation-Title': 'Gradle Quickstart',
'Implementation-Version': version
Expand All @@ -31,13 +31,13 @@ dependencies {
testCompile('org.codehaus.groovy:groovy-all:2.4.5')
}

sourceSets {
main {
java { srcDirs = ["src/main/java"] } // no source dirs for the java compiler
groovy { srcDirs = ["src/test/groovy"] } // compile everything in src/ with groovy
}
}

//sourceSets {
// main {
// java { srcDirs = ["src/main/java"] } // no source dirs for the java compiler
// groovy { srcDirs = ["src/test/groovy"] } // compile everything in src/ with groovy
// }
// }
//
test {
systemProperties 'property': 'value'
}
Expand Down
6 changes: 0 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
#signing.keyId=
#signing.password=
#signing.secretKeyRingFile=
#
#ossrhUsername=
#ossrhPassword=
8 changes: 4 additions & 4 deletions src/main/java/in/ankushs/dbip/api/DbIpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public DbIpClient(final File gzip){
* If nothing can be resolved for an {@code ip} , then the city,state and country
* for the GeoEntity will be set to 'Unknown'
* Any futher initializations of the DbIpClient will not load data into memory again.
* @param gzip The dbip-city-latest.csv.gz file as a File object.
* @throws InvalidIPException if {@code ip} is not a valid IP address.
* @param ip The ip (as String) to be resolved.
* @return a GeoEntity object representing city,state and province info
*/
public GeoEntity lookup(final String ip){
InetAddress inetAddress = null;
Expand All @@ -83,8 +83,8 @@ public GeoEntity lookup(final String ip){
* Returns a loaded GeoEntity object for a given {@code inetAddress}
* If nothing can be resolved for an {@code inetAddress} , then the city,state and country
* for the GeoEntity will be set to 'Unknown'
* @param gzip The dbip-city-latest.csv.gz file as a File object.
* @throws InvalidIPException if {@code inetAddress} is not a valid IP address.
* @param inetAddress The inetAddress (as InetAddress) to be resolved.
* @return a GeoEntity object representing city,state and province info
*/
public GeoEntity lookup(final InetAddress inetAddress){
PreConditions.checkNull(inetAddress, "inetAddress cannot be null");
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/in/ankushs/dbip/importer/ResourceImporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ public static ResourceImporter getInstance() {
* Loads the file into JVM,reading line by line.
* Also transforms each line into a GeoEntity object, and save the object into the
* repository.
* @param gzip The dbip-city-latest.csv.gz file as a File object.
* @throws IOException if {@code file} does not exist or is not gzipped.
* @param file The dbip-city-latest.csv.gz file as a File object.
*/
public void load(final File file) {

Expand Down

0 comments on commit dca495c

Please sign in to comment.