You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ed...@apache.org on 2012/12/19 21:09:14 UTC

[2/2] git commit: fix build, due to refactor rpc

fix build, due to refactor rpc


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

Branch: refs/heads/javelin
Commit: 8214f18897b9b5b6f42c088f11000c45bec6485e
Parents: ea713c7
Author: Edison Su <su...@gmail.com>
Authored: Wed Dec 19 12:01:57 2012 -0800
Committer: Edison Su <su...@gmail.com>
Committed: Wed Dec 19 12:02:11 2012 -0800

----------------------------------------------------------------------
 .../image/motion/DefaultImageMotionStrategy.java   |   31 ++++--
 .../cloudstack/storage/HypervisorHostEndPoint.java |   13 +--
 .../storage/volume/VolumeEntityImpl.java           |   12 +-
 .../storage/datastore/DefaultPrimaryDataStore.java |   16 +--
 .../driver/DefaultPrimaryDataStoreDriverImpl.java  |   32 ++++--
 .../storage/volume/VolumeServiceImpl.java          |   98 +++++++++------
 .../cloudstack/framework/async/AsyncRpcConext.java |   30 +++++
 .../xen/resource/CitrixResourceBase.java           |    5 +-
 .../xen/resource/XenServerStorageResource.java     |    4 +
 9 files changed, 151 insertions(+), 90 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8214f188/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java b/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java
index f9c0388..015d009 100644
--- a/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java
+++ b/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java
@@ -19,8 +19,8 @@
 package org.apache.cloudstack.storage.image.motion;
 
 import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
-import org.apache.cloudstack.framework.async.AsyncCallbackHandler;
 import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
+import org.apache.cloudstack.framework.async.AsyncRpcConext;
 import org.apache.cloudstack.storage.EndPoint;
 import org.apache.cloudstack.storage.command.CommandResult;
 import org.apache.cloudstack.storage.command.CopyTemplateToPrimaryStorageCmd;
@@ -52,20 +52,34 @@ public class DefaultImageMotionStrategy implements ImageMotionStrategy {
         ep.sendMessage(copyCommand);
         return true;
     }
+    
+    private class CreateTemplateContext<T> extends AsyncRpcConext<T> {
+        private final TemplateOnPrimaryDataStoreInfo template;
+        public CreateTemplateContext(AsyncCompletionCallback<T> callback, TemplateOnPrimaryDataStoreInfo template) {
+            super(callback);
+            this.template = template;
+        }
+        
+        public TemplateOnPrimaryDataStoreInfo getTemplate() {
+            return this.template;
+        }
+        
+    }
 
     @Override
     public void copyTemplateAsync(TemplateOnPrimaryDataStoreInfo templateStore, EndPoint ep, AsyncCompletionCallback<CommandResult> callback) {
         ImageOnPrimayDataStoreTO imageTo = new ImageOnPrimayDataStoreTO(templateStore);
         CopyTemplateToPrimaryStorageCmd copyCommand = new CopyTemplateToPrimaryStorageCmd(imageTo);
-        AsyncCallbackDispatcher caller = new AsyncCallbackDispatcher(this).setParentCallback(callback)
-                .setOperationName("defaultImageStrategy.copytemplate.callback")
-                .setContextParam("templateStore", templateStore);
+        CreateTemplateContext<CommandResult> context = new CreateTemplateContext<CommandResult>(callback, templateStore);
+        AsyncCallbackDispatcher<DefaultImageMotionStrategy> caller = AsyncCallbackDispatcher.create(this);
+        caller.setCallback(caller.getTarget().copyTemplateCallBack(null, null))
+            .setContext(context);
+             
         ep.sendMessageAsync(copyCommand, caller);
     }
     
