Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[resolver] Added a URI resolver interface
Sometimes the standard template or default URL calculation is not sufficient. When a URI resolver is set, it takes over and it can calculate any URI based on the file under consideration. Signed-off-by: Peter Kriens <peter.kriens@aqute.biz>
- Loading branch information
Showing
5 changed files
with
135 additions
and
5 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
22 changes: 22 additions & 0 deletions
22
org.osgi.impl.bundle.repoindex.lib/src/org/osgi/service/indexer/impl/URLResolver.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,22 @@ | ||
package org.osgi.service.indexer.impl; | ||
|
||
import java.io.File; | ||
import java.net.URI; | ||
|
||
/** | ||
* Override the calculation of the URL with a specific function. | ||
*/ | ||
public interface URLResolver { | ||
|
||
/** | ||
* Calculate the URL for the given artifact. If this returns null or throws | ||
* an exception, the automatic calculation will be used. Exceptions are | ||
* logged so should not be used for flow control. | ||
* | ||
* @param artifact | ||
* The artifact being analyzed | ||
* @return Either a URI to be used in the content capability or null if the | ||
* default method should be used | ||
*/ | ||
URI resolver(File artifact) throws Exception; | ||
} |
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