Package org.apache.ivy.plugins.repository

Examples of org.apache.ivy.plugins.repository.Resource


        if (shouldUseMavenMetadata(getWholePattern())) {
            InputStream metadataStream = null;
            try {
                String metadataLocation = IvyPatternHelper.substitute(
                    root + "[organisation]/[module]/[revision]/maven-metadata.xml", mrid);
                Resource metadata = getRepository().getResource(metadataLocation);
                if (metadata.exists()) {
                    metadataStream = metadata.openStream();
                    final StringBuffer timestamp = new StringBuffer();
                    final StringBuffer buildNumer = new StringBuffer();
                    XMLHelper.parse(metadataStream, null, new ContextualSAXHandler() {
                        public void endElement(String uri, String localName, String qName)
                                throws SAXException {
View Full Code Here


        if (shouldUseMavenMetadata(getWholePattern())) {
            InputStream metadataStream = null;
            try {
                String metadataLocation = IvyPatternHelper.substitute(
                    root + "[organisation]/[module]/[revision]/maven-metadata.xml", mrid);
                Resource metadata = getRepository().getResource(metadataLocation);
                if (metadata.exists()) {
                    metadataStream = metadata.openStream();
                    final StringBuffer timestamp = new StringBuffer();
                    final StringBuffer buildNumer = new StringBuffer();
                    XMLHelper.parse(metadataStream, null, new ContextualSAXHandler() {
                        public void endElement(String uri, String localName, String qName)
                                throws SAXException {
View Full Code Here

                for (Iterator iter = revs.iterator(); iter.hasNext();) {
                    String rev = (String) iter.next();
                    String resolvedPattern = IvyPatternHelper.substitute(
                        pattern, ModuleRevisionId.newInstance(mrid, rev), artifact);
                    try {
                        Resource res = repository.getResource(resolvedPattern);
                        if ((res != null) && res.exists()) {
                            rres.add(new ResolvedResource(res, rev));
                        }
                    } catch (IOException e) {
                        Message.warn(
                            "impossible to get resource from name listed by maven-metadata.xml:"
View Full Code Here

    private List listRevisionsWithMavenMetadata(Repository repository, String metadataLocation) {
        List revs = null;
        InputStream metadataStream = null;
        try {
            Resource metadata = repository.getResource(metadataLocation);
            if (metadata.exists()) {
                Message.verbose("\tlisting revisions from maven-metadata: " + metadata);
                final List metadataRevs = new ArrayList();
                metadataStream = metadata.openStream();
                XMLHelper.parse(metadataStream, null, new ContextualSAXHandler() {
                    public void endElement(String uri, String localName, String qName)
                            throws SAXException {
                        if ("metadata/versioning/versions/version".equals(getContext())) {
                            metadataRevs.add(getText().trim());
View Full Code Here

    public ResolvedResource findArtifactRef(Artifact artifact, Date date) {
        URL url = artifact.getUrl();
        Message.verbose("\tusing url for " + artifact + ": " + url);
        logArtifactAttempt(artifact, url.toExternalForm());
        Resource resource = new URLResource(url);
        return new ResolvedResource(resource, artifact.getModuleRevisionId().getRevision());
    }
View Full Code Here

     * @param algorithm the checksum algorithm to use
     * @return true if the checksum has been successfully checked, false if the checksum wasn't available
     * @throws IOException if a checksum exist but do not match the downloaded file checksum
     */
  private boolean check(Resource resource, File dest, String algorithm) throws IOException {
    Resource csRes = resource.clone(resource.getName()+"."+algorithm);
    if (csRes.exists()) {
      Message.debug(algorithm + " file found for "+resource+": checking...");
      File csFile = File.createTempFile("ivytmp", algorithm);
      try {
        get(csRes, csFile);
        try {
View Full Code Here

public class URLRepository extends AbstractRepository {
    private RepositoryCopyProgressListener _progress = new RepositoryCopyProgressListener(this);
    private Map _resourcesCache = new HashMap();

    public Resource getResource(String source) throws IOException {
        Resource res = (Resource)_resourcesCache.get(source);
        if (res == null) {
            res = new URLResource(new URL(source));
            _resourcesCache.put(source, res);
        }
        return res;
View Full Code Here

    }

    public void get(String source, File destination) throws IOException {
        fireTransferInitiated(getResource(source), TransferEvent.REQUEST_GET);
        try {
            Resource res = getResource(source);
            long totalLength = res.getContentLength();
            if (totalLength > 0) {
                _progress.setTotalLength(new Long(totalLength));
            }
            FileUtil.copy(new URL(source), destination, _progress);
        } catch (IOException ex) {
View Full Code Here

        try {
            if (!versionMatcher.isDynamic(mrid) || alwaysCheckExactRevision) {
                String resourceName = IvyPatternHelper.substitute(pattern, mrid, artifact);
                Message.debug("\t trying "+resourceName);
                logAttempt(resourceName);
                Resource res = repository.getResource(resourceName);
                boolean reachable = res.exists();
                if (reachable) {
                  String revision = pattern.indexOf(IvyPatternHelper.REVISION_KEY) == -1? "working@"+name : mrid.getRevision();
                    return new ResolvedResource(res, revision);
                } else if (versionMatcher.isDynamic(mrid)) {
                    return findDynamicResourceUsingPattern(name, repository, strategy, versionMatcher, rmdparser, mrid, pattern, artifact, date);
View Full Code Here

        return _exists;
    }

    private void init() {
    if (!_init) {
      Resource r = _repository.resolveResource(_path);
      _contentLength = r.getContentLength();
      _lastModified = r.getLastModified();
      _exists = r.exists();
      _init = true;
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.ivy.plugins.repository.Resource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.