Skip to content

Commit 08b8be7

Browse files
committed
Add rpsl data store and simplify package structure
1 parent 21d67cf commit 08b8be7

File tree

165 files changed

+754
-419
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+754
-419
lines changed

baremaps-benchmarking/src/main/java/org/apache/baremaps/benchmarking/geoparquet/OvertureMapsBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import java.nio.file.Files;
2222
import java.nio.file.Path;
2323
import java.util.concurrent.TimeUnit;
24-
import org.apache.baremaps.geoparquet.format.GeoParquetReader;
24+
import org.apache.baremaps.geoparquet.GeoParquetReader;
2525
import org.apache.hadoop.fs.s3a.AnonymousAWSCredentialsProvider;
2626
import org.openjdk.jmh.annotations.*;
2727
import org.openjdk.jmh.runner.Runner;

baremaps-benchmarking/src/main/java/org/apache/baremaps/benchmarking/geoparquet/SmallFileBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import java.nio.file.Files;
2323
import java.nio.file.Path;
2424
import java.util.concurrent.TimeUnit;
25-
import org.apache.baremaps.geoparquet.format.GeoParquetReader;
25+
import org.apache.baremaps.geoparquet.GeoParquetReader;
2626
import org.openjdk.jmh.annotations.*;
2727
import org.openjdk.jmh.runner.Runner;
2828
import org.openjdk.jmh.runner.RunnerException;

baremaps-cli/src/main/java/org/apache/baremaps/cli/dem/VectorTileContours.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
import java.util.concurrent.Callable;
2525
import org.apache.baremaps.maplibre.tileset.Tileset;
2626
import org.apache.baremaps.maplibre.tileset.TilesetLayer;
27-
import org.apache.baremaps.openstreetmap.format.stream.ProgressLogger;
28-
import org.apache.baremaps.openstreetmap.format.stream.StreamUtils;
27+
import org.apache.baremaps.openstreetmap.stream.ProgressLogger;
28+
import org.apache.baremaps.openstreetmap.stream.StreamUtils;
2929
import org.apache.baremaps.tasks.ExportVectorTiles;
3030
import org.apache.baremaps.tilestore.TileCoord;
3131
import org.apache.baremaps.tilestore.TileEntry;

baremaps-core/src/main/java/org/apache/baremaps/geocoder/openstreetmap/OpenStreetMapDocumentMapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121

2222
import java.util.function.Function;
23-
import org.apache.baremaps.openstreetmap.format.model.Element;
24-
import org.apache.baremaps.openstreetmap.format.model.Node;
23+
import org.apache.baremaps.openstreetmap.model.Element;
24+
import org.apache.baremaps.openstreetmap.model.Node;
2525
import org.apache.lucene.document.Document;
2626
import org.apache.lucene.document.Field;
2727
import org.apache.lucene.document.LatLonShape;

baremaps-core/src/main/java/org/apache/baremaps/geocoder/openstreetmap/OpenStreetMapEntityConsumer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
package org.apache.baremaps.geocoder.openstreetmap;
1919

2020
import java.util.function.Consumer;
21-
import org.apache.baremaps.openstreetmap.format.model.Element;
22-
import org.apache.baremaps.openstreetmap.format.model.Entity;
21+
import org.apache.baremaps.openstreetmap.model.Element;
22+
import org.apache.baremaps.openstreetmap.model.Entity;
2323
import org.apache.lucene.index.IndexWriter;
2424
import org.slf4j.Logger;
2525
import org.slf4j.LoggerFactory;

