1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package mnemosyne.system; |
17 |
|
|
18 |
|
import mnemosyne.core.VersionManager; |
19 |
|
import mnemosyne.core.DefaultPersistentObjectFactory; |
20 |
|
import mnemosyne.guid.RmiUidGuidGenerator; |
21 |
|
import mnemosyne.aop.aspectwerkz.AspectwerkzAopSystem; |
22 |
|
import mnemosyne.archiver.FileSystemArchiver; |
23 |
|
import org.picocontainer.MutablePicoContainer; |
24 |
|
import org.picocontainer.Parameter; |
25 |
|
import org.picocontainer.defaults.DefaultPicoContainer; |
26 |
|
import org.picocontainer.defaults.ComponentParameter; |
27 |
|
import org.picocontainer.defaults.ConstantParameter; |
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
0 |
public class PersistentSystemFactory |
33 |
|
{ |
34 |
|
public static final String DEFAULT_DATA_DIR = "data"; |
35 |
|
|
36 |
|
public PersistentSystem createPersistentSystem() |
37 |
|
{ |
38 |
0 |
return createPersistentSystem(DEFAULT_DATA_DIR); |
39 |
|
} |
40 |
|
|
41 |
|
public PersistentSystem createPersistentSystem(String dataDirectory) |
42 |
|
{ |
43 |
0 |
MutablePicoContainer pico = new DefaultPicoContainer(); |
44 |
0 |
pico.registerComponentImplementation(VersionManager.class); |
45 |
0 |
pico.registerComponentImplementation(RmiUidGuidGenerator.class); |
46 |
0 |
pico.registerComponentImplementation(AspectwerkzAopSystem.class); |
47 |
0 |
pico.registerComponentImplementation(DefaultPersistentObjectFactory.class); |
48 |
0 |
pico.registerComponentImplementation(FileSystemArchiver.class, FileSystemArchiver.class, new Parameter[] { |
49 |
|
new ComponentParameter(), class="keyword">new ComponentParameter(), |
50 |
|
new ConstantParameter(dataDirectory) |
51 |
|
}); |
52 |
0 |
pico.registerComponentImplementation(LocalPersistentSystem.class); |
53 |
0 |
return (LocalPersistentSystem) pico.getComponentInstanceOfType(LocalPersistentSystem.class); |
54 |
|
} |
55 |
|
} |