finished documentation for classes ArchDistribution, Distribution and AsyncRequestParse
This commit is contained in:
parent
44ac927f6e
commit
052ba40800
@ -23,5 +23,16 @@ public interface Distribution {
|
||||
*/
|
||||
Future<List<SearchedPackage>> searchPackage(String packageName);
|
||||
|
||||
/**
|
||||
* This function returns a fully completed package containing all
|
||||
* information about the package identified by it's exact name passed as
|
||||
* parametter, the package contains in its dependency list fully formed
|
||||
* packages that also contains its dependencies, the dependency depth is
|
||||
* specified by the parametter with the same name.
|
||||
*
|
||||
* @param packageName String, The package's exact name
|
||||
* @param depth int, the depth of the dependency tree
|
||||
* @return Package, the fully completed package
|
||||
*/
|
||||
Future<Package> getPackageTree(String packageName, int depth);
|
||||
}
|
||||
|
@ -27,8 +27,8 @@ public abstract class AsyncRequestsParser {
|
||||
private static final Logger logger = LoggerManager.getLogger("AsyncRequestsParser");
|
||||
|
||||
/**
|
||||
* This function return a package from the distribution's api in the form
|
||||
* of a Pair Composed of a Package object, and a set of string containing
|
||||
* This function returns a package from the distribution's api in the form
|
||||
* of a Pair Composed of a Package object and a set of string containing
|
||||
* the names of the dependecies of the package.
|
||||
*
|
||||
* @param packageName String, The package's exact name
|
||||
@ -37,7 +37,15 @@ public abstract class AsyncRequestsParser {
|
||||
protected abstract CompletableFuture<Pair<Package, Set<String>>> getPackageFromAPI(String name);
|
||||
|
||||
/**
|
||||
* This function returns a fully completed package containing all
|
||||
* information about the package identified by it's exact name passed as
|
||||
* parametter, the package contains in its dependency list fully formed
|
||||
* packages that also contains its dependencies, the dependency depth is
|
||||
* specified by the parametter with the same name.
|
||||
*
|
||||
* @param packageName String, The package's exact name
|
||||
* @param depth int, the depth of the dependency tree
|
||||
* @return Package, the fully completed package
|
||||
*/
|
||||
public CompletableFuture<Package> getPackageTree(String packageName, int depth) {
|
||||
// parse the json
|
||||
@ -53,7 +61,7 @@ public abstract class AsyncRequestsParser {
|
||||
return CompletableFuture.completedFuture(null);
|
||||
}
|
||||
futureRequest.thenAccept(result -> {
|
||||
if(result==null){
|
||||
if (result == null) {
|
||||
logger.fine("Completing callback INVALID for package %s (depth=%s)".formatted(packageName, depth));
|
||||
futurePackage.complete(null);
|
||||
return;
|
||||
@ -61,7 +69,6 @@ public abstract class AsyncRequestsParser {
|
||||
Package pack = result.getFirst();
|
||||
Set<String> dependenciesNames = result.getSecond();
|
||||
|
||||
|
||||
// if we're at the maximum depth, return the package without its dependencies
|
||||
if (depth == 0) {
|
||||
logger.fine("Completing callback NODEP for package %s (depth=%s)".formatted(packageName, depth));
|
||||
@ -93,7 +100,8 @@ public abstract class AsyncRequestsParser {
|
||||
futurePackage.complete(pack);
|
||||
}).exceptionally(error -> {
|
||||
error.printStackTrace();
|
||||
logger.warning("Error while manipulating package %s (depth=%s) : \n%s".formatted(packageName, depth, error));
|
||||
logger.warning(
|
||||
"Error while manipulating package %s (depth=%s) : \n%s".formatted(packageName, depth, error));
|
||||
futurePackage.complete(null);
|
||||
return null;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user