KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > cache > aop > TreeCacheAopIfc


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.cache.aop;
8
9 import org.jboss.cache.CacheException;
10 import org.jboss.cache.Fqn;
11
12 /**
13  * Interface for TreeCacheAop. Will need to consolidate with TreeCache interface in the future.
14  * </p>
15   * Implementation of the cache using dyanmic aop interceptors. The basic idea is that the caller only
16   * uses the {@link #putObject(String,Object)}, {@link #getObject(String)} and
17   * {@link #removeObject(String)} methods.<br>
18   * When putting an object into the cache, the cache essentially takes care of how the object
19   * will be replicated. It 'breaks' the object apart to map it onto the tree, and adds an
20   * interceptor recursively for each object reachable from the root object. Those interceptor
21   * 'know' to which part of the tree they are mapped. Whenever there is state change
22   * ("set*" interceptors), the tree is modified using the superclass. All "get*" operations
23   * to the object are intercepted and redirected to the tree.<br>
24   * Bottom line is that a user simply puts <em>any</em> object into the cache, and the object
25   * will be replicated to all caches in the cluster. The only requirement on cachable objects
26   * is that they access all state through getters and setters.
27   *
28   * @author Harald Gliebe
29   * @author Ben Wang
30  */

31 public interface TreeCacheAopIfc {
32    /**
33      * Retrieve the aop-enabled object from the cache. Return null if object does not exist in the cache.
34      *
35      * @param fqn Instance that associates with this node.
36      * @return Current content value. Null if does not exist.
37      * @throws CacheException
38      */

39    Object JavaDoc getObject(String JavaDoc fqn) throws CacheException;
40
41    /**
42      * Retrieve the aop-enabled object from the cache. Return null if object does not exist in the cache.
43      *
44      * @param fqn Instance that associates with this node.
45      * @return Current content value. Null if does not exist.
46      * @throws CacheException
47      */

48    Object JavaDoc getObject(Fqn fqn) throws CacheException;
49
50    /**
51     * Insert an aop-enabled object into the cache.
52     * It will also recursively put the any sub-object that is
53     * declared as aop-capable (i.e., in <code>jboss-aop.xml</code>).
54     * Note that <code>List</code>, <code>Map</code>, <code>Set</code>
55     * attributes are aop-enabled, by default, as well.
56     *
57     * @param fqn The fqn instance to associate with the object in the cache.
58     * @param obj aop-enabled object to be inerted into the cache. If null,
59     * it will nullify the fqn node.
60     * @param obj Return the previous content under fqn.
61     * @throws CacheException
62     */

63    Object JavaDoc putObject(String JavaDoc fqn, Object JavaDoc obj) throws CacheException;
64
65    /**
66     * Insert an aop-enabled object into the cache.
67     * It will also recursively put the any sub-object that is
68     * declared as aop-capable (i.e., in <code>jboss-aop.xml</code>).
69     * Note that <code>List</code>, <code>Map</code>, <code>Set</code>
70     * attributes are aop-enabled, by default, as well.
71     *
72     * @param fqn The fqn instance to associate with the object in the cache.
73     * @param obj aop-enabled object to be inerted into the cache. If null,
74     * it will nullify the fqn node.
75     * @param obj Return the previous content under fqn.
76     * @throws CacheException
77     */

78    Object JavaDoc putObject(Fqn fqn, Object JavaDoc obj) throws CacheException;
79
80    /**
81     * Remove aop-enabled object from the cache.
82     *
83     * @param fqn Instance that associates with this node.
84     * @return Original value object from this node.
85     * @throws CacheException
86     */

87    Object JavaDoc removeObject(String JavaDoc fqn) throws CacheException;
88
89    /**
90     * Remove aop-enabled object from the cache.
91     *
92     * @param fqn Instance that associates with this node.
93     * @return Original value object from this node.
94     * @throws CacheException
95     */

96    Object JavaDoc removeObject(Fqn fqn) throws CacheException;
97 }
98
Popular Tags