KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > perseus > TPMTest


1 /**
2  * Copyright (C) 2003-2004
3  * - France Telecom R&D
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Release: 1.0
20  *
21  * Authors: Olivier Lobry (olivier.lobry@rd.francetelecom.com)
22  *
23  */

24
25 package org.objectweb.perseus;
26
27 import org.objectweb.perseus.cache.api.CacheEntryFactory;
28 import org.objectweb.perseus.cache.lib.BasicCacheManager;
29 import org.objectweb.perseus.cache.replacement.lib.AbstractReplacementManager;
30 import org.objectweb.perseus.persistence.api.MemoryInstanceManager;
31 import org.objectweb.perseus.persistence.api.StateManager;
32 import org.objectweb.perseus.persistence.api.StorageManager;
33 import org.objectweb.perseus.persistence.api.WorkingSetManager;
34 import org.objectweb.perseus.persistence.lib.TransactionalPersistenceManagerImpl;
35 import org.objectweb.perseus.concurrency.api.ConcurrencyManager;
36 import org.objectweb.perseus.dependency.lib.BasicDependencyGraph;
37 import org.objectweb.fractal.api.control.BindingController;
38
39 public class TPMTest extends TransactionalPersistenceManagerImpl {
40
41     protected CacheEntryFactory cef;
42
43
44     public TPMTest(ConcurrencyManager cm, AbstractReplacementManager rm) throws Exception JavaDoc {
45         super();
46         StorageManager storageMgr = new StorageManagerTestImpl();
47         StateManager stateMgr = new StateManagerTestImpl();
48         MemoryInstanceManager aMim = new MemoryInstanceManagerTestImpl();
49         WorkingSetManager wsMgr = new WorkingSetManagerTestImpl();
50         BasicCacheManager cache = new BasicCacheManager();
51         BasicDependencyGraph dg = new BasicDependencyGraph();
52
53         bindFc(CACHE_MANAGER_BINDING, cache);
54         bindFc(CONCURRENCY_MANAGER_BINDING, cm);
55         bindFc(STORAGE_MANAGER_BINDING, storageMgr);
56         bindFc(MEMORY_INSTANCE_MANAGER_BINDING, aMim);
57         bindFc(UNBIND_MANAGER_BINDING, rm);
58         bindFc(WORKINGSET_MANAGER_BINDING, wsMgr);
59         bindFc("logger", LogBoot.getLoggerFactory().getLogger("tpm"));
60         bindFc(STATE_MANAGER_BINDING, stateMgr);
61
62         // CM bindings
63
((BindingController) cm).bindFc("dependency-graph", dg);
64         ((BindingController) cm).bindFc("storage-manager", storageMgr);
65         ((BindingController) cm).bindFc("state-manager", stateMgr);
66         ((BindingController) cm).bindFc("logger", LogBoot.getLoggerFactory().getLogger("tpm.cm"));
67
68         // cache bindingd
69
cache.bindFc(BasicCacheManager.CACHE_ENTRY_FACTORY_BINDING, new CacheEntryFactoryTestImpl());
70         cache.bindFc(BasicCacheManager.CACHE_LISTENER_BINDING, stateMgr);
71         cache.bindFc("logger", LogBoot.getLoggerFactory().getLogger("tpm.cache"));
72         cache.bindFc(BasicCacheManager.REPLACEMENT_MANAGER_BINDING, rm);
73         cache.startFc();
74
75         // Rep manager bidings
76
rm.bindFc("logger", LogBoot.getLoggerFactory().getLogger("tpm.rm"));
77         rm.bindFc(AbstractReplacementManager.UNBIND_MANAGER_BINDING, cache);
78
79     }
80
81 }
82
Popular Tags