Skip to content

Commit

Permalink
Rename IndexRangeImpl to MongoIndexRange
Browse files Browse the repository at this point in the history
  • Loading branch information
Jochen Schalanda committed Jun 30, 2015
1 parent 7aec9c9 commit 23e186b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Expand Up @@ -32,15 +32,15 @@
import java.util.Map;

@CollectionName("index_ranges")
public class IndexRangeImpl extends PersistedImpl implements IndexRange {
public class MongoIndexRange extends PersistedImpl implements IndexRange {

private static final Logger LOG = LoggerFactory.getLogger(IndexRangeImpl.class);
private static final Logger LOG = LoggerFactory.getLogger(MongoIndexRange.class);

public IndexRangeImpl(Map<String, Object> fields) {
public MongoIndexRange(Map<String, Object> fields) {
super(fields);
}

protected IndexRangeImpl(ObjectId id, Map<String, Object> fields) {
protected MongoIndexRange(ObjectId id, Map<String, Object> fields) {
super(id, fields);
}

Expand Down
Expand Up @@ -59,20 +59,20 @@ public MongoIndexRangeService(MongoConnection mongoConnection, ActivityWriter ac

@Override
public IndexRange get(String index) throws NotFoundException {
DBObject dbo = findOne(IndexRangeImpl.class, new BasicDBObject("index", index));
DBObject dbo = findOne(MongoIndexRange.class, new BasicDBObject("index", index));

if (dbo == null)
throw new NotFoundException("Index " + index + " not found.");

return new IndexRangeImpl((ObjectId) dbo.get("_id"), dbo.toMap());
return new MongoIndexRange((ObjectId) dbo.get("_id"), dbo.toMap());
}

@Override
public SortedSet<IndexRange> getFrom(int timestamp) {
final ImmutableSortedSet.Builder<IndexRange> ranges = ImmutableSortedSet.orderedBy(COMPARATOR);
final BasicDBObject query = new BasicDBObject("start", new BasicDBObject("$gte", timestamp));
for (DBObject dbo : query(IndexRangeImpl.class, query)) {
ranges.add(new IndexRangeImpl((ObjectId) dbo.get("_id"), dbo.toMap()));
for (DBObject dbo : query(MongoIndexRange.class, query)) {
ranges.add(new MongoIndexRange((ObjectId) dbo.get("_id"), dbo.toMap()));
}

return ranges.build();
Expand All @@ -94,17 +94,17 @@ public void destroy(String index) {

String x = "Removed range meta-information of [" + index + "]";
LOG.info(x);
activityWriter.write(new Activity(x, IndexRangeImpl.class));
activityWriter.write(new Activity(x, MongoIndexRange.class));
}

@Override
public IndexRange create(Map<String, Object> range) {
return new IndexRangeImpl(range);
return new MongoIndexRange(range);
}

@Override
public void destroyAll() {
destroyAll(IndexRangeImpl.class);
destroyAll(MongoIndexRange.class);
}

@Override
Expand Down
Expand Up @@ -26,7 +26,7 @@
import org.graylog2.alerts.AbstractAlertCondition;
import org.graylog2.alerts.AlertConditionTest;
import org.graylog2.indexer.ranges.IndexRange;
import org.graylog2.indexer.ranges.IndexRangeImpl;
import org.graylog2.indexer.ranges.MongoIndexRange;
import org.graylog2.indexer.results.SearchResult;
import org.graylog2.indexer.searches.Searches;
import org.graylog2.indexer.searches.Sorting;
Expand Down Expand Up @@ -77,7 +77,7 @@ public void testRunMatchingMessagesInStream() throws Exception {
fields.put("index", "graylog_test");
fields.put("started_at", DateTime.now().minusDays(1).getMillis());

final Set<IndexRange> indexRanges = Sets.<IndexRange>newHashSet(new IndexRangeImpl(fields));
final Set<IndexRange> indexRanges = Sets.<IndexRange>newHashSet(new MongoIndexRange(fields));
final SearchResult searchResult = spy(new SearchResult(searchHits,
indexRanges,
"message:something",
Expand Down Expand Up @@ -111,7 +111,7 @@ public void testRunNoMatchingMessages() throws Exception {
fields.put("index", "graylog_test");
fields.put("started_at", DateTime.now().minusDays(1).getMillis());

final Set<IndexRange> indexRanges = Sets.<IndexRange>newHashSet(new IndexRangeImpl(fields));
final Set<IndexRange> indexRanges = Sets.<IndexRange>newHashSet(new MongoIndexRange(fields));
final SearchResult searchResult = spy(new SearchResult(searchHits,
indexRanges,
"message:something",
Expand Down

0 comments on commit 23e186b

Please sign in to comment.