Updated Branches:
  refs/heads/javelin 3b668d290 -> 28b682c8d

Add concept of caller context and message serilizer to messaging layer


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

Branch: refs/heads/javelin
Commit: 28b682c8dbccfd27d30de08c539cb2847222c3a2
Parents: 3b668d2
Author: Kelven Yang <[email protected]>
Authored: Thu Nov 15 15:59:37 2012 -0800
Committer: Kelven Yang <[email protected]>
Committed: Thu Nov 15 15:59:37 2012 -0800

----------------------------------------------------------------------
 .../framework/messaging/ComponentEndpoint.java     |   32 +++-------
 .../cloudstack/framework/messaging/EventBus.java   |    5 +-
 .../framework/messaging/EventBusBase.java          |   24 +++++--
 .../framework/messaging/EventHandler.java          |   16 +++++
 .../framework/messaging/MessageSerializer.java     |   24 ++++++++
 .../framework/messaging/PublishScope.java          |   24 +-------
 .../cloudstack/framework/messaging/RpcCall.java    |   31 ----------
 .../framework/messaging/RpcCallContext.java        |   47 +++++++++++++++
 .../framework/messaging/RpcCallHandler.java        |   31 ----------
 .../framework/messaging/RpcClientCall.java         |   25 ++++++++
 .../framework/messaging/RpcClientCallHandler.java  |   12 ++++
 .../framework/messaging/RpcEndpoint.java           |    7 +--
 .../framework/messaging/RpcException.java          |   18 +++++-
 .../framework/messaging/RpcProvider.java           |   10 +++-
 .../framework/messaging/RpcServerCall.java         |   28 +++++++++
 .../framework/messaging/RpcServerCallHandler.java  |   30 +++++++++
 .../cloudstack/framework/messaging/Subscriber.java |    2 +-
 .../messaging/TransportAddressFactory.java         |   23 -------
 .../framework/messaging/TransportEndpoint.java     |    4 +-
 .../framework/messaging/client/ClientEventBus.java |    1 -
 .../messaging/client/ClientTransportEndpoint.java  |    2 +-
 21 files changed, 246 insertions(+), 150 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28b682c8/framework/ipc/src/org/apache/cloudstack/framework/messaging/ComponentEndpoint.java
----------------------------------------------------------------------
diff --git 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/ComponentEndpoint.java
 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/ComponentEndpoint.java
index ed9ea0b..442f986 100644
--- 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/ComponentEndpoint.java
+++ 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/ComponentEndpoint.java
@@ -18,8 +18,7 @@
  */
 package org.apache.cloudstack.framework.messaging;
 
