Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add the ability to generate geo location data.

  • Loading branch information...
commit 6aaac7667f71eae5f7fdd2b0dd6184685cea2222 1 parent 132a151
@gr0 gr0 authored
View
6 ag-player-es/pom.xml
@@ -4,16 +4,16 @@
<parent>
<groupId>com.sematext.ag</groupId>
<artifactId>ag-parent</artifactId>
- <version>0.1.1</version>
+ <version>0.1.2</version>
</parent>
<groupId>com.sematext.ag</groupId>
<artifactId>ag-player-es</artifactId>
<packaging>jar</packaging>
- <version>0.1.1</version>
+ <version>0.1.2</version>
<name>AG Player for ES</name>
<description>AG Player for ES</description>
- <url>http://maven.apache.org</url>
+ <url>http://sematext.com/open-source/index.html</url>
<licenses>
<license>
View
6 ag-player-solr/pom.xml
@@ -4,16 +4,16 @@
<parent>
<groupId>com.sematext.ag</groupId>
<artifactId>ag-parent</artifactId>
- <version>0.1.1</version>
+ <version>0.1.2</version>
</parent>
<groupId>com.sematext.ag</groupId>
<artifactId>ag-player-solr</artifactId>
<packaging>jar</packaging>
- <version>0.1.1</version>
+ <version>0.1.2</version>
<name>AG Player for Apache Solr</name>
<description>AG Player for Apache Solr</description>
- <url>http://www.sematext.com</url>
+ <url>http://sematext.com/open-source/index.html</url>
<licenses>
<license>
View
6 ag-player/pom.xml
@@ -4,16 +4,16 @@
<parent>
<groupId>com.sematext.ag</groupId>
<artifactId>ag-parent</artifactId>
- <version>0.1.1</version>
+ <version>0.1.2</version>
</parent>
<groupId>com.sematext.ag</groupId>
<artifactId>ag-player</artifactId>
<packaging>jar</packaging>
- <version>0.1.1</version>
+ <version>0.1.2</version>
<name>AG Player</name>
<description>AG Player</description>
- <url>http://maven.apache.org</url>
+ <url>http://sematext.com/open-source/index.html</url>
<licenses>
<license>
View
15 ag-player/src/main/java/com/sematext/ag/source/dictionary/AbstractDictionaryEventSource.java
@@ -55,21 +55,28 @@ public synchronized void init(PlayerConfig config) {
throw new IllegalArgumentException("Property " + DICTIONARY_FILE_NAME_KEY
+ " should designate existing dictionary file!");
}
+ BufferedReader bufferedReader = null;
try {
- BufferedReader br = new BufferedReader(new FileReader(f));
+ bufferedReader = new BufferedReader(new FileReader(f));
while (true) {
- String phrase = br.readLine();
+ String phrase = bufferedReader.readLine();
if (phrase != null) {
DICTIONARY.add(phrase.trim());
} else {
break;
}
}
- } catch (IOException e) {
+ } catch (IOException ioe) {
throw new IllegalArgumentException("File " + f.getName() + " under key " + DICTIONARY_FILE_NAME_KEY
+ " not readable!");
+ } finally {
+ try {
+ if (bufferedReader != null)
+ bufferedReader.close();
+ } catch (IOException ioe) {
+ throw new RuntimeException(ioe);
+ }
}
-
}
/**
View
10 ag-player/src/main/java/com/sematext/ag/source/dictionary/DataDictionaryEventSource.java
@@ -93,7 +93,17 @@ private String getValue(FieldType value) {
return new String("" + RANDOM.nextInt(1000));
case DATE:
return "2006-02-13T15:26:37Z";
+ case GEO:
+ return getLatitude() + "," + getLongitude();
}
return "";
}
+
+ private String getLatitude() {
+ return RANDOM.nextInt(180) - 90 + "." + RANDOM.nextInt(100);
+ }
+
+ private String getLongitude() {
+ return RANDOM.nextInt(360) - 180 + "." + RANDOM.nextInt(100);
+ }
}
View
2  ag-player/src/main/java/com/sematext/ag/source/dictionary/field/FieldType.java
@@ -21,5 +21,5 @@
* @author sematext, http://www.sematext.com/
*/
public enum FieldType {
- TEXT, NUMERIC, DATE;
+ TEXT, NUMERIC, DATE, GEO;
}
View
4 pom.xml
@@ -10,10 +10,10 @@
<groupId>com.sematext.ag</groupId>
<artifactId>ag-parent</artifactId>
<packaging>pom</packaging>
- <version>0.1.1</version>
+ <version>0.1.2</version>
<name>AG Parent</name>
<description>Parent module for ActionGenerator</description>
- <url>http://sematext.com/open-source/</url>
+ <url>http://sematext.com/open-source/index.html</url>
<licenses>
<license>
Please sign in to comment.
Something went wrong with that request. Please try again.