use of org.apache.karaf.features.Feature in project karaf by apache.
the class KarafTestSupport method assertFeatureInstalled.
public void assertFeatureInstalled(String featureName, String featureVersion) throws Exception {
Feature featureToAssert = featureService.getFeatures(featureName, featureVersion)[0];
Feature[] features = featureService.listInstalledFeatures();
for (Feature feature : features) {
if (featureToAssert.equals(feature)) {
return;
}
}
Assert.fail("Feature " + featureName + (featureVersion != null ? "/" + featureVersion : "") + " should be installed but is not");
}
use of org.apache.karaf.features.Feature in project karaf by apache.
the class FeaturesPlugin method getFeatures.
private List<ExtendedFeature> getFeatures(List<Repository> repositories) {
List<ExtendedFeature> features = new ArrayList<>();
if (featuresService == null) {
this.log.error("Features service is not available");
return features;
}
try {
for (Repository r : repositories) {
for (Feature f : r.getFeatures()) {
ExtendedFeature.State state = featuresService.isInstalled(f) ? ExtendedFeature.State.INSTALLED : ExtendedFeature.State.UNINSTALLED;
features.add(new ExtendedFeature(state, r.getName(), f));
}
}
} catch (Exception e) {
this.log.error(e.getMessage());
}
Collections.sort(features, new ExtendedFeatureComparator());
return features;
}
use of org.apache.karaf.features.Feature in project karaf by apache.
the class JmxRepository method getFeatureIdentifierTable.
static TabularData getFeatureIdentifierTable(List<Feature> features) throws OpenDataException {
TabularDataSupport table = new TabularDataSupport(JmxFeature.FEATURE_IDENTIFIER_TABLE);
for (Feature feature : features) {
String[] itemNames = new String[] { FeaturesServiceMBean.FEATURE_NAME, FeaturesServiceMBean.FEATURE_VERSION };
Object[] itemValues = new Object[] { feature.getName(), feature.getVersion() };
CompositeData ident = new CompositeDataSupport(JmxFeature.FEATURE_IDENTIFIER, itemNames, itemValues);
table.put(ident);
}
return table;
}
use of org.apache.karaf.features.Feature in project karaf by apache.
the class FeaturesServiceImpl method getDeploymentState.
private Deployer.DeploymentState getDeploymentState(State state) throws Exception {
Deployer.DeploymentState dstate = new Deployer.DeploymentState();
dstate.state = state;
FrameworkInfo info = installSupport.getInfo();
dstate.serviceBundle = info.ourBundle;
dstate.initialBundleStartLevel = info.initialBundleStartLevel;
dstate.currentStartLevel = info.currentStartLevel;
dstate.bundles = info.bundles;
// Features
dstate.features = new HashMap<>();
for (Map<String, Feature> m : getFeatures().values()) {
for (Feature feature : m.values()) {
String id = feature.getId();
dstate.features.put(id, feature);
}
}
RegionDigraph regionDigraph = installSupport.getDiGraphCopy();
dstate.bundlesPerRegion = DigraphHelper.getBundlesPerRegion(regionDigraph);
dstate.filtersPerRegion = DigraphHelper.getPolicies(regionDigraph);
return dstate;
}
use of org.apache.karaf.features.Feature in project karaf by apache.
the class FeaturesServiceImpl method createFeatureCacheInternal.
private Map<String, Map<String, Feature>> createFeatureCacheInternal() throws Exception {
Map<String, Map<String, Feature>> map = new HashMap<>();
Repository[] repos = repositories.listRepositories();
for (Repository repo : repos) {
for (Feature f : repo.getFeatures()) {
if (map.get(f.getName()) == null) {
Map<String, Feature> versionMap = new HashMap<>();
versionMap.put(f.getVersion(), f);
map.put(f.getName(), versionMap);
} else {
map.get(f.getName()).put(f.getVersion(), f);
}
}
}
return map;
}
Aggregations