1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
package info.magnolia.module.cache.setup; |
35 |
|
|
36 |
|
import info.magnolia.module.InstallContext; |
37 |
|
import info.magnolia.module.delta.AbstractRepositoryTask; |
38 |
|
import info.magnolia.module.delta.BootstrapSingleModuleResource; |
39 |
|
import info.magnolia.module.delta.MoveNodeTask; |
40 |
|
import info.magnolia.module.delta.RenameNodeTask; |
41 |
|
import info.magnolia.module.delta.TaskExecutionException; |
42 |
|
import info.magnolia.repository.RepositoryConstants; |
43 |
|
|
44 |
|
import javax.jcr.RepositoryException; |
45 |
|
import javax.jcr.Session; |
46 |
|
|
47 |
|
import org.apache.commons.lang3.StringUtils; |
48 |
|
|
49 |
|
|
50 |
|
@link |
51 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
52 |
|
public class SupportForMultipleCacheImplementationsTask extends AbstractRepositoryTask { |
53 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
54 |
11 |
public SupportForMultipleCacheImplementationsTask() {... |
55 |
11 |
super("Install support for multiple cache implementations", "Install delegating cache factory"); |
56 |
|
} |
57 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
58 |
9 |
@Override... |
59 |
|
protected void doExecute(InstallContext installContext) throws RepositoryException, TaskExecutionException { |
60 |
9 |
final Session session = installContext.getConfigJCRSession(); |
61 |
9 |
final String newCacheFactoryName = StringUtils.substringBefore(StringUtils.lowerCase(StringUtils.substringAfterLast(session.getNode("/modules/cache/config/cacheFactory/").getProperty("class").getString(), ".")), "factory"); |
62 |
|
|
63 |
9 |
new RenameNodeTask("", RepositoryConstants.CONFIG, "/modules/cache/config", "cacheFactory", newCacheFactoryName, false).execute(installContext); |
64 |
9 |
new BootstrapSingleModuleResource("config.modules.cache.config.cacheFactory.xml").execute(installContext); |
65 |
9 |
new MoveNodeTask("", "/modules/cache/config/" + newCacheFactoryName, "/modules/cache/config/cacheFactory/delegateFactories/" + newCacheFactoryName, false).execute(installContext); |
66 |
|
} |
67 |
|
} |