geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r578515 - in /geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server: RemoteShellContainer.java RshServerMessageVisitor.java
Date Sat, 22 Sep 2007 22:15:23 GMT
Author: jdillon
Date: Sat Sep 22 15:15:22 2007
New Revision: 578515

URL: http://svn.apache.org/viewvc?rev=578515&view=rev
Log:
Introduce a sub-class of the default plexus container for the remote shells so we can clean
up, and perhaps work around other plexus muck

Added:
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RemoteShellContainer.java
  (with props)
Modified:
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerMessageVisitor.java

Added: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RemoteShellContainer.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RemoteShellContainer.java?rev=578515&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RemoteShellContainer.java
(added)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RemoteShellContainer.java
Sat Sep 22 15:15:22 2007
@@ -0,0 +1,44 @@
+/*
+ * 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.geronimo.gshell.remote.server;
+
+import org.codehaus.plexus.DefaultPlexusContainer;
+import org.codehaus.plexus.ContainerConfiguration;
+import org.codehaus.plexus.PlexusContainerException;
+import org.apache.geronimo.gshell.remote.session.SessionAttributeBinder;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public class RemoteShellContainer
+    extends DefaultPlexusContainer
+{
+    public static final SessionAttributeBinder<RemoteShellContainer> BINDER = new SessionAttributeBinder<RemoteShellContainer>(RemoteShellContainer.class);
+
+    public RemoteShellContainer(final ContainerConfiguration config) throws PlexusContainerException
{
+        super(config);
+    }
+
+    public void disposeAllComponents() {
+        super.disposeAllComponents();
+    }
+}

Propchange: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RemoteShellContainer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RemoteShellContainer.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RemoteShellContainer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerMessageVisitor.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerMessageVisitor.java?rev=578515&r1=578514&r2=578515&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerMessageVisitor.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerMessageVisitor.java
Sat Sep 22 15:15:22 2007
@@ -41,7 +41,6 @@
 import org.apache.mina.common.IoSession;
 import org.codehaus.plexus.ContainerConfiguration;
 import org.codehaus.plexus.DefaultContainerConfiguration;
-import org.codehaus.plexus.DefaultPlexusContainer;
 import org.codehaus.plexus.PlexusContainer;
 import org.codehaus.plexus.PlexusContainerException;
 import org.codehaus.plexus.component.annotations.Component;
@@ -56,8 +55,6 @@
 public class RshServerMessageVisitor
     extends MessageVisitorSupport
 {
-    private static final SessionAttributeBinder<PlexusContainer> CONTAINER_BINDER =
new SessionAttributeBinder<PlexusContainer>(PlexusContainer.class);
-
     private static final SessionAttributeBinder<IO> IO_BINDER = new SessionAttributeBinder<IO>(IO.class);
 
     private static final SessionAttributeBinder<Environment> ENV_BINDER = new SessionAttributeBinder<Environment>(Environment.class);
@@ -116,7 +113,7 @@
         }
     }
 
-    private DefaultPlexusContainer createContainer() throws PlexusContainerException {
+    private RemoteShellContainer createContainer() throws PlexusContainerException {
         // Create a new container which will be the parent for our remote shells
         ContainerConfiguration config = new DefaultContainerConfiguration();
 
@@ -126,7 +123,7 @@
 
         config.setClassWorld(parentContainer.getContainerRealm().getWorld());
 
-        return new DefaultPlexusContainer(config);
+        return new RemoteShellContainer(config);
     }
 
     public void visitOpenShell(final OpenShellMessage msg) throws Exception {
@@ -136,8 +133,8 @@
 
         IoSession session = msg.getSession();
 
-        PlexusContainer childContainer = createContainer();
-        CONTAINER_BINDER.bind(session, childContainer);
+        RemoteShellContainer shellContainer = createContainer();
+        RemoteShellContainer.BINDER.bind(session, shellContainer);
 
         // Setup the I/O context (w/o auto-flushing)
         IO io = new IO(SessionInputStream.BINDER.lookup(session), SessionOutputStream.BINDER.lookup(session),
false);
@@ -146,16 +143,16 @@
         // FIXME: We need to set the verbosity of this I/O context as specified by the client
         //
 
-        IOLookup.set(childContainer, io);
+        IOLookup.set(shellContainer, io);
         IO_BINDER.bind(session, io);
 
         // Setup shell environemnt
         Environment env = new DefaultEnvironment(io);
-        EnvironmentLookup.set(childContainer, env);
+        EnvironmentLookup.set(shellContainer, env);
         ENV_BINDER.bind(session, env);
 
         // Create a new shell instance
-        RemoteShell shell = (RemoteShell) childContainer.lookup(RemoteShell.class);
+        RemoteShell shell = (RemoteShell) shellContainer.lookup(RemoteShell.class);
         SHELL_BINDER.bind(session, shell);
 
         //
@@ -186,12 +183,8 @@
 
         log.info("Destroying container");
 
-        PlexusContainer childContainer = CONTAINER_BINDER.unbind(session);
-
-        //
-        // FIXME: This won't work... it kills our class realm... :-(
-        //
-        // childContainer.dispose();
+        RemoteShellContainer shellContainer = RemoteShellContainer.BINDER.unbind(session);
+        shellContainer.disposeAllComponents();
         
         //
         // TODO: Send a meaningful response
@@ -214,13 +207,13 @@
             // TODO: Need to find a better place to stash this me thinks...
             //
 
-            PlexusContainer container = CONTAINER_BINDER.lookup(session);
+            RemoteShellContainer shellContainer = RemoteShellContainer.BINDER.lookup(session);
 
             IO io = IO_BINDER.lookup(session);
-            IOLookup.set(container, io);
+            IOLookup.set(shellContainer, io);
 
             Environment env = ENV_BINDER.lookup(session);
-            EnvironmentLookup.set(container, env);
+            EnvironmentLookup.set(shellContainer, env);
 
             Object result = msg.execute(shell);
 



Mime
View raw message