cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [1/3] git commit: updated refs/heads/4.2-workplace to 1148b6f
Date Thu, 14 Nov 2013 12:11:27 GMT
Updated Branches:
  refs/heads/4.2-workplace 7fb36a5b0 -> 1148b6fed


Fixed a bug in the java stubs for event.from()


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ded95cca
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ded95cca
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ded95cca

Branch: refs/heads/4.2-workplace
Commit: ded95cca725aa1bdc8072bfb170e0d1c7a571174
Parents: 7fb36a5
Author: Alex Huang <alex.huang@citrix.com>
Authored: Wed Nov 13 02:36:50 2013 -0800
Committer: Alex Huang <alex.huang@citrix.com>
Committed: Thu Nov 14 04:11:24 2013 -0800

----------------------------------------------------------------------
 deps/XenServerJava/pom.xml                      |  2 +-
 .../src/com/xensource/xenapi/Event.java         | 58 +++++++++++++-------
 2 files changed, 38 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ded95cca/deps/XenServerJava/pom.xml
----------------------------------------------------------------------
diff --git a/deps/XenServerJava/pom.xml b/deps/XenServerJava/pom.xml
index 5331e4f..a26b898 100755
--- a/deps/XenServerJava/pom.xml
+++ b/deps/XenServerJava/pom.xml
@@ -25,7 +25,7 @@
     <relativePath>../../pom.xml</relativePath>
   </parent>
   <artifactId>xapi</artifactId>
-  <version>5.6.100-1-SNAPSHOT</version>
+  <version>${cs.xapi.version}</version>
   <name>Apache XenSource XAPI</name>
   <description>XenSource XAPI Java Bindings</description>
   <dependencies>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ded95cca/deps/XenServerJava/src/com/xensource/xenapi/Event.java
----------------------------------------------------------------------
diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Event.java b/deps/XenServerJava/src/com/xensource/xenapi/Event.java
index 3574cd1..1d135e5 100644
--- a/deps/XenServerJava/src/com/xensource/xenapi/Event.java
+++ b/deps/XenServerJava/src/com/xensource/xenapi/Event.java
@@ -31,20 +31,18 @@
 
 package com.xensource.xenapi;
 
-import com.xensource.xenapi.Types.BadServerResponse;
-import com.xensource.xenapi.Types.VersionException;
-import com.xensource.xenapi.Types.XenAPIException;
-
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.Date;
 import java.util.HashMap;
-import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
 
 import org.apache.xmlrpc.XmlRpcException;
 
+import com.xensource.xenapi.Types.BadServerResponse;
+import com.xensource.xenapi.Types.XenAPIException;
+
 /**
  * Asynchronous event registration and handling
  *
@@ -67,8 +65,9 @@ public class Event extends XenAPIObject {
     /**
      * @return The XenAPI reference (OpaqueRef) to this object.
      */
+    @Override
     public String toWireString() {
-       return this.ref;
+       return ref;
     }
 
     /**
@@ -80,7 +79,7 @@ public class Event extends XenAPIObject {
         if (obj != null && obj instanceof Event)
         {
             Event other = (Event) obj;
-            return other.ref.equals(this.ref);
+            return other.ref.equals(ref);
         } else
         {
             return false;
@@ -97,31 +96,33 @@ public class Event extends XenAPIObject {
      * Represents all the fields in a Event
      */
     public static class Record implements Types.Record {
+        @Override
         public String toString() {
             StringWriter writer = new StringWriter();
             PrintWriter print = new PrintWriter(writer);
-            print.printf("%1$20s: %2$s\n", "id", this.id);
-            print.printf("%1$20s: %2$s\n", "timestamp", this.timestamp);
-            print.printf("%1$20s: %2$s\n", "clazz", this.clazz);
-            print.printf("%1$20s: %2$s\n", "operation", this.operation);
-            print.printf("%1$20s: %2$s\n", "ref", this.ref);
-            print.printf("%1$20s: %2$s\n", "objUuid", this.objUuid);
-            print.printf("%1$20s: %2$s\n", "snapshot", this.snapshot);
+            print.printf("%1$20s: %2$s\n", "id", id);
+            print.printf("%1$20s: %2$s\n", "timestamp", timestamp);
+            print.printf("%1$20s: %2$s\n", "clazz", clazz);
+            print.printf("%1$20s: %2$s\n", "operation", operation);
+            print.printf("%1$20s: %2$s\n", "ref", ref);
+            print.printf("%1$20s: %2$s\n", "objUuid", objUuid);
+            print.printf("%1$20s: %2$s\n", "snapshot", snapshot);
             return writer.toString();
         }
 
         /**
          * Convert a event.Record to a Map
          */
+        @Override
         public Map<String,Object> toMap() {
             Map<String,Object> map = new HashMap<String,Object>();
-            map.put("id", this.id == null ? 0 : this.id);
-            map.put("timestamp", this.timestamp == null ? new Date(0) : this.timestamp);
-            map.put("class", this.clazz == null ? "" : this.clazz);
-            map.put("operation", this.operation == null ? Types.EventOperation.UNRECOGNIZED
: this.operation);
-            map.put("ref", this.ref == null ? "" : this.ref);
-            map.put("obj_uuid", this.objUuid == null ? "" : this.objUuid);
-            map.put("snapshot", this.snapshot);
+            map.put("id", id == null ? 0 : id);
+            map.put("timestamp", timestamp == null ? new Date(0) : timestamp);
+            map.put("class", clazz == null ? "" : clazz);
+            map.put("operation", operation == null ? Types.EventOperation.UNRECOGNIZED :
operation);
+            map.put("ref", ref == null ? "" : ref);
+            map.put("obj_uuid", objUuid == null ? "" : objUuid);
+            map.put("snapshot", snapshot);
             return map;
         }
 
@@ -265,6 +266,21 @@ public class Event extends XenAPIObject {
             return Types.toSetOfEventRecord(result);
     }
 
+    public static Map properFrom(Connection c, Set<String> classes, String token, Double
timeout) throws BadServerResponse, XenAPIException, XmlRpcException,
+        Types.SessionNotRegistered,
+        Types.EventsLost {
+        String method_call = "event.from";
+        String session = c.getSessionReference();
+        Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(classes),
Marshalling.toXMLRPC(token), Marshalling.toXMLRPC(timeout)};
+        Map response = c.dispatch(method_call, method_params);
+        Object result = response.get("Value");
+        Map value = (Map)result;
+        Map<String, Object> from = new HashMap<String, Object>();
+        from.put("token", value.get("token"));
+        from.put("events", Types.toSetOfEventRecord(value.get("events")));
+        return from;
+    }
+
     /**
      * Return the ID of the next event to be generated by the system
      *


Mime
View raw message