本文整理汇总了Java中org.apache.ivy.core.IvyContext类的典型用法代码示例。如果您正苦于以下问题:Java IvyContext类的具体用法?Java IvyContext怎么用?Java IvyContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IvyContext类属于org.apache.ivy.core包,在下文中一共展示了IvyContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getDependency
import org.apache.ivy.core.IvyContext; //导入依赖的package包/类
public ResolvedModuleRevision getDependency(final DependencyDescriptor dd, final ResolveData data) throws ParseException {
final DependencyResolver loopback = this;
return cacheLockingManager.useCache(String.format("Resolve %s", dd), new Factory<ResolvedModuleRevision>() {
public ResolvedModuleRevision create() {
DefaultBuildableComponentResolveResult result = new DefaultBuildableComponentResolveResult();
DefaultDependencyMetaData dependency = new DefaultDependencyMetaData(dd);
IvyContext ivyContext = IvyContext.pushNewCopyContext();
try {
ivyContext.setResolveData(data);
dependencyResolver.resolve(dependency, result);
} finally {
IvyContext.popContext();
}
return new ResolvedModuleRevision(loopback, loopback, result.getMetaData().getDescriptor(), null);
}
});
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:18,代码来源:LoopbackDependencyResolver.java
示例2: getDependency
import org.apache.ivy.core.IvyContext; //导入依赖的package包/类
public void getDependency(DependencyMetaData dependency, BuildableModuleVersionMetaDataResolveResult result) {
IvyContext.getContext().setResolveData(resolveData);
try {
ResolvedModuleRevision revision = resolver.getDependency(dependency.getDescriptor(), resolveData);
if (revision == null) {
LOGGER.debug("Performed resolved of module '{}' in repository '{}': not found", dependency.getRequested(), getName());
result.missing();
} else {
LOGGER.debug("Performed resolved of module '{}' in repository '{}': found", dependency.getRequested(), getName());
ModuleDescriptorAdapter metaData = new ModuleDescriptorAdapter(revision.getDescriptor());
metaData.setChanging(isChanging(revision));
result.resolved(metaData, null);
}
} catch (ParseException e) {
throw UncheckedException.throwAsUncheckedException(e);
}
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:18,代码来源:IvyDependencyResolverAdapter.java
示例3: ModuleRevisionId
import org.apache.ivy.core.IvyContext; //导入依赖的package包/类
private ModuleRevisionId(ModuleId moduleId, String branch, String revision,
Map<String, String> extraAttributes, boolean replaceNullBranchWithDefault) {
super(null, extraAttributes);
this.moduleId = moduleId;
IvyContext context = IvyContext.getContext();
this.branch = (replaceNullBranchWithDefault && branch == null)
// we test if there's already an Ivy instance loaded, to avoid loading a default one
// just to get the default branch
? (context.peekIvy() == null ? null : context.getSettings().getDefaultBranch(moduleId))
: branch;
this.revision = revision == null ? Ivy.getWorkingRevision() : normalizeRevision(revision);
setStandardAttribute(IvyPatternHelper.ORGANISATION_KEY, this.moduleId.getOrganisation());
setStandardAttribute(IvyPatternHelper.MODULE_KEY, this.moduleId.getName());
setStandardAttribute(IvyPatternHelper.BRANCH_KEY, this.branch);
setStandardAttribute(IvyPatternHelper.REVISION_KEY, this.revision);
}
开发者ID:apache,项目名称:ant-ivy,代码行数:17,代码来源:ModuleRevisionId.java
示例4: publish
import org.apache.ivy.core.IvyContext; //导入依赖的package包/类
private void publish(Artifact artifact, File src, DependencyResolver resolver, boolean overwrite)
throws IOException {
IvyContext.getContext().checkInterrupted();
// notify triggers that an artifact is about to be published
eventManager
.fireIvyEvent(new StartArtifactPublishEvent(resolver, artifact, src, overwrite));
boolean successful = false; // set to true once the publish succeeds
try {
if (src.exists()) {
resolver.publish(artifact, src, overwrite);
successful = true;
}
} finally {
// notify triggers that the publish is finished, successfully or not.
eventManager.fireIvyEvent(new EndArtifactPublishEvent(resolver, artifact, src,
overwrite, successful));
}
}
开发者ID:apache,项目名称:ant-ivy,代码行数:19,代码来源:PublishEngine.java
示例5: getPatternMatcher
import org.apache.ivy.core.IvyContext; //导入依赖的package包/类
public Matcher getPatternMatcher(ModuleRevisionId askedMrid) {
String revision = askedMrid.getRevision();
List<String> args = split(getArgs());
List<String> argValues = getRevisionArgs(revision);
if (args.size() != argValues.size()) {
return new NoMatchMatcher();
}
Map<String, String> variables = new HashMap<>();
for (String arg : args) {
variables.put(arg, argValues.get(args.indexOf(arg)));
}
String pattern = getPattern();
pattern = IvyPatternHelper.substituteVariables(pattern, variables);
PatternMatcher pMatcher = IvyContext.getContext().getSettings().getMatcher(matcher);
return pMatcher.getMatcher(pattern);
}
开发者ID:apache,项目名称:ant-ivy,代码行数:22,代码来源:Match.java
示例6: handleAllBlacklistedRevisions
import org.apache.ivy.core.IvyContext; //导入依赖的package包/类
@Override
public void handleAllBlacklistedRevisions(DependencyDescriptor dd,
Collection<ModuleRevisionId> foundBlacklisted) {
ResolveData resolveData = IvyContext.getContext().getResolveData();
Collection<IvyNode> blacklisted = new HashSet<>();
for (ModuleRevisionId mrid : foundBlacklisted) {
blacklisted.add(resolveData.getNode(mrid));
}
for (IvyNode node : blacklisted) {
IvyNodeBlacklist bdata = node.getBlacklistData(resolveData.getReport()
.getConfiguration());
handleUnsolvableConflict(bdata.getConflictParent(),
Arrays.asList(bdata.getEvictedNode(), bdata.getSelectedNode()),
bdata.getEvictedNode(), bdata.getSelectedNode());
}
}
开发者ID:apache,项目名称:ant-ivy,代码行数:18,代码来源:LatestCompatibleConflictManager.java
示例7: tearDown
import org.apache.ivy.core.IvyContext; //导入依赖的package包/类
@After
public void tearDown() {
// reset test state.
resetCounters();
// test case is finished, pop the test context off the stack.
IvyContext.getContext().pop(PublishEventsTest.class.getName());
// cleanup ivy resources
if (ivy != null) {
ivy.popContext();
ivy = null;
}
publishEngine = null;
if (dataFile != null) {
dataFile.delete();
}
dataFile = null;
ivyFile = null;
}
开发者ID:apache,项目名称:ant-ivy,代码行数:21,代码来源:PublishEventsTest.java
示例8: setUp
import org.apache.ivy.core.IvyContext; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
File f = File.createTempFile("ivycache", ".dir");
ivy = new Ivy();
ivy.configureDefault();
ivy.getLoggerEngine().setDefaultLogger(new DefaultMessageLogger(Message.MSG_DEBUG));
IvyContext.pushNewContext().setIvy(ivy);
IvySettings settings = ivy.getSettings();
f.delete(); // we want to use the file as a directory, so we delete the file itself
cacheManager = new DefaultRepositoryCacheManager();
cacheManager.setSettings(settings);
cacheManager.setBasedir(f);
artifact = createArtifact("org", "module", "rev", "name", "type", "ext");
Artifact originArtifact = createArtifact("org", "module", "rev", "name", "pom.original",
"pom");
origin = new ArtifactOrigin(originArtifact, true, "file:/some/where.pom");
cacheManager.saveArtifactOrigin(originArtifact, origin);
cacheManager.saveArtifactOrigin(artifact, origin);
}
开发者ID:apache,项目名称:ant-ivy,代码行数:24,代码来源:DefaultRepositoryCacheManagerTest.java
示例9: testErrorReport
import org.apache.ivy.core.IvyContext; //导入依赖的package包/类
@Test
public void testErrorReport() throws Exception {
BintrayResolver resolver = new BintrayResolver();
resolver.setSubject("unknown");
resolver.setRepo("unknown");
resolver.setName("test");
resolver.setM2compatible(true);
resolver.setSettings(settings);
assertEquals("test", resolver.getName());
MockMessageLogger mockMessageImpl = new MockMessageLogger();
IvyContext.getContext().getIvy().getLoggerEngine().setDefaultLogger(mockMessageImpl);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache", "commons-fileupload",
"1.0");
ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid,
false), data);
assertNull(rmr);
mockMessageImpl
.assertLogContains("trying https://dl.bintray.com/unknown/unknown/org/apache/commons-fileupload/1.0/commons-fileupload-1.0.jar");
mockMessageImpl
.assertLogContains("tried https://dl.bintray.com/unknown/unknown/org/apache/commons-fileupload/1.0/commons-fileupload-1.0.jar");
}
开发者ID:apache,项目名称:ant-ivy,代码行数:25,代码来源:BintrayResolverTest.java
示例10: testErrorReport
import org.apache.ivy.core.IvyContext; //导入依赖的package包/类
@Test
public void testErrorReport() throws Exception {
IBiblioResolver resolver = new IBiblioResolver();
resolver.setRoot("http://unknown.host.comx/");
resolver.setName("test");
resolver.setM2compatible(true);
resolver.setSettings(settings);
assertEquals("test", resolver.getName());
MockMessageLogger mockMessageImpl = new MockMessageLogger();
IvyContext.getContext().getIvy().getLoggerEngine().setDefaultLogger(mockMessageImpl);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache", "commons-fileupload",
"1.0");
ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid,
false), data);
assertNull(rmr);
mockMessageImpl
.assertLogContains("tried http://unknown.host.comx/org/apache/commons-fileupload/1.0/commons-fileupload-1.0.pom");
mockMessageImpl
.assertLogContains("tried http://unknown.host.comx/org/apache/commons-fileupload/1.0/commons-fileupload-1.0.jar");
}
开发者ID:apache,项目名称:ant-ivy,代码行数:24,代码来源:IBiblioResolverTest.java
示例11: handlePropertyAsAttribute
import org.apache.ivy.core.IvyContext; //导入依赖的package包/类
/**
* handle properties as attribute
*
* @param attributes
* a set of attributes
* @param ignoredAttributes
* a list of ignored attributes
* @param parentNode
* parent node used to apply some attributes to subelements (can be null)
* @param buildConf
* build configurations where this property should be applied (can be null)
*
*/
private void handlePropertyAsAttribute(Attributes attributes, List<String> ignoredAttributes,
AdvancedInheritableItem parentNode, String buildConf) {
for (int i = 0; i < attributes.getLength(); i++) {
if (!ignoredAttributes.contains(attributes.getQName(i))) {
String propertyName = attributes.getQName(i);
String value = IvyContext.getContext().getSettings().substitute(attributes.getValue(i));
PropertyDescriptor property = new PropertyDescriptor(propertyName);
property.setValue(value);
property.setBuildConfigurations(buildConf);
if (parentNode != null) {
property.setInheritScope(parentNode.getInheritScope());
property.setInheritable(parentNode.isInheritable());
}
easyAntModuleDescriptor.getProperties().put(propertyName, property);
}
}
}
开发者ID:apache,项目名称:ant-easyant-core,代码行数:31,代码来源:DefaultEasyAntXmlModuleDescriptorParser.java
示例12: mergeEasyantProperties
import org.apache.ivy.core.IvyContext; //导入依赖的package包/类
/**
* Merge easyant properties
*
* @param properties
* a map of properties that will be merged with current one
*/
protected void mergeEasyantProperties(Map<String, PropertyDescriptor> properties) {
for (PropertyDescriptor prop : properties.values()) {
if (prop.isInheritable()) {
IvyContext.getContext().getSettings().getVariableContainer()
.setVariable(prop.getName(), prop.getValue(), true);
StringBuilder sb = new StringBuilder("Merging property");
sb.append(prop.getName());
if (prop.getSourceModule() != null) {
sb.append(" from ").append(prop.getSourceModule().toString());
}
Message.debug(sb.toString());
easyAntModuleDescriptor.getProperties().put(prop.getName(), prop);
}
}
}
开发者ID:apache,项目名称:ant-easyant-core,代码行数:22,代码来源:DefaultEasyAntXmlModuleDescriptorParser.java
示例13: getEasyAntModuleDescriptor
import org.apache.ivy.core.IvyContext; //导入依赖的package包/类
public EasyAntModuleDescriptor getEasyAntModuleDescriptor(File moduleDescriptor) throws Exception {
if (moduleDescriptor == null) {
throw new Exception("moduleDescriptor cannot be null");
}
if (!moduleDescriptor.exists()) {
throw new Exception("imposible to find the specified module descriptor"
+ moduleDescriptor.getAbsolutePath());
}
IvyContext.pushNewContext().setIvy(ivyInstance);
// First we need to parse the specified file to retrieve all the easyant
// stuff
parser.parseDescriptor(ivyInstance.getSettings(), moduleDescriptor.toURI().toURL(), new URLResource(
moduleDescriptor.toURI().toURL()), true);
EasyAntModuleDescriptor md = parser.getEasyAntModuleDescriptor();
IvyContext.popContext();
return md;
}
开发者ID:apache,项目名称:ant-easyant-core,代码行数:18,代码来源:DefaultPluginService.java
示例14: extractDeployUrl
import org.apache.ivy.core.IvyContext; //导入依赖的package包/类
/**
* @param resolver
*/
protected void extractDeployUrl(String resolver) {
//try to get publish url if the Resolver used to publish was a IBiblioResolver
if (publishUrl == null) {
DependencyResolver dependencyResolver = IvyContext.getContext()
.getSettings().getResolver(resolver);
if (dependencyResolver instanceof IBiblioResolver) {
IBiblioResolver ibiblioResolver = (IBiblioResolver) dependencyResolver;
publishUrl = ibiblioResolver.getRoot();
} else if (dependencyResolver instanceof URLResolver) {
URLResolver urlResolver = (URLResolver) dependencyResolver;
//get the whole pattern
publishUrl = (String) urlResolver.getArtifactPatterns().get(0);
//only keep the token root
publishUrl = IvyPatternHelper.getTokenRoot(publishUrl);
}
}
}
开发者ID:apache,项目名称:ant-easyant-tasks,代码行数:22,代码来源:MavenPublishTrigger.java
示例15: withIvy
import org.apache.ivy.core.IvyContext; //导入依赖的package包/类
public <T> T withIvy(Transformer<? extends T, ? super Ivy> action) {
Integer currentDepth = depth.get();
if (currentDepth != null) {
depth.set(currentDepth + 1);
try {
return action.transform(IvyContext.getContext().getIvy());
} finally {
depth.set(currentDepth);
}
}
IvyContext.pushNewContext();
try {
depth.set(1);
try {
Ivy ivy = getIvy();
try {
IvyContext.getContext().setIvy(ivy);
return action.transform(ivy);
} finally {
releaseIvy(ivy);
}
} finally {
depth.set(null);
}
} finally {
IvyContext.popContext();
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:31,代码来源:DefaultIvyContextManager.java
示例16: getIvyContext
import org.apache.ivy.core.IvyContext; //导入依赖的package包/类
public static IvyContext getIvyContext() {
IvyContext context = IvyContext.getContext();
if (context.peekIvy() == null) {
throw new IllegalStateException("Ivy context not established");
}
return context;
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:8,代码来源:IvyContextualiser.java
示例17: ivyContextualize
import org.apache.ivy.core.IvyContext; //导入依赖的package包/类
private void ivyContextualize(IvyAwareModuleVersionRepository ivyAwareRepository, RepositoryChain userResolverChain, String configurationName) {
Ivy ivy = IvyContext.getContext().getIvy();
IvySettings ivySettings = ivy.getSettings();
LoopbackDependencyResolver loopbackDependencyResolver = new LoopbackDependencyResolver("main", userResolverChain, cacheLockingManager);
ivySettings.addResolver(loopbackDependencyResolver);
ivySettings.setDefaultResolver(loopbackDependencyResolver.getName());
ResolveData resolveData = createResolveData(ivy, configurationName);
ivyAwareRepository.setSettings(ivySettings);
ivyAwareRepository.setResolveData(resolveData);
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:12,代码来源:ResolveIvyFactory.java
示例18: listModuleVersions
import org.apache.ivy.core.IvyContext; //导入依赖的package包/类
public void listModuleVersions(DependencyMetaData dependency, BuildableModuleVersionSelectionResolveResult result) {
IvyContext.getContext().setResolveData(resolveData);
try {
ResolvedModuleRevision revision = resolver.getDependency(dependency.getDescriptor(), resolveData);
if (revision == null) {
result.listed(new DefaultModuleVersionListing());
} else {
result.listed(new DefaultModuleVersionListing(revision.getId().getRevision()));
}
} catch (ParseException e) {
throw UncheckedException.throwAsUncheckedException(e);
}
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:14,代码来源:IvyDependencyResolverAdapter.java
示例19: pushContext
import org.apache.ivy.core.IvyContext; //导入依赖的package包/类
/**
* Pushes a new IvyContext bound to this Ivy instance if the current context is not already
* bound to this Ivy instance. If the current context is already bound to this Ivy instance, it
* pushes the current context on the context stack, so that you can (and must) always call
* {@link #popContext()} when you're done.
* <p>
* Alternatively, you can use the {@link #execute(org.apache.ivy.Ivy.IvyCallback)} method which
* takes care of everything for you.
* </p>
*/
public void pushContext() {
if (IvyContext.getContext().peekIvy() != this) {
// the current Ivy context is associated with another Ivy instance, we push a new
// instance
IvyContext.pushNewContext();
IvyContext.getContext().setIvy(this);
} else {
// the current Ivy context is already associated with this Ivy instance, we only push it
// for popping consistency
IvyContext.pushContext(IvyContext.getContext());
}
}
开发者ID:apache,项目名称:ant-ivy,代码行数:23,代码来源:Ivy.java
示例20: prepareTask
import org.apache.ivy.core.IvyContext; //导入依赖的package包/类
/**
* Called when task starts its execution.
*/
protected void prepareTask() {
getProject().setProperty("ivy.version", Ivy.getIvyVersion());
// push current project and Ivy on the stack in context
IvyContext.pushNewCopyContext();
IvyContext.getContext().setIvy(getIvyInstance());
IvyContext.getContext().push(ANT_PROJECT_CONTEXT_KEY, getProject());
}
开发者ID:apache,项目名称:ant-ivy,代码行数:12,代码来源:IvyTask.java
注:本文中的org.apache.ivy.core.IvyContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论