Package org.apache.ivy.plugins.repository

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


        }

        String symbolicName = id.getName();
        String version = bundle.getVersion().toString();

        Resource res = new SigilIvy(extractBCP ? bundle : null, symbolicName, version);
        ref = new ResolvedResource(res, version);

        Log.debug(format("findIvyFileRef: dd=%s => ref=%s", dd, ref));
        return ref;
    }
View Full Code Here


            return null;
        }

        IBundleModelElement info = bundle.getBundleInfo();
        URI uri = info.getUpdateLocation();
        Resource res = null;

        try
        {
            URL url = (uri != null) ? uri.toURL() : bundle.getLocation().toURI().toURL();
            if (name.contains("!"))
View Full Code Here

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

            EventManager eventManager = getEventManager();
            try {
                if (eventManager != null) {
                    getRepository().addTransferListener(eventManager);
                }
                Resource obrResource = new URLResource(url);
                CacheResourceOptions options = new CacheResourceOptions();
                if (metadataTtl != null) {
                    options.setTtl(metadataTtl.longValue());
                }
                if (forceMetadataUpdate != null) {
View Full Code Here

        try {
            if (!versionMatcher.isDynamic(mrid) || isAlwaysCheckExactRevision()) {
                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;
                    if (pattern.indexOf(IvyPatternHelper.REVISION_KEY) == -1) {
                        if ("ivy".equals(artifact.getType()) || "pom".equals(artifact.getType())) {
                            // we can't determine the revision from the pattern, get it
                            // from the moduledescriptor itself
                            File temp = File.createTempFile("ivy", artifact.getExt());
                            temp.deleteOnExit();
                            repository.get(res.getName(), temp);
                            ModuleDescriptorParser parser = ModuleDescriptorParserRegistry
                                    .getInstance().getParser(res);
                            ModuleDescriptor md = parser.parseDescriptor(getParserSettings(), temp
                                    .toURI().toURL(), res, false);
                            revision = md.getRevision();
View Full Code Here

        return ResolverHelper.listTokenValues(repository, pattern, token);
    }

    protected boolean exist(String path) {
        try {
            Resource resource = repository.getResource(path);
            return resource.exists();
        } catch (IOException e) {
            Message.debug(e);
            return false;
        }
    }
View Full Code Here

    private Map<String, Resource> resourcesCache = new HashMap<String, Resource>();

    public Resource getResource(String source) throws IOException {
        source = encode(source);
        Resource res = resourcesCache.get(source);
        if (res == null) {
            URI uri;
            try {
                uri = new URI(source);
            } catch (URISyntaxException e) {
View Full Code Here

            // not an artifact resolved by this resolver
            return null;
        }
        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

        super("");
        this.repo = repo;
    }

    protected URI buildBundleURI(String location) throws IOException {
        Resource resource = repo.getResource(location);
        // We have a resource to transform into an URI, let's use some heuristics
        try {
            return new URI(resource.getName());
        } catch (URISyntaxException e) {
            return new File(resource.getName()).toURI();
        }
    }
View Full Code Here

        Iterator it = repositories.iterator();
        while (it.hasNext()) {
            Repository repository = (Repository) it.next();
            logTry(repository);
            try {
                Resource r = repository.getResource(source);
                if (r != null && r.exists()) {
                    logSuccess(repository);
                    return r;
                }
            } catch (Exception e) {
                logFailed(repository, e);
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.