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.xbean.kernel;
018
019 /**
020 * This interface is used to monitor service lifecycle events. A ServiceMonitor can be registered with a kernel using
021 * {@link Kernel#addServiceMonitor(ServiceMonitor)} or {@link Kernel#addServiceMonitor(ServiceMonitor, ServiceName)}.
022 *
023 * @author Dain Sundstrom
024 * @version $Id$
025 * @since 2.0
026 */
027 public interface ServiceMonitor {
028 /**
029 * A new service has been registered with the kernel.
030 *
031 * @param serviceEvent the event information
032 */
033 void serviceRegistered(ServiceEvent serviceEvent);
034
035 /**
036 * A service has entered the STARTING state.
037 *
038 * @param serviceEvent the event information
039 */
040 void serviceStarting(ServiceEvent serviceEvent);
041
042 /**
043 * A service is waiting to start because some start conditions are unsatified.
044 *
045 * @param serviceEvent the event information
046 * @see ServiceEvent#getUnsatisfiedConditions()
047 */
048 void serviceWaitingToStart(ServiceEvent serviceEvent);
049
050 /**
051 * An error occured while calling creating the service.
052 *
053 * @param serviceEvent the event information
054 * @see ServiceEvent#getCause()
055 */
056 void serviceStartError(ServiceEvent serviceEvent);
057
058 /**
059 * A service has entered the RUNNING state.
060 *
061 * @param serviceEvent the event information
062 */
063 void serviceRunning(ServiceEvent serviceEvent);
064
065 /**
066 * A service has entered the RUNNING state.
067 *
068 * @param serviceEvent the event information
069 */
070 void serviceStopping(ServiceEvent serviceEvent);
071
072 /**
073 * A service is waiting to stop because some stop condition is unsatified.
074 *
075 * @param serviceEvent the event information
076 * @see ServiceEvent#getUnsatisfiedConditions()
077 */
078 void serviceWaitingToStop(ServiceEvent serviceEvent);
079
080 /**
081 * An error occured while calling destroying the service.
082 *
083 * @param serviceEvent the event information
084 * @see ServiceEvent#getCause()
085 */
086 void serviceStopError(ServiceEvent serviceEvent);
087
088 /**
089 * A service has entered the STOPPED state.
090 *
091 * @param serviceEvent the event information
092 */
093 void serviceStopped(ServiceEvent serviceEvent);
094
095 /**
096 * A service has been unregistered from the kernel.
097 *
098 * @param serviceEvent the event information
099 */
100 void serviceUnregistered(ServiceEvent serviceEvent);
101 }