001 package org.apache.ojb.broker.cache;
002
003 /* Copyright 2002-2005 The Apache Software Foundation
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * 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
018 import org.apache.commons.lang.builder.ToStringBuilder;
019 import org.apache.commons.lang.builder.ToStringStyle;
020 import org.apache.ojb.broker.Identity;
021 import org.apache.ojb.broker.PersistenceBroker;
022
023 import java.util.Properties;
024
025 /**
026 * This is an 'empty' ObjectCache implementation.
027 * Useful when caching was not desired.
028 * <br/>
029 * NOTE: This implementation does not prevent infinite loops caused by
030 * 'circular references' of loaded object graphs.
031 * (this will change in versions > 1.0).
032 *
033 * <p>
034 * Implementation configuration properties:
035 * </p>
036 *
037 * <table cellspacing="2" cellpadding="2" border="3" frame="box">
038 * <tr>
039 * <td><strong>Property Key</strong></td>
040 * <td><strong>Property Values</strong></td>
041 * </tr>
042 * <tr>
043 * <td> - </td>
044 * <td>
045 * -
046 * </td>
047 * </tr>
048 * </table>
049 *
050 * @author Thomas Mahler
051 * @version $Id: ObjectCacheEmptyImpl.java,v 1.1 2007-08-24 22:17:29 ewestfal Exp $
052 *
053 */
054 public class ObjectCacheEmptyImpl implements ObjectCache
055 {
056
057 public ObjectCacheEmptyImpl(PersistenceBroker broker, Properties prop)
058 {
059
060 }
061
062 /**
063 * @see org.apache.ojb.broker.cache.ObjectCache#cache(Identity, Object)
064 */
065 public void cache(Identity oid, Object obj)
066 {
067 //do nothing
068 }
069
070 /**
071 * @see org.apache.ojb.broker.cache.ObjectCache#lookup(Identity)
072 */
073 public Object lookup(Identity oid)
074 {
075 return null;
076 }
077
078 /**
079 * @see org.apache.ojb.broker.cache.ObjectCache#remove(Identity)
080 */
081 public void remove(Identity oid)
082 {
083 //do nothing
084 }
085
086 /**
087 * @see org.apache.ojb.broker.cache.ObjectCache#clear()
088 */
089 public void clear()
090 {
091 //do nothing
092 }
093
094 public String toString()
095 {
096 ToStringBuilder buf = new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE);
097 return buf.toString();
098 }
099 }
100