-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support to plug-in additional ArtifactDownloadProvider
The transport now support to supply an artifact descriptor that then can be used to look-up the artifact in several other places to prevent downloading it several times. This now adds an abstraction for components to supply an ArtifactDownloadProvider component to implement such strategies independent from the actual transport implementation. In addition to this, also the interface for TransportProtocolHandler is moved to the SPI.
- Loading branch information
Showing
9 changed files
with
97 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
...en-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/TransportProtocolHandler.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
tycho-spi/src/main/java/org/eclipse/tycho/transport/ArtifactDownloadProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Christoph Läubrich and others. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Christoph Läubrich - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.tycho.transport; | ||
|
||
import java.io.OutputStream; | ||
import java.net.URI; | ||
|
||
import org.eclipse.core.runtime.IStatus; | ||
import org.eclipse.equinox.internal.p2.repository.DownloadStatus; | ||
import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; | ||
|
||
/** | ||
* An {@link ArtifactDownloadProvider} can supply an alternative caching strategy for artifacts | ||
* fetched from P2 | ||
*/ | ||
public interface ArtifactDownloadProvider { | ||
|
||
/** | ||
* Ask the provider to download the given artifact and transfer it to the given target | ||
* | ||
* @param source | ||
* the source URI, might be a mirror URL | ||
* @param target | ||
* the target where the result should be transfered to | ||
* @param descriptor | ||
* the artifact descriptor to be queried | ||
* @return a status of type cancel if this provider can't supply the artifact, or a | ||
* {@link DownloadStatus} in case of success to supply additional information to P2, or | ||
* an error if the download failed even though it should not. | ||
*/ | ||
public IStatus downloadArtifact(URI source, OutputStream target, IArtifactDescriptor descriptor); | ||
|
||
/** | ||
* @return the priority, higher values are considered first | ||
*/ | ||
int getPriority(); | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
tycho-spi/src/main/java/org/eclipse/tycho/transport/TransportProtocolHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 Christoph Läubrich and others. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Christoph Läubrich - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.tycho.transport; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.net.URI; | ||
|
||
public interface TransportProtocolHandler { | ||
|
||
long getLastModified(URI uri) throws IOException; | ||
|
||
File getFile(URI remoteFile) throws IOException; | ||
|
||
} |