KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > framework > availability > AvailabilityAware


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.avalon.framework.availability;
18
19
20 /** An Availability contract between the container and the component.
21  *
22  * <p>A component that implements AvailabilityAware, is capable to be notified
23  * that components that it has previously looked up via the
24  * ServiceManager.lookup() method are made available and non-available,
25  * and can gracefully handle unavailability.</p>
26  *
27  * <p>Containers are only required to support this interface, if the
28  * container supports dynamic loading/unloading of components, hot-deploys,
29  * remote components and similar cases where components may disappear for
30  * a shorter or longer period of time.</p>
31  *
32  * @since 4.5
33  *
34  * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a>
35  * @version $Id$
36  */

37 public interface AvailabilityAware
38 {
39     /** Notification that component is available.
40      * <p>The component that previously has been looked up in the
41      * ServiceManager, using <i>key</i> is now available. This method can
42      * either be called after the componentUnavailable() method signalled that
43      * a component is no longer available, OR if the ServiceManager.lookup()
44      * returned a null (optional lookup) indicating that the requested
45      * component didn't exist.</p>
46      * <p>
47      * This method will NOT be called with a <i>key</i> argument that has
48      * not been used in a ServiceManager.lookup() previously.
49      * </p>
50      *
51      * @param key The key that was used to lookup the component in the
52      * ServiceManager earlier.
53      */

54     void componentAvailable( String JavaDoc key );
55     
56     /** Notification that component is no longer available.
57      * <p>The component that previously has been looked up in the
58      * ServiceManager, using <i>key</i> is no longer available. The container
59      * does not place any restrictions on how long the component will be
60      * unavailble, and the AvailabilityAware component, must employ one or more
61      * strategies on how to gracefully handle short and long absences of
62      * dependent components. </p>
63      * <p>
64      * This method will NOT be called with a <i>key</i> argument that has
65      * not been used in a ServiceManager.lookup() previously.
66      * </p>
67      *
68      * @param key The key that was used to lookup the component in the
69      * ServiceManager earlier.
70      */

71     void componentUnavailable( String JavaDoc key );
72 }
73
Popular Tags