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: */package org.apache.geronimo.kernel.config;
017:
018: import org.apache.geronimo.kernel.repository.Artifact;
019:
020: /**
021: * This interface can be used to monitor the progress of an operation on the
022: * configuration manager. Typically, the monitor will receive a number of
023: * calls to addConfiguration as the configuration manager decides which
024: * configurations will be effected by the operations. This is followed by a
025: * call to loading, starting, stopping or unloading and then a call to
026: * succeeded or failed for each configuration added.
027: *
028: *
029: * The one notable exception to this is the load operation which calls
030: * addConfiguration and and immediately follows it with a reading and then
031: * succeeded or failed. This is because the load operation needs to read each
032: * configuration to determine which additional configurations will need to be
033: * loaded.
034: *
035: * When an operation fails, the failed method is called with the cause. The
036: * configuration manager normally will follow the failure with compensating
037: * actions to bring the server back to the original state. For example, if it
038: * loaded a configuration, it will unload it. Each of the compensating
039: * actions will cause events to be fired.
040: *
041: * When the, operation is completed, the finished method will be called. This
042: * should be called event if the operation ultimately fails and throws an
043: * exception. It is recommended that you do not rely the finished method to
044: * be called in the case of an Exception as there are cases that will cause
045: * the configuration manager to immediately return without notification (such
046: * as an AssertionError).
047: * @version $Rev: 607674 $ $Date: 2007-12-30 21:16:26 -0800 (Sun, 30 Dec 2007) $
048: */
049: public interface LifecycleMonitor {
050: /**
051: * Adds a configuration to be monitored.
052: * @param configurationId the configuration identifier
053: */
054: void addConfiguration(Artifact configurationId);
055:
056: /**
057: * The configuration manager has started resolving the dependencies of the specified configuration.
058: * @param configurationId the configuration identifier
059: */
060: void resolving(Artifact configurationId);
061:
062: /**
063: * The configuration manager has started reading the specified configuration.
064: * @param configurationId the configuration identifier
065: */
066: void reading(Artifact configurationId);
067:
068: /**
069: * The configuration manager has begun loading the specified configuration.
070: * @param configurationId the configuration identifier
071: */
072: void loading(Artifact configurationId);
073:
074: /**
075: * The configuration manager has begun starting the specified configuration.
076: * @param configurationId the configuration identifier
077: */
078: void starting(Artifact configurationId);
079:
080: /**
081: * The configuration manager has begun stopping the specified configuration.
082: * @param configurationId the configuration identifier
083: */
084: void stopping(Artifact configurationId);
085:
086: /**
087: * The configuration manager has begun unloading the specified configuration.
088: * @param configurationId the configuration identifier
089: */
090: void unloading(Artifact configurationId);
091:
092: /**
093: * The previous operation on the specified configuration has completed successfully.
094: * @param configurationId the configuration identifier
095: */
096: void succeeded(Artifact configurationId);
097:
098: /**
099: * The previous operation on the specified configuration has failed due to the specified exception.
100: * @param configurationId the configuration identifier
101: */
102: void failed(Artifact configurationId, Throwable cause);
103:
104: /**
105: * The operation on the configuration manager has finished.
106: */
107: void finished();
108: }
|