[KARAF-5359] Upgrade to JLine 3.5.1
[karaf.git] / features / core / src / main / java / org / apache / karaf / features / FeaturesService.java
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.apache.karaf.features;
18
19 import java.net.URI;
20 import java.util.EnumSet;
21 import java.util.Map;
22 import java.util.Set;
23
24 /**
25 * The service managing features repositories.
26 */
27 public interface FeaturesService {
28
29 String ROOT_REGION = "root";
30
31 String UPDATE_SNAPSHOTS_NONE = "none";
32 String UPDATE_SNAPSHOTS_CRC = "crc";
33 String DEFAULT_UPDATE_SNAPSHOTS = UPDATE_SNAPSHOTS_CRC;
34 String UPDATE_SNAPSHOTS_ALWAYS = "always";
35
36 String DEFAULT_FEATURE_RESOLUTION_RANGE = "${range;[====,====]}";
37 String DEFAULT_BUNDLE_UPDATE_RANGE = "${range;[==,=+)}";
38
39 String UPDATEABLE_URIS = "mvn:.*SNAPSHOT|(?!mvn:).*";
40
41 String SERVICE_REQUIREMENTS_DISABLE = "disable";
42 String SERVICE_REQUIREMENTS_DEFAULT = "default";
43 String SERVICE_REQUIREMENTS_ENFORCE = "enforce";
44
45 int DEFAULT_DOWNLOAD_THREADS = 8;
46 long DEFAULT_SCHEDULE_DELAY = 250;
47 int DEFAULT_SCHEDULE_MAX_RUN = 9;
48 long DEFAULT_REPOSITORY_EXPIRATION = 60000; // 1 minute
49
50
51 enum Option {
52 NoFailOnFeatureNotFound,
53 NoAutoRefreshManagedBundles,
54 NoAutoRefreshUnmanagedBundles,
55 NoAutoRefreshBundles,
56 NoAutoStartBundles,
57 NoAutoManageBundles,
58 Simulate,
59 Verbose
60 }
61
62 /**
63 * Validate repository contents.
64 *
65 * @param uri Repository uri.
66 * @throws Exception When validation fails.
67 */
68 void validateRepository(URI uri) throws Exception;
69
70 void addRepository(URI uri) throws Exception;
71
72 void addRepository(URI uri, boolean install) throws Exception;
73
74 void removeRepository(URI uri) throws Exception;
75
76 void removeRepository(URI uri, boolean uninstall) throws Exception;
77
78 void restoreRepository(URI uri) throws Exception;
79
80 Repository[] listRequiredRepositories() throws Exception;
81
82 Repository[] listRepositories() throws Exception;
83
84 Repository getRepository(String repoName) throws Exception;
85
86 Repository getRepository(URI uri) throws Exception;
87
88 String getRepositoryName(URI uri) throws Exception;
89
90 void setResolutionOutputFile(String outputFile);
91
92 void installFeature(String name) throws Exception;
93
94 void installFeature(String name, EnumSet<Option> options) throws Exception;
95
96 void installFeature(String name, String version) throws Exception;
97
98 void installFeature(String name, String version, EnumSet<Option> options) throws Exception;
99
100 void installFeature(Feature f, EnumSet<Option> options) throws Exception;
101
102 void installFeatures(Set<String> features, EnumSet<Option> options) throws Exception;
103
104 void installFeatures(Set<String> features, String region, EnumSet<Option> options) throws Exception;
105
106 void addRequirements(Map<String, Set<String>> requirements, EnumSet<Option> options) throws Exception;
107
108 void uninstallFeature(String name, EnumSet<Option> options) throws Exception;
109
110 void uninstallFeature(String name) throws Exception;
111
112 void uninstallFeature(String name, String version, EnumSet<Option> options) throws Exception;
113
114 void uninstallFeature(String name, String version) throws Exception;
115
116 void uninstallFeatures(Set<String> features, EnumSet<Option> options) throws Exception;
117
118 void uninstallFeatures(Set<String> features, String region, EnumSet<Option> options) throws Exception;
119
120 void removeRequirements(Map<String, Set<String>> requirements, EnumSet<Option> options) throws Exception;
121
122 void updateFeaturesState(Map<String, Map<String, FeatureState>> stateChanges, EnumSet<Option> options) throws Exception;
123
124 Feature[] listFeatures() throws Exception;
125
126 Feature[] listRequiredFeatures() throws Exception;
127
128 Feature[] listInstalledFeatures() throws Exception;
129
130 Map<String, Set<String>> listRequirements();
131
132 boolean isRequired(Feature f);
133
134 boolean isInstalled(Feature f);
135
136 Feature getFeature(String name, String version) throws Exception;
137
138 Feature getFeature(String name) throws Exception;
139
140 Feature[] getFeatures(String name, String version) throws Exception;
141
142 Feature[] getFeatures(String name) throws Exception;
143
144 void refreshRepository(URI uri) throws Exception;
145
146 URI getRepositoryUriFor(String name, String version);
147
148 String[] getRepositoryNames();
149
150 void registerListener(FeaturesListener listener);
151
152 void unregisterListener(FeaturesListener listener);
153
154 FeatureState getState(String featureId);
155
156 }