geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r707952 - in /geronimo/gshell/trunk: gshell-commands/gshell-remote/src/main/java/org/apache/geronimo/gshell/commands/remote/ gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/ gshell-remote/gshell-rem...
Date Sun, 26 Oct 2008 07:51:46 GMT
Author: jdillon
Date: Sun Oct 26 00:51:45 2008
New Revision: 707952

URL: http://svn.apache.org/viewvc?rev=707952&view=rev
Log:
Rip out custom ThreadModel muck

Removed:
    geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/ThreadPoolModel.java
Modified:
    geronimo/gshell/trunk/gshell-commands/gshell-remote/src/main/java/org/apache/geronimo/gshell/commands/remote/RshAction.java
    geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClient.java
    geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/proxy/RemoteShellProxy.java
    geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/stream/StreamFeeder.java
    geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseConfiguration.java
    geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseService.java
    geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransport.java
    geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransportServer.java
    geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/LoggingProcessor.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/completer/CommandsCompleter.java

Modified: geronimo/gshell/trunk/gshell-commands/gshell-remote/src/main/java/org/apache/geronimo/gshell/commands/remote/RshAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-remote/src/main/java/org/apache/geronimo/gshell/commands/remote/RshAction.java?rev=707952&r1=707951&r2=707952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-remote/src/main/java/org/apache/geronimo/gshell/commands/remote/RshAction.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-remote/src/main/java/org/apache/geronimo/gshell/commands/remote/RshAction.java
Sun Oct 26 00:51:45 2008
@@ -108,28 +108,26 @@
         IO io = context.getIo();
         MessageSource messages = context.getCommand().getMessages();
 
+        io.info(messages.format("info.connecting", remote));
+        
         // If the username/password was not configured via cli, then prompt the user for
the values
         if (username == null || password == null) {
             PromptReader prompter = new PromptReader(io);
             String text;
 
+            log.debug("Prompting user for credentials");
+            
             if (username == null) {
                 text = messages.getMessage("prompt.username");
                 username = prompter.readLine(text + ": ", new UsernamePasswordValidator(text));
-                assert username != null;
-                assert username.length() != 0;
             }
 
             if (password == null) {
                 text = messages.getMessage("prompt.password");
                 password = prompter.readLine(text + ": ", new UsernamePasswordValidator(text));
-                assert password != null;
-                assert password.length() != 0;
             }
         }
         
