Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 834e1caa authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

add PreparationProcess.java & RomSource.java in models package to map data from config file

parent d6bfc967
Loading
Loading
Loading
Loading
+57 −0
Original line number Diff line number Diff line
/*
 * Copyright 2021-2022 - ECORP SAS 

 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */
package ecorp.easy.installer.models;

import ecorp.easy.installer.models.RomSource;
import java.util.HashMap;

/**
 * This class encapsulate data about process to prepare a device before flashing
 * @author vincent Bourgmayer
 */
public class PreparationProcess extends Process{
    
    private final HashMap<String, RomSource> sourcesToDownload;

    /**
     * Constructor of PreparationProcess
     * 
     * @param stepCount number of step in the process 
     */
    public PreparationProcess(int stepCount){
        super(stepCount);
        sourcesToDownload = new HashMap<>();
    }
    
    /**
     * Get the list of file to download
     * @return HashMap<String, RomSource>
     */
    public final HashMap<String, RomSource> getSourcesToDownload() {
        return sourcesToDownload;
    }
    
    /**
     * Add a source to download
     * @param key the key associated to the RomSource instance
     * @param source  The source to Download
     */
    public void putSourceToDownload(String key, RomSource source){
        sourcesToDownload.put(key, source);
    }
    
}
 No newline at end of file
+55 −0
Original line number Diff line number Diff line
/*
 * Copyright 2021-2022 - ECORP SAS 

 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */
package ecorp.easy.installer.models;

/**
 * This class encapsulate data about rom sources to download (ROM & recovery images, patch, ...)
 * This is used to map data from config file
 * @author vincent Bourgmayer
 */
public class RomSource {
    private final String url; //where to get the file
    private final String fileName; //the file name
    //private String checksum; //@TODO complete: Doesn't remember yet if it is Checksum value or checksum extension or checksum path 
    
    /**
     * Constructor or RomSource instance
     * @param url Url to use to download file
     * @param fileName file name 
     */
    public RomSource(String url, String fileName){
        this.url = url;
        this.fileName = fileName;
    }
    
    /**
     * Get url to download the file
     * @return String url like: https://<anyURL>
     */
    public String getUrl() {
        return url;
    }

    /**
     * Local path to the file
     * @return 
     */
    public String getFileName() {
        return fileName;
    }

}