本文整理汇总了Java中org.apache.ivy.plugins.repository.Repository类的典型用法代码示例。如果您正苦于以下问题:Java Repository类的具体用法?Java Repository怎么用?Java Repository使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Repository类属于org.apache.ivy.plugins.repository包,在下文中一共展示了Repository类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: putAll
import org.apache.ivy.plugins.repository.Repository; //导入依赖的package包/类
private void putAll(Path source, String destination, boolean overwrite, boolean signIfneeded) {
final String[] checksums = this.resolver.getChecksumAlgorithms();
final Repository repository = this.resolver.getRepository();
try {
final String dest = completePath(destination);
JkLog.info("publishing to " + dest);
repository.put(null, source.toFile(), dest, overwrite);
for (final String algo : checksums) {
final Path temp = Files.createTempFile("jk-checksum-", algo);
final String checkSum = ChecksumHelper.computeAsString(source.toFile(), algo);
Files.write(temp, checkSum.getBytes());
final String csDest = dest + "." + algo;
JkLog.info("publishing to " + csDest);
repository.put(null, temp.toFile(), csDest, overwrite);
Files.deleteIfExists(temp);
}
if (this.checkFileFlag.pgpSigner != null && signIfneeded) {
final Path signed = checkFileFlag.pgpSigner.sign(source)[0];
final String signedDest = destination + ".asc";
putAll(signed, signedDest, overwrite, false);
}
} catch (final IOException e) {
throw new UncheckedIOException(e);
}
}
示例2: getResource
import org.apache.ivy.plugins.repository.Repository; //导入依赖的package包/类
public Resource getResource(String source) throws IOException {
for (Repository repository : repositories) {
logTry(repository);
try {
Resource r = repository.getResource(source);
if (r != null && r.exists()) {
logSuccess(repository);
return r;
}
} catch (Exception e) {
logFailed(repository, e);
}
}
// resource that basically doesn't exists
return new BasicResource(source, false, 0, 0, true);
}
示例3: get
import org.apache.ivy.plugins.repository.Repository; //导入依赖的package包/类
public void get(String source, File destination) throws IOException {
for (Repository repository : repositories) {
logTry(repository);
boolean ok = false;
try {
repository.get(source, destination);
ok = true;
} catch (Exception e) {
logFailed(repository, e);
}
if (ok) {
logSuccess(repository);
return;
}
}
throw newIOEFail("copy " + source + " into " + destination);
}
示例4: setRepositories
import org.apache.ivy.plugins.repository.Repository; //导入依赖的package包/类
public void setRepositories(List<Repository> repositories) {
this.repositories = repositories;
}
示例5: logTry
import org.apache.ivy.plugins.repository.Repository; //导入依赖的package包/类
private void logTry(Repository repository) {
Message.debug("Mirrored repository " + getName() + ": trying " + repository.getName());
}
示例6: logFailed
import org.apache.ivy.plugins.repository.Repository; //导入依赖的package包/类
private void logFailed(Repository repository, Exception e) {
Message.warn("Mirrored repository " + getName() + ": " + repository.getName()
+ " is not available", e);
Message.warn("Trying the next one in the mirror list...");
}
示例7: logSuccess
import org.apache.ivy.plugins.repository.Repository; //导入依赖的package包/类
private void logSuccess(Repository repository) {
Message.debug("Mirrored repository " + getName() + ": success with " + repository.getName());
}
示例8: listResources
import org.apache.ivy.plugins.repository.Repository; //导入依赖的package包/类
@Override
protected ResolvedResource[] listResources(Repository repository, ModuleRevisionId mrid,
String pattern, Artifact artifact) {
if (shouldUseMavenMetadata(pattern)) {
List<String> revs = listRevisionsWithMavenMetadata(repository, mrid.getModuleId()
.getAttributes());
if (revs != null) {
Message.debug("\tfound revs: " + revs);
List<ResolvedResource> rres = new ArrayList<>();
for (String rev : revs) {
ModuleRevisionId historicalMrid = ModuleRevisionId.newInstance(mrid, rev);
String patternForRev = pattern;
if (rev.endsWith("SNAPSHOT")) {
String snapshotVersion = findTimestampedSnapshotVersion(historicalMrid);
if (snapshotVersion != null) {
patternForRev = pattern.replaceFirst("\\-\\[revision\\]", "-"
+ snapshotVersion);
}
}
String resolvedPattern = IvyPatternHelper.substitute(patternForRev,
historicalMrid, artifact);
try {
Resource res = repository.getResource(resolvedPattern);
if (res != null) {
// we do not test if the resource actually exist here, it would cause
// a lot of checks which are not always necessary depending on the usage
// which is done of the returned ResolvedResource array
rres.add(new ResolvedResource(res, rev));
}
} catch (IOException e) {
Message.warn(
"impossible to get resource from name listed by maven-metadata.xml:"
+ rres, e);
}
}
return rres.toArray(new ResolvedResource[rres.size()]);
} else {
// maven metadata not available or something went wrong,
// use default listing capability
return super.listResources(repository, mrid, pattern, artifact);
}
} else {
return super.listResources(repository, mrid, pattern, artifact);
}
}
示例9: listRevisionsWithMavenMetadata
import org.apache.ivy.plugins.repository.Repository; //导入依赖的package包/类
private List<String> listRevisionsWithMavenMetadata(Repository repository,
Map<String, String> tokenValues) {
String metadataLocation = IvyPatternHelper.substituteTokens(root
+ "[organisation]/[module]/maven-metadata.xml", tokenValues);
return listRevisionsWithMavenMetadata(repository, metadataLocation);
}
示例10: getRepository
import org.apache.ivy.plugins.repository.Repository; //导入依赖的package包/类
public Repository getRepository() {
return repository;
}
示例11: setRepository
import org.apache.ivy.plugins.repository.Repository; //导入依赖的package包/类
public void setRepository(Repository repository) {
this.repository = repository;
}
示例12: RepositoryManifestIterable
import org.apache.ivy.plugins.repository.Repository; //导入依赖的package包/类
/**
* Default constructor
*
* @param repo
* the root directory of the file system to lookup
*/
public RepositoryManifestIterable(Repository repo) {
super("");
this.repo = repo;
}
示例13: downloadRepositoryResource
import org.apache.ivy.plugins.repository.Repository; //导入依赖的package包/类
/**
* Download some repository resource and put it in the cache.
* <p>
* If the cached version is considered enough up to date, no downloading is done.
*
* @param resource the resource of the file to put in cache
* @param name the descriptive name of the resource (helps while manually looking into the
* cache files)
* @param type the type of the resource (helps while manually looking into the cache files)
* @param extension the extension of the resource (helps while manually looking into the cache
* files)
* @param options a set of options to adjust the download
* @param repository the repository which resolve the content of the resource
* @return a report indicating how the download was performed
*/
ArtifactDownloadReport downloadRepositoryResource(Resource resource, String name,
String type, String extension,
CacheResourceOptions options,
Repository repository);
示例14: listResources
import org.apache.ivy.plugins.repository.Repository; //导入依赖的package包/类
/**
* List all revisions as resolved resources for the given artifact in the given repository using
* the given pattern, and using the given mrid except its revision.
*
* @param repository
* the repository in which revisions should be located
* @param mrid
* the module revision id to look for (except revision)
* @param pattern
* the pattern to use to locate the revisions
* @param artifact
* the artifact to find
* @return an array of ResolvedResource, all pointing to a different revision of the given
* Artifact.
*/
protected ResolvedResource[] listResources(Repository repository, ModuleRevisionId mrid,
String pattern, Artifact artifact) {
return ResolverHelper.findAll(repository, mrid, pattern, artifact);
}