001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.geronimo.system.main;
018
019 import java.util.Iterator;
020 import java.util.Set;
021
022 import org.apache.commons.logging.Log;
023 import org.apache.commons.logging.LogFactory;
024 import org.apache.geronimo.gbean.AbstractName;
025 import org.apache.geronimo.gbean.AbstractNameQuery;
026 import org.apache.geronimo.kernel.GBeanNotFoundException;
027 import org.apache.geronimo.kernel.Kernel;
028 import org.apache.geronimo.kernel.management.State;
029 import org.apache.geronimo.kernel.repository.Artifact;
030
031 /**
032 * @version $Rev: 484989 $ $Date: 2006-12-09 09:54:26 -0500 (Sat, 09 Dec 2006) $
033 */
034 public class SilentStartupMonitor implements StartupMonitor {
035 private final static Log log = LogFactory.getLog(SilentStartupMonitor.class.getName());
036
037 private Kernel kernel;
038
039 public void systemStarting(long startTime) {
040 }
041
042 public void systemStarted(Kernel kernel) {
043 this.kernel = kernel;
044 }
045
046 public void foundModules(Artifact[] modules) {
047 }
048
049 public void moduleLoading(Artifact module) {
050 }
051
052 public void moduleLoaded(Artifact module) {
053 }
054
055 public void moduleStarting(Artifact module) {
056 }
057
058 public void moduleStarted(Artifact module) {
059 }
060
061 public void startupFinished() {
062 try {
063 Set gbeans = kernel.listGBeans((AbstractNameQuery)null);
064 for (Iterator it = gbeans.iterator(); it.hasNext();) {
065 AbstractName name = (AbstractName) it.next();
066 int state = kernel.getGBeanState(name);
067 if (state != State.RUNNING_INDEX) {
068 log.warn("Unable to start "+name+" ("+State.fromInt(state).getName()+")");
069 }
070 }
071 } catch (GBeanNotFoundException e) {
072 }
073 System.out.println("Geronimo startup complete");
074 }
075
076 public void serverStartFailed(Exception problem) {
077 System.out.println("Geronimo startup failed:");
078 problem.printStackTrace(System.out);
079 }
080
081 }