01: /*
02: * Created on 08-Apr-2005
03: *
04: */
05: package com.jofti.cache;
06:
07: import java.util.Properties;
08:
09: 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: * Returns the name of the adapter.
23: * @return - the adpater name.
24: */
25: public String getName();
26:
27: /**
28: * Sets a name into the adpater. The name is used to uniquely identify an Index in the index manager and
29: * is used to obtain the named Cache from the Cache implementation.
30: * @param name
31: */
32: public void setName(String name);
33:
34: /**
35: * Initialises the adapter. This is called as part of the IndexManager's initialisation as it instantiates each of the
36: * configured Caches, or when an Index is added to the manager. The adpater is responsible for initialising the Cache (if
37: * necessary) and the Index for that Cache instance. <p>
38: * This method will always be called on a new adapter.</p>
39: *
40: * @param properties The initialisation properties to start the Adapter.
41: * @throws JoftiException
42: */
43: public void init(Properties properties) throws JoftiException;
44:
45: /**
46: * Called after the initialisation method by the IndexManager on a new Adapter (either configured or added). The adapter can
47: * provide an empty initialisation if required. Typically this method is used to Index all the exisiting (if any) entries in an existing Cache
48: * when an Adapter is added to the Manager.</p>
49: * @throws JoftiException
50: */
51: public void start() throws JoftiException;
52:
53: /**
54: * Called by the IndexManager to destroy a Cache. This should not be called directly on the Index as it does not remove the
55: * Index from the set of registered Indexes in the manager. </p>
56: * The method should result in the Index removing all values it has indexed for a Cache and aslo attempt to destro (or shutdown)
57: * the Cache implementation. </p>
58: * Once called the Index instance is noi longer useable.
59: * @throws JoftiException
60: */
61: public void destroy() throws JoftiException;
62:
63: /**
64: * Sets the real Index into the adapter.
65: * @param index
66: */
67: public void setInternalIndex(InternalIndex index);
68:
69: }
|