tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1510888 - in /tomee/tomee/trunk/server: openejb-client/src/main/java/org/apache/openejb/client/ openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/
Date Tue, 06 Aug 2013 09:01:42 GMT
Author: rmannibucau
Date: Tue Aug  6 09:01:42 2013
New Revision: 1510888

URL: http://svn.apache.org/r1510888
Log:
trying to ensure compatiility with previous ejbd protocol (without authenticationInfo)

Modified:
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/Client.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBRequest.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBResponse.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ProtocolMetaData.java
    tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbDaemon.java
    tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbRequestHandler.java

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/Client.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/Client.java?rev=1510888&r1=1510887&r2=1510888&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/Client.java
(original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/Client.java
Tue Aug  6 09:01:42 2013
@@ -54,7 +54,7 @@ public class Client {
     private boolean FINER = logger.isLoggable(Level.FINER);
 
     public static final ThreadLocal<Set<URI>> failed = new ThreadLocal<Set<URI>>();
-    private static final ProtocolMetaData PROTOCOL_VERSION = new ProtocolMetaData("3.1");
+    private static final ProtocolMetaData PROTOCOL_VERSION = new ProtocolMetaData("4.6");
     private static final int maxConditionRetry = Integer.parseInt(System.getProperty("openejb.client.retry.condition.max",
"20"));
 
     private List<Class<? extends Throwable>> retryConditions = new CopyOnWriteArrayList<Class<?
extends Throwable>>();

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBRequest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBRequest.java?rev=1510888&r1=1510887&r2=1510888&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBRequest.java
(original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBRequest.java
Tue Aug  6 09:01:42 2013
@@ -239,7 +239,6 @@ public class EJBRequest implements Clust
 
     @Override
     public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException
{
-
         ClassNotFoundException ex = null;
 
         deploymentId = null;
@@ -407,6 +406,10 @@ public class EJBRequest implements Clust
         @SuppressWarnings("unchecked")
         @Override
         public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException
{
+            readExternal(in , new ProtocolMetaData("4.6"));
+        }
+
+        public void readExternal(final ObjectInput in, final ProtocolMetaData metaData) throws
IOException, ClassNotFoundException {
 
             this.version = in.readByte();
 
@@ -444,8 +447,10 @@ public class EJBRequest implements Clust
             }
 
             //Version 3
-            if (this.version >= 3) {
+            if (metaData.isAtLeast(4, 6)) {
                 authentication = JNDIContext.AuthenticationInfo.class.cast(in.readObject());
+            } else {
+                authentication = null;
             }
 
             if (result != null) {

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBResponse.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBResponse.java?rev=1510888&r1=1510887&r2=1510888&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBResponse.java
(original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBResponse.java
Tue Aug  6 09:01:42 2013
@@ -26,9 +26,8 @@ public class EJBResponse implements Clus
      * Version provides the protocol hint for backwards compatibility:
      * 1. Initial
      * 2. Append times.
-     * 3. JNDIContext.AuthenticationInfo.
      */
-    public static final byte VERSION = 3;
+    public static final byte VERSION = 2;
 
     private transient byte version = VERSION;
     private transient int responseCode = -1;

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ProtocolMetaData.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ProtocolMetaData.java?rev=1510888&r1=1510887&r2=1510888&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ProtocolMetaData.java
(original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ProtocolMetaData.java
Tue Aug  6 09:01:42 2013
@@ -62,6 +62,10 @@ public class ProtocolMetaData {
         this.minor = Integer.parseInt(new String(chars, 7, 1));
     }
 
+    public boolean isAtLeast(final int major, int minor) {
+        return this.major >= major || (this.major == major && this.minor >=
minor);
+    }
+
     public String getId() {
         return id;
     }

Modified: tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbDaemon.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbDaemon.java?rev=1510888&r1=1510887&r2=1510888&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbDaemon.java
(original)
+++ tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbDaemon.java
Tue Aug  6 09:01:42 2013
@@ -50,7 +50,7 @@ import java.util.zip.GZIPInputStream;
 
 public class EjbDaemon implements org.apache.openejb.spi.ApplicationServer {
 
-    private static final ProtocolMetaData PROTOCOL_VERSION = new ProtocolMetaData("3.1");
+    private static final ProtocolMetaData PROTOCOL_VERSION = new ProtocolMetaData("4.6");
// aligned with org.apache.openejb.client.EJBRequest.readExternal(java.io.ObjectInput)() and
org.apache.openejb.client.Client.PROTOCOL_VERSION
 
     static final Logger logger = Logger.getInstance(LogCategory.OPENEJB_SERVER_REMOTE, "org.apache.openejb.server.util.resources");
 
@@ -205,7 +205,7 @@ public class EjbDaemon implements org.ap
             // things up with the client accordingly.
             switch (requestType) {
                 case EJB_REQUEST:
-                    processEjbRequest(ois, oos);
+                    processEjbRequest(ois, oos, protocolMetaData);
                     break;
                 case JNDI_REQUEST:
                     processJndiRequest(ois, oos);
@@ -281,8 +281,8 @@ public class EjbDaemon implements org.ap
         return beanContext;
     }
 
-    public void processEjbRequest(final ObjectInputStream in, final ObjectOutputStream out)
{
-        ejbHandler.processRequest(in, out);
+    public void processEjbRequest(final ObjectInputStream in, final ObjectOutputStream out,
final ProtocolMetaData metaData) {
+        ejbHandler.processRequest(in, out, metaData);
     }
 
     public void processJndiRequest(final ObjectInputStream in, final ObjectOutputStream out)
throws Exception {

Modified: tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbRequestHandler.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbRequestHandler.java?rev=1510888&r1=1510887&r2=1510888&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbRequestHandler.java
(original)
+++ tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbRequestHandler.java
Tue Aug  6 09:01:42 2013
@@ -25,6 +25,7 @@ import org.apache.openejb.client.EJBObje
 import org.apache.openejb.client.EJBRequest;
 import org.apache.openejb.client.EJBResponse;
 import org.apache.openejb.client.JNDIContext;
+import org.apache.openejb.client.ProtocolMetaData;
 import org.apache.openejb.client.ResponseCodes;
 import org.apache.openejb.client.ThrowableArtifact;
 import org.apache.openejb.client.serializer.EJBDSerializer;
@@ -67,7 +68,7 @@ class EjbRequestHandler {
         return new BasicClusterableRequestHandler();
     }
 
-    public void processRequest(final ObjectInputStream in, final ObjectOutputStream out)
{
+    public void processRequest(final ObjectInputStream in, final ObjectOutputStream out,
final ProtocolMetaData metaData) {
 
         // Setup the client proxy replacement to replace
         // the proxies with the IntraVM proxy implementations
@@ -125,7 +126,7 @@ class EjbRequestHandler {
 
                 res.start(EJBResponse.Time.DESERIALIZATION);
 
-                req.getBody().readExternal(in);
+                req.getBody().readExternal(in, metaData);
 
                 //Client version retrieved from body
                 version = req.getVersion();
@@ -158,14 +159,12 @@ class EjbRequestHandler {
 
         Object securityToken = null;
         try {
-            if (version >= 3) { // login if needed with request
-                final JNDIContext.AuthenticationInfo authentication = req.getBody().getAuthentication();
-                if (authentication != null) {
-                    try {
-                        securityToken = securityService.login(authentication.getRealm(),
authentication.getUser(), new String(authentication.getPassword()));
-                    } catch (final Throwable t) {
-                        res.setResponse(req.getVersion(), ResponseCodes.AUTH_DENIED, t);
-                    }
+            final JNDIContext.AuthenticationInfo authentication = req.getBody().getAuthentication();
+            if (authentication != null) {
+                try {
+                    securityToken = securityService.login(authentication.getRealm(), authentication.getUser(),
new String(authentication.getPassword()));
+                } catch (final Throwable t) {
+                    res.setResponse(req.getVersion(), ResponseCodes.AUTH_DENIED, t);
                 }
             }
 



Mime
View raw message