ODE-987. Rename the Channel interface for now. It may go away eventually, as exportChannel could be directly invoked by ProcUtil
git-svn-id: https://svn.apache.org/repos/asf/ode/trunk@1434015 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/ode/jacob/Channel.java b/src/main/java/org/apache/ode/jacob/Channel.java
deleted file mode 100644
index 2eb555d..0000000
--- a/src/main/java/org/apache/ode/jacob/Channel.java
+++ /dev/null
@@ -1,28 +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.ode.jacob;
-
-import java.io.Serializable;
-
-/**
- * Interface implemented by channel proxies.
- */
-public interface Channel extends Serializable {
- public String export();
-}
diff --git a/src/main/java/org/apache/ode/jacob/ChannelListener.java b/src/main/java/org/apache/ode/jacob/ChannelListener.java
index 5354741..f48c9ad 100644
--- a/src/main/java/org/apache/ode/jacob/ChannelListener.java
+++ b/src/main/java/org/apache/ode/jacob/ChannelListener.java
@@ -31,9 +31,9 @@
@SuppressWarnings("serial")
public abstract class ChannelListener extends JacobObject {
private transient Set<Method> _implementedMethods;
- private transient Channel _channel;
+ private transient ExportableChannel _channel;
- protected ChannelListener(Channel channel) throws IllegalStateException {
+ protected ChannelListener(ExportableChannel channel) throws IllegalStateException {
assert getClass().getSuperclass().getSuperclass() == ChannelListener.class :
"Inheritance in ChannelListener classes not allowed!";
if (channel == null) {
@@ -42,11 +42,11 @@
_channel = channel;
}
- public Channel getChannel() {
+ public ExportableChannel getChannel() {
return _channel;
}
- public void setChannel(Channel channel) {
+ public void setChannel(ExportableChannel channel) {
_channel = channel;
}
diff --git a/src/main/java/org/apache/ode/jacob/ClassUtil.java b/src/main/java/org/apache/ode/jacob/ClassUtil.java
index a9cfb6a..1f2aa59 100644
--- a/src/main/java/org/apache/ode/jacob/ClassUtil.java
+++ b/src/main/java/org/apache/ode/jacob/ClassUtil.java
@@ -33,7 +33,7 @@
Class<?>[] interfaces = clazz.getInterfaces();
for (Class<?> iface : interfaces) {
// TODO: the test below could be more generic...
- if (iface != Channel.class) {
+ if (iface != ExportableChannel.class) {
for (Method method : iface.getDeclaredMethods()) {
methods.add(method);
}
diff --git a/src/main/java/org/apache/ode/jacob/JacobObject.java b/src/main/java/org/apache/ode/jacob/JacobObject.java
index 416d999..dd98841 100644
--- a/src/main/java/org/apache/ode/jacob/JacobObject.java
+++ b/src/main/java/org/apache/ode/jacob/JacobObject.java
@@ -44,7 +44,7 @@
}
@SuppressWarnings("unchecked")
- protected static <T extends Channel> T importChannel(String channelId, Class<T> channelClass) {
+ protected static <T extends ExportableChannel> T importChannel(String channelId, Class<T> channelClass) {
return (T) JacobVPU.activeJacobThread().importChannel(channelId, channelClass);
}
@@ -58,7 +58,7 @@
JacobVPU.activeJacobThread().instance(concretion);
}
- protected <T extends Channel> T newChannel(Class<T> channelType)
+ protected <T extends ExportableChannel> T newChannel(Class<T> channelType)
throws IllegalArgumentException
{
return newChannel(channelType, null);
@@ -69,7 +69,7 @@
* is equivalent to <code>(new x) ... </code> in the process calculus.
*/
@SuppressWarnings("unchecked")
- protected <T extends Channel> T newChannel(Class<T> channelType, String description)
+ protected <T extends ExportableChannel> T newChannel(Class<T> channelType, String description)
throws IllegalArgumentException
{
return (T) JacobVPU.activeJacobThread().newChannel(channelType, getClassName(), description);
@@ -82,7 +82,7 @@
* @param methodList method list for the communication reduction
* @see JacobThread#object
*/
- protected static Channel object(ChannelListener methodList) {
+ protected static ExportableChannel object(ChannelListener methodList) {
JacobVPU.activeJacobThread().object(false, methodList);
return methodList.getChannel();
}
@@ -100,7 +100,7 @@
methodLists.toArray(new ChannelListener[methodLists.size()]));
}
- protected static Channel replication(ChannelListener methodList) {
+ protected static ExportableChannel replication(ChannelListener methodList) {
JacobVPU.activeJacobThread().object(true, methodList);
return methodList.getChannel();
}
@@ -111,7 +111,7 @@
* @param channel target channel
* @return replicated channel broadcaster
*/
- protected static <T extends Channel> T replication(T channel) {
+ protected static <T extends ExportableChannel> T replication(T channel) {
// TODO: we should create a replicated wrapper here.
return channel;
}
diff --git a/src/main/java/org/apache/ode/jacob/JacobThread.java b/src/main/java/org/apache/ode/jacob/JacobThread.java
index 85e1054..b7167b8 100644
--- a/src/main/java/org/apache/ode/jacob/JacobThread.java
+++ b/src/main/java/org/apache/ode/jacob/JacobThread.java
@@ -32,9 +32,9 @@
public interface JacobThread {
public Object getExtension(Class<?> extensionClass);
- public String exportChannel(Channel channel);
+ public String exportChannel(ExportableChannel channel);
- public Channel importChannel(String channelId, Class<?> channelClass);
+ public ExportableChannel importChannel(String channelId, Class<?> channelClass);
/**
* Create a process instance i.e. a concretion of a process abstraction.
@@ -43,7 +43,7 @@
/**
* Send a message (object invocation). This method shouldn't really be used
- * as {@link Channel} objects may be used as proxies in this respect.
+ * as {@link ExportableChannel} objects may be used as proxies in this respect.
*
* @param channel
* channel on which to send the message
@@ -52,12 +52,12 @@
* @param args
* arguments
*/
- public Channel message(Channel channel, Method method, Object[] args);
+ public ExportableChannel message(ExportableChannel channel, Method method, Object[] args);
/**
* Create a new channel.
*/
- public Channel newChannel(Class<?> channelType, String creator, String description);
+ public ExportableChannel newChannel(Class<?> channelType, String creator, String description);
/**
* <p>
diff --git a/src/main/java/org/apache/ode/jacob/ProcessUtil.java b/src/main/java/org/apache/ode/jacob/ProcessUtil.java
index ec9a14d..053af4c 100644
--- a/src/main/java/org/apache/ode/jacob/ProcessUtil.java
+++ b/src/main/java/org/apache/ode/jacob/ProcessUtil.java
@@ -25,8 +25,8 @@
}
public static String exportChannel(ChannelType channel) {
- if (channel != null && channel instanceof Channel) {
- return ((Channel)channel).export();
+ if (channel != null && channel instanceof ExportableChannel) {
+ return ((ExportableChannel)channel).export();
}
throw new IllegalArgumentException("Invalid proxy type: "
+ channel == null ? "<null>" : channel.getClass().toString());
diff --git a/src/main/java/org/apache/ode/jacob/ReceiveProcess.java b/src/main/java/org/apache/ode/jacob/ReceiveProcess.java
index 9b53b3e..f878277 100644
--- a/src/main/java/org/apache/ode/jacob/ReceiveProcess.java
+++ b/src/main/java/org/apache/ode/jacob/ReceiveProcess.java
@@ -29,7 +29,7 @@
private transient Set<Method> _implementedMethods;
private R receiver;
- protected ReceiveProcess(Channel channel, R receiver) throws IllegalStateException {
+ protected ReceiveProcess(ExportableChannel channel, R receiver) throws IllegalStateException {
super(channel);
this.receiver = receiver;
}
diff --git a/src/main/java/org/apache/ode/jacob/SynchChannel.java b/src/main/java/org/apache/ode/jacob/SynchChannel.java
index 51e1b56..efe135d 100644
--- a/src/main/java/org/apache/ode/jacob/SynchChannel.java
+++ b/src/main/java/org/apache/ode/jacob/SynchChannel.java
@@ -15,6 +15,6 @@
* @see org.apache.ode.jacob.Synch
*/
public interface SynchChannel
- extends org.apache.ode.jacob.Channel,
+ extends org.apache.ode.jacob.ExportableChannel,
org.apache.ode.jacob.Synch
{}
diff --git a/src/main/java/org/apache/ode/jacob/ValChannel.java b/src/main/java/org/apache/ode/jacob/ValChannel.java
index 22f4411..ab9dc0f 100644
--- a/src/main/java/org/apache/ode/jacob/ValChannel.java
+++ b/src/main/java/org/apache/ode/jacob/ValChannel.java
@@ -15,6 +15,6 @@
* @see org.apache.ode.jacob.Val
*/
public interface ValChannel
- extends org.apache.ode.jacob.Channel,
+ extends org.apache.ode.jacob.ExportableChannel,
org.apache.ode.jacob.Val
{}
diff --git a/src/main/java/org/apache/ode/jacob/vpu/ChannelFactory.java b/src/main/java/org/apache/ode/jacob/vpu/ChannelFactory.java
index 4c0bfd7..c38ac21 100644
--- a/src/main/java/org/apache/ode/jacob/vpu/ChannelFactory.java
+++ b/src/main/java/org/apache/ode/jacob/vpu/ChannelFactory.java
@@ -22,7 +22,7 @@
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
-import org.apache.ode.jacob.Channel;
+import org.apache.ode.jacob.ExportableChannel;
import org.apache.ode.jacob.soup.CommChannel;
public class ChannelFactory {
@@ -38,22 +38,22 @@
}
try {
- METHOD_CHANNEL_EXPORT = Channel.class.getMethod("export", new Class[] {});
+ METHOD_CHANNEL_EXPORT = ExportableChannel.class.getMethod("export", new Class[] {});
} catch (Exception e) {
throw new AssertionError("No export() method on Object!");
}
}
- public static Object getBackend(Channel channel) {
+ public static Object getBackend(ExportableChannel channel) {
ChannelInvocationHandler cih = (ChannelInvocationHandler) Proxy.getInvocationHandler(channel);
return cih._backend;
}
- public static Channel createChannel(CommChannel backend, Class<?> type) {
+ public static ExportableChannel createChannel(CommChannel backend, Class<?> type) {
InvocationHandler h = new ChannelInvocationHandler(backend);
- Class<?>[] ifaces = new Class[] { Channel.class, type };
- Object proxy = Proxy.newProxyInstance(Channel.class.getClassLoader(), ifaces, h);
- return (Channel) proxy;
+ Class<?>[] ifaces = new Class[] { ExportableChannel.class, type };
+ Object proxy = Proxy.newProxyInstance(ExportableChannel.class.getClassLoader(), ifaces, h);
+ return (ExportableChannel) proxy;
}
public static final class ChannelInvocationHandler implements InvocationHandler {
@@ -83,9 +83,9 @@
return method.invoke(this, args);
}
if (method.equals(METHOD_CHANNEL_EXPORT)) {
- return JacobVPU.activeJacobThread().exportChannel((Channel) proxy);
+ return JacobVPU.activeJacobThread().exportChannel((ExportableChannel) proxy);
}
- return JacobVPU.activeJacobThread().message((Channel) proxy, method, args);
+ return JacobVPU.activeJacobThread().message((ExportableChannel) proxy, method, args);
}
} // class ChannelInvocationHandler
diff --git a/src/main/java/org/apache/ode/jacob/vpu/ExecutionQueueImpl.java b/src/main/java/org/apache/ode/jacob/vpu/ExecutionQueueImpl.java
index 547125b..4627753 100644
--- a/src/main/java/org/apache/ode/jacob/vpu/ExecutionQueueImpl.java
+++ b/src/main/java/org/apache/ode/jacob/vpu/ExecutionQueueImpl.java
@@ -40,7 +40,7 @@
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
-import org.apache.ode.jacob.Channel;
+import org.apache.ode.jacob.ExportableChannel;
import org.apache.ode.jacob.ChannelListener;
import org.apache.ode.jacob.IndexedObject;
import org.apache.ode.jacob.JacobObject;
@@ -664,8 +664,8 @@
if (!Serializable.class.isAssignableFrom(obj.getClass()))
return null;
- if (obj instanceof org.apache.ode.jacob.Channel) {
- CommChannel commChannel = (CommChannel) ChannelFactory.getBackend((Channel) obj);
+ if (obj instanceof org.apache.ode.jacob.ExportableChannel) {
+ CommChannel commChannel = (CommChannel) ChannelFactory.getBackend((ExportableChannel) obj);
_serializedChannels.add(commChannel.getId());
return new ChannelRef(commChannel.getType(), (Integer) commChannel.getId());
} else if (_replacementMap != null && _replacementMap.isReplaceable(obj)) {
diff --git a/src/main/java/org/apache/ode/jacob/vpu/JacobVPU.java b/src/main/java/org/apache/ode/jacob/vpu/JacobVPU.java
index 550fb9c..5bef121 100644
--- a/src/main/java/org/apache/ode/jacob/vpu/JacobVPU.java
+++ b/src/main/java/org/apache/ode/jacob/vpu/JacobVPU.java
@@ -24,7 +24,7 @@
import java.util.Map;
import java.util.Stack;
-import org.apache.ode.jacob.Channel;
+import org.apache.ode.jacob.ExportableChannel;
import org.apache.ode.jacob.ChannelListener;
import org.apache.ode.jacob.JacobObject;
import org.apache.ode.jacob.JacobRunnable;
@@ -274,7 +274,7 @@
LOG.isInfoEnabled() ? template.toString() : null);
}
- public Channel message(Channel channel, Method method, Object[] args) {
+ public ExportableChannel message(ExportableChannel channel, Method method, Object[] args) {
LOG.trace(">> [{}] : {} ! {} ({})", _cycle, channel, method.getName(),
LOG.isTraceEnabled() ? stringify(args) : null);
@@ -301,26 +301,26 @@
return replyChannel;
}
- public Channel newChannel(Class<?> channelType, String creator, String description) {
+ public ExportableChannel newChannel(Class<?> channelType, String creator, String description) {
CommChannel chnl = new CommChannel(channelType);
chnl.setDescription(description);
_executionQueue.add(chnl);
- Channel ret = ChannelFactory.createChannel(chnl, channelType);
+ ExportableChannel ret = ChannelFactory.createChannel(chnl, channelType);
LOG.trace(">> [{}] : new {}", _cycle, ret);
_statistics.channelsCreated++;
return ret;
}
- public String exportChannel(Channel channel) {
+ public String exportChannel(ExportableChannel channel) {
LOG.trace(">> [{}] : export<{}>", _cycle, channel);
CommChannel chnl = (CommChannel) ChannelFactory.getBackend(channel);
return _executionQueue.createExport(chnl);
}
- public Channel importChannel(String channelId, Class<?> channelType) {
+ public ExportableChannel importChannel(String channelId, Class<?> channelType) {
CommChannel cframe = _executionQueue.consumeExport(channelId);
return ChannelFactory.createChannel(cframe, channelType);
}
diff --git a/src/test/java/org/apache/ode/jacob/examples/cell/CellChannel.java b/src/test/java/org/apache/ode/jacob/examples/cell/CellChannel.java
index 0fa5c6a..203b2f9 100644
--- a/src/test/java/org/apache/ode/jacob/examples/cell/CellChannel.java
+++ b/src/test/java/org/apache/ode/jacob/examples/cell/CellChannel.java
@@ -15,6 +15,6 @@
* @see org.apache.ode.jacob.examples.cell.Cell
*/
public interface CellChannel
- extends org.apache.ode.jacob.Channel,
+ extends org.apache.ode.jacob.ExportableChannel,
org.apache.ode.jacob.examples.cell.Cell
{}
diff --git a/src/test/java/org/apache/ode/jacob/examples/eratosthenes/NaturalNumberStreamChannel.java b/src/test/java/org/apache/ode/jacob/examples/eratosthenes/NaturalNumberStreamChannel.java
index a6bd40b..8dde3f2 100644
--- a/src/test/java/org/apache/ode/jacob/examples/eratosthenes/NaturalNumberStreamChannel.java
+++ b/src/test/java/org/apache/ode/jacob/examples/eratosthenes/NaturalNumberStreamChannel.java
@@ -15,6 +15,6 @@
* @see org.apache.ode.jacob.examples.eratosthenes.NaturalNumberStream
*/
public interface NaturalNumberStreamChannel
- extends org.apache.ode.jacob.Channel,
+ extends org.apache.ode.jacob.ExportableChannel,
org.apache.ode.jacob.examples.eratosthenes.NaturalNumberStream
{}
diff --git a/src/test/java/org/apache/ode/jacob/examples/synch/SynchPrintChannel.java b/src/test/java/org/apache/ode/jacob/examples/synch/SynchPrintChannel.java
index b6cf186..b8d59aa 100644
--- a/src/test/java/org/apache/ode/jacob/examples/synch/SynchPrintChannel.java
+++ b/src/test/java/org/apache/ode/jacob/examples/synch/SynchPrintChannel.java
@@ -15,6 +15,6 @@
* @see org.apache.ode.jacob.examples.synch.SynchPrint
*/
public interface SynchPrintChannel
- extends org.apache.ode.jacob.Channel,
+ extends org.apache.ode.jacob.ExportableChannel,
org.apache.ode.jacob.examples.synch.SynchPrint
{}
diff --git a/src/test/java/org/apache/ode/jacob/vpu/ProxyConstructorTimingTest.java b/src/test/java/org/apache/ode/jacob/vpu/ProxyConstructorTimingTest.java
index dac7aef..f738e67 100644
--- a/src/test/java/org/apache/ode/jacob/vpu/ProxyConstructorTimingTest.java
+++ b/src/test/java/org/apache/ode/jacob/vpu/ProxyConstructorTimingTest.java
@@ -22,7 +22,7 @@
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
-import org.apache.ode.jacob.Channel;
+import org.apache.ode.jacob.ExportableChannel;
import org.apache.ode.jacob.ChannelType;
import org.apache.ode.jacob.ProcessUtil;
@@ -37,7 +37,7 @@
public void testDoNothing() throws Exception {
Greeter gp = (Greeter) Proxy.newProxyInstance(Greeter.class.getClassLoader(),
- new Class<?>[] {Channel.class, Greeter.class}, new GreeterInvocationHandler(new GreeterImpl()));
+ new Class<?>[] {ExportableChannel.class, Greeter.class}, new GreeterInvocationHandler(new GreeterImpl()));
assertEquals("Hello World", gp.hello("World"));
assertEquals("Implemented by InvocationHandler", ProcessUtil.exportChannel(gp));
}
@@ -145,7 +145,7 @@
throw new IllegalStateException(String.valueOf(method));
}
}
- if (method.equals(Channel.class.getMethod("export", new Class[] {}))) {
+ if (method.equals(ExportableChannel.class.getMethod("export", new Class[] {}))) {
return "Implemented by InvocationHandler";
}
return method.invoke(greeter, args);