-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Contact Information #20
base: master
Are you sure you want to change the base?
Changes from 8 commits
08e9bfb
5c3622e
7740ea9
08ab4ff
a78a074
83b9d1e
8f11c64
c6ae90d
c34b1c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7"> | ||
<output url="file://$MODULE_DIR$/target/classes" /> | ||
<output-test url="file://$MODULE_DIR$/target/test-classes" /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> | ||
<excludeFolder url="file://$MODULE_DIR$/target" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.6.2" level="project" /> | ||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" /> | ||
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.6.2" level="project" /> | ||
</component> | ||
</module> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
import java.text.SimpleDateFormat; | ||
import java.util.Calendar; | ||
|
||
|
||
public class SyncService { | ||
|
||
private static final String BROADCAST_IP = "172.16.5.255"; | ||
|
@@ -17,69 +18,82 @@ public class SyncService { | |
private static String mapFileServerDirectory = "/home/alarm/DMS/"; | ||
private static String databaseAndLogDirectory = "/home/alarm/DMS/"; | ||
private static String databaseName = "fileDB.txt"; | ||
private static String contactName ="contactHistoryFile.txt"; | ||
|
||
|
||
public Logger logger; | ||
public WebServer webServer; | ||
public Discoverer discoverer; | ||
public FileManager fileManager; | ||
public FileTransporter fileTransporter; | ||
public Controller controller; | ||
|
||
|
||
public SyncService() throws IOException { | ||
|
||
|
||
public SyncService() { | ||
logger = new Logger(databaseAndLogDirectory, PEER_ID); | ||
discoverer = new Discoverer(BROADCAST_IP, PEER_ID, PORT, logger); | ||
discoverer = new Discoverer(BROADCAST_IP, PEER_ID, PORT, logger,contactName,databaseAndLogDirectory); | ||
fileManager = new FileManager(PEER_ID, databaseName, databaseAndLogDirectory, syncDirectory, mapFileServerDirectory, logger); | ||
fileTransporter = new FileTransporter(syncDirectory, logger); | ||
controller = new Controller(discoverer, fileManager, fileTransporter, syncInterval, maxRunningDownloads, logger, 2, true); | ||
webServer = new WebServer(8080, controller, logger); | ||
|
||
} | ||
|
||
|
||
public SyncService(String inputPeerId, String baseDirectory) { | ||
syncDirectory = baseDirectory + File.separator + "sync" + File.separator; | ||
public SyncService(String inputPeerId, String baseDirectory) throws IOException { | ||
syncDirectory = baseDirectory + "sync" + "/"; | ||
mapFileServerDirectory = baseDirectory; | ||
databaseAndLogDirectory = baseDirectory; | ||
PEER_ID = inputPeerId; | ||
|
||
|
||
logger = new Logger(databaseAndLogDirectory, PEER_ID); | ||
discoverer = new Discoverer(BROADCAST_IP, PEER_ID, PORT, logger); | ||
discoverer = new Discoverer(BROADCAST_IP, PEER_ID, PORT, logger,contactName,databaseAndLogDirectory); | ||
fileManager = new FileManager(PEER_ID, databaseName, databaseAndLogDirectory, syncDirectory, mapFileServerDirectory, logger); | ||
fileTransporter = new FileTransporter(syncDirectory, logger); | ||
controller = new Controller(discoverer, fileManager, fileTransporter, syncInterval, maxRunningDownloads, logger, 2, true); | ||
webServer = new WebServer(8080, controller, logger); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. port |
||
} | ||
|
||
public SyncService(String inputPeerId, String baseDirectory, int priorityMethod) { | ||
syncDirectory = baseDirectory + File.separator + "sync" + File.separator; | ||
public SyncService(String inputPeerId, String baseDirectory, int priorityMethod) throws IOException { | ||
syncDirectory = baseDirectory +"sync" + "/"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ? why this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suppose my baseDirectory is provided as "C:/Users/Desktop/WorkingDirectory/" (with a trailing '/'). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay then I am replacing last '/' with File.separator |
||
mapFileServerDirectory = baseDirectory; | ||
databaseAndLogDirectory = baseDirectory; | ||
PEER_ID = inputPeerId; | ||
|
||
|
||
logger = new Logger(databaseAndLogDirectory, PEER_ID); | ||
discoverer = new Discoverer(BROADCAST_IP, PEER_ID, PORT, logger); | ||
discoverer = new Discoverer(BROADCAST_IP, PEER_ID, PORT, logger,contactName,databaseAndLogDirectory); | ||
fileManager = new FileManager(PEER_ID, databaseName, databaseAndLogDirectory, syncDirectory, mapFileServerDirectory, logger); | ||
fileTransporter = new FileTransporter(syncDirectory, logger); | ||
controller = new Controller(discoverer, fileManager, fileTransporter, syncInterval, maxRunningDownloads, logger, priorityMethod, true); | ||
webServer = new WebServer(8080, controller, logger); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. port |
||
} | ||
|
||
public SyncService(String inputPeerId, String baseDirectory, int priorityMethod, boolean restrictedEpidemicFlag) { | ||
syncDirectory = baseDirectory + File.separator + "sync" + File.separator; | ||
public SyncService(String inputPeerId, String baseDirectory, int priorityMethod, boolean restrictedEpidemicFlag) throws IOException { | ||
|
||
|
||
syncDirectory = baseDirectory + "sync" + "/"; | ||
mapFileServerDirectory = baseDirectory; | ||
databaseAndLogDirectory = baseDirectory; | ||
PEER_ID = inputPeerId; | ||
|
||
logger = new Logger(databaseAndLogDirectory, PEER_ID); | ||
discoverer = new Discoverer(BROADCAST_IP, PEER_ID, PORT, logger); | ||
discoverer = new Discoverer(BROADCAST_IP, PEER_ID, PORT, logger,contactName,databaseAndLogDirectory); | ||
fileManager = new FileManager(PEER_ID, databaseName, databaseAndLogDirectory, syncDirectory, mapFileServerDirectory, logger); | ||
fileTransporter = new FileTransporter(syncDirectory, logger); | ||
controller = new Controller(discoverer, fileManager, fileTransporter, syncInterval, maxRunningDownloads, logger, priorityMethod, restrictedEpidemicFlag); | ||
webServer = new WebServer(8080, controller, logger); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. port |
||
|
||
} | ||
|
||
|
||
|
||
public void start(){ | ||
public void start() throws FileNotFoundException { | ||
|
||
|
||
|
||
discoverer.startDiscoverer(); | ||
fileManager.startFileManager(); | ||
controller.startController(); | ||
|
@@ -97,7 +111,7 @@ public void stop() { | |
webServer.stop(); | ||
} | ||
|
||
public static void main(final String[] args) { | ||
public static void main(final String[] args) throws IOException { | ||
System.out.println(args.length); | ||
if(args.length < 2){ | ||
SyncService s = new SyncService(); | ||
|
@@ -147,6 +161,8 @@ public void uncaughtException(Thread t, Throwable e) { | |
} | ||
} | ||
}); | ||
|
||
|
||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
port