Location of JPachube.jar

Modifying JPachube.jar to point to GroveStreams


As explained in the XBee blog, I have been following the examples in the book Building Wireless Sensor Networks which culminates in a Pachube based system. However, as already explained in Xively – No Thanks!, Xively bought Pachube, and it is broken, so the whole project is dead, essentially. Enough has been written about this already.

Using GroveStreams instead is a great solution, but requires the re-writing of the Pachube Processing library, JPachube, to point to GroveStreams, instead of Pachube. This is how you achieve that.

NOTE: JPachube.jar is based on the EEML for Processing library.

See also BWSN Uploading to Xively.


Take the JPachube.jar library from the Simple_Sensor_Network_Pachube code example (Book website)

Location of JPachube.jar
Location of JPachube.jar

Option drag it to a new folder to make a copy, as you don’t really need to destroy the original, plus you will want to keep it as a reference to compare against.

Open the .jar file, with 7-Zip, or Archive Utility on OS X, or something that handles zip files.

Unziped JPachube.jar
Unzipped JPachube.jar

Delete all of the .class files, as you are going to recompile them later.

Unzipped JPachube.jar with .class files removed
Unzipped JPachube.jar with .class files removed

Now, the simple part – replace “Pachube” with “GroveStreams” where ever you see it. Before all, the parent directory should be renamed from JPachube to JGroveStreams, and the directory that it contains from “Pachube” to “GroveStreams”.

Then just three filenames,:

  • Pachube.java
  • PachubeFactory.java
  • PachubeException.java

Now open every .java file, including those in the httpClient sub-directory, and replace EVERY instance of:

  • “Pachube” with “GroveStreams”, and ;
  • “pachube” with “grovestreams”

You do this everywhere… in URLs, class and method names, comments, everywhere.

Save all of the files.

Now, in a terminal, in the JGroveStream/GroveStream directory run

$ find . -name "*.java" > sources.txt

This makes a list of all of the .java files, including those in the sub-directory (you can check this by running “more sources.txt”. If you do not do this, you will had many compile errors. Next compile the lot:

$ javac @sources.txt

Now to make the .jar file. Change directory in the terminal to the JGroveStreams directory, and run the jar command on all files in the GroveStreams directory

$ jar cf JGroveStreams.jar GroveStreams/*

Now, there will be a JGroveStreams.jar directory, of exactly the same file structure as the original JPachube.jar file. You can check this, by creating a copy in a dummy folder and unzipping it and comparing it to the unzipped JPachube.jar directory:

JGroveStreams.jar unzipped
JGroveStreams.jar unzipped

NOTE: There is no need to make this .jar file executable, and so no entry point needs to be specified when creating the .jar file.

Useful Resources

Modifying the API calls

It is necessary to adjust the API calls, which were used to call Pachube, to match the GroveStreams calls. To do this it is necessary to see if, hopefully, there exists a one-for-one relationship for the various entities in each system, and then examine and compare the API references of each. This is no mean feat. For simplicity, one could just work through the JGRoveStreams library and modify the methods as required. Here are the developer resources:

Assuming, for the moment, that Grovestreams Component maps to Pachube’s Product, then considering each API in turn (Pachube vs GroveStreams), going down the GroveStreams’s Component Resource

List All Products vs GET component



Read a Product vs GET component/{ComponentUid}



vs Get Component/{componentUid}/location


vs GET component/new


vs PUT component


vs PUT component/{componentUid}/reconcile_changes


vs POST component


Delete a Product vs DELETE component/{componentUid}




2 thoughts on “Modifying JPachube.jar to point to GroveStreams”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s