geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r279072 - in /geronimo/trunk/modules/security/src: java/org/apache/geronimo/security/network/protocol/ java/org/apache/geronimo/security/remoting/jmx/ test/org/apache/geronimo/security/network/protocol/
Date Tue, 06 Sep 2005 19:20:12 GMT
Author: dblevins
Date: Tue Sep  6 12:20:05 2005
New Revision: 279072

URL: http://svn.apache.org/viewcvs?rev=279072&view=rev
Log:
ActiveIO 2.0 changes

Modified:
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/network/protocol/SubjectCarryingChannel.java
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/JaasLoginServiceRemotingServer.java
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/RequestChannelInterceptor.java
    geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/network/protocol/SubjectCarryingProtocolTest.java

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/network/protocol/SubjectCarryingChannel.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/network/protocol/SubjectCarryingChannel.java?rev=279072&r1=279071&r2=279072&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/network/protocol/SubjectCarryingChannel.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/network/protocol/SubjectCarryingChannel.java
Tue Sep  6 12:20:05 2005
@@ -14,6 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
+
 package org.apache.geronimo.security.network.protocol;
 
 import org.activeio.AsyncChannel;

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/JaasLoginServiceRemotingServer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/JaasLoginServiceRemotingServer.java?rev=279072&r1=279071&r2=279072&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/JaasLoginServiceRemotingServer.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/JaasLoginServiceRemotingServer.java
Tue Sep  6 12:20:05 2005
@@ -17,51 +17,50 @@
 
 package org.apache.geronimo.security.remoting.jmx;
 
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.InetSocketAddress;
-import javax.management.ObjectName;
-
 import org.activeio.AcceptListener;
-import org.activeio.AsynchChannelServer;
+import org.activeio.AsyncChannelServer;
 import org.activeio.Channel;
 import org.activeio.Packet;
 import org.activeio.RequestChannel;
-import org.activeio.SynchChannel;
-import org.activeio.SynchChannelServer;
-import org.activeio.adapter.AsynchChannelToServerRequestChannel;
-import org.activeio.adapter.AsynchToSynchChannelAdapter;
-import org.activeio.adapter.SynchToAsynchChannelAdapter;
-import org.activeio.adapter.SynchToAsynchChannelServerAdapter;
-import org.activeio.filter.PacketAggregatingAsynchChannel;
+import org.activeio.SyncChannel;
+import org.activeio.SyncChannelServer;
+import org.activeio.adapter.AsyncChannelToServerRequestChannel;
+import org.activeio.adapter.AsyncToSyncChannel;
+import org.activeio.adapter.SyncToAsyncChannel;
+import org.activeio.adapter.SyncToAsyncChannelServer;
+import org.activeio.filter.PacketAggregatingAsyncChannel;
 import org.activeio.net.SocketMetadata;
-import org.activeio.net.SocketSynchChannelFactory;
-
+import org.activeio.net.SocketSyncChannelFactory;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.kernel.jmx.JMXUtil;
+import org.apache.geronimo.management.geronimo.NetworkConnector;
 import org.apache.geronimo.proxy.ReflexiveInterceptor;
 import org.apache.geronimo.security.jaas.JaasLoginServiceMBean;
