#670 Should the Read Op in the Java Toolkit return a current value?

Si Chen Fri 8 Feb


I'm just getting started and have installed the Java Toolkit.

Reading the documentation on the Read operation (https://project-haystack.org/doc/Ops#read), it seems that it should return the current value.

So trying it now: http://localhost:8080/haystack-java-3.0.2-SNAPSHOT/read?filter=site returns 4 sites but no current value for any of them. Is this how it should be, since these are sites so no current value applies?

http://localhost:8080/haystack-java-3.0.2-SNAPSHOT/read?filter=ahu returns 8 AHU's but no current value for any of them. Should it return some current value (maybe just a dummy random variable for demo purposes)?

Finally, trying http://localhost:8080/haystack-java-3.0.2-SNAPSHOT/read?id=A-Meter-KWH and http://localhost:8080/haystack-java-3.0.2-SNAPSHOT/read?id=A

both return exceptions: java.lang.ClassCastException: org.projecthaystack.HStr cannot be cast to org.projecthaystack.HRef

Is this expected?

Brian Frank Sat 9 Feb

You can look at the code for the test database. It just a very simple stub to test with, you have to glue the HServer class to your own data.

Also note that in Haystack, sites don't have "current values". Only points have current values modeled via the curVal tag. And ids are keyed by Refs, not Str which are encoded as @A

Si Chen Mon 11 Feb

Hi Brian,

Thanks so much for your response.

My question is that when I use the Read op with the Java Toolkit, I can get a list of the points, but none of them have a current value. For example: http://localhost:8080/haystack-java-3.0.2-SNAPSHOT/read?id=@B-AHU2-DTemp

returns ver:"3.0" tz,air,point,dis,his,discharge,equipRef,id,temp,kind,siteRef,unit,sensor "New_York",M,M,"B-AHU2-DTemp",M,M,@B-AHU2,@B-AHU2-DTemp,M,"Number",@B,"°F",M


will return a grid of these results. But none of them have a current value.

I posted a screenshot of it here: https://drive.google.com/open?id=1cNUhPL0X6tixqWKzyQR555t7p2FreHhE

Is that just because Java Toolkit is not hooked to anything? I've seen other implementations and they do return a current value.

Brian Frank Tue 12 Feb

There is a link to the test server code in my previous post - look at the addPoint method. It does not add curVal.

Si Chen Wed 13 Feb

Thanks for pointing me to your method.

I guess what confused me was that https://project-haystack.org/doc/Ops#read says "Note: a read operation on points returns the last known values for curVal and curStatus"

But it seems that if there is no curVal/curStatus then neither would not be returned.

So as part of Haystack, the operations and tags definitions are standard, but the results returned is implementation-specific?

Login or Signup to reply.