Package io.fabric8.agent.download

Examples of io.fabric8.agent.download.DownloadManager


    protected DownloadStrategy createDownloadStrategy() throws MalformedURLException {
        // lets check we're in an active profile and not in a test case that has no profile
        if (fabricService != null) {
            Container container = fabricService.getCurrentContainer();
            if (container != null) {
                final DownloadManager downloadManager = DownloadManagers.createDownloadManager(fabricService, downloadExecutor);
                return new DownloadStrategy() {
                    @Override
                    public File downloadContent(URL sourceUrl, File installDir) throws IOException {
                        DownloadFuture future = downloadManager.download(sourceUrl.toString());
                        File file = AgentUtils.waitForFileDownload(future);
                        if (file != null && file.exists() && file.isFile()) {
                            // now lest copy it to the install dir
                            File newFile = new File(installDir, file.getName());
                            Files.copy(file, newFile);
View Full Code Here


     * TODO: make this code available to hawt.io/JMX too
     */
    private File fetchArchetype(Archetype archetype) throws IOException {
        MavenConfigurationImpl config = new MavenConfigurationImpl(new PropertiesPropertyResolver(System.getProperties()), "org.ops4j.pax.url.mvn");
        config.setSettings(new MavenSettingsImpl(config.getSettingsFileUrl(), config.useFallbackRepositories()));
        DownloadManager dm = new DownloadManager(config, Executors.newSingleThreadExecutor());

        final CountDownLatch latch = new CountDownLatch(1);
        final DownloadFuture df = dm.download(String.format("mvn:%s/%s/%s", archetype.groupId, archetype.artifactId, archetype.version));
        df.addListener(new FutureListener<DownloadFuture>() {
            @Override
            public void operationComplete(DownloadFuture future) {
                latch.countDown();
            }
View Full Code Here

        updateStatus(Container.PROVISION_DOWNLOADING, null, null);
        Set<String> bundles = new LinkedHashSet<String>();
        Set<Feature> features = new LinkedHashSet<Feature>();
        bundles.addAll(profile.getBundles());

        DownloadManager downloadManager = DownloadManagers.createDownloadManager(fabric, downloadExecutor);
        AgentUtils.addFeatures(features, fabric, downloadManager, profile);
        //return AgentUtils.downloadProfileArtifacts(fabricService.get(), downloadManager, profile);
        return AgentUtils.downloadBundles(downloadManager, features, bundles,
                Collections.<String>emptySet());
    }
View Full Code Here

        return artifactKeys;
    }

    @Override
    public ArtifactFilesAdder invoke() throws Exception {
        DownloadManager downloadManager = DownloadManagers.createDownloadManager(fabric, downloadExecutor);
        Map<String, Parser> artifacts = JavaContainers.getJavaContainerArtifacts(fabric, profileList, downloadManager);
        libFileCount = 0;
        deployFileCount = 0;
        Set<Map.Entry<String, Parser>> entries = artifacts.entrySet();
        Set<String> rawUrls = artifacts.keySet();
View Full Code Here

        properties.setProperty("mvn.repositories", "http://repo1.maven.org/maven2/,http://repository.jboss.org/nexus/content/groups/fs-public/,https://repo.fusesource.com/nexus/content/repositories/ea");
        PropertiesPropertyResolver propertyResolver = new PropertiesPropertyResolver(properties);
        MavenConfigurationImpl mavenConfiguration = new MavenConfigurationImpl(propertyResolver, "mvn");
        mavenConfiguration.setSettings(new MavenSettingsImpl(getClass().getResource("maven-default-settings.xml")));

        DownloadManager manager = new DownloadManager(mavenConfiguration, Executors.newFixedThreadPool(2));

        Map<URI, Repository> repositories = new HashMap<URI, Repository>();
        AgentUtils.addRepository(manager, repositories, URI.create("mvn:org.apache.karaf.assemblies.features/standard/" + System.getProperty("karaf-version") + "/xml/features"));

        DeploymentBuilder builder = new DeploymentBuilder(manager, null, repositories.values(), 0);
View Full Code Here

        server.start();

        Properties custom = new Properties();
        custom.setProperty("org.ops4j.pax.url.mvn.proxySupport", "true");
        String settings = createMavenSettingsWithProxy(server.getConnectors()[0].getLocalPort());
        DownloadManager dm = createDownloadManager("http://relevant.not/maven2@id=central", settings, custom);

        try {
            final CountDownLatch latch = new CountDownLatch(1);
            DownloadFuture df = dm.download("mvn:x.y/z/1.0");
            df.addListener(new FutureListener<DownloadFuture>() {
                @Override
                public void operationComplete(DownloadFuture future) {
                    latch.countDown();
                }
View Full Code Here

        server.start();

        Properties custom = new Properties();
        custom.setProperty("org.ops4j.pax.url.mvn.proxySupport", "true");
        String settings = createMavenSettingsWithProxy(server.getConnectors()[0].getLocalPort());
        DownloadManager dm = createDownloadManager("http://relevant.not/maven2@id=central", settings, custom);

        try {
            final CountDownLatch latch = new CountDownLatch(1);
            DownloadFuture df = dm.download("mvn:x.y/z/1.0");
            df.addListener(new FutureListener<DownloadFuture>() {
                @Override
                public void operationComplete(DownloadFuture future) {
                    latch.countDown();
                }
View Full Code Here

        }
    }

    @Test
    public void testDownloadAlreadyDownloadedArtifact() throws Exception {
        DownloadManager dm = createDownloadManager("non-existing-settings.xml", null);
        File dir = new File(systemRepo, "x/y/z/1.0");
        dir.mkdirs();
        FileOutputStream artifact = new FileOutputStream(new File(dir, "z-1.0.jar"));
        artifact.write(new byte[] { 0x42 });
        artifact.close();

        final CountDownLatch latch = new CountDownLatch(1);
        DownloadFuture df = dm.download("mvn:x.y/z/1.0");
        df.addListener(new FutureListener<DownloadFuture>() {
            @Override
            public void operationComplete(DownloadFuture future) {
                latch.countDown();
            }
View Full Code Here

        properties.setProperty("org.ops4j.pax.url.mvn.repositories", remoteRepo);
        properties.setProperty("org.ops4j.pax.url.mvn.defaultRepositories", systemRepoUri);
        PropertiesPropertyResolver propertyResolver = new PropertiesPropertyResolver(properties);
        MavenConfigurationImpl mavenConfiguration = new MavenConfigurationImpl(propertyResolver, "org.ops4j.pax.url.mvn");
        mavenConfiguration.setSettings(new MavenSettingsImpl(mavenSettings.toURI().toURL()));
        return new DownloadManager(mavenConfiguration, Executors.newSingleThreadExecutor());
    }
View Full Code Here

            } catch (IOException e) {
                throw new MojoExecutionException("Unable to load additional metadata from " + additionalMetadata, e);
            }
        }

        DownloadManager manager;
        final Map<String, Repository> repositories;
        Map<String, Feature[]> allFeatures = new HashMap<>();
        try {
            DictionaryPropertyResolver propertyResolver = new DictionaryPropertyResolver(properties);
            MavenConfigurationImpl config = new MavenConfigurationImpl(propertyResolver, "org.ops4j.pax.url.mvn");
            config.setSettings(new MavenSettingsImpl(config.getSettingsFileUrl(), config.useFallbackRepositories()));
            manager = new DownloadManager(config, executor);
            repositories = loadRepositories(manager, descriptors);
            for (String repoUri : repositories.keySet()) {
                Feature[] features = repositories.get(repoUri).getFeatures();
                // Ack features to inline configuration files urls
                for (Feature feature : features) {
View Full Code Here

TOP

Related Classes of io.fabric8.agent.download.DownloadManager

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.