001    package org.apache.geronimo.system.main;
002    
003    import java.util.Iterator;
004    import java.util.Set;
005    
006    import org.apache.commons.logging.Log;
007    import org.apache.commons.logging.LogFactory;
008    import org.apache.geronimo.gbean.AbstractName;
009    import org.apache.geronimo.gbean.AbstractNameQuery;
010    import org.apache.geronimo.kernel.GBeanNotFoundException;
011    import org.apache.geronimo.kernel.Kernel;
012    import org.apache.geronimo.kernel.management.State;
013    import org.apache.geronimo.kernel.repository.Artifact;
014    
015    /**
016     * @version $Rev: 406091 $ $Date: 2006-05-13 06:20:17 -0700 (Sat, 13 May 2006) $
017     */
018    public class SilentStartupMonitor implements StartupMonitor {
019        private final static Log log = LogFactory.getLog(SilentStartupMonitor.class.getName());
020    
021        private Kernel kernel;
022    
023        public void systemStarting(long startTime) {
024        }
025    
026        public void systemStarted(Kernel kernel) {
027            this.kernel = kernel;
028        }
029    
030        public void foundModules(Artifact[] modules) {
031        }
032    
033        public void moduleLoading(Artifact module) {
034        }
035    
036        public void moduleLoaded(Artifact module) {
037        }
038    
039        public void moduleStarting(Artifact module) {
040        }
041    
042        public void moduleStarted(Artifact module) {
043        }
044    
045        public void startupFinished() {
046            try {
047                Set gbeans = kernel.listGBeans((AbstractNameQuery)null);
048                for (Iterator it = gbeans.iterator(); it.hasNext();) {
049                    AbstractName name = (AbstractName) it.next();
050                    int state = kernel.getGBeanState(name);
051                    if (state != State.RUNNING_INDEX) {
052                        log.warn("Unable to start "+name+" ("+State.fromInt(state).getName()+")");
053                    }
054                }
055            } catch (GBeanNotFoundException e) {
056            }
057            System.out.println("Geronimo startup complete");
058        }
059    
060        public void serverStartFailed(Exception problem) {
061            System.out.println("Geronimo startup failed:");
062            problem.printStackTrace(System.out);
063        }
064    
065    }