本文整理了Java中org.apache.karaf.features.Feature.getDependencies()
方法的一些代码示例,展示了Feature.getDependencies()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Feature.getDependencies()
方法的具体详情如下:
包路径:org.apache.karaf.features.Feature
类名称:Feature
方法名:getDependencies
暂无
代码示例来源:origin: org.opendaylight.controller/config-persister-feature-adapter
/**
* @return
* @see org.apache.karaf.features.Feature#getDependencies()
*/
@Override
public List<Dependency> getDependencies() {
return feature.getDependencies();
}
代码示例来源:origin: apache/karaf
@Override
public List<Dependency> getDependencies() {
return this.feature.getDependencies();
}
代码示例来源:origin: apache/karaf
private void displayDependencyInformation(Feature feature, String contentType) {
List<Dependency> dependencies = feature.getDependencies();
if (dependencies.isEmpty()) {
System.out.println(contentType + " has no dependencies.");
} else {
System.out.println(contentType + " depends on:");
for (Dependency featureDependency : dependencies) {
System.out.println(INDENT + featureDependency.getName() + " " + featureDependency.getVersion());
}
}
}
代码示例来源:origin: org.apache.karaf.features/org.apache.karaf.features.command
private void displayDependencyInformation(Feature feature, String contentType) {
List<Dependency> dependencies = feature.getDependencies();
if (dependencies.isEmpty()) {
System.out.println(contentType + " has no dependencies.");
} else {
System.out.println(contentType + " depends on:");
for (Dependency featureDependency : dependencies) {
System.out.println(INDENT + featureDependency.getName() + " " + featureDependency.getVersion());
}
}
}
代码示例来源:origin: apache/karaf
private Set<Feature> getFeatures(Map<String, Feature> featureMap, List<String> features, int depth) {
Set<Feature> featureSet = new HashSet<>();
if (depth > 5) {
// Break after some recursions to avoid endless loops
return featureSet;
}
if (features == null) {
featureSet.addAll(featureMap.values());
return featureSet;
}
for (String featureName : features) {
Feature feature = featureMap.get(featureName);
if (feature == null) {
System.out.println("Feature " + featureName + " not found in repository.");
//throw new RuntimeException();
} else {
featureSet.add(feature);
List<Dependency> deps = feature.getDependencies();
List<String> depNames = new ArrayList<>();
for (Dependency dependency : deps) {
depNames.add(dependency.getName());
}
featureSet.addAll(getFeatures(featureMap, depNames, depth ++));
}
}
return featureSet;
}
代码示例来源:origin: io.fabric8/fabric-features-service
/**
* Adds {@link Feature} and its dependencies to the set of {@link Feature}s.
*/
private void addFeatures(Feature feature, Set<Feature> features) {
if (features.contains(feature)) {
return;
}
features.add(feature);
for (Feature dependency : feature.getDependencies()) {
addFeatures(search(dependency.getName(), dependency.getVersion(), repositories.asMap().values()), features);
}
}
代码示例来源:origin: jboss-fuse/fabric8
/**
* Adds {@link Feature} and its dependencies to the set of {@link Feature}s.
*/
private void addFeatures(Feature feature, Set<Feature> features) {
if (features.contains(feature)) {
return;
}
features.add(feature);
for (Feature dependency : feature.getDependencies()) {
addFeatures(search(dependency.getName(), dependency.getVersion(), repositories.asMap().values()), features);
}
}
代码示例来源:origin: org.apache.karaf.features/org.apache.karaf.features.obr
/**
* get all bundles from a given feature, including the bundles from dependency
* features
*
* @param feature
*/
public List<BundleInfo> getAllBundles(Feature feature) throws Exception {
List<BundleInfo> bundles = new ArrayList<BundleInfo>();
bundles.addAll(feature.getBundles());
for (Dependency dependency : feature.getDependencies()) {
Feature dependencyfeature = getFeaturesService().getFeature(dependency.getName(), dependency.getVersion());
bundles.addAll(getAllBundles(dependencyfeature));
}
return bundles;
}
代码示例来源:origin: org.opendaylight.controller/config-persister-feature-adapter
public LinkedHashSet <? extends ChildAwareFeatureWrapper> getChildFeatures() throws Exception {
List<Dependency> dependencies = feature.getDependencies();
LinkedHashSet <ChildAwareFeatureWrapper> childFeatures = new LinkedHashSet<ChildAwareFeatureWrapper>();
if(dependencies != null) {
for(Dependency dependency: dependencies) {
Feature fi = extractFeatureFromDependency(dependency);
if(fi != null) {
if(featuresService.getFeature(fi.getName(), fi.getVersion()) == null) {
LOG.warn("Feature: {}, {} is missing from features service. Skipping", fi.getName(), fi.getVersion());
} else {
ChildAwareFeatureWrapper wrappedFeature = new ChildAwareFeatureWrapper(fi,featuresService);
childFeatures.add(wrappedFeature);
}
}
}
}
return childFeatures;
}
代码示例来源:origin: apache/karaf
private void doCollectPrerequisites(Set<String> prereqs) {
for (Subsystem child : children) {
child.doCollectPrerequisites(prereqs);
}
if (feature != null) {
boolean match = false;
for (String prereq : prereqs) {
String[] p = prereq.split("/");
if (feature.getName().equals(p[0])
&& VersionRange.parseVersionRange(p[1]).contains(Version.parseVersion(feature.getVersion()))) {
// our feature is already among prerequisites, so ...
match = true;
break;
}
}
// ... we won't be adding its prerequisites - they'll be handled after another PartialDeploymentException
if (!match) {
for (Dependency dep : feature.getDependencies()) {
if (dep.isPrerequisite()) {
prereqs.add(dep.toString());
}
}
}
}
}
代码示例来源:origin: apache/karaf
public JmxFeature(Feature feature, boolean installed, boolean required) {
try {
String[] itemNames = FeaturesServiceMBean.FEATURE;
Object[] itemValues = new Object[itemNames.length];
itemValues[0] = feature.getName();
itemValues[1] = feature.getVersion();
itemValues[2] = getDependencyIdentifierTable(feature.getDependencies());
itemValues[3] = getBundleUris(feature.getBundles());
itemValues[4] = getConfigList(feature.getConfigurations());
itemValues[5] = getConfigFileList(feature.getConfigurationFiles());
itemValues[6] = installed;
itemValues[7] = feature.isBlacklisted();
itemValues[8] = required;
data = new CompositeDataSupport(FEATURE, itemNames, itemValues);
} catch (OpenDataException e) {
throw new IllegalStateException("Cannot form feature open data", e);
}
}
代码示例来源:origin: apache/karaf
/**
* checks if all required features are available
* @param featureRepos the repositories within the kar
* @return <code>null</code> if the contained features have no unresolvable dependencies. Otherwise the first missing dependency
* @throws Exception
*/
private Dependency findMissingDependency(List<URI> featureRepos)
throws Exception {
for (URI uri : featureRepos) {
Feature[] includedFeatures = featuresService.getRepository(uri).getFeatures();
for (Feature includedFeature : includedFeatures) {
List<Dependency> dependencies = includedFeature.getDependencies();
for (Dependency dependency : dependencies) {
Feature feature = featuresService.getFeature(dependency.getName(), dependency.getVersion());
if(feature==null)
{
return dependency;
}
}
}
}
return null;
}
代码示例来源:origin: apache/karaf
List<Dependency> dependencies = resolved.getDependencies();
for (Dependency toDisplay : dependencies) {
unresolved += displayFeatureTree(admin, toDisplay.getName(), toDisplay.getVersion(), prefix);
代码示例来源:origin: org.apache.karaf.features/org.apache.karaf.features.command
List<Dependency> dependencies = resolved.getDependencies();
for (Dependency toDisplay : dependencies) {
unresolved += displayFeatureTree(admin, toDisplay.getName(), toDisplay.getVersion(), prefix);
代码示例来源:origin: apache/karaf
for (Dependency dep : feature.getDependencies()) {
if (dep.isBlacklisted()) {
continue;
代码示例来源:origin: apache/karaf
for (final Dependency dependency : feature.getDependencies()) {
final Feature dFeature = featuresService.getFeature(dependency.getName(), dependency.getVersion());
if (dFeature != null) {
代码示例来源:origin: org.apache.karaf.features/org.apache.karaf.features.command
for (final Dependency dependency : feature.getDependencies()) {
final Feature dFeature = featuresService.getFeature(dependency.getName(), dependency.getVersion());
if (dFeature != null) {
代码示例来源:origin: apache/karaf
/**
* Constructs {@link Resource} for given non-conditional feature.
*/
public static FeatureResource build(Feature feature, String featureRange, Map<String, ? extends Resource> locToRes) throws BundleException {
FeatureResource resource = new FeatureResource(feature);
for (BundleInfo info : feature.getBundles()) {
if (!info.isDependency() && !info.isBlacklisted()) {
Resource res = locToRes.get(info.getLocation());
if (res == null) {
throw new IllegalStateException("Resource not found for url " + info.getLocation());
}
addIdentityRequirement(resource, res);
}
}
for (Dependency dep : feature.getDependencies()) {
if (!dep.isDependency() && !dep.isBlacklisted()) {
addDependency(resource, dep, featureRange);
}
}
for (org.apache.karaf.features.Capability cap : feature.getCapabilities()) {
resource.addCapabilities(ResourceBuilder.parseCapability(resource, cap.getValue()));
}
for (org.apache.karaf.features.Requirement req : feature.getRequirements()) {
resource.addRequirements(ResourceBuilder.parseRequirement(resource, req.getValue()));
}
return resource;
}
内容来源于网络,如有侵权,请联系作者删除!