geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r209177 - in /geronimo/trunk: modules/assembly/src/plan/ modules/assembly/src/var/log/ modules/derby/src/java/org/apache/geronimo/derby/ modules/jetty/src/java/org/apache/geronimo/jetty/connector/ modules/system/src/java/org/apache/geronimo...
Date Tue, 05 Jul 2005 01:42:16 GMT
Author: ammulder
Date: Mon Jul  4 18:42:14 2005
New Revision: 209177

URL: http://svn.apache.org/viewcvs?rev=209177&view=rev
Log:
New server startup output
 - shows a progress bar, timer, and operation status during start
 - shows a list of started application modules (other than o/a/g/System*)
 - shows a list of network ports that GBeans tried to bind to
The port list is voluntary on behalf of the GBeans.  They must declare an
  attribute of type java.net.InetSocketAddress in order to be included
  in the list (though it can be a read-only attribute).  We should review
  the current GBeans and make sure they do.
There is also some logic around calculating the name of a service.  For
  example, if the same GBean has more than one InetSocketAddress attribute,
  it tries to add the name of each attribute in the port list, and if the
  GBean has a "name" attribute (for GBeans tht may be deployed more than
  once with different names) it includes that too.
The new progress bar does not render particularly well in log files, and
  can be disabled by passing -noprogress on the server command line.  The
  maven deployment plugin does that.

Added:
    geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/ProgressBarStartupMonitor.java
    geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/SilentStartupMonitor.java
    geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/StartupMonitor.java
Modified:
    geronimo/trunk/modules/assembly/src/plan/j2ee-server-tomcat-plan.xml
    geronimo/trunk/modules/assembly/src/var/log/server-log4j.properties
    geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbyNetworkGBean.java
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/AJP13Connector.java
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPConnector.java
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPSConnector.java
    geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/Daemon.java
    geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/rmi/RMIRegistryService.java
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/ConnectorGBean.java
    geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
    geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartRemoteServer.java

Modified: geronimo/trunk/modules/assembly/src/plan/j2ee-server-tomcat-plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/plan/j2ee-server-tomcat-plan.xml?rev=209177&r1=209176&r2=209177&view=diff
==============================================================================
--- geronimo/trunk/modules/assembly/src/plan/j2ee-server-tomcat-plan.xml (original)
+++ geronimo/trunk/modules/assembly/src/plan/j2ee-server-tomcat-plan.xml Mon Jul  4 18:42:14
2005
@@ -31,6 +31,9 @@
     >
 
     <dependency>
+        <uri>geronimo/jars/geronimo-web-builder-${geronimo_version}.jar</uri>
+    </dependency>
+    <dependency>
         <uri>geronimo/jars/geronimo-tomcat-builder-${geronimo_version}.jar</uri>
     </dependency>
     <dependency>
@@ -135,7 +138,9 @@
     </gbean>
 
     <gbean name="TomcatWebConnector" class="org.apache.geronimo.tomcat.ConnectorGBean">
+        <attribute name="name">HTTP</attribute>
         <attribute name="initParams">
+            address=0.0.0.0
             port=${PlanTomcatHTTPPort}
             maxHttpHeaderSize=8192
             maxThreads=150
@@ -154,7 +159,9 @@
 
     <gbean name="TomcatAJPConnector" class="org.apache.geronimo.tomcat.ConnectorGBean">
         <attribute name="protocol">AJP/1.3</attribute>
+        <attribute name="name">AJP</attribute>
         <attribute name="initParams">
+            address=0.0.0.0
             port=${PlanTomcatAJPPort}
             enableLookups=false
             redirectPort=${PlanTomcatHTTPSPort}
@@ -174,7 +181,9 @@
     For more information on the specific parameters, see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/ssl-howto.html
 
     <gbean name="TomcatWebSSLConnector" class="org.apache.geronimo.tomcat.ConnectorGBean">
+        <attribute name="name">HTTPS</attribute>
         <attribute name="initParams">
+            address=0.0.0.0
             port=${PlanTomcatHTTPSPort}
             maxHttpHeaderSize=8192
             maxThreads=150

Modified: geronimo/trunk/modules/assembly/src/var/log/server-log4j.properties
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/var/log/server-log4j.properties?rev=209177&r1=209176&r2=209177&view=diff
==============================================================================
--- geronimo/trunk/modules/assembly/src/var/log/server-log4j.properties (original)
+++ geronimo/trunk/modules/assembly/src/var/log/server-log4j.properties Mon Jul  4 18:42:14
2005
@@ -19,7 +19,7 @@
 log4j.rootCategory=DEBUG, CONSOLE, FILE
 
 log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.Threshold=INFO
