Skip to content

Commit

Permalink
move data files to user's home directory for convenience
Browse files Browse the repository at this point in the history
  • Loading branch information
stumash committed Dec 3, 2018
1 parent a771882 commit ea10465
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
15 changes: 15 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,29 @@ if [ "${2}" == "--rm" ]; then
else
case "${3}" in
[Cc]ustomer)
eval "$(run_rmi_server Customer ${CUST_RM_PORT} --recover \
-cuh ${CUST_RM_HOST} -cup ${CUST_RM_PORT} -mwh ${MID_RM_HOST} -mwp ${MID_RM_PORT})"
;;
[Cc]ar)
eval "$(run_rmi_server Car ${CAR_RM_PORT} --recover \
-ch ${CAR_RM_HOST} -cp ${CAR_RM_PORT} -cuh ${CUST_RM_HOST} -cup ${CUST_RM_PORT} \
-mwh ${MID_RM_HOST} -mwp ${MID_RM_PORT})"
;;
[Rr]oom)
eval "$(run_rmi_server Room ${ROOM_RM_PORT} --recover \
-rh ${ROOM_RM_HOST} -rp ${ROOM_RM_PORT} -cuh ${CUST_RM_HOST} -cup ${CUST_RM_PORT} \
-mwh ${MID_RM_HOST} -mwp ${MID_RM_PORT})"
;;
[Ff]light)
eval "$(run_rmi_server Flight ${FLIGHT_RM_PORT} --recover \
-fh ${FLIGHT_RM_HOST} -fp ${FLIGHT_RM_PORT} -cuh ${CUST_RM_HOST} -cup ${CUST_RM_PORT} \
-mwh ${MID_RM_HOST} -mwp ${MID_RM_PORT})"
;;
[Mm]id)
eval "$(run_rmi_middleware ${MID_RM_PORT} --recover \
-mwh ${MID_RM_HOST} -mwp ${MID_RM_PORT} \
-cuh ${CUST_RM_HOST} -cup ${CUST_RM_PORT} -fh ${FLIGHT_RM_HOST} -fp ${FLIGHT_RM_PORT} \
-rh ${ROOM_RM_HOST} -rp ${ROOM_RM_PORT} -ch ${CAR_RM_HOST}) -cp ${CAR_RM_PORT}"
;;
esac
fi
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/group25/Utils/XMLPersistor.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.nio.charset.Charset;
import java.util.HashMap;

import static group25.Utils.AnsiColors.RED;
Expand All @@ -20,8 +19,7 @@

public class XMLPersistor {

private final Charset UTF8_CHARSET = Charset.forName("UTF-8");
private final String DATA_FILE_PATH = (System.getProperty("user.home")) + "/comp512/DistributedSystemsProject/Data";
private final String DATA_FILE_PATH = (System.getProperty("user.home"));

private XStream xstream;

Expand All @@ -43,7 +41,7 @@ public XMLPersistor() {

public boolean writeObject(Object obj, String filename) {
FileOutputStream fos = null;
File dataFile = new File(DATA_FILE_PATH+"/" + filename);
File dataFile = new File(DATA_FILE_PATH+"/"+filename);
try {
dataFile.getParentFile().mkdir();
dataFile.createNewFile();
Expand Down

0 comments on commit ea10465

Please sign in to comment.