package bishakh.psync;
import java.io.IOException;

public class SyncService {

    private static final String BROADCAST_IP = "192.168.43.255";
    private static final String PEER_ID = "defaultMcs";
    private static final int PORT = 4446;
    private static final int syncInterval = 5;
    private static final int maxRunningDownloads = 5;

    private static String syncDirectory = "/home/alarm/dms/sync/";
    private static String mapFileServerDirectory = "/home/alarm/dms/";
    private static String databaseAndLogDirectory = "/home/alarm/dms/";
    private static String databaseName = "fileDB.txt";

    public Logger logger;
    public WebServer webServer;
    public Discoverer discoverer;
    public FileManager fileManager;
    public FileTransporter fileTransporter;
    public Controller controller;

    public SyncService() {
        logger = new Logger(databaseAndLogDirectory, PEER_ID);
        discoverer = new Discoverer(BROADCAST_IP, PEER_ID, PORT, logger);
        fileManager = new FileManager(PEER_ID, databaseName, databaseAndLogDirectory, syncDirectory, mapFileServerDirectory, logger);
        fileTransporter = new FileTransporter(syncDirectory, logger);
        controller = new Controller(discoverer, fileManager, fileTransporter, syncInterval, maxRunningDownloads, logger, false);
        webServer = new WebServer(8080, controller, logger);
    }




    public  void start(){
        discoverer.startDiscoverer();
        fileManager.startFileManager();
        controller.startController();
        try {
            webServer.start();
        } catch(IOException ioe) {
            logger.d("Httpd", "The server could not start.");
        }
    }

    public void stop() {
        discoverer.stopDiscoverer();
        fileManager.stopFileManager();
        controller.stopController();
        webServer.stop();
    }

    public static void main(String[] args) {
        SyncService s = new SyncService();
        s.start();
    }

}

@@ -153,30 +153,24 @@
 vate static 
-final 
 String PEER_
@@ -188,16 +188,16 @@
 ltMcs%22;%0A
+
     priv
@@ -1371,16 +1371,820 @@
     %7D%0A%0A%0A
+    public SyncService(String inputPeerId, String baseDirectory) %7B%0A        syncDirectory = baseDirectory + %22dms/sync/%22;%0A        mapFileServerDirectory = baseDirectory + %22dms/%22;%0A        databaseAndLogDirectory = baseDirectory + %22dms/%22;%0A        PEER_ID = inputPeerId;%0A%0A        logger = new Logger(databaseAndLogDirectory, PEER_ID);%0A        discoverer = new Discoverer(BROADCAST_IP, PEER_ID, PORT, logger);%0A        fileManager = new FileManager(PEER_ID, databaseName, databaseAndLogDirectory, syncDirectory, mapFileServerDirectory, logger);%0A        fileTransporter = new FileTransporter(syncDirectory, logger);%0A        controller = new Controller(discoverer, fileManager, fileTransporter, syncInterval, maxRunningDownloads, logger, false);%0A        webServer = new WebServer(8080, controller, logger);%0A    %7D%0A
 %0A%0A    pu
@@ -2708,38 +2708,181 @@
   Sy
-ncService s = new SyncService(
+stem.out.println(args.length);%0A        if(args.length %3C 2)%7B%0A            SyncService s = new SyncService();%0A        %7D%0A        SyncService s = new SyncService(args%5B0%5D, args%5B1%5D
 );%0A 

Add support for command line arguments