baremaps-core/src/main/java/org/apache/baremaps/iploc/IpLocMapper.java

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,22 @@ public Optional<IpLocObject> apply(RpslObject nicObject) {
8585
var attributes = nicObject.asMap();
8686

8787
// Use a default name if there is no netname
88-
var network = attributes.getOrDefault("netname", "unknown");
88+
var network = String.join(", ", attributes.getOrDefault("netname", List.of("unknown")));
89+
var geoloc = String.join(", ", attributes.getOrDefault("geoloc", List.of()));
90+
var country = String.join(", ", attributes.getOrDefault("country", List.of()));
91+
var source = String.join(", ", attributes.getOrDefault("source", List.of()));
8992

9093
// If there is a geoloc field, we use the latitude and longitude provided
9194
if (attributes.containsKey("geoloc")) {
92-
var location = stringToCoordinate(attributes.get("geoloc"));
95+
var location = stringToCoordinate(geoloc);
9396
if (location.isPresent()) {
9497
return Optional.of(new IpLocObject(
95-
attributes.get("geoloc"),
98+
geoloc,
9699
inetRange,
97100
location.get(),
98101
network,
99-
attributes.get("country"),
100-
attributes.get("source"),
102+
country,
103+
source,
101104
IpLocPrecision.GEOLOC));
102105
}
103106
}
@@ -112,36 +115,37 @@ public Optional<IpLocObject> apply(RpslObject nicObject) {
112115
// build a query text string out of the cherry-picked fields
113116
var queryTextBuilder = new StringBuilder();
114117
for (String field : searchedFields) {
115-
if (!Strings.isNullOrEmpty(attributes.get(field))) {
118+
var fieldValue = String.join(", ", attributes.get(field));
119+
if (!Strings.isNullOrEmpty(fieldValue)) {
116120
queryTextBuilder.append(attributes.get(field)).append(" ");
117121
}
118122
}
119123

120124
String queryText = queryTextBuilder.toString();
121-
var location = findLocationInCountry(queryText, attributes.get("country"));
125+
var location = findLocationInCountry(queryText, country);
122126
if (location.isPresent()) {
123127
return Optional.of(new IpLocObject(
124128
queryText,
125129
inetRange,
126130
location.get(),
127131
network,
128-
attributes.get("country"),
129-
attributes.get("source"),
132+
country,
133+
source,
130134
IpLocPrecision.GEOCODER));
131135
}
132136
}
133137

134138
// If there is a country get the location of country
135139
if (attributes.containsKey("country")) {
136-
var location = findCountryLocation(attributes.get("country"));
140+
var location = findCountryLocation(country);
137141
if (location.isPresent()) {
138142
return Optional.of(new IpLocObject(
139-
attributes.get("country"),
143+
country,
140144
inetRange,
141145
location.get(),
142146
network,
143-
attributes.get("country"),
144-
attributes.get("source"),
147+
country,
148+
source,
145149
IpLocPrecision.COUNTRY));
146150
}
147151
}
@@ -152,7 +156,7 @@ public Optional<IpLocObject> apply(RpslObject nicObject) {
152156
new Coordinate(),
153157
network,
154158
null,
155-
attributes.get("source"),
159+
source,
156160
IpLocPrecision.WORLD));
157161
} catch (Exception e) {
158162
logger.warn("Error while mapping nic object to ip loc object", e);

baremaps-core/src/main/java/org/apache/baremaps/iploc/IpLocRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import java.util.List;
2929
import java.util.stream.Stream;
3030
import javax.sql.DataSource;
31-
import org.apache.baremaps.openstreetmap.format.stream.StreamUtils;
31+
import org.apache.baremaps.openstreetmap.stream.StreamUtils;
3232
import org.locationtech.jts.geom.Coordinate;
3333
import org.slf4j.Logger;
3434
import org.slf4j.LoggerFactory;

baremaps-core/src/main/java/org/apache/baremaps/tasks/CreateGeocoderOpenStreetMap.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
import java.util.StringJoiner;
2626
import org.apache.baremaps.geocoder.GeocoderConstants;
2727
import org.apache.baremaps.geocoder.openstreetmap.OpenStreetMapEntityConsumer;
28-
import org.apache.baremaps.openstreetmap.format.pbf.PbfEntityReader;
29-
import org.apache.baremaps.openstreetmap.format.stream.StreamUtils;
28+
import org.apache.baremaps.openstreetmap.pbf.PbfEntityReader;
29+
import org.apache.baremaps.openstreetmap.stream.StreamUtils;
3030
import org.apache.baremaps.workflow.Task;
3131
import org.apache.baremaps.workflow.WorkflowContext;
3232
import org.apache.lucene.index.IndexWriter;

baremaps-core/src/main/java/org/apache/baremaps/tasks/CreateIplocIndex.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import java.util.StringJoiner;
2727
import org.apache.baremaps.iploc.IpLocReader;
2828
import org.apache.baremaps.iploc.IpLocRepository;
29-
import org.apache.baremaps.openstreetmap.format.stream.StreamException;
29+
import org.apache.baremaps.openstreetmap.stream.StreamException;
3030
import org.apache.baremaps.workflow.Task;
3131
import org.apache.baremaps.workflow.WorkflowContext;
3232
import org.apache.lucene.search.SearcherFactory;

baremaps-core/src/main/java/org/apache/baremaps/tasks/DiffService.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
package org.apache.baremaps.tasks;
1919

20-
import static org.apache.baremaps.openstreetmap.format.stream.ConsumerUtils.consumeThenReturn;
20+
import static org.apache.baremaps.openstreetmap.stream.ConsumerUtils.consumeThenReturn;
2121

2222
import java.io.BufferedInputStream;
2323
import java.net.MalformedURLException;
@@ -28,12 +28,12 @@
2828
import java.util.stream.Stream;
2929
import java.util.stream.StreamSupport;
3030
import java.util.zip.GZIPInputStream;
31-
import org.apache.baremaps.openstreetmap.format.function.EntityGeometryBuilder;
32-
import org.apache.baremaps.openstreetmap.format.function.EntityToGeometryMapper;
33-
import org.apache.baremaps.openstreetmap.format.function.ProjectionTransformer;
34-
import org.apache.baremaps.openstreetmap.format.model.*;
35-
import org.apache.baremaps.openstreetmap.format.stream.StreamException;
36-
import org.apache.baremaps.openstreetmap.format.xml.XmlChangeReader;
31+
import org.apache.baremaps.openstreetmap.function.EntityGeometryBuilder;
32+
import org.apache.baremaps.openstreetmap.function.EntityToGeometryMapper;
33+
import org.apache.baremaps.openstreetmap.function.ProjectionTransformer;
34+
import org.apache.baremaps.openstreetmap.model.*;
35+
import org.apache.baremaps.openstreetmap.stream.StreamException;
36+
import org.apache.baremaps.openstreetmap.xml.XmlChangeReader;
3737
import org.apache.baremaps.postgres.openstreetmap.HeaderRepository;
3838
import org.apache.baremaps.postgres.openstreetmap.Repository;
3939
import org.apache.baremaps.tilestore.TileCoord;

0 commit comments

Comments
 (0)