[jboss-remoting-commits] JBoss Remoting SVN: r4826 - remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Fri Jan 16 16:10:57 EST 2009


Author: david.lloyd at jboss.com
Date: 2009-01-16 16:10:57 -0500 (Fri, 16 Jan 2009)
New Revision: 4826

Added:
   remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatibilityCallback.java
   remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatibilityClient.java
Modified:
   remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatabilityClassResolver.java
   remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatabilityInvocationRequest.java
   remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatabilityInvocationResponse.java
   remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatibilityHome.java
   remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatibilityInvokerLocator.java
Log:
More compatibility layer work

Modified: remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatabilityClassResolver.java
===================================================================
--- remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatabilityClassResolver.java	2009-01-16 17:16:55 UTC (rev 4825)
+++ remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatabilityClassResolver.java	2009-01-16 21:10:57 UTC (rev 4826)
@@ -23,10 +23,14 @@
 package org.jboss.remoting.compat;
 
 import org.jboss.marshalling.AbstractClassResolver;
+import org.jboss.remoting.Client;
 import java.io.IOException;
+import java.io.InvalidClassException;
 import java.util.Map;
 import java.util.HashMap;
 import java.util.Collections;
+import java.util.Set;
+import java.util.HashSet;
 
 /**
  * A base class resolver which maps Remoting 2 classes to their compatible placeholders.
@@ -35,22 +39,35 @@
 
     private static final Map<Class<?>, String> CLASS_WRITE_MAP;
     private static final Map<String, Class<?>> CLASS_READ_MAP;
+    private static final Set<Class<?>> REMOTING_2_BLACKLIST;
 
     static {
         final Map<Class<?>, String> classWriteMap = new HashMap<Class<?>, String>();
+
+        classWriteMap.put(CompatibilityClient.class, "org.jboss.remoting.Client");
         classWriteMap.put(CompatabilityInvocationRequest.class, "org.jboss.remoting.InvocationRequest");
         classWriteMap.put(CompatabilityInvocationResponse.class, "org.jboss.remoting.InvocationReply");
         classWriteMap.put(CompatibilityInvokerLocator.class, "org.jboss.remoting.InvokerLocator");
         classWriteMap.put(CompatibilityHome.class, "org.jboss.remoting.Home");
+
+        classWriteMap.put(CompatibilityCallback.class, "org.jboss.remoting.callback.Callback");
+
         CLASS_WRITE_MAP = Collections.unmodifiableMap(classWriteMap);
         final Map<String, Class<?>> classReadMap = new HashMap<String, Class<?>>();
         for (Map.Entry<Class<?>, String> entry : classWriteMap.entrySet()) {
             classReadMap.put(entry.getValue(), entry.getKey());
         }
         CLASS_READ_MAP = Collections.unmodifiableMap(classReadMap);
+
+        final Set<Class<?>> remoting2BlackList = new HashSet<Class<?>>();
+        remoting2BlackList.add(Client.class);
+        REMOTING_2_BLACKLIST = Collections.unmodifiableSet(remoting2BlackList);
     }
 
     public String getClassName(final Class<?> clazz) throws IOException {
+        if (REMOTING_2_BLACKLIST.contains(clazz)) {
+            throw new InvalidClassException(clazz.getName(), "Instances of this class may not be sent to a Remoting 2 client or server"); 
+        }
         final String name = CLASS_WRITE_MAP.get(clazz);
         return name == null ? clazz.getName() : name;
     }

Modified: remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatabilityInvocationRequest.java
===================================================================
--- remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatabilityInvocationRequest.java	2009-01-16 17:16:55 UTC (rev 4825)
+++ remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatabilityInvocationRequest.java	2009-01-16 21:10:57 UTC (rev 4826)
@@ -32,7 +32,7 @@
 /**
  *
  */
-public final class CompatabilityInvocationRequest implements Serializable {
+public class CompatabilityInvocationRequest implements Serializable {
     private static final long serialVersionUID = -6719842238864057289L;
 
     private static final ObjectStreamField[] serialPersistentFields = {

Modified: remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatabilityInvocationResponse.java
===================================================================
--- remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatabilityInvocationResponse.java	2009-01-16 17:16:55 UTC (rev 4825)
+++ remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatabilityInvocationResponse.java	2009-01-16 21:10:57 UTC (rev 4826)
@@ -31,7 +31,7 @@
 /**
  *
  */
-public final class CompatabilityInvocationResponse<T> implements Serializable {
+public class CompatabilityInvocationResponse implements Serializable {
     private static final long serialVersionUID = 1324503813652865685L;
 
     private final String sessionId;

Added: remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatibilityCallback.java
===================================================================
--- remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatibilityCallback.java	                        (rev 0)
+++ remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatibilityCallback.java	2009-01-16 21:10:57 UTC (rev 4826)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.compat;
+
+/**
+ *
+ */
+public class CompatibilityCallback extends CompatabilityInvocationRequest {
+
+    private static final long serialVersionUID = -9196653590434634454L;
+}

Added: remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatibilityClient.java
===================================================================
--- remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatibilityClient.java	                        (rev 0)
+++ remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatibilityClient.java	2009-01-16 21:10:57 UTC (rev 4826)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.compat;
+
+import java.io.Externalizable;
+import java.io.ObjectOutput;
+import java.io.IOException;
+import java.io.ObjectInput;
+
+/**
+ *
+ */
+public final class CompatibilityClient implements Externalizable {
+
+    private static final long serialVersionUID = 5679279425009837934L;
+
+    public void writeExternal(final ObjectOutput out) throws IOException {
+        out.writeInt(22);
+        out.writeObject(null); // Invoker Locator
+        out.writeObject(null); // subsystem name
+        out.writeObject(null); // configuration
+        out.writeBoolean(false); // isConnected
+        out.flush();
+    }
+
+    public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+
+    }
+}

Modified: remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatibilityHome.java
===================================================================
--- remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatibilityHome.java	2009-01-16 17:16:55 UTC (rev 4825)
+++ remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatibilityHome.java	2009-01-16 21:10:57 UTC (rev 4826)
@@ -27,7 +27,7 @@
 /**
  *
  */
-public final class CompatibilityHome implements Serializable {
+public class CompatibilityHome implements Serializable {
 
     private static final long serialVersionUID = 8267821565540095027L;
 

Modified: remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatibilityInvokerLocator.java
===================================================================
--- remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatibilityInvokerLocator.java	2009-01-16 17:16:55 UTC (rev 4825)
+++ remoting3/trunk/compat/src/main/java/org/jboss/remoting/compat/CompatibilityInvokerLocator.java	2009-01-16 21:10:57 UTC (rev 4826)
@@ -34,7 +34,7 @@
 /**
  *
  */
-public final class CompatibilityInvokerLocator implements Serializable {
+public class CompatibilityInvokerLocator implements Serializable {
 
     private static final long serialVersionUID = -4977622166779282521L;
 




More information about the jboss-remoting-commits mailing list