Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2010-12-24 23:29:47 -0500
committerPascal Rapicault2010-12-24 23:29:47 -0500
commit952f0261aae1ae40b11d72fc204a37dd189e3476 (patch)
tree739b2070fe483b4a64993f913456bfc90a89b3e4 /bundles/org.eclipse.equinox.p2.artifact.repository
parentbb2fff87b9edef35e79fdeb17784618ee79527d4 (diff)
downloadrt.equinox.p2-952f0261aae1ae40b11d72fc204a37dd189e3476.tar.gz
rt.equinox.p2-952f0261aae1ae40b11d72fc204a37dd189e3476.tar.xz
rt.equinox.p2-952f0261aae1ae40b11d72fc204a37dd189e3476.zip
Bug 321819 - [transport] Repository transport API is tightly coupled with the implementationv20110104v20110102
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.artifact.repository')
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRequest.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorSelector.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java5
6 files changed, 23 insertions, 15 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java
index 155f09f15..5b74e16f4 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Genuitec LLC - various bug fixes
+ * Sonatype, Inc. - transport split
*******************************************************************************/
package org.eclipse.equinox.internal.p2.artifact.repository;
@@ -41,7 +42,7 @@ public class ArtifactRepositoryManager extends AbstractRepositoryManager<IArtifa
}
public IArtifactRequest createMirrorRequest(IArtifactKey key, IArtifactRepository destination, Map<String, String> destinationDescriptorProperties, Map<String, String> destinationRepositoryProperties) {
- return new MirrorRequest(key, destination, destinationDescriptorProperties, destinationRepositoryProperties);
+ return new MirrorRequest(key, destination, destinationDescriptorProperties, destinationRepositoryProperties, getTransport());
}
public IArtifactRepository createRepository(URI location, String name, String type, Map<String, String> properties) throws ProvisionException {
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRequest.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRequest.java
index 2248eab30..35c0b0aca 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRequest.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRequest.java
@@ -7,10 +7,12 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Sonatype, Inc. - transport split
*******************************************************************************/
package org.eclipse.equinox.internal.p2.artifact.repository;
import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.repository.Transport;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRequest;
@@ -24,10 +26,11 @@ public abstract class ArtifactRequest implements IArtifactRequest {
protected String resolvedKey;
protected IArtifactRepository source;
protected IStatus result = DEFAULT_STATUS;
+ protected Transport transport = null;
- public ArtifactRequest(IArtifactKey key) {
+ public ArtifactRequest(IArtifactKey key, Transport transport) {
artifact = key;
- // TODO do we need to make this configurable? for now set default request handler to ECF
+ this.transport = transport;
}
public IArtifactKey getArtifactKey() {
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java
index 1262780f2..50cd3ef85 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
* Compeople AG (Stefan Liebig) - various ongoing maintenance
* Genuitec LLC - various bug fixes
+ * Sonatype, Inc. - transport split
*******************************************************************************/
package org.eclipse.equinox.internal.p2.artifact.repository;
@@ -20,7 +21,7 @@ import java.util.Map;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactDescriptor;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
-import org.eclipse.equinox.internal.p2.repository.RepositoryTransport;
+import org.eclipse.equinox.internal.p2.repository.Transport;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepHandler;
import org.eclipse.equinox.internal.provisional.p2.repository.IStateful;
import org.eclipse.equinox.p2.core.ProvisionException;
@@ -54,8 +55,8 @@ public class MirrorRequest extends ArtifactRequest {
private final Map<String, String> targetRepositoryProperties;
protected IArtifactDescriptor descriptor;
- public MirrorRequest(IArtifactKey key, IArtifactRepository targetRepository, Map<String, String> targetDescriptorProperties, Map<String, String> targetRepositoryProperties) {
- super(key);
+ public MirrorRequest(IArtifactKey key, IArtifactRepository targetRepository, Map<String, String> targetDescriptorProperties, Map<String, String> targetRepositoryProperties, Transport transport) {
+ super(key, transport);
target = targetRepository;
if (targetDescriptorProperties == null || targetDescriptorProperties.isEmpty()) {
this.targetDescriptorProperties = null;
@@ -201,7 +202,7 @@ public class MirrorRequest extends ArtifactRequest {
return;
}
try {
- RepositoryTransport.getInstance().getLastModified(statsURI, monitor);
+ transport.getLastModified(statsURI, monitor);
} catch (FileNotFoundException e) {
//ignore because it is expected that the statistics URI doesn't represent an existing file
} catch (Exception e) {
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorSelector.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorSelector.java
index 43eefdcd0..1012c9b34 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorSelector.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorSelector.java
@@ -21,7 +21,7 @@ import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
import org.eclipse.equinox.internal.p2.repository.DownloadStatus;
-import org.eclipse.equinox.internal.p2.repository.RepositoryTransport;
+import org.eclipse.equinox.internal.p2.repository.Transport;
import org.eclipse.equinox.p2.repository.IRepository;
import org.w3c.dom.*;
import org.xml.sax.InputSource;
@@ -153,13 +153,16 @@ public class MirrorSelector {
private final Random random = new Random();
+ private final Transport transport;
+
/**
* Constructs a mirror support class for the given repository. Mirrors are
* not contacted and the mirrorsURL document is not parsed until a
* mirror location request is sent.
*/
- public MirrorSelector(IRepository<?> repository) {
+ public MirrorSelector(IRepository<?> repository, Transport transport) {
this.repository = repository;
+ this.transport = transport;
try {
String base = repository.getProperties().get(IRepository.PROP_MIRRORS_BASE_URL);
if (base != null) {
@@ -200,7 +203,6 @@ public class MirrorSelector {
DocumentBuilder builder = domFactory.newDocumentBuilder();
Document document = null;
// Use Transport to read the mirrors list (to benefit from proxy support, authentication, etc)
- RepositoryTransport transport = RepositoryTransport.getInstance();
InputSource input = new InputSource(mirrorsURL);
input.setByteStream(transport.stream(URIUtil.fromString(mirrorsURL), monitor));
document = builder.parse(input);
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java
index 740775e83..1893e4b26 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Sonatype, Inc. - transport split
*******************************************************************************/
package org.eclipse.equinox.internal.p2.artifact.repository;
@@ -14,6 +15,7 @@ import java.io.OutputStream;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.artifact.processors.md5.MD5Verifier;
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository;
+import org.eclipse.equinox.internal.p2.repository.Transport;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStep;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepHandler;
import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
@@ -23,8 +25,8 @@ import org.eclipse.osgi.util.NLS;
public class RawMirrorRequest extends MirrorRequest {
protected IArtifactDescriptor sourceDescriptor, targetDescriptor;
- public RawMirrorRequest(IArtifactDescriptor sourceDescriptor, IArtifactDescriptor targetDescriptor, IArtifactRepository targetRepository) {
- super(sourceDescriptor.getArtifactKey(), targetRepository, null, null);
+ public RawMirrorRequest(IArtifactDescriptor sourceDescriptor, IArtifactDescriptor targetDescriptor, IArtifactRepository targetRepository, Transport transport) {
+ super(sourceDescriptor.getArtifactKey(), targetRepository, null, null, transport);
this.sourceDescriptor = sourceDescriptor;
this.targetDescriptor = targetDescriptor;
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
index 5a02762fd..635688bd8 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
@@ -29,7 +29,6 @@ import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
import org.eclipse.equinox.internal.p2.metadata.expression.CompoundIterator;
import org.eclipse.equinox.internal.p2.metadata.index.IndexProvider;
-import org.eclipse.equinox.internal.p2.repository.RepositoryTransport;
import org.eclipse.equinox.internal.p2.repository.Transport;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.*;
import org.eclipse.equinox.internal.provisional.p2.repository.IStateful;
@@ -548,7 +547,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
if (!MIRRORS_ENABLED || (!isForceThreading() && isLocal()))
return baseLocation;
if (mirrors == null)
- mirrors = new MirrorSelector(this);
+ mirrors = new MirrorSelector(this, getTransport());
return mirrors.getMirrorLocation(baseLocation, monitor);
}
@@ -820,7 +819,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
private Transport getTransport() {
- return RepositoryTransport.getInstance();
+ return (Transport) getProvisioningAgent().getService(Transport.SERVICE_NAME);
}
// use this method to setup any transient fields etc after the object has been restored from a stream

Back to the top