1 //
2 // Copyright (c) 2003, Caltha - Gajda, Krzewski, Mach, Potempski Sp.J.
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without modification,
6 // are permitted provided that the following conditions are met:
7 //
8 // * Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright notice,
11 // this list of conditions and the following disclaimer in the documentation
12 // and/or other materials provided with the distribution.
13 // * Neither the name of the Caltha - Gajda, Krzewski, Mach, Potempski Sp.J.
14 // nor the names of its contributors may be used to endorse or promote products
15 // derived from this software without specific prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
21 // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
23 // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 // POSSIBILITY OF SUCH DAMAGE.
27 //
28 package org.objectledge.cache;
29
30 import java.io.PrintWriter;
31 import java.util.Map;
32
33 import org.jcontainer.dna.ConfigurationException;
34
35 /***
36 * A factory of cache objects, which are variants of java.util.Map with additional functionality.
37 *
38 * @author <a href="mailto:rafal@caltha.pl">Rafal Krzewski</a>
39 * @version $Id: CacheFactory.java,v 1.3 2004/12/27 03:05:51 rafal Exp $
40 */
41 public interface CacheFactory
42 {
43 // CacheFactorySPI interface ////////////////////////////////////////////////
44
45 /***
46 * Get the map.
47 *
48 * @param type the type.
49 * @return the map.
50 */
51 public abstract Map getMap(String type);
52
53 /***
54 * {@inheritDoc}
55 */
56 public abstract Map getInstance(String name);
57
58 /***
59 * {@inheritDoc}
60 */
61 public abstract Map getInstance(String name, String configAlias) throws ConfigurationException;
62
63 /***
64 * {@inheritDoc}
65 */
66 public abstract ValueFactory getValueFactory(String factory, String map);
67
68 /***
69 * {@inheritDoc}
70 */
71 public abstract Map getHashMap();
72
73 /***
74 * {@inheritDoc}
75 */
76 public abstract Map getTimeoutMap(long timeoutMillis);
77
78 /***
79 * {@inheritDoc}
80 */
81 public abstract Map getLRUMap(int capacity);
82
83 /***
84 * {@inheritDoc}
85 */
86 public abstract Map getSoftMap(int protect);
87
88 /***
89 * {@inheritDoc}
90 */
91 public abstract org.objectledge.cache.DistributedMap getDistributedMap(
92 String name,
93 Map delegate);
94
95 /***
96 * {@inheritDoc}
97 */
98 public abstract Map getFactoryMap(ValueFactory factory, Map delegate);
99
100 /***
101 * {@inheritDoc}
102 */
103 public abstract Map getStatisticsMap(String name, Map delegate);
104
105 /***
106 * {@inheritDoc}
107 */
108 public abstract ValueFactory getPersitenceValueFactory(Class valueClass);
109
110 /***
111 * {@inheritDoc}
112 */
113 public abstract void register(DelayedUpdate object);
114
115 /***
116 * Prints the report on the specified PrintWriter.
117 *
118 * @param out the PrintWriter to print report into.
119 */
120 public abstract void getStatus(PrintWriter out);
121 }