View Javadoc

1   package org.apache.geronimo.system.main;
2   
3   import java.util.Iterator;
4   import java.util.Set;
5   
6   import org.apache.commons.logging.Log;
7   import org.apache.commons.logging.LogFactory;
8   import org.apache.geronimo.gbean.AbstractName;
9   import org.apache.geronimo.gbean.AbstractNameQuery;
10  import org.apache.geronimo.kernel.GBeanNotFoundException;
11  import org.apache.geronimo.kernel.Kernel;
12  import org.apache.geronimo.kernel.management.State;
13  import org.apache.geronimo.kernel.repository.Artifact;
14  
15  /**
16   * @version $Rev: 406091 $ $Date: 2006-05-13 06:20:17 -0700 (Sat, 13 May 2006) $
17   */
18  public class SilentStartupMonitor implements StartupMonitor {
19      private final static Log log = LogFactory.getLog(SilentStartupMonitor.class.getName());
20  
21      private Kernel kernel;
22  
23      public void systemStarting(long startTime) {
24      }
25  
26      public void systemStarted(Kernel kernel) {
27          this.kernel = kernel;
28      }
29  
30      public void foundModules(Artifact[] modules) {
31      }
32  
33      public void moduleLoading(Artifact module) {
34      }
35  
36      public void moduleLoaded(Artifact module) {
37      }
38  
39      public void moduleStarting(Artifact module) {
40      }
41  
42      public void moduleStarted(Artifact module) {
43      }
44  
45      public void startupFinished() {
46          try {
47              Set gbeans = kernel.listGBeans((AbstractNameQuery)null);
48              for (Iterator it = gbeans.iterator(); it.hasNext();) {
49                  AbstractName name = (AbstractName) it.next();
50                  int state = kernel.getGBeanState(name);
51                  if (state != State.RUNNING_INDEX) {
52                      log.warn("Unable to start "+name+" ("+State.fromInt(state).getName()+")");
53                  }
54              }
55          } catch (GBeanNotFoundException e) {
56          }
57          System.out.println("Geronimo startup complete");
58      }
59  
60      public void serverStartFailed(Exception problem) {
61          System.out.println("Geronimo startup failed:");
62          problem.printStackTrace(System.out);
63      }
64  
65  }