-public class ComponentEndpoint implements RpcEndpoint, TransportMultiplexier, 
Subscriber {
-
+public class ComponentEndpoint implements RpcEndpoint, Subscriber {
        private TransportEndpoint transportEndpoint;
        private RpcProvider rpcProvider;
        
@@ -42,44 +41,33 @@ public class ComponentEndpoint implements RpcEndpoint, 
TransportMultiplexier, Su
                this.rpcProvider = rpcProvider;
        }
        
-       public void initialize(String[] multiplexiers) {
-               if(multiplexiers != null) {
-                       for(String name : multiplexiers)
-                               transportEndpoint.registerMultiplexier(name, 
this);
-               }
-               
+       public void initialize() {
                rpcProvider.registerRpcEndpoint(this);
        }
 
-       @Override
-       public void onTransportMessage(String senderEndpointAddress,
-               String targetEndpointAddress, String multiplexer, String 
message) {
-       }
-
-       @Override
-       public String call(String targetAddress, String rpcMessage)
+       // it will throw RpcRuntimeException in case of transport
+       public String call(RpcCallContext callContext, String targetAddress, 
String command, Object cmdArg)
        {
-               return null;
+               return rpcProvider.call(this, callContext, targetAddress, 
command, cmdArg);
        }
        
-       @Override
-       public RpcCall asyncCall(String targetAddress, String rpcMessage) {
-               return null;
+       public RpcClientCall asyncCall(RpcCallContext callContext, String 
targetAddress, String command, Object cmdArg) {
+               return rpcProvider.asyncCall(this, callContext, targetAddress, 
command, cmdArg);
        }
 
        @Override
-       public void onCallReceive(RpcCall call) {
+       public void onCallReceive(RpcServerCall call) {
                // TODO Auto-generated method stub
                // implement annotation based call dispatching
        }
        
        @Override
-       public void onCallReturn(RpcCall call, String rpcReturnMessage, 
RpcException e) {
+       public void onCallReturn(RpcClientCall call, Object returnObject, 
RpcException e) {
                // ???
        }
        
        @Override
-       public void onPublishEvent(String subject, String senderAddress, String 
args) {
+       public void onPublishEvent(String subject, String senderAddress, Object 
args) {
                // TODO
        }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28b682c8/framework/ipc/src/org/apache/cloudstack/framework/messaging/EventBus.java
----------------------------------------------------------------------
diff --git 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/EventBus.java 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/EventBus.java
index e11a009..b73438b 100644
--- a/framework/ipc/src/org/apache/cloudstack/framework/messaging/EventBus.java
+++ b/framework/ipc/src/org/apache/cloudstack/framework/messaging/EventBus.java
@@ -18,8 +18,11 @@
 package org.apache.cloudstack.framework.messaging;
 
 public interface EventBus {
+       void setMessageSerializer(MessageSerializer messageSerializer);
+       MessageSerializer getMessageSerializer();
+       
        void subscribe(String subject, Subscriber subscriber);
        void unsubscribe(String subject, Subscriber subscriber);
        
-       void publish(String subject, PublishScope scope, String senderAddress, 
String args);
+       void publish(String senderAddress, String subject, PublishScope scope, 
Object args);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28b682c8/framework/ipc/src/org/apache/cloudstack/framework/messaging/EventBusBase.java
----------------------------------------------------------------------
diff --git 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/EventBusBase.java 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/EventBusBase.java
index fbcf648..729208a 100644
--- 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/EventBusBase.java
+++ 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/EventBusBase.java
@@ -24,13 +24,13 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-
 public class EventBusBase implements EventBus {
 
        private Gate _gate;
        private List<ActionRecord> _pendingActions;
        
        private SubscriptionNode _subscriberRoot;
+       private MessageSerializer _messageSerializer; 
        
        public EventBusBase() {
                _gate = new Gate();
@@ -40,6 +40,16 @@ public class EventBusBase implements EventBus {
        }
        
        @Override
+       public void setMessageSerializer(MessageSerializer messageSerializer) {
+               _messageSerializer = messageSerializer;
+       }
+       
+       @Override
+       public MessageSerializer getMessageSerializer() {
+               return _messageSerializer;
+       }
+       
+       @Override
        public void subscribe(String subject, Subscriber subscriber) {
                assert(subject != null);
                assert(subscriber != null);
@@ -71,8 +81,8 @@ public class EventBusBase implements EventBus {
        }
 
        @Override
-       public void publish(String subject, PublishScope scope, String 
senderAddress,
-               String args) {
+       public void publish(String senderAddress, String subject, PublishScope 
scope, 
+               Object args) {
                
                if(_gate.enter(true)) {
 
@@ -80,11 +90,11 @@ public class EventBusBase implements EventBus {
                        SubscriptionNode current = locate(subject, 
chainFromTop, false);
                        
                        if(current != null)
-                               current.notifySubscribers(subject, 
senderAddress, args);
+                               current.notifySubscribers(senderAddress, 
subject, args);
                        
                        Collections.reverse(chainFromTop);
                        for(SubscriptionNode node : chainFromTop)
-                               node.notifySubscribers(subject, senderAddress, 
args);
+                               node.notifySubscribers(senderAddress, subject, 
args);
                        
                        _gate.leave();
                }
@@ -283,9 +293,9 @@ public class EventBusBase implements EventBus {
                        _children.put(key, childNode);
                }
                
-               public void notifySubscribers(String subject, String 
senderAddress, String args) {
+               public void notifySubscribers(String senderAddress, String 
subject,  Object args) {
                        for(Subscriber subscriber : _subscribers) {
-                               subscriber.onPublishEvent(subject, 
senderAddress, args);
+                               subscriber.onPublishEvent(senderAddress, 
subject, args);
                        }
                }
        }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28b682c8/framework/ipc/src/org/apache/cloudstack/framework/messaging/EventHandler.java
----------------------------------------------------------------------
diff --git 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/EventHandler.java 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/EventHandler.java
index 12e6fb8..6ee67c8 100644
--- 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/EventHandler.java
+++ 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/EventHandler.java
@@ -1,3 +1,19 @@
+// 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
+// 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.messaging;
 
 import java.lang.annotation.ElementType;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28b682c8/framework/ipc/src/org/apache/cloudstack/framework/messaging/MessageSerializer.java
----------------------------------------------------------------------
diff --git 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/MessageSerializer.java
 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/MessageSerializer.java
new file mode 100644
index 0000000..3aafd85
--- /dev/null
+++ 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/MessageSerializer.java
@@ -0,0 +1,24 @@
+/*
+ * 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.messaging;
+
+public interface MessageSerializer {
+       String serializeTo(Object object);
+       Object serializeFrom(String message);
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28b682c8/framework/ipc/src/org/apache/cloudstack/framework/messaging/PublishScope.java
----------------------------------------------------------------------
diff --git 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/PublishScope.java 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/PublishScope.java
index fbce919..a266578 100644
--- 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/PublishScope.java
+++ 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/PublishScope.java
@@ -17,26 +17,6 @@
 
 package org.apache.cloudstack.framework.messaging;
 
-public class PublishScope {
-       public enum Type { SINGLE, LOCAL, GLOBAL };
-       
-       Type scope;
-       String address;
-       
-       public PublishScope(Type scope) {
-               this.scope = scope;
-       }
-       
-       public PublishScope(String address) {
-               scope = Type.SINGLE;
-               this.address = address;
-       }
-       
-       public Type getType() {
-               return scope;
-       }
-       
-       public String getAddress() {
-               return this.address;
-       }
+public enum PublishScope {
+       LOCAL, GLOBAL 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28b682c8/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcCall.java
----------------------------------------------------------------------
diff --git 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcCall.java 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcCall.java
deleted file mode 100644
index 570b82a..0000000
--- a/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcCall.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.messaging;
-
-public interface RpcCall {
-       String getCommand();
-       String getContent();
-       String getRequestTag();
-
-       // for sender to cancel
-       void cancel();
-       
-       // for receiver to response call
-       void completeCall(String rpcMessage);
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28b682c8/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcCallContext.java
----------------------------------------------------------------------
diff --git 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcCallContext.java
 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcCallContext.java
new file mode 100644
index 0000000..bdfcd45
--- /dev/null
+++ 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcCallContext.java
@@ -0,0 +1,47 @@
+// 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
+// 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.messaging;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class RpcCallContext {
+       private final static int DEFAULT_RPC_TIMEOUT = 10000;
+       
+       Map<String, Object> _contextMap = new HashMap<String, Object>();
+       int _timeoutMilliSeconds = DEFAULT_RPC_TIMEOUT;
+       
+       public RpcCallContext() {
+       }
+       
+       public int getTimeoutMilliSeconds() {
+               return _timeoutMilliSeconds;
+       }
+       
+       public void setTimeoutMilliSeconds(int timeoutMilliseconds) {
+               _timeoutMilliSeconds = timeoutMilliseconds;
+       }
+       
+       @SuppressWarnings("unchecked")
+       public <T> T getContextParameter(String key) {
+               return (T)_contextMap.get(key);
+       }
+       
+       public void setContextParameter(String key, Object object) {
+               _contextMap.put(key, object);
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28b682c8/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcCallHandler.java
----------------------------------------------------------------------
diff --git 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcCallHandler.java
 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcCallHandler.java
deleted file mode 100644
index 70110ee..0000000
--- 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcCallHandler.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.messaging;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-public @interface RpcCallHandler {
-    String command();
-    boolean returnHandler() default false;
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28b682c8/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcClientCall.java
----------------------------------------------------------------------
diff --git 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcClientCall.java
 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcClientCall.java
new file mode 100644
index 0000000..7d9cd8f
--- /dev/null
+++ 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcClientCall.java
@@ -0,0 +1,25 @@
+// 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
+// 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.messaging;
+
+public interface RpcClientCall {
+       String getCommand();
+       Object getCommandArgument();
+       RpcCallContext getCallContext();
+       
+       void cancel();
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28b682c8/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcClientCallHandler.java
----------------------------------------------------------------------
diff --git 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcClientCallHandler.java
 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcClientCallHandler.java
new file mode 100644
index 0000000..d695ff3
--- /dev/null
+++ 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcClientCallHandler.java
@@ -0,0 +1,12 @@
+package org.apache.cloudstack.framework.messaging;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface RpcClientCallHandler {
+    String command();
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28b682c8/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcEndpoint.java
----------------------------------------------------------------------
diff --git 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcEndpoint.java 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcEndpoint.java
index 1be5890..ff00728 100644
--- 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcEndpoint.java
+++ 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcEndpoint.java
@@ -19,9 +19,6 @@
 package org.apache.cloudstack.framework.messaging;
 
 public interface RpcEndpoint {
-       String call(String targetAddress, String rpcMessage);
-       RpcCall asyncCall(String targetAddress, String rpcMessage);
-
-       void onCallReceive(RpcCall call);
-       void onCallReturn(RpcCall call, String rpcReturnMessage, RpcException 
e);
+       void onCallReceive(RpcServerCall call);
+       void onCallReturn(RpcClientCall call, Object returnObject, RpcException 
e);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28b682c8/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcException.java
----------------------------------------------------------------------
diff --git 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcException.java 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcException.java
index 978f1c3..914d93a 100644
--- 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcException.java
+++ 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcException.java
@@ -1,6 +1,22 @@
+// 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
+// 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.messaging;
 
-public class RpcException extends Exception {
+public class RpcException extends RuntimeException {
        private static final long serialVersionUID = -3164514701087423787L;
 
        public RpcException() {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28b682c8/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcProvider.java
----------------------------------------------------------------------
diff --git 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcProvider.java 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcProvider.java
index cbdd4a7..95217cd 100644
--- 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcProvider.java
+++ 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcProvider.java
@@ -19,6 +19,12 @@
 package org.apache.cloudstack.framework.messaging;
 
 public interface RpcProvider extends TransportMultiplexier {
-       public void registerRpcEndpoint(RpcEndpoint rpcEndpoint);
-       public void unregisteRpcEndpoint(RpcEndpoint rpcEndpoint);
+       void setMessageSerializer(MessageSerializer messageSerializer);
+       MessageSerializer getMessageSerializer();
+       
+       void registerRpcEndpoint(RpcEndpoint rpcEndpoint);
+       void unregisteRpcEndpoint(RpcEndpoint rpcEndpoint);
+
+       String call(RpcEndpoint endpoint, RpcCallContext callContext, String 
targetAddress, String command, Object cmdArg);
+       RpcClientCall asyncCall(RpcEndpoint endpoint, RpcCallContext 
callContext, String targetAddress, String command, Object cmdArg);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28b682c8/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcServerCall.java
----------------------------------------------------------------------
diff --git 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcServerCall.java
 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcServerCall.java
new file mode 100644
index 0000000..7380fb2
--- /dev/null
+++ 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcServerCall.java
@@ -0,0 +1,28 @@
+/*
+ * 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.messaging;
+
+public interface RpcServerCall {
+       String getCommand();
+       Object getCommandArgument();
+       String getRequestTag();
+
+       // for receiver to response call
+       void completeCall(Object returnObject);
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28b682c8/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcServerCallHandler.java
----------------------------------------------------------------------
diff --git 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcServerCallHandler.java
 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcServerCallHandler.java
new file mode 100644
index 0000000..73502ab
--- /dev/null
+++ 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcServerCallHandler.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.messaging;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface RpcServerCallHandler {
+    String command();
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28b682c8/framework/ipc/src/org/apache/cloudstack/framework/messaging/Subscriber.java
----------------------------------------------------------------------
diff --git 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/Subscriber.java 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/Subscriber.java
index 3eb3fc6..9f8d460 100644
--- 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/Subscriber.java
+++ 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/Subscriber.java
@@ -18,5 +18,5 @@
 package org.apache.cloudstack.framework.messaging;
 
 public interface Subscriber {
-       void onPublishEvent(String subject, String senderAddress, String args);
+       void onPublishEvent(String senderAddress, String subject, Object args);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28b682c8/framework/ipc/src/org/apache/cloudstack/framework/messaging/TransportAddressFactory.java
----------------------------------------------------------------------
diff --git 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/TransportAddressFactory.java
 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/TransportAddressFactory.java
deleted file mode 100644
index d7f3e9d..0000000
--- 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/TransportAddressFactory.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.messaging;
-
-public interface TransportAddressFactory {
-       String createServiceAddress(String serviceProvider);
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28b682c8/framework/ipc/src/org/apache/cloudstack/framework/messaging/TransportEndpoint.java
----------------------------------------------------------------------
diff --git 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/TransportEndpoint.java
 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/TransportEndpoint.java
index 3a98681..6bca566 100644
--- 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/TransportEndpoint.java
+++ 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/TransportEndpoint.java
@@ -19,12 +19,12 @@
 package org.apache.cloudstack.framework.messaging;
 
 public interface TransportEndpoint {
-       void onAttachConfirm(String endpointAddress);
+       void onAttachConfirm(boolean bSuccess, String endpointAddress);
        void onDetachIndication(String endpointAddress);
        
        void registerMultiplexier(String name, TransportMultiplexier 
multiplexier);
        void unregisterMultiplexier(String name);
        
        void sendMessage(TransportEndpoint sender, String 
targetEndpointAddress, 
-                       String multiplexier, String message);
+               String multiplexier, String message);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28b682c8/framework/ipc/src/org/apache/cloudstack/framework/messaging/client/ClientEventBus.java
----------------------------------------------------------------------
diff --git 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/client/ClientEventBus.java
 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/client/ClientEventBus.java
index 68303bc..c06934e 100644
--- 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/client/ClientEventBus.java
+++ 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/client/ClientEventBus.java
@@ -27,6 +27,5 @@ public class ClientEventBus extends EventBusBase implements 
TransportMultiplexie
        public void onTransportMessage(String senderEndpointAddress,
                        String targetEndpointAddress, String multiplexer, 
String message) {
                // TODO Auto-generated method stub
-               
        }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28b682c8/framework/ipc/src/org/apache/cloudstack/framework/messaging/client/ClientTransportEndpoint.java
----------------------------------------------------------------------
diff --git 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/client/ClientTransportEndpoint.java
 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/client/ClientTransportEndpoint.java
index 49a1eb6..3c8878f 100644
--- 
a/framework/ipc/src/org/apache/cloudstack/framework/messaging/client/ClientTransportEndpoint.java
+++ 
b/framework/ipc/src/org/apache/cloudstack/framework/messaging/client/ClientTransportEndpoint.java
@@ -24,7 +24,7 @@ import 
org.apache.cloudstack.framework.messaging.TransportMultiplexier;
 public class ClientTransportEndpoint implements TransportEndpoint {
 
        @Override
-       public void onAttachConfirm(String endpointAddress) {
+       public void onAttachConfirm(boolean bSuccess, String endpointAddress) {
                // TODO Auto-generated method stub
        }
        

Reply via email to