Skip to content

Commit

Permalink
Implemented latestTimestamp() method from from binjr 2.10.0 adapter API
Browse files Browse the repository at this point in the history
  • Loading branch information
fthevenet committed Oct 21, 2019
1 parent f2cffa1 commit 44207a2
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
## [binjr-adapter-demo 1.0.0](https://github.com/binjr/binjr/releases/tag/1.0.0)
Released on Thu, 17 Oct 2019

* Initial release
2 changes: 1 addition & 1 deletion UNRELEASED.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Initial release
* _[New]_ New worksheets' time range are now automatically set to the last 24 hours from the last captured sample.
8 changes: 6 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ plugins {

ext.IS_TAG = System.getenv('IS_TAG') != null ? System.getenv('IS_TAG') == "true" : false
ext.IS_RELEASE = IS_TAG && !(System.getenv('REPO_TAG_NAME').endsWith('-SNAPSHOT'))
ext.VERSION_STEM = "1.0.0"
ext.VERSION_STEM = "1.1.0"
ext.PRODUCT_VERSION = "${VERSION_STEM}${IS_RELEASE ? '' : '-SNAPSHOT'}"
ext.OS_NAME = System.getProperty("os.name").toLowerCase()
ext.OS_ARCH = System.getProperty("os.arch")
Expand Down Expand Up @@ -118,6 +118,10 @@ jar {
}
}

configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}

task shaded(type: Jar) {
manifest {
attributes(
Expand Down Expand Up @@ -232,12 +236,12 @@ class WrapTaskForSigning extends AbstractArchiveTask {
}

repositories {
// mavenLocal()
mavenCentral()
jcenter()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
mavenLocal()
}


Expand Down
15 changes: 15 additions & 0 deletions src/main/java/eu/binjr/sources/demo/adapters/DemoDataAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public FilterableTreeItem<TimeSeriesBinding> getBindingTree() throws DataAdapter
this.hostsList = new HostsList();
this.hostsList.setProbeClassResolver(new ReadOnlyProbeClassResolver(propertiesManager.extensionClassLoader))
.configure(propertiesManager);

var tree = new FilterableTreeItem<>(
new TimeSeriesBinding(
"",
Expand All @@ -122,6 +123,20 @@ public FilterableTreeItem<TimeSeriesBinding> getBindingTree() throws DataAdapter
return tree;
}

// @Override
public ZonedDateTime latestTimestamp(String path, List<TimeSeriesInfo> seriesInfos) throws DataAdapterException {
ZonedDateTime latest = ZonedDateTime.now();
int sepPos = path.indexOf("?");
if (sepPos >= 0) {
String graphTreePath = path.substring(0, sepPos);
String graphNodeKey = path.substring(sepPos + 1);
var graphTree = hostsList.getGraphTreeByHost().getById(graphTreePath.hashCode());
var graphNode = graphTree.getGraphsSet().get(graphNodeKey);
latest = ZonedDateTime.ofInstant(graphNode.getProbe().getLastUpdate().toInstant(), getTimeZoneId());
}
return latest;
}

@Override
public Map<TimeSeriesInfo, TimeSeriesProcessor> fetchData(String path,
Instant start,
Expand Down

0 comments on commit 44207a2

Please sign in to comment.