本文整理汇总了Java中org.apache.ivy.core.resolve.DownloadOptions类的典型用法代码示例。如果您正苦于以下问题:Java DownloadOptions类的具体用法?Java DownloadOptions怎么用?Java DownloadOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DownloadOptions类属于org.apache.ivy.core.resolve包,在下文中一共展示了DownloadOptions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: download
import org.apache.ivy.core.resolve.DownloadOptions; //导入依赖的package包/类
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
// Not much to do here - downloads are not required for workspace projects.
DownloadReport dr = new DownloadReport();
for (Artifact artifact : artifacts) {
ArtifactDownloadReport adr = new ArtifactDownloadReport(artifact);
dr.addArtifactReport(adr);
URL url = artifact.getUrl();
if (url == null || !url.getProtocol().equals("file")) {
// this is not an artifact managed by this resolver
adr.setDownloadStatus(DownloadStatus.FAILED);
return dr;
}
File f;
try {
f = new File(url.toURI());
} catch (URISyntaxException e) {
f = new File(url.getPath());
}
adr.setLocalFile(f);
adr.setDownloadStatus(DownloadStatus.NO);
adr.setSize(0);
Message.verbose("\t[IN WORKSPACE] " + artifact);
}
return dr;
}
开发者ID:apache,项目名称:ant-ivy,代码行数:26,代码来源:AntWorkspaceResolver.java
示例2: download
import org.apache.ivy.core.resolve.DownloadOptions; //导入依赖的package包/类
@Override
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
ensureConfigured();
clearArtifactAttempts();
DownloadReport dr = new DownloadReport();
for (Artifact artifact : artifacts) {
final ArtifactDownloadReport adr = new ArtifactDownloadReport(artifact);
dr.addArtifactReport(adr);
ResolvedResource artifactRef = getArtifactRef(artifact, null);
if (artifactRef != null) {
Message.verbose("\t[NOT REQUIRED] " + artifact);
ArtifactOrigin origin = new ArtifactOrigin(artifact, true, artifactRef
.getResource().getName());
File archiveFile = ((FileResource) artifactRef.getResource()).getFile();
adr.setDownloadStatus(DownloadStatus.NO);
adr.setSize(archiveFile.length());
adr.setArtifactOrigin(origin);
adr.setLocalFile(archiveFile);
} else {
adr.setDownloadStatus(DownloadStatus.FAILED);
}
}
return dr;
}
开发者ID:apache,项目名称:ant-ivy,代码行数:25,代码来源:CacheResolver.java
示例3: download
import org.apache.ivy.core.resolve.DownloadOptions; //导入依赖的package包/类
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
RepositoryCacheManager cacheManager = getRepositoryCacheManager();
clearArtifactAttempts();
DownloadReport dr = new DownloadReport();
for (Artifact artifact : artifacts) {
ArtifactDownloadReport adr = cacheManager.download(artifact, artifactResourceResolver,
downloader, getCacheDownloadOptions(options));
if (DownloadStatus.FAILED == adr.getDownloadStatus()) {
if (!ArtifactDownloadReport.MISSING_ARTIFACT.equals(adr.getDownloadDetails())) {
Message.warn("\t" + adr);
}
} else if (DownloadStatus.NO == adr.getDownloadStatus()) {
Message.verbose("\t" + adr);
} else if (LogOptions.LOG_QUIET.equals(options.getLog())) {
Message.verbose("\t" + adr);
} else {
Message.info("\t" + adr);
}
dr.addArtifactReport(adr);
checkInterrupted();
}
return dr;
}
开发者ID:apache,项目名称:ant-ivy,代码行数:25,代码来源:BasicResolver.java
示例4: download
import org.apache.ivy.core.resolve.DownloadOptions; //导入依赖的package包/类
@Override
public DownloadReport download( Artifact[] artifacts, DownloadOptions options )
{
DownloadReport report = new DownloadReport();
for ( Artifact artifact : artifacts )
{
ArtifactDownloadReport artifactReport = new ArtifactDownloadReport( artifact );
ResolutionRequest request = new ResolutionRequest();
request.setArtifact( ivy2aether( artifact ) );
ResolutionResult result = getResolver().resolve( request );
Path artifactPath = result.getArtifactPath();
if ( artifactPath != null )
{
artifactReport.setArtifactOrigin( new ArtifactOrigin( artifact, false, artifactPath.toString() ) );
artifactReport.setLocalFile( artifactPath.toFile() );
artifactReport.setDownloadStatus( DownloadStatus.SUCCESSFUL );
}
else
{
artifactReport.setDownloadStatus( DownloadStatus.FAILED );
}
report.addArtifactReport( artifactReport );
}
return report;
}
开发者ID:fedora-java,项目名称:xmvn,代码行数:30,代码来源:IvyResolver.java
示例5: download
import org.apache.ivy.core.resolve.DownloadOptions; //导入依赖的package包/类
@Override
public ArtifactDownloadReport download(ArtifactOrigin artifact, DownloadOptions options) {
if (artifact.getArtifact().isMetadata()) {
return ivyResolver.download(artifact, options);
} else {
return artifactResolver.download(artifact, options);
}
}
开发者ID:apache,项目名称:ant-ivy,代码行数:9,代码来源:DualResolver.java
示例6: locate
import org.apache.ivy.core.resolve.DownloadOptions; //导入依赖的package包/类
/**
* Default implementation actually download the artifact Subclasses should overwrite this to
* avoid the download
*
* @param artifact ArtifactOrigin
* @return ArtifactOrigin
*/
public ArtifactOrigin locate(Artifact artifact) {
DownloadReport dr = download(new Artifact[] {artifact}, new DownloadOptions());
if (dr == null) {
/*
* according to IVY-831, it seems that this actually happen sometime, while the
* contract of DependencyResolver says that it should never return null
*/
throw new IllegalStateException("null download report returned by " + getName() + " ("
+ getClass().getName() + ")" + " when trying to download " + artifact);
}
ArtifactDownloadReport adr = dr.getArtifactReport(artifact);
return adr.getDownloadStatus() == DownloadStatus.FAILED ? null : adr.getArtifactOrigin();
}
开发者ID:apache,项目名称:ant-ivy,代码行数:21,代码来源:AbstractResolver.java
示例7: download
import org.apache.ivy.core.resolve.DownloadOptions; //导入依赖的package包/类
@Override
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
EventManager eventManager = getEventManager();
try {
if (eventManager != null) {
repository.addTransferListener(eventManager);
}
return super.download(artifacts, options);
} finally {
if (eventManager != null) {
repository.removeTransferListener(eventManager);
}
}
}
开发者ID:apache,项目名称:ant-ivy,代码行数:15,代码来源:RepositoryResolver.java
示例8: testResolveNotZipped
import org.apache.ivy.core.resolve.DownloadOptions; //导入依赖的package包/类
@Test
public void testResolveNotZipped() throws Exception {
settings.setDefaultResolver("p2-zipped");
ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE,
"org.eclipse.e4.core.services", "1.0.0.v20120521-2346");
ResolvedModuleRevision rmr = p2ZippedResolver.getDependency(
new DefaultDependencyDescriptor(mrid, false), data);
assertNotNull(rmr);
assertEquals(mrid, rmr.getId());
assertEquals(1, rmr.getDescriptor().getAllArtifacts().length);
DownloadOptions options = new DownloadOptions();
DownloadReport report = p2ZippedResolver.download(rmr.getDescriptor().getAllArtifacts(),
options);
assertNotNull(report);
assertEquals(1, report.getArtifactsReports().length);
Artifact artifact = rmr.getDescriptor().getAllArtifacts()[0];
ArtifactDownloadReport ar = report.getArtifactReport(artifact);
assertNotNull(ar);
assertEquals(artifact, ar.getArtifact());
assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
assertNull(ar.getUnpackedLocalFile());
}
开发者ID:apache,项目名称:ant-ivy,代码行数:30,代码来源:P2DescriptorTest.java
示例9: testResolveZipped
import org.apache.ivy.core.resolve.DownloadOptions; //导入依赖的package包/类
@Test
public void testResolveZipped() throws Exception {
settings.setDefaultResolver("p2-zipped");
ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE,
"org.apache.ant", "1.8.3.v20120321-1730");
ResolvedModuleRevision rmr = p2ZippedResolver.getDependency(
new DefaultDependencyDescriptor(mrid, false), data);
assertNotNull(rmr);
assertEquals(mrid, rmr.getId());
assertEquals(2, rmr.getDescriptor().getAllArtifacts().length);
DownloadOptions options = new DownloadOptions();
DownloadReport report = p2ZippedResolver.download(rmr.getDescriptor().getAllArtifacts(),
options);
assertNotNull(report);
assertEquals(2, report.getArtifactsReports().length);
for (int i = 0; i < 2; i++) {
Artifact artifact = rmr.getDescriptor().getAllArtifacts()[i];
ArtifactDownloadReport ar = report.getArtifactReport(artifact);
assertNotNull(ar);
assertEquals(artifact, ar.getArtifact());
assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
// only the binary get unpacked
if (ar.getArtifact().getType().equals("source")) {
assertNull(ar.getUnpackedLocalFile());
} else {
assertNotNull(ar.getUnpackedLocalFile());
}
}
}
开发者ID:apache,项目名称:ant-ivy,代码行数:37,代码来源:P2DescriptorTest.java
示例10: testResolvePacked
import org.apache.ivy.core.resolve.DownloadOptions; //导入依赖的package包/类
@Test
public void testResolvePacked() throws Exception {
settings.setDefaultResolver("p2-with-packed");
ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE, "org.junit",
"4.10.0.v4_10_0_v20120426-0900");
ResolvedModuleRevision rmr = p2WithPackedResolver.getDependency(
new DefaultDependencyDescriptor(mrid, false), data);
assertNotNull(rmr);
assertEquals(mrid, rmr.getId());
assertEquals(1, rmr.getDescriptor().getAllArtifacts().length);
DownloadOptions options = new DownloadOptions();
DownloadReport report = p2WithPackedResolver.download(
rmr.getDescriptor().getAllArtifacts(), options);
assertNotNull(report);
assertEquals(1, report.getArtifactsReports().length);
Artifact artifact = rmr.getDescriptor().getAllArtifacts()[0];
ArtifactDownloadReport ar = report.getArtifactReport(artifact);
assertNotNull(ar);
assertEquals(artifact, ar.getArtifact());
assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
assertNotNull(ar.getUnpackedLocalFile());
}
开发者ID:apache,项目名称:ant-ivy,代码行数:30,代码来源:P2DescriptorTest.java
示例11: genericTestResolveDownload
import org.apache.ivy.core.resolve.DownloadOptions; //导入依赖的package包/类
private void genericTestResolveDownload(DependencyResolver resolver, ModuleRevisionId mrid)
throws ParseException {
ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid,
false), data);
assertNotNull(rmr);
assertEquals(mrid, rmr.getId());
Artifact artifact = rmr.getDescriptor().getAllArtifacts()[0];
DownloadReport report = resolver.download(new Artifact[] {artifact}, new DownloadOptions());
assertNotNull(report);
assertEquals(1, report.getArtifactsReports().length);
ArtifactDownloadReport ar = report.getArtifactReport(artifact);
assertNotNull(ar);
assertEquals(artifact, ar.getArtifact());
assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
// test to ask to download again, should use cache
report = resolver.download(new Artifact[] {artifact}, new DownloadOptions());
assertNotNull(report);
assertEquals(1, report.getArtifactsReports().length);
ar = report.getArtifactReport(artifact);
assertNotNull(ar);
assertEquals(artifact, ar.getArtifact());
assertEquals(DownloadStatus.NO, ar.getDownloadStatus());
}
开发者ID:apache,项目名称:ant-ivy,代码行数:32,代码来源:UpdateSiteResolverTest.java
示例12: testDownloadWithDual
import org.apache.ivy.core.resolve.DownloadOptions; //导入依赖的package包/类
@Test
public void testDownloadWithDual() {
ChainResolver chain = new ChainResolver();
chain.setName("chain");
chain.setSettings(settings);
chain.setDual(true);
// first resolver has only an artifact pattern which don't lead to anything: it won't find
// the module
FileSystemResolver resolver = new FileSystemResolver();
resolver.setName("1");
resolver.setSettings(settings);
resolver.addArtifactPattern(settings.getBaseDir()
+ "/test/repositories/nowhere/[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
chain.add(resolver);
resolver = new FileSystemResolver();
resolver.setName("2");
resolver.setSettings(settings);
resolver.addIvyPattern(settings.getBaseDir()
+ "/test/repositories/1/[organisation]/[module]/ivys/ivy-[revision].xml");
resolver.addArtifactPattern(settings.getBaseDir()
+ "/test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
chain.add(resolver);
settings.addResolver(chain);
MockMessageLogger mockLogger = new MockMessageLogger();
IvyContext.getContext().getIvy().getLoggerEngine().setDefaultLogger(mockLogger);
DownloadReport report = chain.download(
new Artifact[] {new DefaultArtifact(ModuleRevisionId.parse("org1#mod1.1;1.0"),
new Date(), "mod1.1", "jar", "jar")}, new DownloadOptions());
assertNotNull(report);
assertEquals(1, report.getArtifactsReports().length);
assertEquals(DownloadStatus.SUCCESSFUL, report.getArtifactsReports()[0].getDownloadStatus());
mockLogger.assertLogDoesntContain("[FAILED ] org1#mod1.1;1.0!mod1.1.jar");
}
开发者ID:apache,项目名称:ant-ivy,代码行数:40,代码来源:ChainResolverTest.java
示例13: testDownloadWithUseOriginIsTrue
import org.apache.ivy.core.resolve.DownloadOptions; //导入依赖的package包/类
@Test
public void testDownloadWithUseOriginIsTrue() throws Exception {
URLResolver resolver = new URLResolver();
resolver.setSettings(settings);
String rootpath = new File("test/repositories/1").toURI().toURL().toExternalForm();
resolver.addIvyPattern(rootpath + "/[organisation]/[module]/ivys/ivy-[revision].xml");
resolver.addArtifactPattern(rootpath
+ "/[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
resolver.setName("test");
((DefaultRepositoryCacheManager) resolver.getRepositoryCacheManager()).setUseOrigin(true);
assertEquals("test", resolver.getName());
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.1", "1.0");
ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid,
false), data);
assertNotNull(rmr);
assertEquals(mrid, rmr.getId());
Date pubdate = new GregorianCalendar(2004, 10, 1, 11, 0, 0).getTime();
assertEquals(pubdate, rmr.getPublicationDate());
// test to ask to download
DefaultArtifact artifact = new DefaultArtifact(mrid, pubdate, "mod1.1", "jar", "jar");
DownloadReport report = resolver.download(new Artifact[] {artifact}, new DownloadOptions());
assertNotNull(report);
assertEquals(1, report.getArtifactsReports().length);
ArtifactDownloadReport ar = report.getArtifactReport(artifact);
assertNotNull(ar);
assertEquals(artifact, ar.getArtifact());
assertEquals(DownloadStatus.NO, ar.getDownloadStatus());
}
开发者ID:apache,项目名称:ant-ivy,代码行数:35,代码来源:URLResolverTest.java
示例14: download
import org.apache.ivy.core.resolve.DownloadOptions; //导入依赖的package包/类
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
DownloadReport dr = new DownloadReport();
for (Artifact artifact : artifacts) {
dr.addArtifactReport(new ArtifactDownloadReport(artifact));
}
return dr;
}
开发者ID:apache,项目名称:ant-ivy,代码行数:8,代码来源:MockResolver.java
示例15: download
import org.apache.ivy.core.resolve.DownloadOptions; //导入依赖的package包/类
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
IvyContext context = IvyContext.getContext();
Map<Artifact, Artifact> workspaceArtifacts = context.get(IVYDE_WORKSPACE_ARTIFACTS);
Map<Artifact, ArtifactDownloadReport> workspaceReports = null;
if (workspaceArtifacts != null) {
workspaceReports = new HashMap<>();
context.set(IVYDE_WORKSPACE_ARTIFACT_REPORTS, workspaceReports);
}
// Not much to do here - downloads are not required for workspace projects.
DownloadReport dr = new DownloadReport();
for (Artifact artifact : artifacts) {
ArtifactDownloadReport adr = new ArtifactDownloadReport(artifact);
dr.addArtifactReport(adr);
// Only report java projects as downloaded
if (artifact.getType().equals(ECLIPSE_PROJECT_TYPE)) {
adr.setDownloadStatus(DownloadStatus.NO);
adr.setSize(0);
Message.verbose("\t[IN WORKSPACE] " + artifact);
} else if (workspaceArtifacts != null && workspaceArtifacts.containsKey(artifact)) {
adr.setDownloadStatus(DownloadStatus.NO);
adr.setSize(0);
// there is some 'forced' artifact by the dependency descriptor
Artifact eclipseArtifact = workspaceArtifacts.get(artifact);
ArtifactDownloadReport eclipseAdr = new ArtifactDownloadReport(eclipseArtifact);
eclipseAdr.setDownloadStatus(DownloadStatus.NO);
eclipseAdr.setSize(0);
workspaceReports.put(artifact, eclipseAdr);
Message.verbose("\t[IN WORKSPACE] " + eclipseArtifact);
} else {
adr.setDownloadStatus(DownloadStatus.FAILED);
Message.verbose("\t[Eclipse Workspace resolver] "
+ "cannot download non-project artifact: " + artifact);
}
}
return dr;
}
开发者ID:apache,项目名称:ant-ivyde,代码行数:38,代码来源:WorkspaceResolver.java
示例16: download
import org.apache.ivy.core.resolve.DownloadOptions; //导入依赖的package包/类
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
throw new UnsupportedOperationException("A Maven deployer cannot be used to resolve dependencies. It can only be used to publish artifacts.");
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:4,代码来源:AbstractMavenResolver.java
示例17: download
import org.apache.ivy.core.resolve.DownloadOptions; //导入依赖的package包/类
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
throw new UnsupportedOperationException();
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:4,代码来源:LoopbackDependencyResolver.java
示例18: download
import org.apache.ivy.core.resolve.DownloadOptions; //导入依赖的package包/类
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
// This is never used
throw new UnsupportedOperationException();
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:5,代码来源:LegacyDependencyResolver.java
示例19: download
import org.apache.ivy.core.resolve.DownloadOptions; //导入依赖的package包/类
public ArtifactDownloadReport download(Artifact artifact, File cache, boolean useOrigin) {
Message.deprecated("using cache and useOrigin when calling download is not supported anymore");
return ivy.getResolveEngine().download(artifact, new DownloadOptions());
}
开发者ID:apache,项目名称:ant-ivy,代码行数:5,代码来源:Ivy14.java
示例20: download
import org.apache.ivy.core.resolve.DownloadOptions; //导入依赖的package包/类
@Override
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
ensureArtifactConfigured(getSettings());
return super.download(artifacts, options);
}
开发者ID:apache,项目名称:ant-ivy,代码行数:6,代码来源:IvyRepResolver.java
注:本文中的org.apache.ivy.core.resolve.DownloadOptions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论