本文整理汇总了Java中org.apache.ivy.core.module.descriptor.ModuleDescriptor.getConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Java ModuleDescriptor.getConfiguration方法的具体用法?Java ModuleDescriptor.getConfiguration怎么用?Java ModuleDescriptor.getConfiguration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ivy.core.module.descriptor.ModuleDescriptor
的用法示例。
在下文中一共展示了ModuleDescriptor.getConfiguration方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveTargetConfigurations
import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入方法依赖的package包/类
public Set<ConfigurationMetaData> resolveTargetConfigurations(DependencyMetaData dependencyMetaData, ConfigurationMetaData fromConfiguration, ComponentResolveMetaData targetComponent) {
// TODO - resolve directly to config meta data
ModuleDescriptor targetDescriptor = targetComponent.getDescriptor();
DependencyDescriptor dependencyDescriptor = dependencyMetaData.getDescriptor();
Set<String> targetConfigurationNames = new LinkedHashSet<String>();
for (String config : dependencyDescriptor.getModuleConfigurations()) {
if (config.equals("*") || config.equals("%")) {
collectTargetConfiguration(dependencyDescriptor, fromConfiguration, fromConfiguration.getName(), targetDescriptor, targetConfigurationNames);
} else if (fromConfiguration.getHierarchy().contains(config)) {
collectTargetConfiguration(dependencyDescriptor, fromConfiguration, config, targetDescriptor, targetConfigurationNames);
}
}
Set<ConfigurationMetaData> targets = new LinkedHashSet<ConfigurationMetaData>();
for (String targetConfigurationName : targetConfigurationNames) {
// TODO - move this down below
if (targetDescriptor.getConfiguration(targetConfigurationName) == null) {
throw new RuntimeException(String.format("Module version %s, configuration '%s' declares a dependency on configuration '%s' which is not declared in the module descriptor for %s",
fromConfiguration.getComponent().getId(), fromConfiguration.getName(),
targetConfigurationName, targetComponent.getId()));
}
ConfigurationMetaData targetConfiguration = targetComponent.getConfiguration(targetConfigurationName);
targets.add(targetConfiguration);
}
return targets;
}
示例2: collectTargetConfiguration
import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入方法依赖的package包/类
private void collectTargetConfiguration(DependencyDescriptor dependencyDescriptor, ConfigurationMetaData fromConfiguration, String mappingRhs, ModuleDescriptor targetModule, Collection<String> targetConfigs) {
String[] dependencyConfigurations = dependencyDescriptor.getDependencyConfigurations(mappingRhs, fromConfiguration.getName());
for (String target : dependencyConfigurations) {
String candidate = target;
int startFallback = candidate.indexOf('(');
if (startFallback >= 0) {
if (candidate.charAt(candidate.length() - 1) == ')') {
String preferred = candidate.substring(0, startFallback);
if (targetModule.getConfiguration(preferred) != null) {
targetConfigs.add(preferred);
continue;
}
candidate = candidate.substring(startFallback + 1, candidate.length() - 1);
}
}
if (candidate.equals("*")) {
Collections.addAll(targetConfigs, targetModule.getPublicConfigurationsNames());
continue;
}
targetConfigs.add(candidate);
}
}
示例3: resolveTargetConfigurations
import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入方法依赖的package包/类
public Set<ConfigurationMetaData> resolveTargetConfigurations(DependencyMetaData dependencyMetaData, ConfigurationMetaData fromConfiguration, ComponentMetaData targetComponent) {
// TODO - resolve directly to config meta data
ModuleDescriptor targetDescriptor = targetComponent.getDescriptor();
DependencyDescriptor dependencyDescriptor = dependencyMetaData.getDescriptor();
Set<String> targetConfigurationNames = new LinkedHashSet<String>();
for (String config : dependencyDescriptor.getModuleConfigurations()) {
if (config.equals("*") || config.equals("%")) {
collectTargetConfiguration(dependencyDescriptor, fromConfiguration, fromConfiguration.getName(), targetDescriptor, targetConfigurationNames);
} else if (fromConfiguration.getHierarchy().contains(config)) {
collectTargetConfiguration(dependencyDescriptor, fromConfiguration, config, targetDescriptor, targetConfigurationNames);
}
}
Set<ConfigurationMetaData> targets = new LinkedHashSet<ConfigurationMetaData>();
for (String targetConfigurationName : targetConfigurationNames) {
// TODO - move this down below
if (targetDescriptor.getConfiguration(targetConfigurationName) == null) {
throw new RuntimeException(String.format("Module version %s, configuration '%s' declares a dependency on configuration '%s' which is not declared in the module descriptor for %s",
fromConfiguration.getComponent().getId(), fromConfiguration.getName(),
targetConfigurationName, targetComponent.getId()));
}
ConfigurationMetaData targetConfiguration = targetComponent.getConfiguration(targetConfigurationName);
targets.add(targetConfiguration);
}
return targets;
}
示例4: testImportConfigurationsWithExtendOtherConfigs
import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入方法依赖的package包/类
@Test
public void testImportConfigurationsWithExtendOtherConfigs() throws Exception {
// import configurations and default mapping
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings,
getClass().getResource("test-configextendsothers2.xml"), true);
assertNotNull(md);
// has an 'all-public' configuration
Configuration allPublic = md.getConfiguration("all-public");
assertNotNull(allPublic);
// 'all-public' extends all other public configurations
String[] allPublicExt = allPublic.getExtends();
assertEquals(Arrays.asList("default", "test", "extra"),
Arrays.asList(allPublicExt));
}
示例5: checkDescriptor
import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入方法依赖的package包/类
protected void checkDescriptor(ComponentMetaData metaData) {
ModuleDescriptor moduleDescriptor = metaData.getDescriptor();
for (Configuration configuration : moduleDescriptor.getConfigurations()) {
for (String parent : configuration.getExtends()) {
if (moduleDescriptor.getConfiguration(parent) == null) {
throw new ModuleVersionResolveException(metaData.getId(), String.format("Configuration '%s' extends unknown configuration '%s' in module descriptor for %%s.", configuration.getName(), parent));
}
}
}
}
示例6: assertConf
import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入方法依赖的package包/类
protected void assertConf(ModuleDescriptor md, String name, String desc, Visibility visibility,
String[] exts) {
Configuration conf = md.getConfiguration(name);
assertNotNull("configuration not found: " + name, conf);
assertEquals(name, conf.getName());
assertEquals(desc, conf.getDescription());
assertEquals(visibility, conf.getVisibility());
assertEquals(Arrays.asList(exts), Arrays.asList(conf.getExtends()));
}
示例7: testExtendOtherConfigs
import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入方法依赖的package包/类
@Test
public void testExtendOtherConfigs() throws Exception {
// import configurations and default mapping
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings,
getClass().getResource("test-configextendsothers1.xml"), true);
assertNotNull(md);
// has an 'all-public' configuration
Configuration allPublic = md.getConfiguration("all-public");
assertNotNull(allPublic);
// 'all-public' extends all other public configurations
String[] allPublicExt = allPublic.getExtends();
assertEquals(Arrays.asList("default", "test"), Arrays.asList(allPublicExt));
}