KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > lifecycle > AbstractAccessor


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

17 package org.apache.avalon.lifecycle;
18
19 import org.apache.avalon.framework.context.Context;
20 import org.apache.avalon.framework.logger.AbstractLogEnabled;
21
22 /**
23  * Abstract implementation of a <code>Accessor</code>.
24  * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a>
25  */

26 public class AbstractAccessor extends AbstractLogEnabled implements Accessor
27 {
28
29     //=======================================================================
30
// Accessor
31
//=======================================================================
32

33     /**
34      * Access stage handler.
35      *
36      * @param object the object that is being accessed
37      * @param context the context instance required by the access handler
38      * implementation
39      * @exception Exception if an error occurs
40      */

41     public void access( Object JavaDoc object, Context context )
42         throws Exception JavaDoc
43     {
44         if( getLogger() == null )
45         {
46             return;
47         }
48
49         if( getLogger().isDebugEnabled() )
50         {
51             getLogger().debug(
52                 "accessing " + object.getClass().getName()
53                 + "#" + System.identityHashCode( object ) );
54         }
55     }
56
57     /**
58      * Release stage handler.
59      *
60      * @param object the object that is being released
61      * @param context the context instance required by the release handler
62      * implementation
63      */

64     public void release( Object JavaDoc object, Context context )
65     {
66         if( getLogger() == null )
67         {
68             return;
69         }
70
71         if( getLogger().isDebugEnabled() )
72         {
73             getLogger().debug(
74                 "releasing " + object.getClass().getName()
75                 + "#" + System.identityHashCode( object ) );
76         }
77     }
78 }
79
Popular Tags