-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from billmurrin/issue25-26-null-error
Fixed null issue, added migration for blank configurations. Bumped ve…
- Loading branch information
Showing
6 changed files
with
124 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/org/graylog/plugins/quickvaluesplus/QuickValuesPlusDefaultValuesMigration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.graylog.plugins.quickvaluesplus; | ||
|
||
import org.graylog2.migrations.Migration; | ||
import org.graylog2.cluster.ClusterConfigServiceImpl; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import javax.inject.Inject; | ||
import java.time.ZonedDateTime; | ||
|
||
|
||
/** | ||
* Migration creating the quick values plus entries if they do not exist. | ||
*/ | ||
public class QuickValuesPlusDefaultValuesMigration extends Migration { | ||
private static final Logger LOG = LoggerFactory.getLogger(QuickValuesPlusDefaultValuesMigration.class); | ||
|
||
private final ClusterConfigServiceImpl clusterConfigService; | ||
|
||
@Inject | ||
public QuickValuesPlusDefaultValuesMigration(final ClusterConfigServiceImpl clusterConfigService) { | ||
this.clusterConfigService = clusterConfigService; | ||
} | ||
|
||
@Override | ||
public ZonedDateTime createdAt() { | ||
return ZonedDateTime.parse("2017-09-03T01:57:00Z"); | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("unchecked") | ||
public void upgrade() { | ||
if (clusterConfigService.get(QuickValuesPlusPluginConfiguration.class) != null) { | ||
LOG.debug("Migration already done."); | ||
return; | ||
} | ||
|
||
LOG.info("Writing values for Quick Values Plugin Configuration"); | ||
clusterConfigService.write(QuickValuesPlusPluginConfiguration.create(25, 5, "descending")); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters