当前位置: 首页>>代码示例>>Java>>正文


Java IvyContext类代码示例

本文整理汇总了Java中org.apache.ivy.core.IvyContext的典型用法代码示例。如果您正苦于以下问题:Java IvyContext类的具体用法?Java IvyContext怎么用?Java IvyContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IvyContext类属于org.apache.ivy.core包,在下文中一共展示了IvyContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的org.apache.ivy.core.IvyContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。