-    @AsyncCallbackHandler(operationName="defaultImageStrategy.copytemplate.callback")
-    public void copyTemplateCallBack(AsyncCallbackDispatcher callback) {
-        AsyncCallbackDispatcher parentCall = callback.getParentCallback();
+    public Object copyTemplateCallBack(AsyncCallbackDispatcher<DefaultImageMotionStrategy> callback, CreateTemplateContext<CommandResult> context) {
+        AsyncCompletionCallback<CommandResult> parentCall = context.getParentCallback();
         CopyTemplateToPrimaryStorageAnswer answer = callback.getResult();
         CommandResult result = new CommandResult();
        
@@ -73,12 +87,13 @@ public class DefaultImageMotionStrategy implements ImageMotionStrategy {
             result.setSucess(answer.getResult());
             result.setResult(answer.getDetails());
         } else {
-            TemplateOnPrimaryDataStoreInfo templateStore = callback.getContextParam("templateStore");
+            TemplateOnPrimaryDataStoreInfo templateStore = context.getTemplate();
             templateStore.setPath(answer.getPath());
             result.setSucess(true);
         }
 
         parentCall.complete(result);
+        return null;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8214f188/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPoint.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPoint.java b/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPoint.java
index 9e06b92..7e5387d 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPoint.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPoint.java
@@ -20,8 +20,6 @@ package org.apache.cloudstack.storage;
 
 import javax.inject.Inject;
 
-import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
-import org.apache.cloudstack.framework.async.AsyncCallbackHandler;
 import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
 import org.apache.log4j.Logger;
 
@@ -62,15 +60,6 @@ public class HypervisorHostEndPoint implements EndPoint {
     
     @Override
     public void sendMessageAsync(Command cmd, AsyncCompletionCallback<Answer> callback) {
-        AsyncCallbackDispatcher dispatcher = new AsyncCallbackDispatcher(this).setContextParam("parentCallback", callback).
-                setOperationName("hypervisorEndpoint.sendMessage.callback");
-
-        rpcServer.sendCommandAsync(this.hostAddress, cmd, dispatcher);
-    }
-    
-    @AsyncCallbackHandler(operationName="hypervisorEndpoint.sendMessage.callback")
-    public void sendMessageCallback(AsyncCallbackDispatcher callback) {
-        AsyncCallbackDispatcher parentDispatcher = callback.getContextParam("parentCallback");
-        parentDispatcher.complete(callback.getResult());
+        rpcServer.sendCommandAsync(this.hostAddress, cmd, callback);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8214f188/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java
index 632542a..546c339 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java
@@ -31,7 +31,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskType;
 import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType;
 import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
-import org.apache.cloudstack.framework.async.AsyncCallbackHandler;
+import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
 import org.apache.cloudstack.storage.datastore.PrimaryDataStoreEntityImpl;
 import org.apache.cloudstack.storage.image.TemplateEntityImpl;
 import org.apache.cloudstack.storage.image.TemplateInfo;
@@ -197,8 +197,9 @@ public class VolumeEntityImpl implements VolumeEntity {
     public boolean createVolumeFromTemplate(long dataStoreId, VolumeDiskType diskType, TemplateEntity template) {
         TemplateInfo ti = ((TemplateEntityImpl)template).getTemplateInfo();
         
-        AsyncCallbackDispatcher caller = new AsyncCallbackDispatcher(this)
-            .setOperationName("volumeEntity.createVolumeFromTemplateAsyncCallback");
+        AsyncCallbackDispatcher<VolumeEntityImpl> caller = AsyncCallbackDispatcher.create(this);
+        caller.setCallback(caller.getTarget().createVolumeFromTemplateAsyncCallback(null, null));
+          
         vs.createVolumeFromTemplateAsync(volumeInfo, dataStoreId, diskType, ti, caller);
         try {
             synchronized (volumeInfo) {
@@ -210,11 +211,12 @@ public class VolumeEntityImpl implements VolumeEntity {
         return true;
     }
     
-    @AsyncCallbackHandler(operationName="volumeEntity.createVolumeFromTemplateAsyncCallback")
-    public void createVolumeFromTemplateAsyncCallback(AsyncCallbackDispatcher callback) {
+   
+    public Object createVolumeFromTemplateAsyncCallback(AsyncCompletionCallback<VolumeInfo> callback, Object context) {
         synchronized (volumeInfo) {
             volumeInfo.notify();
         }
+        return null;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8214f188/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java
index a9781e1..a3d1038 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java
@@ -11,8 +11,6 @@ import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreLifeCy
 import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreProvider;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskType;
-import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
-import org.apache.cloudstack.framework.async.AsyncCallbackHandler;
 import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
 import org.apache.cloudstack.storage.EndPoint;
 import org.apache.cloudstack.storage.HypervisorHostEndPoint;
@@ -31,7 +29,6 @@ import org.apache.log4j.Logger;
 import com.cloud.host.HostVO;
 import com.cloud.host.dao.HostDao;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.storage.Volume;
 import com.cloud.utils.component.ComponentInject;
 import edu.emory.mathcs.backport.java.util.Collections;
 
@@ -197,19 +194,10 @@ public class DefaultPrimaryDataStore implements PrimaryDataStore {
     public void createVoluemFromBaseImageAsync(VolumeInfo volume, TemplateOnPrimaryDataStoreInfo templateStore, AsyncCompletionCallback<CommandResult> callback) {
         VolumeObject vo = (VolumeObject) volume;
         vo.setVolumeDiskType(templateStore.getTemplate().getDiskType());
-        AsyncCallbackDispatcher<DefaultPrimaryDataStore> caller = new AsyncCallbackDispatcher<DefaultPrimaryDataStore>(this);
-        caller.setCallback(caller.getTarget().createVoluemFromBaseImageAsyncCallback(null, null))
-        .setOperationName("primarydatastore.createvolumefrombaseImage");
-        this.driver.createVolumeFromBaseImageAsync(vo, templateStore, caller);
+
+        this.driver.createVolumeFromBaseImageAsync(vo, templateStore, callback);
     }
     
-    @AsyncCallbackHandler(operationName="primarydatastore.createvolumefrombaseImage")
-    public Object createVoluemFromBaseImageAsyncCallback(AsyncCallbackDispatcher callback, Object parames) {
-        AsyncCallbackDispatcher parent = callback.getParentCallback();
-        CommandResult result = callback.getResult();
-        parent.complete(result);
-    }
-
     @Override
     public boolean installTemplate(TemplateOnPrimaryDataStoreInfo template) {
         // TODO Auto-generated method stub

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8214f188/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java
index a2506ca..1a09266 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java
@@ -5,8 +5,8 @@ import java.util.Map;
 
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
-import org.apache.cloudstack.framework.async.AsyncCallbackHandler;
 import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
+import org.apache.cloudstack.framework.async.AsyncRpcConext;
 import org.apache.cloudstack.storage.EndPoint;
 import org.apache.cloudstack.storage.command.CommandResult;
 import org.apache.cloudstack.storage.command.CreateVolumeAnswer;
@@ -103,6 +103,19 @@ public class DefaultPrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver
         return answer;
     }
     
+    private class CreateVolumeFromBaseImageContext<T> extends AsyncRpcConext<T> {
+        private final VolumeObject volume;
+      
+        public CreateVolumeFromBaseImageContext(AsyncCompletionCallback<T> callback, VolumeObject volume) {
+            super(callback);
+            this.volume = volume;
+        }
+        
+        public VolumeObject getVolume() {
+            return this.volume;
+        }
+        
+    }
     @Override
     public void createVolumeFromBaseImageAsync(VolumeObject volume, TemplateOnPrimaryDataStoreInfo template, AsyncCompletionCallback<CommandResult> callback) {
         VolumeTO vol = new VolumeTO(volume);
@@ -111,17 +124,17 @@ public class DefaultPrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver
         List<EndPoint> endPoints = template.getPrimaryDataStore().getEndPoints();
         EndPoint ep = endPoints.get(0);
         
-        AsyncCallbackDispatcher caller = new AsyncCallbackDispatcher(this)
-        .setParentCallback(callback)
-        .setOperationName("primarydatastoredriver.createvolumefrombaseImage")
-        .setContextParam("volume", volume);
+        CreateVolumeFromBaseImageContext<CommandResult> context = new CreateVolumeFromBaseImageContext<CommandResult>(callback, volume);
+        AsyncCallbackDispatcher<DefaultPrimaryDataStoreDriverImpl> caller = AsyncCallbackDispatcher.create(this);
+        caller.setContext(context)
+            .setCallback(caller.getTarget().createVolumeFromBaseImageAsyncCallback(null, null));
+
         ep.sendMessageAsync(cmd, caller);
         
        
     }
     
-    @AsyncCallbackHandler(operationName="primarydatastoredriver.createvolumefrombaseImage")
-    public void createVolumeFromBaseImageAsyncCallback(AsyncCallbackDispatcher callback) {
+    public Object createVolumeFromBaseImageAsyncCallback(AsyncCallbackDispatcher<DefaultPrimaryDataStoreDriverImpl> callback, CreateVolumeFromBaseImageContext<CommandResult> context) {
         CreateVolumeAnswer answer = (CreateVolumeAnswer)callback.getResult();
         CommandResult result = new CommandResult();
         if (answer == null || answer.getDetails() != null) {
@@ -131,11 +144,12 @@ public class DefaultPrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver
             }
         } else {
             result.setSucess(true);
-            VolumeObject volume = callback.getContextParam("volume");
+            VolumeObject volume = context.getVolume();
             volume.setPath(answer.getVolumeUuid());
         }
-        AsyncCallbackDispatcher parentCall = callback.getParentCallback();
+        AsyncCompletionCallback<CommandResult> parentCall = context.getParentCallback();
         parentCall.complete(result);
+        return null;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8214f188/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
index cd3414a..5ae6ed9 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
@@ -25,8 +25,8 @@ import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskType;
 import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType;
 import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
-import org.apache.cloudstack.framework.async.AsyncCallbackHandler;
 import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
+import org.apache.cloudstack.framework.async.AsyncRpcConext;
 import org.apache.cloudstack.storage.EndPoint;
 import org.apache.cloudstack.storage.command.CommandResult;
 import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
@@ -131,6 +131,30 @@ public class VolumeServiceImpl implements VolumeService {
         return null;
     }
 
+    private class CreateBaseImageContext<T> extends AsyncRpcConext<T> {
+        private final VolumeInfo volume;
+        private final PrimaryDataStore dataStore;
+        private final TemplateOnPrimaryDataStoreObject template;
+        public CreateBaseImageContext(AsyncCompletionCallback<T> callback, VolumeInfo volume, PrimaryDataStore datastore, TemplateOnPrimaryDataStoreObject template) {
+            super(callback);
+            this.volume = volume;
+            this.dataStore = datastore;
+            this.template = template;
+        }
+        
+        public VolumeInfo getVolume() {
+            return this.volume;
+        }
+        
+        public PrimaryDataStore getDataStore() {
+            return this.dataStore;
+        }
+        
+        public TemplateOnPrimaryDataStoreObject getTemplate() {
+            return this.template;
+        }
+        
+    }
     @DB
     protected void createBaseImageAsync(VolumeInfo volume, PrimaryDataStore dataStore, TemplateInfo template, AsyncCompletionCallback<VolumeInfo> callback) {
         TemplateOnPrimaryDataStoreObject templateOnPrimaryStoreObj = (TemplateOnPrimaryDataStoreObject) templatePrimaryStoreMgr.createTemplateOnPrimaryDataStore(template, dataStore);
@@ -147,21 +171,18 @@ public class VolumeServiceImpl implements VolumeService {
 
         templateOnPrimaryStoreObj.updateStatus(Status.DOWNLOAD_IN_PROGRESS);
 
-        AsyncCallbackDispatcher caller = new AsyncCallbackDispatcher(this)
-            .setParentCallback(callback)
-            .setOperationName("volumeservice.createbaseimage.callback")
-            .setContextParam("volume", volume)
-            .setContextParam("primary", dataStore)
-            .setContextParam("templateOnPrimary", templateOnPrimaryStoreObj);
+        CreateBaseImageContext<VolumeInfo> context = new CreateBaseImageContext<VolumeInfo>(callback, volume, dataStore, templateOnPrimaryStoreObj);
+        AsyncCallbackDispatcher<VolumeServiceImpl> caller = AsyncCallbackDispatcher.create(this);
+            caller.setCallback(caller.getTarget().createBaseImageCallback(null, null))
+            .setContext(context);
 
         imageMotion.copyTemplateAsync(templateOnPrimaryStoreObj, caller);
     }
 
     @DB
-    @AsyncCallbackHandler(operationName="volumeservice.createbaseimage.callback")
-    public void createBaseImageCallback(AsyncCallbackDispatcher callback) {
+    public Object createBaseImageCallback(AsyncCallbackDispatcher<VolumeServiceImpl> callback, CreateBaseImageContext<VolumeInfo> context) {
         CommandResult result = callback.getResult();
-        TemplateOnPrimaryDataStoreObject templateOnPrimaryStoreObj = callback.getContextParam("templateOnPrimary");
+        TemplateOnPrimaryDataStoreObject templateOnPrimaryStoreObj = context.getTemplate();
         if (result.isSuccess()) {
             templateOnPrimaryStoreObj.updateStatus(Status.DOWNLOADED);
             templateOnPrimaryStoreObj.stateTransit(TemplateOnPrimaryDataStoreStateMachine.Event.OperationSuccessed);
@@ -170,18 +191,28 @@ public class VolumeServiceImpl implements VolumeService {
             templateOnPrimaryStoreObj.stateTransit(TemplateOnPrimaryDataStoreStateMachine.Event.OperationFailed);
         }
         
-        AsyncCallbackDispatcher parentCaller = callback.getParentCallback();
-        VolumeInfo volume = callback.getContextParam("volume");
-        PrimaryDataStore pd = callback.getContextParam("primary");
-        AsyncCallbackDispatcher caller = new AsyncCallbackDispatcher(this)
-              .setParentCallback(parentCaller)
-              .setOperationName("volumeservice.createvolumefrombaseimage.callback");
+        AsyncCompletionCallback<VolumeInfo> parentCaller = context.getParentCallback();
+        VolumeInfo volume = context.getVolume();
+        PrimaryDataStore pd = context.getDataStore();
+
+        createVolumeFromBaseImageAsync(volume, templateOnPrimaryStoreObj, pd, parentCaller);
+        return null;
+    }
+    
+    private class CreateVolumeFromBaseImageContext<T> extends AsyncRpcConext<T> {
+        private final VolumeObject vo;
+        public CreateVolumeFromBaseImageContext(AsyncCompletionCallback<T> callback, VolumeObject vo) {
+            super(callback);
+            this.vo = vo;
+        }
         
-        createVolumeFromBaseImageAsync(volume, templateOnPrimaryStoreObj, pd, caller);
+        public VolumeObject getVolumeObject() {
+            return this.vo;
+        }
     }
     
     @DB
-    protected void createVolumeFromBaseImageAsync(VolumeInfo volume, TemplateOnPrimaryDataStoreInfo templateOnPrimaryStore, PrimaryDataStore pd, AsyncCompletionCallback<VolumeObject> callback) {
+    protected void createVolumeFromBaseImageAsync(VolumeInfo volume, TemplateOnPrimaryDataStoreInfo templateOnPrimaryStore, PrimaryDataStore pd, AsyncCompletionCallback<VolumeInfo> callback) {
         VolumeObject vo = (VolumeObject) volume;
         try {
             vo.stateTransit(Volume.Event.CreateRequested);
@@ -189,19 +220,17 @@ public class VolumeServiceImpl implements VolumeService {
             throw new CloudRuntimeException(e.toString());
         }
 
-
-        AsyncCallbackDispatcher caller = new AsyncCallbackDispatcher(this)
-        .setParentCallback(callback)
-        .setOperationName("volumeservice.createVolumeFromBaseImageCallback")
-        .setContextParam("volume", vo);
+        CreateVolumeFromBaseImageContext<VolumeInfo> context = new CreateVolumeFromBaseImageContext<VolumeInfo>(callback, vo);
+        AsyncCallbackDispatcher<VolumeServiceImpl> caller =  AsyncCallbackDispatcher.create(this);
+        caller.setCallback(caller.getTarget().createVolumeFromBaseImageCallback(null, null))
+        .setContext(context);
 
         pd.createVoluemFromBaseImageAsync(volume, templateOnPrimaryStore, caller);
     }
     
     @DB
-    @AsyncCallbackHandler(operationName="volumeservice.createVolumeFromBaseImageCallback")
-    public void createVolumeFromBaseImageCallback(AsyncCallbackDispatcher callback) {
-        VolumeObject vo = callback.getContextParam("volume");
+    public Object createVolumeFromBaseImageCallback(AsyncCallbackDispatcher<VolumeServiceImpl> callback, CreateVolumeFromBaseImageContext<VolumeInfo> context) {
+        VolumeObject vo = context.getVolumeObject();
         CommandResult result = callback.getResult();
         if (result.isSuccess()) {
             vo.stateTransit(Volume.Event.OperationSucceeded); 
@@ -209,16 +238,9 @@ public class VolumeServiceImpl implements VolumeService {
             vo.stateTransit(Volume.Event.OperationFailed);
         }
         
-        AsyncCallbackDispatcher parentCall = callback.getParentCallback();
-        parentCall.complete(vo);
-    }
-    
-    @DB
-    @AsyncCallbackHandler(operationName="volumeservice.createvolumefrombaseimage.callback")
-    public void createVolumeFromBaseImageAsyncCallback(AsyncCallbackDispatcher callback) {
-        AsyncCallbackDispatcher parentCall = callback.getParentCallback();
-        VolumeObject vo = callback.getResult();
+        AsyncCompletionCallback<VolumeInfo> parentCall = context.getParentCallback();
         parentCall.complete(vo);
+        return null;
     }
 
     @DB
@@ -230,12 +252,8 @@ public class VolumeServiceImpl implements VolumeService {
             createBaseImageAsync(volume, pd, template, callback);
             return;
         }
-
-        AsyncCallbackDispatcher caller = new AsyncCallbackDispatcher(this)
-            .setParentCallback(callback)
-            .setOperationName("volumeservice.createvolumefrombaseimage.callback");
             
-        createVolumeFromBaseImageAsync(volume, templateOnPrimaryStore, pd, caller);
+        createVolumeFromBaseImageAsync(volume, templateOnPrimaryStore, pd, callback);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8214f188/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncRpcConext.java
----------------------------------------------------------------------
diff --git a/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncRpcConext.java b/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncRpcConext.java
new file mode 100644
index 0000000..102364c
--- /dev/null
+++ b/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncRpcConext.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.framework.async;
+
+public class AsyncRpcConext<T> {
+    protected final AsyncCompletionCallback<T> parentCallBack;
+    public AsyncRpcConext(AsyncCompletionCallback<T> callback) {
+        this.parentCallBack = callback;
+    }
+    
+    public AsyncCompletionCallback<T> getParentCallback() {
+        return this.parentCallBack;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8214f188/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index a0066c8..611913a 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -47,6 +47,7 @@ import javax.ejb.Local;
 import javax.naming.ConfigurationException;
 import javax.xml.parsers.DocumentBuilderFactory;
 
+import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
 import org.apache.log4j.Logger;
 import org.apache.xmlrpc.XmlRpcException;
 import org.w3c.dom.Document;
@@ -559,8 +560,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
             return execute((Site2SiteVpnCfgCommand) cmd);
         } else if (clazz == CheckS2SVpnConnectionsCommand.class) {
             return execute((CheckS2SVpnConnectionsCommand) cmd);
-        } else if (clazz == StorageCommand.class) {
-            return this.storageResource.handleStorageCommands((StorageCommand)cmd);
+        } else if (cmd instanceof StorageSubSystemCommand) {
+            return this.storageResource.handleStorageCommands((StorageSubSystemCommand)cmd);
         } else {
             return Answer.createUnsupportedCommandAnswer(cmd);
         }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8214f188/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageResource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageResource.java
index b80b5d9..435734c 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageResource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageResource.java
@@ -67,6 +67,7 @@ public class XenServerStorageResource {
     }
     
     private long getTemplateSize(String url) {
+        /*
         HttpGet method = new HttpGet(url);
         HttpClient client = new HttpClient();
         try {
@@ -82,6 +83,8 @@ public class XenServerStorageResource {
             // TODO Auto-generated catch block
             e.printStackTrace();
         }
+        */
+        return 0;
     }
     
     protected Answer directDownloadHttpTemplate(TemplateTO template, PrimaryDataStoreTO primarDataStore) {
@@ -131,6 +134,7 @@ public class XenServerStorageResource {
             // TODO Auto-generated catch block
             e.printStackTrace();
         }
+        return null;
     }
     
     protected Answer execute(CopyTemplateToPrimaryStorageCmd cmd) {