-        io.info(messages.format("info.connecting", remote));
-
         // Create the client from prototype
         RshClient client = container.getBean(RshClient.class);
 

Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClient.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClient.java?rev=707952&r1=707951&r2=707952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClient.java
(original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClient.java
Sun Oct 26 00:51:45 2008
@@ -42,6 +42,7 @@
 import javax.security.auth.login.LoginException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.Closeable;
 import java.net.URI;
 import java.util.List;
 
@@ -51,6 +52,7 @@
  * @version $Rev$ $Date$
  */
 public class RshClient
+    implements Closeable
 {
     private final Logger log = LoggerFactory.getLogger(getClass());
 

Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/proxy/RemoteShellProxy.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/proxy/RemoteShellProxy.java?rev=707952&r1=707951&r2=707952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/proxy/RemoteShellProxy.java
(original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/proxy/RemoteShellProxy.java
Sun Oct 26 00:51:45 2008
@@ -23,6 +23,7 @@
 import org.apache.geronimo.gshell.console.Console;
 import org.apache.geronimo.gshell.console.JLineConsole;
 import org.apache.geronimo.gshell.io.IO;
+import org.apache.geronimo.gshell.io.Closer;
 import org.apache.geronimo.gshell.notification.ExitNotification;
 import org.apache.geronimo.gshell.remote.client.RshClient;
 import org.apache.geronimo.gshell.shell.ShellContext;
@@ -110,10 +111,7 @@
         }
         catch (Exception ignore) {}
 
-        try {
-            outputFeeder.close();
-        }
-        catch (Exception ignore) {}
+        Closer.close(outputFeeder);
 
         opened = false;
     }

Modified: geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/stream/StreamFeeder.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/stream/StreamFeeder.java?rev=707952&r1=707951&r2=707952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/stream/StreamFeeder.java
(original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/stream/StreamFeeder.java
Sun Oct 26 00:51:45 2008
@@ -24,6 +24,7 @@
 
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.Closeable;
 import java.util.concurrent.atomic.AtomicInteger;
 
 /**
@@ -32,7 +33,7 @@
  * @version $Rev$ $Date$
  */
 public class StreamFeeder
-    implements Runnable
+    implements Runnable, Closeable
 {
     private final Logger log = LoggerFactory.getLogger(getClass());
 

Modified: geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseConfiguration.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseConfiguration.java?rev=707952&r1=707951&r2=707952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseConfiguration.java
(original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseConfiguration.java
Sun Oct 26 00:51:45 2008
@@ -21,7 +21,6 @@
 
 import org.apache.geronimo.gshell.yarn.Yarn;
 import org.apache.mina.common.IoHandler;
-import org.apache.mina.common.ThreadModel;
 
 /**
  * Provides the base configuration for transport services.
@@ -32,8 +31,6 @@
 {
     private IoHandler handler;
 
-    private ThreadModel threadModel;
-
     public void setHandler(final IoHandler handler) {
         this.handler = handler;
     }
@@ -42,14 +39,6 @@
         return handler;
     }
 
-    public ThreadModel getThreadModel() {
-        return threadModel;
-    }
-
-    public void setThreadModel(final ThreadModel threadModel) {
-        this.threadModel = threadModel;
-    }
-
     public String toString() {
         return Yarn.render(this);
     }

Modified: geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseService.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseService.java?rev=707952&r1=707951&r2=707952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseService.java
(original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseService.java
Sun Oct 26 00:51:45 2008
@@ -38,10 +38,12 @@
 import org.apache.mina.common.ThreadModel;
 import org.apache.mina.filter.codec.ProtocolCodecFilter;
 import org.apache.mina.filter.codec.serialization.ObjectSerializationCodecFactory;
+import org.apache.mina.filter.executor.ExecutorFilter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.net.SocketAddress;
+import java.util.concurrent.Executors;
 
 /**
  * Common bits for {@link Transport} and {@link TransportServer} implementations.
@@ -117,21 +119,6 @@
         return handler;
     }
 
-    private ThreadModel threadModel;
-
-    protected synchronized ThreadModel createThreadModel() throws Exception {
-        return null;
-    }
-
-    protected synchronized ThreadModel getThreadModel() throws Exception {
-        if (threadModel == null) {
-            threadModel = createThreadModel();
-        }
-
-        // This can be null to leave the default model installed
-        return threadModel;
-    }
-
     protected void configure(final IoService service) throws Exception {
         assert service != null;
 
@@ -169,24 +156,11 @@
         });
 
 
-        configure(service.getDefaultConfig());
+        service.getDefaultConfig().setThreadModel(ThreadModel.MANUAL);
         
         configure(service.getFilterChain());
     }
 
-    protected void configure(final IoServiceConfig config) throws Exception {
-        assert config != null;
-
-        log.debug("Configure: {}", config);
-
-        ThreadModel threadModel = getThreadModel();
-
-        if (threadModel != null) {
-            config.setThreadModel(threadModel);
-            log.debug("Installed custom thread model: {}", threadModel);
-        }
-    }
-
     protected void configure(final DefaultIoFilterChainBuilder chain) throws Exception {
         assert chain != null;
 
@@ -200,6 +174,8 @@
 
         chain.addLast(ProtocolCodecFilter.class.getSimpleName(), new ProtocolCodecFilter(new
ObjectSerializationCodecFactory()));
 
+        chain.addLast(ExecutorFilter.class.getSimpleName(), new ExecutorFilter(Executors.newCachedThreadPool()));
+
         chain.addLast(LoggingFilter.class.getSimpleName(), new LoggingFilter());
 
         chain.addLast(SessionStreamFilter.class.getSimpleName(), new SessionStreamFilter());

Modified: geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransport.java?rev=707952&r1=707951&r2=707952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransport.java
(original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransport.java
Sun Oct 26 00:51:45 2008
@@ -27,11 +27,9 @@
 import org.apache.mina.common.IoConnector;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoSession;
-import org.apache.mina.common.ThreadModel;
 
 import java.net.SocketAddress;
 import java.net.URI;
-import java.util.concurrent.atomic.AtomicLong;
 
 /**
  * Support for {@link Transport} implementations.
@@ -42,8 +40,6 @@
     extends BaseService
     implements Transport
 {
-    private static final AtomicLong INSTANCE_COUNTER = new AtomicLong(0);
-
     private static final SessionAttributeBinder<Transport> TRANSPORT = new SessionAttributeBinder<Transport>(Transport.class);
 
     protected URI remoteLocation;
@@ -62,11 +58,6 @@
         super(addressFactory);
     }
 
-    @Override
-    protected synchronized ThreadModel createThreadModel() throws Exception {
-        return new ThreadPoolModel(getClass(), INSTANCE_COUNTER);
-    }
-
     //
     // Connection
     //

Modified: geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransportServer.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransportServer.java?rev=707952&r1=707951&r2=707952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransportServer.java
(original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransportServer.java
Sun Oct 26 00:51:45 2008
@@ -22,11 +22,9 @@
 import org.apache.geronimo.gshell.whisper.transport.TransportServer;
 import org.apache.mina.common.IoAcceptor;
 import org.apache.mina.common.IoHandler;
-import org.apache.mina.common.ThreadModel;
 
 import java.net.SocketAddress;
 import java.net.URI;
-import java.util.concurrent.atomic.AtomicLong;
 
 /**
  * Support for {@link TransportServer} implementations.
@@ -37,8 +35,6 @@
     extends BaseService
     implements TransportServer
 {
-    private static final AtomicLong INSTANCE_COUNTER = new AtomicLong(0);
-
     protected URI location;
 
     protected SocketAddress address;
@@ -49,11 +45,6 @@
         super(addressFactory);
     }
 
-    @Override
-    protected synchronized ThreadModel createThreadModel() throws Exception {
-        return new ThreadPoolModel(getClass(), INSTANCE_COUNTER);
-    }
-
     //
     // Acceptor
     //

Modified: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/LoggingProcessor.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/LoggingProcessor.java?rev=707952&r1=707951&r2=707952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/LoggingProcessor.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/LoggingProcessor.java
Sun Oct 26 00:51:45 2008
@@ -96,7 +96,7 @@
         if (log.isTraceEnabled()) {
             try {
                 String xml = render(beanFactory);
-                log.trace("Bean factory contents: {}", xml);
+                log.trace("Bean factory contents:\n{}", xml);
             }
             catch (Exception e) {
                 log.error("Failed to render bean factory contents", e);

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/completer/CommandsCompleter.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/completer/CommandsCompleter.java?rev=707952&r1=707951&r2=707952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/completer/CommandsCompleter.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/completer/CommandsCompleter.java
Sun Oct 26 00:51:45 2008
@@ -33,6 +33,7 @@
 import org.apache.geronimo.gshell.vfs.provider.meta.data.MetaDataRemovedEvent;
 import org.apache.geronimo.gshell.wisdom.registry.CommandRegisteredEvent;
 import org.apache.geronimo.gshell.wisdom.registry.CommandRemovedEvent;
+import org.apache.commons.vfs.FileName;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -60,6 +61,8 @@
 
     private final Map<String,Completor> completors = new HashMap<String,Completor>();
 
+    private final Map<FileName,Completor> groupCompleters = new HashMap<FileName,Completor>();
+
     private final AggregateCompleter delegate = new AggregateCompleter();
 
     public CommandsCompleter(final EventManager eventManager, final CommandRegistry commandRegistry)
{
@@ -75,6 +78,9 @@
     //        and look for an attribute on the file, which is the completer.  If it does
not exist, then build a new one
     //        and attach it, else use what we found.  Pending how to deal with dynamic add/remove
muck.  May need to add
     //        events to the MetaRegistry?
+
+    //
+    // TODO: Re-write to use meta:/commands and then dynamically lookup the specific completer
to use.
     //
 
     // @PostConstruct
@@ -97,6 +103,7 @@
                     CommandRemovedEvent targetEvent = (CommandRemovedEvent)event;
                     removeCompleter(targetEvent.getName());
                 }
+                /*
                 else if (event instanceof MetaDataRegisteredEvent) {
                     MetaDataRegisteredEvent targetEvent = (MetaDataRegisteredEvent)event;
                     log.debug("+ {}", targetEvent.getName());
@@ -105,6 +112,7 @@
                     MetaDataRemovedEvent targetEvent = (MetaDataRemovedEvent)event;
                     log.debug("- {}", targetEvent.getName());
                 }
+                */
             }
         });
     }



Mime
View raw message