KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > system > main > SilentStartupMonitor


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.geronimo.system.main;
18
19 import java.util.Iterator JavaDoc;
20 import java.util.Set JavaDoc;
21
22 import org.apache.commons.logging.Log;
23 import org.apache.commons.logging.LogFactory;
24 import org.apache.geronimo.gbean.AbstractName;
25 import org.apache.geronimo.gbean.AbstractNameQuery;
26 import org.apache.geronimo.kernel.GBeanNotFoundException;
27 import org.apache.geronimo.kernel.Kernel;
28 import org.apache.geronimo.kernel.management.State;
29 import org.apache.geronimo.kernel.repository.Artifact;
30
31 /**
32  * @version $Rev: 484989 $ $Date: 2006-12-09 09:54:26 -0500 (Sat, 09 Dec 2006) $
33  */

34 public class SilentStartupMonitor implements StartupMonitor {
35     private final static Log log = LogFactory.getLog(SilentStartupMonitor.class.getName());
36
37     private Kernel kernel;
38
39     public void systemStarting(long startTime) {
40     }
41
42     public void systemStarted(Kernel kernel) {
43         this.kernel = kernel;
44     }
45
46     public void foundModules(Artifact[] modules) {
47     }
48
49     public void moduleLoading(Artifact module) {
50     }
51
52     public void moduleLoaded(Artifact module) {
53     }
54
55     public void moduleStarting(Artifact module) {
56     }
57
58     public void moduleStarted(Artifact module) {
59     }
60
61     public void startupFinished() {
62         try {
63             Set JavaDoc gbeans = kernel.listGBeans((AbstractNameQuery)null);
64             for (Iterator JavaDoc it = gbeans.iterator(); it.hasNext();) {
65                 AbstractName name = (AbstractName) it.next();
66                 int state = kernel.getGBeanState(name);
67                 if (state != State.RUNNING_INDEX) {
68                     log.warn("Unable to start "+name+" ("+State.fromInt(state).getName()+")");
69                 }
70             }
71         } catch (GBeanNotFoundException e) {
72         }
73         System.out.println("Geronimo startup complete");
74     }
75
76     public void serverStartFailed(Exception JavaDoc problem) {
77         System.out.println("Geronimo startup failed:");
78         problem.printStackTrace(System.out);
79     }
80
81 }
82
Popular Tags