Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 83572 Details for
Bug 207802
[prov] Add multi-threaded download and mirror selection into p2's artifact retrieval
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch updated to HEAD
207802.patch (text/plain), 26.90 KB, created by
Pascal Rapicault
on 2007-11-22 14:56:37 EST
(
hide
)
Description:
Patch updated to HEAD
Filename:
MIME Type:
Creator:
Pascal Rapicault
Created:
2007-11-22 14:56:37 EST
Size:
26.90 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.p2.download >Index: .settings/org.eclipse.pde.core.prefs >=================================================================== >RCS file: /cvsroot/eclipse/equinox-incubator/provisioning/org.eclipse.equinox.p2.download/.settings/org.eclipse.pde.core.prefs,v >retrieving revision 1.1 >diff -u -r1.1 org.eclipse.pde.core.prefs >--- .settings/org.eclipse.pde.core.prefs 30 Sep 2007 18:11:00 -0000 1.1 >+++ .settings/org.eclipse.pde.core.prefs 22 Nov 2007 19:53:39 -0000 >@@ -1,4 +1,5 @@ >- >+#Mon Oct 29 09:10:03 EDT 2007 > eclipse.preferences.version=1 >-pluginProject.extensions=false >+instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true >+pluginProject.extensions=true > resolve.requirebundle=false >Index: src/org/eclipse/equinox/internal/p2/download/DownloadActivator.java >=================================================================== >RCS file: /cvsroot/eclipse/equinox-incubator/provisioning/org.eclipse.equinox.p2.download/src/org/eclipse/equinox/internal/p2/download/DownloadActivator.java,v >retrieving revision 1.1 >diff -u -r1.1 DownloadActivator.java >--- src/org/eclipse/equinox/internal/p2/download/DownloadActivator.java 30 Sep 2007 18:55:17 -0000 1.1 >+++ src/org/eclipse/equinox/internal/p2/download/DownloadActivator.java 22 Nov 2007 19:53:39 -0000 >@@ -10,21 +10,27 @@ > *******************************************************************************/ > package org.eclipse.equinox.internal.p2.download; > >-import org.osgi.framework.BundleActivator; >-import org.osgi.framework.BundleContext; >+import org.eclipse.equinox.internal.p2.download.strategy.DownloadStrategyManager; >+import org.eclipse.equinox.p2.download.strategy.IDownloadStrategyManager; >+import org.osgi.framework.*; > > public class DownloadActivator implements BundleActivator { > public static final String ID = "org.eclipse.equinox.p2.download"; > > public static BundleContext context; > >+ private ServiceRegistration strategyManagerRegistration; >+ > public void start(BundleContext context) throws Exception { > DownloadActivator.context = context; >- >+ DownloadStrategyManager strategyManager = new DownloadStrategyManager(); >+ strategyManagerRegistration = context.registerService(IDownloadStrategyManager.class.getName(), strategyManager, null); > } > > public void stop(BundleContext context) throws Exception { > DownloadActivator.context = null; >+ if (strategyManagerRegistration != null) >+ strategyManagerRegistration.unregister(); >+ strategyManagerRegistration = null; > } >- > } >Index: src/org/eclipse/equinox/p2/download/DownloadManager.java >=================================================================== >RCS file: /cvsroot/eclipse/equinox-incubator/provisioning/org.eclipse.equinox.p2.download/src/org/eclipse/equinox/p2/download/DownloadManager.java,v >retrieving revision 1.5 >diff -u -r1.5 DownloadManager.java >--- src/org/eclipse/equinox/p2/download/DownloadManager.java 7 Nov 2007 21:31:55 -0000 1.5 >+++ src/org/eclipse/equinox/p2/download/DownloadManager.java 22 Nov 2007 19:53:39 -0000 >@@ -10,12 +10,12 @@ > *******************************************************************************/ > package org.eclipse.equinox.p2.download; > >-import java.util.ArrayList; >-import java.util.Iterator; >+import java.util.*; > import org.eclipse.core.runtime.*; > import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; > import org.eclipse.equinox.internal.p2.download.DownloadActivator; > import org.eclipse.equinox.p2.artifact.repository.*; >+import org.eclipse.equinox.p2.download.strategy.*; > > public class DownloadManager { > ArrayList requestsToProcess = new ArrayList(); >@@ -51,44 +51,65 @@ > try { > if (requestsToProcess.isEmpty()) > return Status.OK_STATUS; >+ >+ IDownloadStrategyManager strategyMgr = (IDownloadStrategyManager) ServiceHelper.getService(DownloadActivator.context, IDownloadStrategyManager.class.getName()); >+ IDownloadStrategy[] strategies = strategyMgr.getKnownStrategies(); >+ if (strategies.length == 0) >+ return new Status(IStatus.ERROR, DownloadActivator.ID, "No strategy available"); >+ > IArtifactRepositoryManager repoMgr = (IArtifactRepositoryManager) ServiceHelper.getService(DownloadActivator.context, IArtifactRepositoryManager.class.getName()); > IArtifactRepository[] repositories = repoMgr.getKnownRepositories(); > if (repositories.length == 0) > return new Status(IStatus.ERROR, DownloadActivator.ID, "No repository available"); >- // TODO for now ensure that we try local repos first >- if (!fetch(sortRepositories(repositories, true), subMonitor)) >- return overallStatus(monitor); >- // TODO then try the othe repositories. >- fetch(sortRepositories(repositories, false), subMonitor); >+ >+ // determine which strategies will work best for these repositories >+ StrategyRequests[] strategyRequests = determineStrategies(monitor, strategies, repositories); >+ >+ // delegate work to the various strategies >+ for (int i = 0; i < strategyRequests.length && !requestsToProcess.isEmpty() && !monitor.isCanceled(); i++) { >+ IStatus dlStatus = strategyRequests[i].process(subMonitor); >+ if (dlStatus.getSeverity() == IStatus.CANCEL) >+ return overallStatus(monitor); >+ filterUnfetched(); >+ subMonitor.setWorkRemaining(requestsToProcess.size()); >+ // notifyFetched(); >+ } > return overallStatus(monitor); > } finally { > subMonitor.done(); > } > } > >- private IArtifactRepository[] sortRepositories(IArtifactRepository[] repositories, boolean local) { >- ArrayList result = new ArrayList(repositories.length); >- for (int i = 0; i < repositories.length; i++) { >- IArtifactRepository repository = repositories[i]; >- if (local && repository.getLocation().getProtocol().equals("file")) >- result.add(repository); >- else if (!local && !repository.getLocation().getProtocol().equals("file")) >- result.add(repository); >- } >- return (IArtifactRepository[]) result.toArray(new IArtifactRepository[result.size()]); >- } >- >- private boolean fetch(IArtifactRepository[] repositories, SubMonitor monitor) { >- for (int i = 0; i < repositories.length && !requestsToProcess.isEmpty() && !monitor.isCanceled(); i++) { >+ private StrategyRequests[] determineStrategies(IProgressMonitor monitor, IDownloadStrategy[] strategies, IArtifactRepository[] repositories) { >+ StrategyRequests[] strategyRequests = new StrategyRequests[strategies.length]; >+ for (int i = 0; i < repositories.length && !monitor.isCanceled(); i++) { > IArtifactRequest[] requests = getRequestsForRepository(repositories[i]); >- IStatus dlStatus = repositories[i].getArtifacts(requests, monitor.newChild(requests.length)); >- if (dlStatus.getSeverity() == IStatus.CANCEL) >- return false; >- filterUnfetched(); >- monitor.setWorkRemaining(requestsToProcess.size()); >- // notifyFetched(); >+ if (requests.length == 0) >+ continue; >+ >+ IDownloadStrategy bestStrategy = null; >+ int strategyIdx = -1; >+ for (int j = 0; j < strategies.length; j++) { >+ if (!strategies[j].supportsRepository(repositories[i])) >+ break; >+ if (bestStrategy == null || strategies[j].isBetterThan(bestStrategy, repositories[i])) { >+ bestStrategy = strategies[j]; >+ strategyIdx = j; >+ } >+ } >+ if (bestStrategy == null) >+ continue; >+ >+ if (strategyRequests[strategyIdx] == null) >+ strategyRequests[strategyIdx] = new StrategyRequests(strategies[strategyIdx]); >+ strategyRequests[strategyIdx].queueWork(repositories[i], requests); > } >- return true; >+ >+ List toUse = new ArrayList(strategyRequests.length); >+ for (int i = 0; i < strategyRequests.length; i++) >+ if (strategyRequests[i] != null) >+ toUse.add(strategyRequests[i]); >+ return (StrategyRequests[]) toUse.toArray(new StrategyRequests[toUse.size()]); > } > > private IArtifactRequest[] getRequestsForRepository(IArtifactRepository repository) { >@@ -115,12 +136,32 @@ > if (requestsToProcess.size() == 0) > return Status.OK_STATUS; > >- MultiStatus result = new MultiStatus(DownloadActivator.ID, IStatus.OK, null, null); >+ MultiStatus result = new MultiStatus(); > for (Iterator iterator = requestsToProcess.iterator(); iterator.hasNext();) { >- IStatus failed = ((IArtifactRequest) iterator.next()).getResult(); >- if (failed != null && !failed.isOK()) >- result.add(failed); >+ IArtifactRequest failed = (IArtifactRequest) iterator.next(); >+ result.add(failed.getResult()); > } > return result; > } >-} >+ >+ private static final class StrategyRequests { >+ >+ private final IDownloadStrategy strategy; >+ private final List strategyRequests = new ArrayList(); >+ private final Set totalRequests = new HashSet(); >+ >+ StrategyRequests(IDownloadStrategy strategy) { >+ this.strategy = strategy; >+ } >+ >+ void queueWork(IArtifactRepository artifactRepository, IArtifactRequest[] requests) { >+ totalRequests.addAll(Arrays.asList(requests)); >+ strategyRequests.add(new DownloadStrategyRequests(artifactRepository, requests)); >+ } >+ >+ IStatus process(SubMonitor subMonitor) { >+ DownloadStrategyRequests requests[] = (DownloadStrategyRequests[]) strategyRequests.toArray(new DownloadStrategyRequests[strategyRequests.size()]); >+ return strategy.getArtifacts(requests, subMonitor.newChild(totalRequests.size())); >+ } >+ } >+} >\ No newline at end of file >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/equinox-incubator/provisioning/org.eclipse.equinox.p2.download/META-INF/MANIFEST.MF,v >retrieving revision 1.6 >diff -u -r1.6 MANIFEST.MF >--- META-INF/MANIFEST.MF 7 Nov 2007 01:21:05 -0000 1.6 >+++ META-INF/MANIFEST.MF 22 Nov 2007 19:53:39 -0000 >@@ -7,7 +7,8 @@ > Bundle-Version: 0.1.0.qualifier > Export-Package: org.eclipse.equinox.internal.p2.download;x-internal:=true, > org.eclipse.equinox.p2.download >-Require-Bundle: org.eclipse.equinox.common >+Require-Bundle: org.eclipse.equinox.common, >+ org.eclipse.equinox.registry > Import-Package: org.eclipse.equinox.internal.p2.core, > org.eclipse.equinox.internal.p2.core.helpers, > org.eclipse.equinox.p2.artifact.repository, >Index: src/org/eclipse/equinox/p2/download/strategy/IDownloadStrategy.java >=================================================================== >RCS file: src/org/eclipse/equinox/p2/download/strategy/IDownloadStrategy.java >diff -N src/org/eclipse/equinox/p2/download/strategy/IDownloadStrategy.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/equinox/p2/download/strategy/IDownloadStrategy.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,28 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 Genuitec, LLC and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Genuitec, LLC - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.equinox.p2.download.strategy; >+ >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.equinox.p2.artifact.repository.IArtifactRepository; >+ >+/** >+ * Provides a strategy that understands how to perform downloading from one or more >+ * repositories. >+ */ >+public interface IDownloadStrategy { >+ >+ boolean supportsRepository(IArtifactRepository artifactRepository); >+ >+ boolean isBetterThan(IDownloadStrategy other, IArtifactRepository artifactRepository); >+ >+ IStatus getArtifacts(DownloadStrategyRequests[] requests, IProgressMonitor monitor); >+} >Index: src/org/eclipse/equinox/p2/download/strategy/DownloadStrategyRequests.java >=================================================================== >RCS file: src/org/eclipse/equinox/p2/download/strategy/DownloadStrategyRequests.java >diff -N src/org/eclipse/equinox/p2/download/strategy/DownloadStrategyRequests.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/equinox/p2/download/strategy/DownloadStrategyRequests.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,33 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 Genuitec, LLC and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Genuitec, LLC - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.equinox.p2.download.strategy; >+ >+import org.eclipse.equinox.p2.artifact.repository.IArtifactRepository; >+import org.eclipse.equinox.p2.artifact.repository.IArtifactRequest; >+ >+public class DownloadStrategyRequests { >+ >+ private final IArtifactRepository artifactRepository; >+ private final IArtifactRequest[] requests; >+ >+ public DownloadStrategyRequests(IArtifactRepository artifactRepository, IArtifactRequest[] requests) { >+ this.artifactRepository = artifactRepository; >+ this.requests = requests; >+ } >+ >+ public IArtifactRepository getRepository() { >+ return artifactRepository; >+ } >+ >+ public IArtifactRequest[] getRequests() { >+ return requests; >+ } >+} >Index: plugin.xml >=================================================================== >RCS file: plugin.xml >diff -N plugin.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ plugin.xml 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,12 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<?eclipse version="3.2"?> >+<plugin> >+ <extension-point id="downloadStrategies" name="Download Strategies" schema="schema/downloadStrategies.exsd"/> >+ <extension >+ point="org.eclipse.equinox.p2.download.downloadStrategies"> >+ <strategy >+ class="org.eclipse.equinox.internal.p2.download.strategy.SimpleDownloadStrategy"> >+ </strategy> >+ </extension> >+ >+</plugin> >Index: src/org/eclipse/equinox/internal/p2/download/strategy/SimpleDownloadStrategy.java >=================================================================== >RCS file: src/org/eclipse/equinox/internal/p2/download/strategy/SimpleDownloadStrategy.java >diff -N src/org/eclipse/equinox/internal/p2/download/strategy/SimpleDownloadStrategy.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/equinox/internal/p2/download/strategy/SimpleDownloadStrategy.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,76 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 Genuitec, LLC and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Genuitec, LLC - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.equinox.internal.p2.download.strategy; >+ >+import java.util.*; >+import org.eclipse.core.runtime.*; >+import org.eclipse.equinox.p2.artifact.repository.IArtifactRepository; >+import org.eclipse.equinox.p2.artifact.repository.IArtifactRequest; >+import org.eclipse.equinox.p2.download.strategy.DownloadStrategyRequests; >+import org.eclipse.equinox.p2.download.strategy.IDownloadStrategy; >+ >+/** >+ * The simplest download strategy that can work with all repository formats >+ * and is better than no other repository -- single threaded, sequential through >+ * the various artifacts until all requests are processed. >+ */ >+public class SimpleDownloadStrategy implements IDownloadStrategy { >+ >+ public IStatus getArtifacts(DownloadStrategyRequests[] requests, IProgressMonitor monitor) { >+ >+ Set requestsToProcess = new HashSet(); >+ for (int i = 0; i < requests.length; i++) >+ requestsToProcess.addAll(Arrays.asList(requests[i].getRequests())); >+ SubMonitor subMonitor = SubMonitor.convert(monitor, "Downloading artifacts", requestsToProcess.size()); >+ >+ for (int i = 0; i < requests.length && !requestsToProcess.isEmpty() && !monitor.isCanceled(); i++) { >+ IStatus dlStatus = requests[i].getRepository().getArtifacts(requests[i].getRequests(), subMonitor.newChild(requests[i].getRequests().length)); >+ if (dlStatus.getSeverity() == IStatus.CANCEL) >+ return overallStatus(requestsToProcess, monitor); >+ filterUnfetched(requestsToProcess); >+ subMonitor.setWorkRemaining(requestsToProcess.size()); >+ } >+ >+ return overallStatus(requestsToProcess, monitor); >+ } >+ >+ public boolean isBetterThan(IDownloadStrategy other, IArtifactRepository artifactRepository) { >+ return false; >+ } >+ >+ public boolean supportsRepository(IArtifactRepository artifactRepository) { >+ return true; >+ } >+ >+ private void filterUnfetched(Set requestsToProcess) { >+ for (Iterator iterator = requestsToProcess.iterator(); iterator.hasNext();) { >+ IArtifactRequest request = (IArtifactRequest) iterator.next(); >+ if (request.getResult() != null && request.getResult().isOK()) { >+ iterator.remove(); >+ } >+ } >+ } >+ >+ private IStatus overallStatus(Set requestsToProcess, IProgressMonitor monitor) { >+ if (monitor.isCanceled()) >+ return Status.CANCEL_STATUS; >+ >+ if (requestsToProcess.size() == 0) >+ return Status.OK_STATUS; >+ >+ MultiStatus result = new MultiStatus(); >+ for (Iterator iterator = requestsToProcess.iterator(); iterator.hasNext();) { >+ IArtifactRequest failed = (IArtifactRequest) iterator.next(); >+ result.add(failed.getResult()); >+ } >+ return result; >+ } >+} >Index: src/org/eclipse/equinox/p2/download/strategy/IDownloadStrategyManager.java >=================================================================== >RCS file: src/org/eclipse/equinox/p2/download/strategy/IDownloadStrategyManager.java >diff -N src/org/eclipse/equinox/p2/download/strategy/IDownloadStrategyManager.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/equinox/p2/download/strategy/IDownloadStrategyManager.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,20 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 Genuitec, LLC and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Genuitec, LLC - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.equinox.p2.download.strategy; >+ >+public interface IDownloadStrategyManager { >+ >+ IDownloadStrategy[] getKnownStrategies(); >+ >+ void add(IDownloadStrategy strategy); >+ >+ void remove(IDownloadStrategy strategy); >+} >Index: schema/downloadStrategies.exsd >=================================================================== >RCS file: schema/downloadStrategies.exsd >diff -N schema/downloadStrategies.exsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ schema/downloadStrategies.exsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,105 @@ >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.equinox.p2.download"> >+<annotation> >+ <appInfo> >+ <meta.schema plugin="org.eclipse.equinox.p2.download" id="downloadStrategies" name="Download Strategies"/> >+ </appInfo> >+ <documentation> >+ Definition of strategies that understand how to efficiently download software from a set of artifact repositories. >+ </documentation> >+ </annotation> >+ >+ <element name="extension"> >+ <complexType> >+ <sequence minOccurs="1" maxOccurs="unbounded"> >+ <element ref="strategy"/> >+ </sequence> >+ <attribute name="point" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="id" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appInfo> >+ <meta.attribute translatable="true"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="strategy"> >+ <complexType> >+ <attribute name="class" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appInfo> >+ <meta.attribute kind="java" basedOn=":org.eclipse.equinox.p2.download.strategy.IDownloadStrategy"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="since"/> >+ </appInfo> >+ <documentation> >+ [Enter the first release in which this extension point appears.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="examples"/> >+ </appInfo> >+ <documentation> >+ [Enter extension point usage example here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="apiInfo"/> >+ </appInfo> >+ <documentation> >+ [Enter API information here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="implementation"/> >+ </appInfo> >+ <documentation> >+ [Enter information about supplied implementation of this extension point.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="copyright"/> >+ </appInfo> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ >+</schema> >Index: src/org/eclipse/equinox/internal/p2/download/strategy/ThreadedDownloadStrategy.java >=================================================================== >RCS file: src/org/eclipse/equinox/internal/p2/download/strategy/ThreadedDownloadStrategy.java >diff -N src/org/eclipse/equinox/internal/p2/download/strategy/ThreadedDownloadStrategy.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/equinox/internal/p2/download/strategy/ThreadedDownloadStrategy.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,39 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 Genuitec, LLC and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Genuitec, LLC - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.equinox.internal.p2.download.strategy; >+ >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.equinox.p2.artifact.repository.IArtifactRepository; >+import org.eclipse.equinox.p2.artifact.repository.IArtifactRepositoryWithRangeSupport; >+import org.eclipse.equinox.p2.download.strategy.DownloadStrategyRequests; >+import org.eclipse.equinox.p2.download.strategy.IDownloadStrategy; >+ >+/** >+ * Place holder implementation for the threaded download strategy that will utilize >+ * knowledge about certain artificat repositories for greater overall throughput. >+ */ >+public class ThreadedDownloadStrategy implements IDownloadStrategy { >+ >+ public IStatus getArtifacts(DownloadStrategyRequests[] requests, IProgressMonitor monitor) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public boolean isBetterThan(IDownloadStrategy other, IArtifactRepository artifactRepository) { >+ // TODO Auto-generated method stub >+ return false; >+ } >+ >+ public boolean supportsRepository(IArtifactRepository artifactRepository) { >+ return artifactRepository instanceof IArtifactRepositoryWithRangeSupport; >+ } >+} >Index: src/org/eclipse/equinox/internal/p2/download/strategy/DownloadStrategyManager.java >=================================================================== >RCS file: src/org/eclipse/equinox/internal/p2/download/strategy/DownloadStrategyManager.java >diff -N src/org/eclipse/equinox/internal/p2/download/strategy/DownloadStrategyManager.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/equinox/internal/p2/download/strategy/DownloadStrategyManager.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,48 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 Genuitec, LLC and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Genuitec, LLC - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.equinox.internal.p2.download.strategy; >+ >+import java.util.ArrayList; >+import java.util.List; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.RegistryFactory; >+import org.eclipse.equinox.internal.p2.download.DownloadActivator; >+import org.eclipse.equinox.p2.download.strategy.IDownloadStrategy; >+import org.eclipse.equinox.p2.download.strategy.IDownloadStrategyManager; >+ >+public class DownloadStrategyManager implements IDownloadStrategyManager { >+ >+ private List strategies = new ArrayList(); >+ >+ public DownloadStrategyManager() { >+ IConfigurationElement[] elt = RegistryFactory.getRegistry().getConfigurationElementsFor(DownloadActivator.ID + ".downloadStrategies"); >+ for (int i = 0; i < elt.length; i++) { >+ try { >+ strategies.add((IDownloadStrategy) elt[i].createExecutableExtension("class")); >+ } catch (Exception e) { >+ // should do something with this >+ e.printStackTrace(); >+ } >+ } >+ } >+ >+ public void add(IDownloadStrategy strategy) { >+ strategies.add(strategy); >+ } >+ >+ public void remove(IDownloadStrategy strategy) { >+ strategies.remove(strategy); >+ } >+ >+ public IDownloadStrategy[] getKnownStrategies() { >+ return (IDownloadStrategy[]) strategies.toArray(new IDownloadStrategy[strategies.size()]); >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 207802
:
81472
|
83572
|
88433
|
88919