KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jofti > cache > LifeCycleAdapter


1 /*
2  * Created on 08-Apr-2005
3  *
4  */

5 package com.jofti.cache;
6
7 import java.util.Properties JavaDoc;
8
9 import com.jofti.core.InternalIndex;
10 import com.jofti.exception.JoftiException;
11
12 /**
13  
14  *
15  * Lifecycle events to enable the indexManager to manage caches.<p>
16  *
17  ** @author Steve Woodcock (steve@jofti.com)<p>
18  */

19 public interface LifeCycleAdapter {
20
21     
22     /**
23      * Returns the name of the adapter.
24      * @return - the adpater name.
25      */

26     public String JavaDoc getName();
27     
28     
29     /**
30      * Sets a name into the adpater. The name is used to uniquely identify an Index in the index manager and
31      * is used to obtain the named Cache from the Cache implementation.
32      * @param name
33      */

34     public void setName(String JavaDoc name);
35     
36     /**
37      * Initialises the adapter. This is called as part of the IndexManager's initialisation as it instantiates each of the
38      * configured Caches, or when an Index is added to the manager. The adpater is responsible for initialising the Cache (if
39      * necessary) and the Index for that Cache instance. <p>
40      * This method will always be called on a new adapter.</p>
41      *
42      * @param properties The initialisation properties to start the Adapter.
43      * @throws JoftiException
44      */

45     public void init(Properties JavaDoc properties) throws JoftiException;
46     
47     /**
48      * Called after the initialisation method by the IndexManager on a new Adapter (either configured or added). The adapter can
49      * provide an empty initialisation if required. Typically this method is used to Index all the exisiting (if any) entries in an existing Cache
50      * when an Adapter is added to the Manager.</p>
51      * @throws JoftiException
52      */

53     public void start() throws JoftiException;
54     
55     
56      /**
57       * Called by the IndexManager to destroy a Cache. This should not be called directly on the Index as it does not remove the
58       * Index from the set of registered Indexes in the manager. </p>
59       * The method should result in the Index removing all values it has indexed for a Cache and aslo attempt to destro (or shutdown)
60       * the Cache implementation. </p>
61       * Once called the Index instance is noi longer useable.
62      * @throws JoftiException
63      */

64     public void destroy() throws JoftiException;
65      
66     
67      /**
68       * Sets the real Index into the adapter.
69      * @param index
70      */

71     public void setInternalIndex(InternalIndex index);
72      
73 }
74
Popular Tags