added attribute's description

This commit is contained in:
Djalim Simaila 2022-12-14 14:01:16 +01:00
parent a97aa19fef
commit 44ac927f6e
3 changed files with 40 additions and 2 deletions

View File

@ -24,6 +24,9 @@ import org.json.*;
*/
public class ArchDistribution extends AsyncRequestsParser implements Distribution {
/**
* Logger object used to split debug output and the application output
*/
private static final Logger logger = LoggerManager.getLogger("ArchDistribution");
/**
@ -34,7 +37,6 @@ public class ArchDistribution extends AsyncRequestsParser implements Distributio
* @param packageName String, The package's exact name
* @return Pair of Package and Set of String
*/
@Override
public CompletableFuture<Pair<Package, Set<String>>> getPackageFromAPI(String packageName) {
// create a new http client

View File

@ -7,7 +7,21 @@ import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
/**
* This interface specifies the methods needed by a distribtion to be parsable.
*
* @author R.Thomas
* @version 1.0
*/
public interface Distribution {
/**
* Search for a package matching a pattern and return a list of packages and
* return a list of string matching this pattern.
*
* @param packageName String, the pattern to search in the repositories
* @return List of SearchedPackage objects
*/
Future<List<SearchedPackage>> searchPackage(String packageName);
Future<Package> getPackageTree(String packageName, int depth);
}

View File

@ -11,12 +11,34 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.logging.Logger;
/**
* This abstract class defines the method that a distribution will use
* in order to get a package and fill its dependency list. It does all that
* in an asyncron manner
*
* @author R.Thomas
* @version 1.0
*
*/
public abstract class AsyncRequestsParser {
/**
* Logger object used to split debug output and the application output
*/
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
* the names of the dependecies of the package.
*
* @param packageName String, The package's exact name
* @return Pair of Package and Set of String
*/
protected abstract CompletableFuture<Pair<Package, Set<String>>> getPackageFromAPI(String name);
/**
*
*/
public CompletableFuture<Package> getPackageTree(String packageName, int depth) {
// parse the json
var futurePackage = new CompletableFuture<Package>();