KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > util > jcache > CacheMap


1 /* Open Source Java Caching Service
2 * Copyright (C) 2002 Frank Karlstrøm
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * The author can be contacted by email: fjankk@users.sourceforge.net
18 */

19 package javax.util.jcache;
20
21 import java.util.Map JavaDoc;
22
23 /** Interface with extra methods for special features of FKache.
24  * @author Frank Karlstrøm
25  *
26  */

27 public interface CacheMap extends Map JavaDoc {
28     /**
29      * Will return an attribute object describing the current attributes
30      * associated for the region for this CacheAccess.
31      
32      * @return an Attributes object for the region of this CacheAccess.
33
34      */

35     Attributes getAttributes() ;
36
37     /**
38      * will return an attribute object describing the current attributes
39      * associated with the object name.
40      *@deprecated moved to MapAccess
41      * @param name the name of the object to get the attributes for.
42      *
43      * @return an Attributes object for the named object.
44      *
45      * @throws CacheException if an error occurs.
46      */

47     Attributes getAttributes(Object JavaDoc name) throws CacheException;
48     /**
49      * Gets the object from the cache. If the object is not currently in the
50      * cache and a loader object has been registered, the object will be
51      * loaded into the cache with the arguments specified.
52      *
53      * @param name the name of the object to get.
54      * @param arguments the arguments wich is passed to the load method of the
55      * CacheLoader, if registered.
56      *
57      * @return a reference to a shared object.
58      */

59     Object JavaDoc get(Object JavaDoc name, Object JavaDoc arguments);
60     /**
61      * is used to specify the attributes to associate with an object when it is
62      * loaded. This can include the loader object, cache event handlers, and
63      * spesific attributes for the object such as distribute, spool, etc.
64      * Attributes (with the exception of the CacheLoader object itself) can
65      * also be specified within the load method of the CacheLoader object
66      * using the setAttributes method, if the attributes for an object are not
67      * defined, the attributes of the region will be used.
68      *
69      * @param name the name of the object to associate the attributes with.
70      * @param attributes the attributes to associate.
71      */

72     public void defineObject(Object JavaDoc name, Attributes attributes);
73     /**Puts a object into the cache, and attach it to a group.
74      * If the group does not exist, this method will fail.
75      * If an object with the specified name, in the specified group
76      * already exists, this object is repleaced with the new object,
77      * and the old object is returned. Otherwise null is returned.
78      * @param key the key of the object
79      * @param group the group to put it in to.
80      * @param value the actual object to put into the cache.
81      * @return if an object already was in the cache in the specified group, this object is returned.
82      */

83     public Object JavaDoc put(Object JavaDoc key, String JavaDoc group, Object JavaDoc value);
84
85     /**Removes an object from a group.
86      * @param key The object to remove.
87      * @param group The group to remove the object from.
88      * @return The removed object if any.
89      */

90     public Object JavaDoc remove(Object JavaDoc key, String JavaDoc group);
91 }
92
Popular Tags