Permalink
Browse files

Initial commit of the JPachube client

  • Loading branch information...
1 parent e0e3402 commit cdfcf4eb4d3ed57398a38cdf7d9b44729c15492d Ben Lawson committed Dec 7, 2011
Showing with 2,291 additions and 0 deletions.
  1. +9 −0 .classpath
  2. +2 −0 .gitignore
  3. +17 −0 .project
  4. +12 −0 .settings/org.eclipse.jdt.core.prefs
  5. BIN bin/com/pachube/jpachube/Data.class
  6. BIN bin/com/pachube/jpachube/Disposition.class
  7. BIN bin/com/pachube/jpachube/Domain.class
  8. BIN bin/com/pachube/jpachube/Exposure.class
  9. BIN bin/com/pachube/jpachube/Feed.class
  10. BIN bin/com/pachube/jpachube/Location.class
  11. BIN bin/com/pachube/jpachube/Pachube.class
  12. BIN bin/com/pachube/jpachube/PachubeException.class
  13. BIN bin/com/pachube/jpachube/PachubeFactory.class
  14. BIN bin/com/pachube/jpachube/Status.class
  15. BIN bin/com/pachube/jpachube/Trigger.class
  16. BIN bin/com/pachube/jpachube/TriggerType.class
  17. BIN bin/com/pachube/jpachube/example/ExamplePachubeClient.class
  18. BIN bin/com/pachube/jpachube/httpClient/HttpClient.class
  19. BIN bin/com/pachube/jpachube/httpClient/HttpMethod.class
  20. BIN bin/com/pachube/jpachube/httpClient/HttpRequest.class
  21. BIN bin/com/pachube/jpachube/httpClient/HttpResponse.class
  22. BIN bin/com/pachube/jpachube/httpClient/SocketClient.class
  23. BIN lib/httpclient-4.1.2.jar
  24. BIN lib/httpcore-4.1.2.jar
  25. +126 −0 src/com/pachube/jpachube/Data.java
  26. +8 −0 src/com/pachube/jpachube/Disposition.java
  27. +8 −0 src/com/pachube/jpachube/Domain.java
  28. +8 −0 src/com/pachube/jpachube/Exposure.java
  29. +502 −0 src/com/pachube/jpachube/Feed.java
  30. +181 −0 src/com/pachube/jpachube/Location.java
  31. +379 −0 src/com/pachube/jpachube/Pachube.java
  32. +14 −0 src/com/pachube/jpachube/PachubeException.java
  33. +347 −0 src/com/pachube/jpachube/PachubeFactory.java
  34. +8 −0 src/com/pachube/jpachube/Status.java
  35. +156 −0 src/com/pachube/jpachube/Trigger.java
  36. +15 −0 src/com/pachube/jpachube/TriggerType.java
  37. +61 −0 src/com/pachube/jpachube/example/ExamplePachubeClient.java
  38. BIN src/com/pachube/jpachube/httpClient/HttpClient.class
  39. +6 −0 src/com/pachube/jpachube/httpClient/HttpClient.java
  40. BIN src/com/pachube/jpachube/httpClient/HttpMethod.class
  41. +17 −0 src/com/pachube/jpachube/httpClient/HttpMethod.java
  42. BIN src/com/pachube/jpachube/httpClient/HttpRequest.class
  43. +223 −0 src/com/pachube/jpachube/httpClient/HttpRequest.java
  44. BIN src/com/pachube/jpachube/httpClient/HttpResponse.class
  45. +63 −0 src/com/pachube/jpachube/httpClient/HttpResponse.java
  46. BIN src/com/pachube/jpachube/httpClient/SocketClient.class
  47. +129 −0 src/com/pachube/jpachube/httpClient/SocketClient.java
View
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="test"/>
+ <classpathentry kind="lib" path="lib/httpclient-4.1.2.jar"/>
+ <classpathentry kind="lib" path="lib/httpcore-4.1.2.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
View
@@ -0,0 +1,2 @@
+src/com/pachube/jpachube/*.class
+src/com/pachube/jpachube/httpClient/*.class
View
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>PachubeClient</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
@@ -0,0 +1,12 @@
+#Wed Dec 07 12:20:45 GMT 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
@@ -0,0 +1,126 @@
+package com.pachube.jpachube;
+
+public class Data {
+
+ private int id;
+
+ private String tag;
+
+ private double value;
+
+ private Double minValue;
+
+ private Double maxValue;
+
+ public Data(int id, String tag, double value, Double minValue,
+ Double maxValue) {
+ super();
+ this.id = id;
+ this.tag = tag;
+ this.value = value;
+ this.minValue = minValue;
+ this.maxValue = maxValue;
+ }
+
+ public Data() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = Integer.parseInt(id);
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getTag() {
+ return tag;
+ }
+
+ public void setTag(String tag) {
+ this.tag = tag;
+ }
+
+ public double getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = Double.parseDouble(value);
+ }
+
+ public void setValue(double value) {
+ this.value = value;
+ }
+
+ public Double getMinValue() {
+ return minValue;
+ }
+
+ public void setMinValue(Double minValue) {
+ if (minValue != null) {
+ this.minValue = minValue;
+ }
+ }
+
+ public void setMinValue(String minValue) {
+ if (minValue != null) {
+ this.minValue = Double.parseDouble(minValue);
+ }
+ }
+
+ public Double getMaxValue() {
+ return maxValue;
+ }
+
+ public void setMaxValue(Double maxValue) {
+ if (maxValue != null) {
+ this.maxValue = maxValue;
+ }
+ }
+
+ public void setMaxValue(String maxValue) {
+ if (minValue != null) {
+ this.maxValue = Double.parseDouble(maxValue);
+ }
+ }
+
+ public String toXMLWithWrapper(){
+ String ret = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<eeml xmlns=\"http://www.eeml.org/xsd/005\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" version=\"5\" xsi:schemaLocation=\"http://www.eeml.org/xsd/005 http://www.eeml.org/xsd/005/005.xsd\"><environment>";
+ ret = ret + this.toXML() + "</environment></eeml>";
+ return ret;
+ }
+
+ public String toXML() {
+ String ret = "";
+ ret = "<data id=\"" + this.id + "\">\n\t\t";
+ ret = ret + "<tag>" + this.tag + "</tag>\n\t\t";
+ ret = ret + "<value ";
+
+ if (this.minValue != null) {
+ ret = ret + "minValue=\"" + this.minValue + "\" ";
+ }
+
+ if(this.maxValue != null){
+ ret = ret + "maxValue=\""+this.maxValue+"\" ";
+ }
+ ret = ret + ">"+ this.value +"</value>\n\t";
+
+ ret = ret + "</data>";
+
+ return ret;
+ }
+
+ @Override
+ public String toString() {
+ return "Data [id=" + id + ", maxValue=" + maxValue + ", minValue="
+ + minValue + ", tag=" + tag + ", value=" + value + "]";
+ }
+
+}
@@ -0,0 +1,8 @@
+package com.pachube.jpachube;
+
+public enum Disposition {
+
+ fixed,
+ mobile
+
+}
@@ -0,0 +1,8 @@
+package com.pachube.jpachube;
+
+public enum Domain {
+
+ physical,
+ virtual
+
+}
@@ -0,0 +1,8 @@
+package com.pachube.jpachube;
+
+public enum Exposure {
+
+ indoor,
+ outdoor
+
+}
Oops, something went wrong.

0 comments on commit cdfcf4e

Please sign in to comment.