-import org.apache.geronimo.management.geronimo.NetworkConnector;
+
+import javax.management.ObjectName;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.URI;
+import java.net.URISyntaxException;
 
 
 /**
  * A server-side utility that exposes a JaasLoginService to remote clients.
  * It prevents clients from connecting to arbitrary server-side MBeans through
  * this listener -- only the JaasLoginService is exposed.
- * 
+ *
  * @version $Rev: 56022 $ $Date: 2004-10-30 01:16:18 -0400 (Sat, 30 Oct 2004) $
  */
 public class JaasLoginServiceRemotingServer implements GBeanLifecycle, NetworkConnector {
 
     public static final ObjectName REQUIRED_OBJECT_NAME = JMXUtil.getObjectName("geronimo.remoting:target=JaasLoginServiceRemotingServer");
-    
+
     private static final Log log = LogFactory.getLog(JaasLoginServiceRemotingServer.class);
-    private AsynchChannelServer server;
+    private AsyncChannelServer server;
     private JaasLoginServiceMBean loginService;
     private String protocol;
     private String host;
@@ -103,7 +102,7 @@
     }
 
     public InetSocketAddress getListenAddress() {
-        if(server != null) {
+        if (server != null) {
             URI uri = server.getBindURI();
             return new InetSocketAddress(uri.getHost(), uri.getPort());
         } else {
@@ -113,69 +112,68 @@
 
     public void doStart() throws Exception {
         final ReflexiveInterceptor loginServiceInterceptor = new ReflexiveInterceptor(loginService);
-        
-        server = createAsynchChannelServer();
+
+        server = createAsyncChannelServer();
         server.setAcceptListener(new AcceptListener() {
             public void onAccept(Channel channel) {
-                RequestChannel requestChannel=null;
+                RequestChannel requestChannel = null;
                 try {
-                    SynchChannel synchChannel = AsynchToSynchChannelAdapter.adapt(channel);
-                    SocketMetadata socket = (SocketMetadata) synchChannel.narrow(SocketMetadata.class);
+                    SyncChannel syncChannel = AsyncToSyncChannel.adapt(channel);
+                    SocketMetadata socket = (SocketMetadata) syncChannel.narrow(SocketMetadata.class);
                     socket.setTcpNoDelay(true);
-                    
-                    requestChannel = createRequestChannel(synchChannel);     
-                    
-                    RequestChannelInterceptorInvoker invoker = new RequestChannelInterceptorInvoker(loginServiceInterceptor,
loginService.getClass().getClassLoader() ); 
+
+                    requestChannel = createRequestChannel(syncChannel);
+
+                    RequestChannelInterceptorInvoker invoker = new RequestChannelInterceptorInvoker(loginServiceInterceptor,
loginService.getClass().getClassLoader());
                     requestChannel.setRequestListener(invoker);
                     requestChannel.start();
                 } catch (IOException e) {
                     log.info("Failed to accept connection.", e);
-                    if( requestChannel!=null )
+                    if (requestChannel != null)
                         requestChannel.dispose();
                     else
                         channel.dispose();
-                }                
+                }
             }
+
             public void onAcceptError(IOException error) {
-                log.info("Accept Failed: "+error);
+                log.info("Accept Failed: " + error);
             }
         });
-        
+
         server.start();
-        log.info("Remote login service started on: "+server.getConnectURI()+" clients can
connect to: "+server.getConnectURI());
+        log.info("Remote login service started on: " + server.getConnectURI() + " clients
can connect to: " + server.getConnectURI());
     }
-    
-    private AsynchChannelServer createAsynchChannelServer() throws IOException, URISyntaxException
{
-        SocketSynchChannelFactory factory = new SocketSynchChannelFactory();
-        SynchChannelServer server = factory.bindSynchChannel(new URI(protocol, null, host,
port, null, null, null));
-        return new SynchToAsynchChannelServerAdapter(server);        
+
+    private AsyncChannelServer createAsyncChannelServer() throws IOException, URISyntaxException
{
+        SocketSyncChannelFactory factory = new SocketSyncChannelFactory();
+        SyncChannelServer server = factory.bindSyncChannel(new URI(protocol, null, host,
port, null, null, null));
+        return new SyncToAsyncChannelServer(server);
     }
 
-    private RequestChannel createRequestChannel(SynchChannel channel) throws IOException
{
-        
-        return new AsynchChannelToServerRequestChannel( 
-                new PacketAggregatingAsynchChannel(
-                        SynchToAsynchChannelAdapter.adapt(channel))) {            
+    private RequestChannel createRequestChannel(SyncChannel channel) throws IOException {
+
+        return new AsyncChannelToServerRequestChannel(new PacketAggregatingAsyncChannel(SyncToAsyncChannel.adapt(channel)))
{
             /**
              * close out the channel once one request has been serviced.
              */
             public void onPacket(Packet packet) {
                 super.onPacket(packet);
                 dispose();
-            }            
+            }
         };
     }
 
     public void doStop() {
         server.dispose();
-        server=null;        
+        server = null;
         log.info("Stopped remote login service.");
     }
 
     public void doFail() {
-        if( server !=null ) {
+        if (server != null) {
             server.dispose();
-	        server=null;        
+            server = null;
         }
         log.info("Failed remote login service.");
     }
@@ -186,7 +184,7 @@
         GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Remote Login Listener", JaasLoginServiceRemotingServer.class);
//has fixed name, j2eeType is irrelevant
         infoFactory.addAttribute("clientConnectURI", URI.class, false);
         infoFactory.addReference("LoginService", JaasLoginServiceMBean.class, "JaasLoginService");
-        infoFactory.addInterface(NetworkConnector.class, new String[]{"host","port","protocol"},
new String[]{"host","port"});
+        infoFactory.addInterface(NetworkConnector.class, new String[]{"host", "port", "protocol"},
new String[]{"host", "port"});
         infoFactory.setConstructor(new String[]{"protocol", "host", "port", "LoginService"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/RequestChannelInterceptor.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/RequestChannelInterceptor.java?rev=279072&r1=279071&r2=279072&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/RequestChannelInterceptor.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/RequestChannelInterceptor.java
Tue Sep  6 12:20:05 2005
@@ -26,12 +26,12 @@
 import org.activeio.Packet;
 import org.activeio.RequestChannel;
 import org.activeio.Service;
-import org.activeio.SynchChannel;
-import org.activeio.adapter.AsynchChannelToClientRequestChannel;
-import org.activeio.adapter.PacketInputStream;
-import org.activeio.filter.PacketAggregatingSynchChannel;
+import org.activeio.SyncChannel;
+import org.activeio.adapter.AsyncChannelToClientRequestChannel;
+import org.activeio.adapter.PacketToInputStream;
+import org.activeio.filter.PacketAggregatingSyncChannel;
 import org.activeio.net.SocketMetadata;
-import org.activeio.net.SocketSynchChannelFactory;
+import org.activeio.net.SocketSyncChannelFactory;
 import org.activeio.packet.ByteArrayPacket;
 
 import org.apache.geronimo.core.service.Interceptor;
@@ -89,12 +89,12 @@
     }
     
     private static RequestChannel createRequestChannel(URI target) throws IOException, URISyntaxException
{
-        SocketSynchChannelFactory factory = new SocketSynchChannelFactory();
-        SynchChannel channel = factory.openSynchChannel(target);
+        SocketSyncChannelFactory factory = new SocketSyncChannelFactory();
+        SyncChannel channel = factory.openSyncChannel(target);
         SocketMetadata socket = (SocketMetadata) channel.narrow(SocketMetadata.class);
         socket.setTcpNoDelay(true);
-        return new AsynchChannelToClientRequestChannel(
-	               new PacketAggregatingSynchChannel(
+        return new AsyncChannelToClientRequestChannel(
+	               new PacketAggregatingSyncChannel(
                        channel));        
     }
 
@@ -106,7 +106,7 @@
      * @throws ClassNotFoundException
      */
     static public Object deserialize(Packet response, ClassLoader cl) throws IOException,
ClassNotFoundException {
-        ObjectInputStreamExt is = new ObjectInputStreamExt(new PacketInputStream(response),
cl);
+        ObjectInputStreamExt is = new ObjectInputStreamExt(new PacketToInputStream(response),
cl);
         Object rc = is.readObject();
         is.close();
         return rc;

Modified: geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/network/protocol/SubjectCarryingProtocolTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/network/protocol/SubjectCarryingProtocolTest.java?rev=279072&r1=279071&r2=279072&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/network/protocol/SubjectCarryingProtocolTest.java
(original)
+++ geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/network/protocol/SubjectCarryingProtocolTest.java
Tue Sep  6 12:20:05 2005
@@ -17,44 +17,42 @@
 
 package org.apache.geronimo.security.network.protocol;
 
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-import java.util.Collections;
-import java.util.Properties;
-
-import javax.management.ObjectName;
-import javax.security.auth.Subject;
-import javax.security.auth.login.Configuration;
-import javax.security.auth.login.LoginContext;
-
+import com.sun.security.auth.login.ConfigFile;
 import org.activeio.AcceptListener;
-import org.activeio.AsynchChannelServer;
+import org.activeio.AsyncChannelServer;
 import org.activeio.Channel;
 import org.activeio.Packet;
 import org.activeio.RequestChannel;
 import org.activeio.RequestListener;
-import org.activeio.adapter.AsynchChannelToClientRequestChannel;
-import org.activeio.adapter.AsynchChannelToServerRequestChannel;
-import org.activeio.adapter.AsynchToSynchChannelAdapter;
-import org.activeio.adapter.SynchToAsynchChannelAdapter;
-import org.activeio.adapter.SynchToAsynchChannelServerAdapter;
-import org.activeio.filter.PacketAggregatingAsynchChannel;
-import org.activeio.net.SocketSynchChannelFactory;
+import org.activeio.adapter.AsyncChannelToClientRequestChannel;
+import org.activeio.adapter.AsyncChannelToServerRequestChannel;
+import org.activeio.adapter.AsyncToSyncChannel;
+import org.activeio.adapter.SyncToAsyncChannel;
+import org.activeio.adapter.SyncToAsyncChannelServer;
+import org.activeio.filter.PacketAggregatingAsyncChannel;
+import org.activeio.net.SocketSyncChannelFactory;
 import org.activeio.packet.ByteArrayPacket;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.security.AbstractTest;
-import org.apache.geronimo.security.jaas.LoginModuleGBean;
 import org.apache.geronimo.security.jaas.JaasLoginModuleUse;
+import org.apache.geronimo.security.jaas.LoginModuleGBean;
 import org.apache.geronimo.security.realm.GenericSecurityRealm;
-import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.apache.geronimo.system.serverinfo.BasicServerInfo;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
 
-import com.sun.security.auth.login.ConfigFile;
+import javax.management.ObjectName;
+import javax.security.auth.Subject;
+import javax.security.auth.login.Configuration;
+import javax.security.auth.login.LoginContext;
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
+import java.util.Collections;
+import java.util.Properties;
 
 
 /**
@@ -71,7 +69,7 @@
     private Subject clientSubject;
     private Subject serverSubject;
     private URI serverURI;
-    private AsynchChannelServer server;
+    private AsyncChannelServer server;
 
     public void testNothing() throws Exception {
     }
@@ -81,14 +79,14 @@
      */
     public void disabledtest() throws Exception {
 
-        SocketSynchChannelFactory factory = new SocketSynchChannelFactory();
+        SocketSyncChannelFactory factory = new SocketSyncChannelFactory();
         final RequestChannel channel =
-            new AsynchChannelToClientRequestChannel(
-                AsynchToSynchChannelAdapter.adapt(
+            new AsyncChannelToClientRequestChannel(
+                AsyncToSyncChannel.adapt(
                     new SubjectCarryingChannel(
-                        new PacketAggregatingAsynchChannel(
-                            SynchToAsynchChannelAdapter.adapt(
-                                 factory.openSynchChannel(serverURI))))));
+                        new PacketAggregatingAsyncChannel(
+                            SyncToAsyncChannel.adapt(
+                                 factory.openSyncChannel(serverURI))))));
         try {
             channel.start();
 	        Subject.doAs(clientSubject, new PrivilegedExceptionAction() {
@@ -162,9 +160,9 @@
         context.login();
         serverSubject = context.getSubject();
 
-        SocketSynchChannelFactory factory = new SocketSynchChannelFactory();
-        server = new SynchToAsynchChannelServerAdapter(
-                factory.bindSynchChannel(new URI("tcp://localhost:0")));
+        SocketSyncChannelFactory factory = new SocketSyncChannelFactory();
+        server = new SyncToAsyncChannelServer(
+                factory.bindSyncChannel(new URI("tcp://localhost:0")));
 
         server.setAcceptListener(new AcceptListener() {
             public void onAccept(Channel channel) {
@@ -172,10 +170,10 @@
                 try {
 
                     requestChannel =
-                        new AsynchChannelToServerRequestChannel(
+                        new AsyncChannelToServerRequestChannel(
 	                        new SubjectCarryingChannel(
-	                            new PacketAggregatingAsynchChannel(
-	                                SynchToAsynchChannelAdapter.adapt(channel))));
+	                            new PacketAggregatingAsyncChannel(
+	                                SyncToAsyncChannel.adapt(channel))));
 
                     requestChannel.setRequestListener(SubjectCarryingProtocolTest.this);
                     requestChannel.start();



Mime
View raw message