+log4j.appender.CONSOLE.Threshold=WARN
 log4j.appender.CONSOLE.Target=System.out
 log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
 log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n
@@ -43,3 +43,6 @@
 # Example: enable trace messages from foo.bar category
 #
 #log4j.category.foo.bar=TRACE#org.apache.geronimo.system.logging.log4j.XLevel
+
+# Suppress warnings that DB is already initialized; remove this if that output is removed
from ActiveMQ
+log4j.category.org.activemq.store.jdbc.adapter.DefaultJDBCAdapter=ERROR

Modified: geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbyNetworkGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbyNetworkGBean.java?rev=209177&r1=209176&r2=209177&view=diff
==============================================================================
--- geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbyNetworkGBean.java
(original)
+++ geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbyNetworkGBean.java
Mon Jul  4 18:42:14 2005
@@ -17,6 +17,7 @@
 package org.apache.geronimo.derby;
 
 import java.net.InetAddress;
+import java.net.InetSocketAddress;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -57,6 +58,10 @@
         this.port = port;
     }
 
+    public InetSocketAddress getAddress() {
+        return new InetSocketAddress(getHost(), getPort());
+    }
+
     public void doStart() throws Exception {
         InetAddress address = InetAddress.getByName(host);
         network = new NetworkServerControl(address, port);
@@ -85,9 +90,10 @@
     }
 
     static {
-        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder(DerbyNetworkGBean.class);
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Derby Connector", DerbyNetworkGBean.class);
         infoFactory.addAttribute("host", String.class, true);
         infoFactory.addAttribute("port", Integer.TYPE, true);
+        infoFactory.addAttribute("address", InetSocketAddress.class, false);
         infoFactory.addReference("derbySystem", DerbySystem.class, "GBean");
         infoFactory.setConstructor(new String[]{"derbySystem"});
         GBEAN_INFO = infoFactory.getBeanInfo();

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/AJP13Connector.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/AJP13Connector.java?rev=209177&r1=209176&r2=209177&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/AJP13Connector.java
(original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/AJP13Connector.java
Mon Jul  4 18:42:14 2005
@@ -33,7 +33,7 @@
     public static final GBeanInfo GBEAN_INFO;
 
     static {
-        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty AJP13 Connector", AJP13Connector.class,
JettyConnector.GBEAN_INFO);
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty Connector AJP13", AJP13Connector.class,
JettyConnector.GBEAN_INFO);
         infoFactory.setConstructor(new String[]{"JettyContainer"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPConnector.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPConnector.java?rev=209177&r1=209176&r2=209177&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPConnector.java
(original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPConnector.java
Mon Jul  4 18:42:14 2005
@@ -33,7 +33,7 @@
     public static final GBeanInfo GBEAN_INFO;
 
     static {
-        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty HTTP Connector", HTTPConnector.class,
JettyConnector.GBEAN_INFO);
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty Connector HTTP", HTTPConnector.class,
JettyConnector.GBEAN_INFO);
         infoFactory.setConstructor(new String[]{"JettyContainer"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPSConnector.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPSConnector.java?rev=209177&r1=209176&r2=209177&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPSConnector.java
(original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPSConnector.java
Mon Jul  4 18:42:14 2005
@@ -114,7 +114,7 @@
     public static final GBeanInfo GBEAN_INFO;
 
     static {
-        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty HTTPS Connector", HTTPSConnector.class,
JettyConnector.GBEAN_INFO);
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty Connector HTTPS", HTTPSConnector.class,
JettyConnector.GBEAN_INFO);
         infoFactory.addAttribute("keystore", String.class, true);
         infoFactory.addAttribute("algorithm", String.class, true);
         infoFactory.addAttribute("keyPassword", String.class, true);

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/Daemon.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/Daemon.java?rev=209177&r1=209176&r2=209177&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/Daemon.java (original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/Daemon.java Mon
Jul  4 18:42:14 2005
@@ -50,12 +50,15 @@
  * @version $Rev$ $Date$
  */
 public class Daemon {
+    private final static String ARGUMENT_NO_PROGRESS="-noprogress";
     private static Log log;
     private static final ObjectName PERSISTENT_CONFIGURATION_LIST_NAME_QUERY = JMXUtil.getObjectName("*:j2eeType=PersistentConfigurationList,*");
 
     static {
+        System.out.println("Booting Geronimo Kernel (in Java "+System.getProperty("java.version")+")...");
+        System.out.flush();
         // This MUST be done before the first log is acquired
-        GeronimoLogging.initialize(GeronimoLogging.INFO);
+        GeronimoLogging.initialize(GeronimoLogging.WARN);
         log = LogFactory.getLog(Daemon.class.getName());
 
         // Install our url factory
@@ -65,25 +68,40 @@
         ToolsJarHack.install();
     }
 
-    private Daemon() {
-    }
 
-    /**
-     * Static entry point allowing a Kernel to be run from the command line.
-     * Arguments are:
-     * <li>the filename of the directory to use for the configuration store.
-     * This will be created if it does not exist.</li>
-     * <li>the id of a configuation to load</li>
-     * Once the Kernel is booted and the configuration is loaded, the process
-     * will remain running until the shutdown() method on the kernel is
-     * invoked or until the JVM exits.
-     *
-     * @param args the command line arguments
-     */
-    public static void main(String[] args) {
 
+    private StartupMonitor monitor;
+    private List configs = new ArrayList();
+
+    private Daemon(String[] args) {
+        long start = System.currentTimeMillis();
+        processArguments(args);
         log.info("Server startup begun");
+        monitor.systemStarting(start);
+        doStartup();
+    }
+
+    private void processArguments(String[] args) {
+        for (int i = 0; i < args.length; i++) {
+            if(args[i].equals(ARGUMENT_NO_PROGRESS)) {
+                monitor = new SilentStartupMonitor();
+            } else {
+                try {
+                    configs.add(new URI(args[i]));
+                } catch (URISyntaxException e) {
+                    System.err.println("Invalid configuration-id: " + args[i]);
+                    e.printStackTrace();
+                    System.exit(1);
+                    throw new AssertionError();
+                }
+            }
+        }
+        if(monitor == null) {
+            monitor = new ProgressBarStartupMonitor();
+        }
+    }
 
+    private void doStartup() {
         try {
             // Determine the geronimo installation directory
             File geronimoInstallDirectory = DirectoryUtils.getGeronimoInstallDirectory();
@@ -111,20 +129,8 @@
             if (endorsedDirs.length() > 0) {
                 System.setProperty("java.endorsed.dirs", endorsedDirs);
             }
-            log.info("java.endorsed.dirs=" + System.getProperty("java.endorsed.dirs"));
+            log.debug("java.endorsed.dirs=" + System.getProperty("java.endorsed.dirs"));
 
-            // get a list of the configuration uris from the command line
-            List configs = new ArrayList();
-            for (int i = 0; i < args.length; i++) {
-                try {
-                    configs.add(new URI(args[i]));
-                } catch (URISyntaxException e) {
-                    System.err.println("Invalid configuration-id: " + args[i]);
-                    e.printStackTrace();
-                    System.exit(1);
-                    throw new AssertionError();
-                }
-            }
 
             // load this configuration
             ClassLoader classLoader = Daemon.class.getClassLoader();
@@ -163,13 +169,15 @@
             Runtime.getRuntime().addShutdownHook(new Thread("Shutdown Thread") {
                 public void run() {
                     log.info("Server shutdown begun");
+                    System.out.println("Server shutdown begun");
                     kernel.shutdown();
                     log.info("Server shutdown completed");
+                    System.out.println("Server shutdown completed");
                 }
             });
 
             // add the jmx bridge
-            ObjectName mbeanServerKernelBridgeName = new ObjectName("geronimo.boot:role=MBeanServerKernelBridge");

+            ObjectName mbeanServerKernelBridgeName = new ObjectName("geronimo.boot:role=MBeanServerKernelBridge");
             GBeanData mbeanServerKernelBridge = new GBeanData(mbeanServerKernelBridgeName,
MBeanServerKernelBridge.GBEAN_INFO);
             mbeanServerKernelBridge.setAttribute("mbeanServerId", mbeanServerId);
             kernel.loadGBean(mbeanServerKernelBridge, classLoader);
@@ -177,6 +185,7 @@
 
             // start this configuration
             kernel.startRecursiveGBean(configuration.getName());
+            monitor.systemStarted(kernel);
 
             if (configs.isEmpty()) {
                 // nothing explicit, see what was running before
@@ -195,20 +204,26 @@
                 }
             }
 
+            monitor.foundConfigurations((URI[]) configs.toArray(new URI[configs.size()]));
+
             // load the rest of the configurations
             try {
                 ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
                 for (Iterator i = configs.iterator(); i.hasNext();) {
                     URI configID = (URI) i.next();
+                    monitor.configurationLoading(configID);
                     List list = configurationManager.loadRecursive(configID);
+                    monitor.configurationLoaded(configID);
+                    monitor.configurationStarting(configID);
                     for (Iterator iterator = list.iterator(); iterator.hasNext();) {
                         ObjectName name = (ObjectName) iterator.next();
-                        kernel.startRecursiveGBean(name);
+                         kernel.startRecursiveGBean(name);
                     }
+                    monitor.configurationStarted(configID);
                 }
             } catch (Exception e) {
-                System.err.println("Exception caught when starting configurations, starting
kernel shutdown");
-                e.printStackTrace();
+                //Exception caught when starting configurations, starting kernel shutdown
+                monitor.serverStartFailed(e);
                 try {
                     kernel.shutdown();
                 } catch (Exception e1) {
@@ -238,6 +253,10 @@
                     log.info("Alleged GBean " + objectName + " is not a GBean");
                 }
             }
+
+            // Startup sequence is finished
+            monitor.startupFinished();
+            monitor = null;
             log.info("Server startup completed");
 
             // capture this thread until the kernel is ready to exit
@@ -251,9 +270,27 @@
                 }
             }
         } catch (Exception e) {
+            if(monitor != null) {
+                monitor.serverStartFailed(e);
+            }
             e.printStackTrace();
             System.exit(3);
             throw new AssertionError();
         }
     }
+
+    /**
+     * Static entry point allowing a Kernel to be run from the command line.
+     * Arguments are:
+     * <li>the id of a configuation to load</li>
+     * Once the Kernel is booted and the configuration is loaded, the process
+     * will remain running until the shutdown() method on the kernel is
+     * invoked or until the JVM exits.
+     *
+     * @param args the command line arguments
+     */
+    public static void main(String[] args) {
+        new Daemon(args);
+    }
+
 }

Added: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/ProgressBarStartupMonitor.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/ProgressBarStartupMonitor.java?rev=209177&view=auto
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/ProgressBarStartupMonitor.java
(added)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/ProgressBarStartupMonitor.java
Mon Jul  4 18:42:14 2005
@@ -0,0 +1,384 @@
+package org.apache.geronimo.system.main;
+
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+import java.net.URI;
+import java.net.InetSocketAddress;
+import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.NoSuchAttributeException;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GAttributeInfo;
+
+/**
+ * A startup monitor that shows progress using line feeds
+ *
+ * @version $Revision: 1.0$
+ */
+public class ProgressBarStartupMonitor implements StartupMonitor {
+    private final static char STATUS_NOT_READY=' ';
+    private final static char STATUS_LOADING='-';
+    private final static char STATUS_LOADED='>';
+    private final static char STATUS_STARTED='*';
+    private final static char STATUS_FAILED='x';
+    private final static int MAX_WIDTH=70;
+    private PrintStream out;
+    private String currentOperation;
+    private URI[] configurations;
+    private char[] configStatus;
+    private long started;
+    private int percent = 0;
+    private Kernel kernel;
+    private int operationLimit = 50;
+    private boolean finished = false;
+    private List exceptions = new ArrayList();
+    private UpdateThread thread;
+
+    public void systemStarting(long startTime) {
+        out = System.out;
+        started = startTime;
+    }
+
+    public void systemStarted(Kernel kernel) {
+        out.println("Starting Geronimo Application Server");
+        this.kernel = kernel;
+        currentOperation = "Loading";
+    }
+
+    public synchronized void foundConfigurations(URI[] configurations) {
+        this.configurations = configurations;
+        configStatus = new char[configurations.length];
+        for (int i = 0; i < configStatus.length; i++) {
+            configStatus[i] = STATUS_NOT_READY;
+        }
+        operationLimit = MAX_WIDTH
+            - 5 // two brackets, start and stop tokens, space afterward
+            - configurations.length // configuration tokens
+            - 4 // 2 digits of percent plus % plus space afterward
+            - 5;// 3 digits of time plus s plus space afterward
+        repaint();
+        thread = new UpdateThread();
+        thread.start();
+    }
+
+    public void calculatePercent() {
+        if(finished) {
+            this.percent = 100;
+            return;
+        }
+        int percent = 0;
+        if(kernel != null) percent += 5;
+        int total = configStatus.length*2;
+        int progress = 0;
+        for (int i = 0; i < configStatus.length; i++) {
+            char c = configStatus[i];
+            switch(c) {
+                case STATUS_LOADED:
+                    progress +=1;
+                    break;
+                case STATUS_STARTED:
+                case STATUS_FAILED:
+                    progress +=2;
+                    break;
+            }
+        }
+        percent += Math.round(90f*(float)progress/(float)total);
+        this.percent = percent;
+    }
+
+    public synchronized void configurationLoading(URI configuration) {
+        currentOperation = " Loading "+configuration;
+        for (int i = 0; i < configurations.length; i++) {
+            if(configurations[i].equals(configuration)) {
+                configStatus[i] = STATUS_LOADING;
+            }
+        }
+        repaint();
+    }
+
+    public synchronized void configurationLoaded(URI configuration) {
+        for (int i = 0; i < configurations.length; i++) {
+            if(configurations[i].equals(configuration)) {
+                configStatus[i] = STATUS_LOADED;
+            }
+        }
+        calculatePercent();
+        repaint();
+    }
+
+    public synchronized void configurationStarting(URI configuration) {
+        currentOperation = "Starting "+configuration;
+    }
+
+    public synchronized void configurationStarted(URI configuration) {
+        for (int i = 0; i < configurations.length; i++) {
+            if(configurations[i].equals(configuration)) {
+                configStatus[i] = STATUS_STARTED;
+            }
+        }
+        calculatePercent();
+        repaint();
+    }
+
+    public synchronized void startupFinished() {
+        finished = true;
+        currentOperation = "Startup complete";
+        calculatePercent();
+        thread.done = true;
+        thread.interrupt();
+    }
+
+    private void wrapUp() {
+        repaint();
+        out.println();
+        try {
+            Set gbeans = kernel.listGBeans(new ObjectName("*:*"));
+            Map beanInfos = new HashMap(); // key = GBeanInfo, value = List (of attribute
names)
+            List ports = new ArrayList(); // type = AddressHolder
+            boolean firstApp = true;
+            for (Iterator it = gbeans.iterator(); it.hasNext();) {
+                ObjectName name = (ObjectName) it.next();
+                if(isApplicationModule(name)) {
+                    if(firstApp) {
+                        firstApp = false;
+                        out.println("  Started Application Modules:");
+                    }
+                    out.println("    "+decodeModule(name.getKeyProperty("j2eeType"))+": "+name.getKeyProperty("name"));
+                }
+                GBeanInfo info = kernel.getGBeanInfo(name);
+                List list = (List) beanInfos.get(info);
+                if(list == null) {
+                    list = new ArrayList(3);
+                    beanInfos.put(info, list);
+                    Set atts = info.getAttributes();
+                    for (Iterator it2 = atts.iterator(); it2.hasNext();) {
+                        GAttributeInfo att = (GAttributeInfo) it2.next();
+                        if(att.getType().equals("java.net.InetSocketAddress")) {
+                            list.add(att);
+                        }
+                    }
+                }
+                for (int i = 0; i < list.size(); i++) {
+                    GAttributeInfo att = (GAttributeInfo) list.get(i);
+                    InetSocketAddress addr = (InetSocketAddress) kernel.getAttribute(name,
att.getName());
+                    if(addr == null) {
+                        continue;
+                    }
+                    String attName = info.getName();
+                    if(list.size() > 1) {
+                        attName += " "+decamelize(att.getName());
+                    } else if(info.getAttribute("name") != null) {
+                        attName += " "+kernel.getAttribute(name, "name");
+                    }
+                    ports.add(new AddressHolder(attName, addr));
+                }
+            }
+            Collections.sort(ports);
+            if(ports.size() > 0) {
+                System.out.println("  Listening on Ports:");
+                int max = 0;
+                for (int i = 0; i < ports.size(); i++) {
+                    AddressHolder holder = (AddressHolder) ports.get(i);
+                    max = Math.max(max, holder.getAddress().getAddress().getHostAddress().length());
+                }
+                for (int i = 0; i < ports.size(); i++) {
+                    AddressHolder holder = (AddressHolder) ports.get(i);
+                    StringBuffer buf = new StringBuffer();
+                    buf.append("   ");
+                    if(holder.getAddress().getPort() < 10) {
+                        buf.append(' ');
+                    }
+                    if(holder.getAddress().getPort() < 100) {
+                        buf.append(' ');
+                    }
+                    if(holder.getAddress().getPort() < 1000) {
+                        buf.append(' ');
+                    }
+                    if(holder.getAddress().getPort() < 10000) {
+                        buf.append(' ');
+                    }
+                    buf.append(holder.getAddress().getPort()).append(' ');
+                    buf.append(holder.getAddress().getAddress().getHostAddress());
+                    for(int j=holder.getAddress().getAddress().getHostAddress().length();
j<=max; j++) {
+                        buf.append(' ');
+                    }
+                    buf.append(holder.getName());
+                    out.println(buf.toString());
+                }
+            }
+            out.flush();
+        } catch (MalformedObjectNameException e) {
+            e.printStackTrace();
+        } catch (GBeanNotFoundException e) {
+            e.printStackTrace();
+        } catch (NoSuchAttributeException e) {
+            e.printStackTrace();
+        } catch (Exception e) { // required by Kernel.getAttribute
+            e.printStackTrace();
+        }
+    }
+
+    public synchronized void loadFailed(String configuration, Exception problem) {
+        for (int i = 0; i < configurations.length; i++) {
+            if(configurations[i].equals(configuration)) {
+                configStatus[i] = STATUS_FAILED;
+            }
+        }
+        if(problem != null) exceptions.add(problem);
+    }
+
+    public synchronized void serverStartFailed(Exception problem) {
+        currentOperation = "Startup failed";
+        repaint();
+        out.println();
+        problem.printStackTrace(out);
+    }
+
+    public synchronized void startFailed(String configuration, Exception problem) {
+        for (int i = 0; i < configurations.length; i++) {
+            if(configurations[i].equals(configuration)) {
+                configStatus[i] = STATUS_FAILED;
+            }
+        }
+        if(problem != null) exceptions.add(problem);
+    }
+
+    private synchronized void repaint() {
+        StringBuffer buf = new StringBuffer();
+        buf.append("\r[");
+        buf.append(kernel == null ? STATUS_NOT_READY : STATUS_STARTED);
+        for (int i = 0; i < configStatus.length; i++) {
+            buf.append(configStatus[i]);
+        }
+        buf.append(finished ? STATUS_STARTED : STATUS_NOT_READY);
+        buf.append("] ");
+        if(percent < 10) {
+            buf.append(' ');
+        }
+        buf.append(percent).append("% ");
+        int time = Math.round((float)(System.currentTimeMillis() - started)/1000f);
+        if(time < 10) {
+            buf.append(' ');
+        }
+        if(time < 100) {
+            buf.append(' ');
+        }
+        buf.append(time).append("s ");
+        if(currentOperation.length() > operationLimit) { // "Foo BarBarBar" limit 9 =
"Foo ...ar" = 13 - 9 + 3 + 1 + 3
+            int space = currentOperation.indexOf(' ');
+            buf.append(currentOperation.substring(0, space+1));
+            buf.append("...").append(currentOperation.substring(currentOperation.length()-operationLimit+space+4));
+        } else {
+            buf.append(currentOperation);
+            for(int i=currentOperation.length(); i<operationLimit; i++) {
+                buf.append(' ');
+            }
+        }
+        out.print(buf.toString());
+        out.flush();
+    }
+
+    private static boolean isApplicationModule(ObjectName on) {
+        String type = on.getKeyProperty("j2eeType");
+        String app = on.getKeyProperty("J2EEApplication");
+        String name = on.getKeyProperty("name");
+        if(type != null && (app == null || app.equals("null"))) {
+            return (type.equals("WebModule") || type.equals("J2EEModule") || type.equals("EJBModule")
|| type.equals("AppClientModule") || type.equals("ResourceAdapterModule")) && !name.startsWith("org/apache/geronimo/System");
+        }
+        return false;
+    }
+
+    private static String decodeModule(String value) {
+        if(value.equals("WebModule")) {
+            return "WAR";
+        } else if(value.equals("J2EEModule")) {
+            return "EAR";
+        } else if(value.equals("EJBModule")) {
+            return "JAR";
+        } else if(value.equals("AppClientModule")) {
+            return "CAR";
+        } else if(value.equals("ResourceAdapterModule")) {
+            return "RAR";
+        } else {
+            return "UNK";
+        }
+    }
+
+    private static String decamelize(String s) {
+        if(s == null || s.equals("")) {
+            return s;
+        }
+        StringBuffer buf = new StringBuffer();
+        buf.append(Character.toUpperCase(s.charAt(0)));
+        for(int i=1; i<s.length(); i++) {
+            if(Character.isUpperCase(s.charAt(i))) {
+                if(s.length() > i+1 && Character.isLowerCase(s.charAt(i+1))) {
+                    buf.append(" ");
+                }
+            }
+            buf.append(s.charAt(i));
+        }
+        return buf.toString();
+    }
+
+    private static class AddressHolder implements Comparable {
+        private String name;
+        private InetSocketAddress address;
+
+        public AddressHolder(String name, InetSocketAddress address) {
+            this.name = name;
+            this.address = address;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        public InetSocketAddress getAddress() {
+            return address;
+        }
+
+        public void setAddress(InetSocketAddress address) {
+            this.address = address;
+        }
+
+        public int compareTo(Object o) {
+            AddressHolder other = (AddressHolder) o;
+            int value = address.getPort() - other.address.getPort();
+            return value == 0 ? address.getAddress().toString().compareTo(other.address.getAddress().toString())
: value;
+        }
+    }
+
+    private class UpdateThread extends Thread {
+        private volatile boolean done = false;
+
+        public UpdateThread() {
+            super("Progress Display Update Thread");
+            setDaemon(true);
+        }
+
+        public void run() {
+            while(!done) {
+                try {
+                    Thread.sleep(500);
+                } catch (InterruptedException e) {
+                    continue;
+                }
+                repaint();
+            }
+            wrapUp();
+        }
+    }
+}

Added: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/SilentStartupMonitor.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/SilentStartupMonitor.java?rev=209177&view=auto
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/SilentStartupMonitor.java
(added)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/SilentStartupMonitor.java
Mon Jul  4 18:42:14 2005
@@ -0,0 +1,42 @@
+package org.apache.geronimo.system.main;
+
+import java.net.URI;
+import org.apache.geronimo.kernel.Kernel;
+
+/**
+ * @version $Revision: 1.0$
+ */
+public class SilentStartupMonitor implements StartupMonitor {
+    public void systemStarting(long startTime) {
+    }
+
+    public void systemStarted(Kernel kernel) {
+    }
+
+    public void foundConfigurations(URI[] configurations) {
+    }
+
+    public void configurationLoading(URI configuration) {
+    }
+
+    public void configurationLoaded(URI configuration) {
+    }
+
+    public void configurationStarting(URI configuration) {
+    }
+
+    public void configurationStarted(URI configuration) {
+    }
+
+    public void startupFinished() {
+    }
+
+    public void serverStartFailed(Exception problem) {
+    }
+
+    public void loadFailed(String configuration, Exception problem) {
+    }
+
+    public void startFailed(String configuration, Exception problem) {
+    }
+}

Added: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/StartupMonitor.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/StartupMonitor.java?rev=209177&view=auto
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/StartupMonitor.java
(added)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/StartupMonitor.java
Mon Jul  4 18:42:14 2005
@@ -0,0 +1,27 @@
+package org.apache.geronimo.system.main;
+
+import java.net.URI;
+import org.apache.geronimo.kernel.Kernel;
+
+/**
+ * An interface used by the Daemon to convey the status of the server
+ * startup.
+ *
+ * @version $Revision: 1.0$
+ */
+public interface StartupMonitor {
+    // Normal calls, will generally occur in this order
+    void systemStarting(long startTime);
+    void systemStarted(Kernel kernel);
+    void foundConfigurations(URI[] configurations);
+    void configurationLoading(URI configuration);
+    void configurationLoaded(URI configuration);
+    void configurationStarting(URI configuration);
+    void configurationStarted(URI configuration);
+    void startupFinished();
+
+    // Indicate failures during load
+    void serverStartFailed(Exception problem);
+    void loadFailed(String configuration, Exception problem);
+    void startFailed(String configuration, Exception problem);
+}

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/rmi/RMIRegistryService.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/rmi/RMIRegistryService.java?rev=209177&r1=209176&r2=209177&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/rmi/RMIRegistryService.java
(original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/rmi/RMIRegistryService.java
Mon Jul  4 18:42:14 2005
@@ -19,6 +19,7 @@
 import java.rmi.registry.LocateRegistry;
 import java.rmi.registry.Registry;
 import java.rmi.server.UnicastRemoteObject;
+import java.net.InetSocketAddress;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -63,11 +64,16 @@
         }
     }
 
+    public InetSocketAddress getAddress() {
+        return new InetSocketAddress("0.0.0.0", getPort());
+    }
+
     public static final GBeanInfo GBEAN_INFO;
 
     static {
-        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder(RMIRegistryService.class);
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("RMI Naming", RMIRegistryService.class);
         infoFactory.addAttribute("port", int.class, true);
+        infoFactory.addAttribute("address", InetSocketAddress.class, false);
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 

Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/ConnectorGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/ConnectorGBean.java?rev=209177&r1=209176&r2=209177&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/ConnectorGBean.java
(original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/ConnectorGBean.java
Mon Jul  4 18:42:14 2005
@@ -17,6 +17,9 @@
 package org.apache.geronimo.tomcat;
 
 import java.util.Map;
+import java.util.Iterator;
+import java.net.InetSocketAddress;
+import java.net.InetAddress;
 
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.connector.Connector;
@@ -29,24 +32,44 @@
     
     private final Connector connector;
     private final TomcatContainer container;
+    private String name;
+    private int port;
 
-    public ConnectorGBean(String protocol, Map initParams, TomcatContainer container) throws
Exception {
+    public ConnectorGBean(String name, String protocol, Map initParams, TomcatContainer container)
throws Exception {
         super(); // TODO: make it an attribute
         
         if (container == null){
             throw new IllegalArgumentException("container cannot be null.");
         }
         
+        this.name = name;
         this.container = container;
-                
+
         //Create the Connector object
         connector = new Connector(protocol);
-        
+
         //Set the parameters
         setParameters(connector, initParams);
         
     }
 
+    public InetSocketAddress getAddress() {
+        Object port = connector.getAttribute("port");
+        if(port instanceof String) {
+            port = new Integer((String)port);
+        }
+        Object address = connector.getAttribute("address");
+        if(address instanceof InetAddress) {
+            return new InetSocketAddress((InetAddress)address, ((Number)port).intValue());
+        } else if(address instanceof String) {
+            return new InetSocketAddress((String)address, ((Number)port).intValue());
+        } else throw new IllegalStateException("Unexpected address class "+(address == null
? "null" : address.getClass().getName()));
+    }
+
+    public String getName() {
+        return name;
+    }
+
     public Object getInternalObject() {
         return connector;
     }
@@ -67,12 +90,14 @@
     public static final GBeanInfo GBEAN_INFO;
 
     static {
-        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("TomcatConnector", ConnectorGBean.class);
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Tomcat Connector", ConnectorGBean.class);
+        infoFactory.addAttribute("name", String.class, true);
         infoFactory.addAttribute("protocol", String.class, true);
+        infoFactory.addAttribute("address", InetSocketAddress.class, false);
         infoFactory.addAttribute("initParams", Map.class, true);
         infoFactory.addReference("TomcatContainer", TomcatContainer.class, NameFactory.GERONIMO_SERVICE);
         infoFactory.addOperation("getInternalObject");
-        infoFactory.setConstructor(new String[] { "protocol", "initParams", "TomcatContainer"});
+        infoFactory.setConstructor(new String[] { "name", "protocol", "initParams", "TomcatContainer"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 

Modified: geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java?rev=209177&r1=209176&r2=209177&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
(original)
+++ geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
Mon Jul  4 18:42:14 2005
@@ -334,8 +334,10 @@
 
         initParams.clear();
         initParams.put("port","8080");
+        initParams.put("address","0.0.0.0");
         connector = new GBeanData(connectorName, ConnectorGBean.GBEAN_INFO);
         connector.setAttribute("initParams", initParams);
+        connector.setAttribute("name", "HTTP");
         connector.setReferencePattern("TomcatContainer", containerName);
 
         start(container);

Modified: geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartRemoteServer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartRemoteServer.java?rev=209177&r1=209176&r2=209177&view=diff
==============================================================================
--- geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartRemoteServer.java
(original)
+++ geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartRemoteServer.java
Mon Jul  4 18:42:14 2005
@@ -134,6 +134,7 @@
         cmd.add("-ea");
         cmd.add("-jar");
         cmd.add(systemFile.getCanonicalPath());
+        cmd.add("-noprogress");
 
         if (getConfigs() != null) {
             for (StringTokenizer st = new StringTokenizer(getConfigs()); st.hasMoreTokens();)
{



Mime
View raw message