View Javadoc

1   package org.apache.ojb.broker.cache;
2   
3   /* Copyright 2002-2005 The Apache Software Foundation
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * 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  
18  import org.apache.commons.lang.builder.ToStringBuilder;
19  import org.apache.commons.lang.builder.ToStringStyle;
20  import org.apache.ojb.broker.Identity;
21  import org.apache.ojb.broker.PersistenceBroker;
22  
23  import java.util.Properties;
24  
25  /**
26   * This is an 'empty' ObjectCache implementation.
27   * Useful when caching was not desired.
28   * <br/>
29   * NOTE: This implementation does not prevent infinite loops caused by
30   * 'circular references' of loaded object graphs.
31   * (this will change in versions &gt; 1.0).
32   *
33   * <p>
34   * Implementation configuration properties:
35   * </p>
36   *
37   * <table cellspacing="2" cellpadding="2" border="3" frame="box">
38   * <tr>
39   *     <td><strong>Property Key</strong></td>
40   *     <td><strong>Property Values</strong></td>
41   * </tr>
42   * <tr>
43   *     <td> - </td>
44   *     <td>
45   *          -
46   *    </td>
47   * </tr>
48   * </table>
49   *
50   * @author Thomas Mahler
51   * @version $Id: ObjectCacheEmptyImpl.java,v 1.1 2007-08-24 22:17:29 ewestfal Exp $
52   *
53   */
54  public class ObjectCacheEmptyImpl implements ObjectCache
55  {
56  
57      public ObjectCacheEmptyImpl(PersistenceBroker broker, Properties prop)
58      {
59  
60      }
61  
62      /**
63       * @see org.apache.ojb.broker.cache.ObjectCache#cache(Identity, Object)
64       */
65      public void cache(Identity oid, Object obj)
66      {
67          //do nothing
68      }
69  
70      /**
71       * @see org.apache.ojb.broker.cache.ObjectCache#lookup(Identity)
72       */
73      public Object lookup(Identity oid)
74      {
75          return null;
76      }
77  
78      /**
79       * @see org.apache.ojb.broker.cache.ObjectCache#remove(Identity)
80       */
81      public void remove(Identity oid)
82      {
83          //do nothing
84      }
85  
86      /**
87       * @see org.apache.ojb.broker.cache.ObjectCache#clear()
88       */
89      public void clear()
90      {
91          //do nothing
92      }
93  
94      public String toString()
95      {
96          ToStringBuilder buf = new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE);
97          return buf.toString();
98      }
99  }
100