Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
FlavorDistributionStep | 41 | 5 | 0% | 5 | 11 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software 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 software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.extension.distribution.internal.job.step; | |
21 | ||
22 | import javax.inject.Inject; | |
23 | import javax.inject.Named; | |
24 | ||
25 | import org.xwiki.component.annotation.Component; | |
26 | import org.xwiki.component.annotation.InstantiationStrategy; | |
27 | import org.xwiki.component.descriptor.ComponentInstantiationStrategy; | |
28 | import org.xwiki.extension.ExtensionId; | |
29 | import org.xwiki.extension.repository.InstalledExtensionRepository; | |
30 | import org.xwiki.platform.flavor.FlavorManager; | |
31 | ||
32 | /** | |
33 | * Install and upgrade flavor extension. | |
34 | * | |
35 | * @version $Id: 09562890bb2ef11a0eb985a403c211239aa58e83 $ | |
36 | * @since 7.1M1 | |
37 | */ | |
38 | @Component | |
39 | @Named(FlavorDistributionStep.ID) | |
40 | @InstantiationStrategy(ComponentInstantiationStrategy.PER_LOOKUP) | |
41 | public class FlavorDistributionStep extends AbstractDistributionStep | |
42 | { | |
43 | /** | |
44 | * ID of the distribution step. | |
45 | */ | |
46 | public static final String ID = "extension.flavor"; | |
47 | ||
48 | @Inject | |
49 | private transient InstalledExtensionRepository installedRepository; | |
50 | ||
51 | /** | |
52 | * The flavor manager. | |
53 | */ | |
54 | @Inject | |
55 | private transient FlavorManager flavorManager; | |
56 | ||
57 | /** | |
58 | * Constructs a new FlavorDistributionStep. | |
59 | */ | |
60 | 0 | ![]() |
61 | { | |
62 | 0 | super(ID); |
63 | } | |
64 | ||
65 | 0 | ![]() |
66 | public void prepare() | |
67 | { | |
68 | 0 | if (getState() == null) { |
69 | 0 | ExtensionId flavor = flavorManager.getFlavorOfWiki(getWiki()); |
70 | 0 | if (flavor != null && installedRepository.getInstalledExtension(flavor).isValid(getNamespace())) { |
71 | 0 | setState(State.COMPLETED); |
72 | } | |
73 | } | |
74 | } | |
75 | } |