diff --git a/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcAddressable.java b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcAddressable.java new file mode 100644 index 00000000000..0bf62cf76a4 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcAddressable.java @@ -0,0 +1,23 @@ +/* + * 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 RpcAddressable { + String getAddress(); +} 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 7b6984a9580..b6d58cf28bf 100644 --- a/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcProvider.java +++ b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcProvider.java @@ -27,8 +27,11 @@ public interface RpcProvider extends TransportMultiplexier { void registerRpcServiceEndpoint(RpcServiceEndpoint rpcEndpoint); void unregisteRpcServiceEndpoint(RpcServiceEndpoint rpcEndpoint); + RpcClientCall newCall(TransportEndpoint sourceEndpoint, RpcAddressable targetAddress); RpcClientCall newCall(TransportEndpoint sourceEndpoint, String targetAddress); + RpcClientCall newCall(String targetAddress); + RpcClientCall newCall(RpcAddressable targetAddress); void registerCall(RpcClientCall call); void cancelCall(RpcClientCall call); diff --git a/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcProviderImpl.java b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcProviderImpl.java index 8b61e6e46e9..b3d8a4e0a12 100644 --- a/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcProviderImpl.java +++ b/framework/ipc/src/org/apache/cloudstack/framework/messaging/RpcProviderImpl.java @@ -92,6 +92,17 @@ public class RpcProviderImpl implements RpcProvider { return call; } + + @Override + public RpcClientCall newCall(TransportEndpoint sourceEndpoint, RpcAddressable targetAddress) { + long callTag = getNextCallTag(); + RpcClientCallImpl call = new RpcClientCallImpl(this); + call.setSourceAddress(sourceEndpoint.getEndpointAddress()); + call.setTargetAddress(targetAddress.getAddress()); + call.setCallTag(callTag); + + return call; + } @Override public RpcClientCall newCall(String targetAddress) { @@ -100,6 +111,12 @@ public class RpcProviderImpl implements RpcProvider { return null; } + @Override + public RpcClientCall newCall(RpcAddressable targetAddress) { + return newCall(targetAddress.getAddress()); + } + + @Override public void registerCall(RpcClientCall call) { assert(call != null); diff --git a/framework/ipc/test/org/apache/cloudstack/framework/messaging/ClientOnlyEventDrivenStyle.java b/framework/ipc/test/org/apache/cloudstack/framework/messaging/ClientOnlyEventDrivenStyle.java index 2fff15b28a0..37c78ba14af 100644 --- a/framework/ipc/test/org/apache/cloudstack/framework/messaging/ClientOnlyEventDrivenStyle.java +++ b/framework/ipc/test/org/apache/cloudstack/framework/messaging/ClientOnlyEventDrivenStyle.java @@ -1,3 +1,21 @@ +/* + * 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 class ClientOnlyEventDrivenStyle { diff --git a/framework/ipc/test/org/apache/cloudstack/framework/messaging/ClientOnlyListenerStyle.java b/framework/ipc/test/org/apache/cloudstack/framework/messaging/ClientOnlyListenerStyle.java index ed58382cc27..b1f91663064 100644 --- a/framework/ipc/test/org/apache/cloudstack/framework/messaging/ClientOnlyListenerStyle.java +++ b/framework/ipc/test/org/apache/cloudstack/framework/messaging/ClientOnlyListenerStyle.java @@ -1,3 +1,21 @@ +/* + * 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 class ClientOnlyListenerStyle { diff --git a/framework/ipc/test/org/apache/cloudstack/framework/messaging/TestCommand.java b/framework/ipc/test/org/apache/cloudstack/framework/messaging/TestCommand.java index c8f62a5c749..abceb4efc5d 100644 --- a/framework/ipc/test/org/apache/cloudstack/framework/messaging/TestCommand.java +++ b/framework/ipc/test/org/apache/cloudstack/framework/messaging/TestCommand.java @@ -1,3 +1,21 @@ +/* + * 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; @OnwireName(name="TestCommand")