commit 1b3f73ae961a78dccc470ce2afa417214164c542
Author: eryawen <monikakoltunik@gmail.com>
Date:   Sun Feb 12 23:47:07 2017 +0100

    Create README.md

diff --git a/README.md b/README.md
new file mode 100644
index 0000000..2f0c170
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+# file-storage-client
+
+Client-side of file storage project that visualises local and remote file system and enables user to manage files in the cloud.

commit c7850ceb103a2eb3a5aaea9b3bec4fa6919dac4f
Author: mika6 <monikakoltunik@gmail.com>
Date:   Sun Feb 12 23:31:34 2017 +0100

    First commit

diff --git a/.gitignore b/.gitignore
index 309d5e2..87dc0f2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,2 @@ gradle/
 build/
-build.gradle
 gradlew
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..6e01548
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,42 @@
+/*
+ * This build file was auto generated by running the Gradle 'init' task
+ * by 'mk' at '16.01.17 18:20' with Gradle 3.2.1
+ *
+ * This generated file contains a sample Java project to get you started.
+ * For more details take a look at the Java Quickstart chapter in the Gradle
+ * user guide available at https://docs.gradle.org/3.2.1/userguide/tutorial_java_projects.html
+ */
+
+// Apply the java plugin to add support for Java
+apply plugin: 'java'
+apply plugin: 'idea'
+apply plugin: 'eclipse'
+apply plugin: 'application'
+
+// In this section you declare where to find the dependencies of your project
+repositories {
+    // Use 'jcenter' for resolving your dependencies.
+    // You can declare any Maven/Ivy/file repository here.
+    jcenter()
+}
+
+// In this section you declare the dependencies for your production and test code
+dependencies {
+    // The production code uses the SLF4J logging API at compile time
+    compile 'org.slf4j:slf4j-api:1.7.21'
+    compile group: 'org.projectlombok', name: 'lombok', version: '1.16.12'
+    compile group: 'com.mashape.unirest', name: 'unirest-java', version: '1.4.9'
+    compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.8.6'
+    compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.8.6'
+    compile group: 'org.valid4j', name: 'valid4j', version: '0.5.0'
+    compile group: 'com.google.code.gson', name: 'gson', version: '2.8.0'
+    compile group: 'com.google.guava', name: 'guava', version: '21.0'
+    compile 'com.google.googlejavaformat:google-java-format:1.2'
+
+
+    // Declare the dependency for your favourite test framework you want to use in your tests.
+    // TestNG is also supported by the Gradle Test task. Just change the
+    // testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add
+    // 'test.useTestNG()' to your build script.
+    testCompile 'junit:junit:4.12'
+}

commit 8e171f25c683c7f6f2aa32f1938eb271abadb3f3
Author: mika6 <monikakoltunik@gmail.com>
Date:   Sun Feb 12 23:30:56 2017 +0100

    First commit

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..309d5e2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,13 @@
+gradle/
+.gradle/
+build/
+build.gradle
+gradlew
+gradlew.bat
+settings.gradle
+
+# IntelliJ IDEA files
+.idea/
+*.iws
+*.ipr
+out/
diff --git a/src/main/java/lab/App.java b/src/main/java/lab/App.java
new file mode 100644
index 0000000..3250bc0
--- /dev/null
+++ b/src/main/java/lab/App.java
@@ -0,0 +1,109 @@
+package lab;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.mashape.unirest.http.ObjectMapper;
+import com.mashape.unirest.http.Unirest;
+import javafx.application.Application;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Scene;
+import javafx.scene.layout.AnchorPane;
+import javafx.stage.Stage;
+import lab.controller.CreateAccountController;
+import lab.controller.LoginController;
+import lab.controller.MainController;
+import lab.model.User;
+
+import java.io.IOException;
+
+public class App extends Application {
+	LoginController loginController;
+	CreateAccountController createAccountController;
+	MainController mainController;
+	
+	private Stage primaryStage;
+	private Scene loginScene;
+	private Scene createScene;
+	private Scene mainScene;
+	
+	public void showMainLayout(String sessionHeader, User user) {
+		mainController.initView(sessionHeader, user);
+		primaryStage.setScene(mainScene);
+		primaryStage.show();
+	}
+	
+	public void showLoginLayout() {
+		primaryStage.setScene(loginScene);
+		primaryStage.show();
+	}
+	
+	public void showCreateAccountLayout() {
+		primaryStage.setScene(createScene);
+		primaryStage.show();
+	}
+	
+	@Override
+	public void start(Stage primaryStage) {
+		initRequestSettings();
+		initLayouts();
+		
+		this.primaryStage = primaryStage;
+		this.primaryStage.setTitle("REST client");
+		showLoginLayout();
+	}
+	
+	public static void main(String[] args) {
+		launch(args);
+	}
+	
+	private void initRequestSettings() {
+		Unirest.setObjectMapper(
+			   new ObjectMapper() {
+				   private com.fasterxml.jackson.databind.ObjectMapper jacksonObjectMapper =
+						 new com.fasterxml.jackson.databind.ObjectMapper();
+				   
+				   public <T> T readValue(String value, Class<T> valueType) {
+					   try {
+						   return jacksonObjectMapper.readValue(value, valueType);
+					   } catch (IOException e) {
+						   throw new RuntimeException(e);
+					   }
+				   }
+				   
+				   public String writeValue(Object value) {
+					   try {
+						   return jacksonObjectMapper.writeValueAsString(value);
+					   } catch (JsonProcessingException e) {
+						   throw new RuntimeException(e);
+					   }
+				   }
+			   });
+	}
+	
+	private void initLayouts() {
+		try {
+			FXMLLoader loader = new FXMLLoader();
+			loader.setLocation(App.class.getResource("/loginView.fxml"));
+			AnchorPane loginLayout = loader.load();
+			loginController = loader.getController();
+			loginController.setMainApp(this);
+			loginScene = new Scene(loginLayout);
+			
+			loader = new FXMLLoader();
+			loader.setLocation(App.class.getResource("/createAccountView.fxml"));
+			AnchorPane createAccountLayout = loader.load();
+			createAccountController = loader.getController();
+			createAccountController.setMainApp(this);
+			createScene = new Scene(createAccountLayout);
+			
+			loader = new FXMLLoader();
+			loader.setLocation(App.class.getResource("/mainView.fxml"));
+			AnchorPane mainLayout = loader.load();
+			
+			mainController = loader.getController();
+			mainController.setMainApp(this);
+			mainScene = new Scene(mainLayout);
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+}
diff --git a/src/main/java/lab/controller/CreateAccountController.java b/src/main/java/lab/controller/CreateAccountController.java
new file mode 100644
index 0000000..e581e50
--- /dev/null
+++ b/src/main/java/lab/controller/CreateAccountController.java
@@ -0,0 +1,82 @@
+package lab.controller;
+
+import com.mashape.unirest.http.HttpResponse;
+import javafx.fxml.FXML;
+import javafx.scene.control.Alert;
+import javafx.scene.control.TextField;
+import lab.App;
+import lab.exceptions.EmptyFieldException;
+import lab.exceptions.UserAlreadyExistException;
+import lab.model.User;
+import lab.request.CreateUser;
+import lab.request.Login;
+
+import static lab.utils.Status.USER_ALREADY_EXIST;
+import static org.valid4j.Validation.otherwiseThrowing;
+import static org.valid4j.Validation.validate;
+
+public class CreateAccountController {
+	@FXML
+	private TextField usernameTextField;
+	@FXML
+	private TextField passwordTextField;
+	
+	private User user = new User();
+	private String sessionHeader = "";
+	private App mainApp;
+	
+	public CreateAccountController() {
+	}
+	
+	@FXML
+	private void initialize() {
+		usernameTextField.textProperty().bindBidirectional(user.user_nameProperty());
+		passwordTextField.textProperty().bindBidirectional(user.user_passProperty());
+	}
+	
+	@FXML
+	private void handleLogin() {
+		mainApp.showLoginLayout();
+	}
+	
+	@FXML
+	private void handleCreateNewAccount() {
+		try {
+			validate(!user.getUser_name().isEmpty(), otherwiseThrowing(EmptyFieldException.class));
+			validate(!user.getUser_pass().isEmpty(), otherwiseThrowing(EmptyFieldException.class));
+			
+			HttpResponse response = (HttpResponse) new CreateUser(user).doRequest();
+			validate(
+				   response.getStatus() != USER_ALREADY_EXIST,
+				   otherwiseThrowing(UserAlreadyExistException.class));
+			
+			response = (HttpResponse) new Login(user).doRequest();
+			sessionHeader = response.getHeaders().getFirst("Set-Cookie");
+			mainApp.showMainLayout(sessionHeader, user);
+		} catch (Exception e) {
+			handleException(e);
+		}
+	}
+	
+	public void setMainApp(App mainApp) {
+		this.mainApp = mainApp;
+	}
+	
+	private void handleException(Exception e) {
+		user.setUser_name("");
+		user.setUser_pass("");
+		if (e instanceof EmptyFieldException) {
+			showAlert("Fields cannot be empty");
+		} else if (e instanceof UserAlreadyExistException) {
+			showAlert("User already exists");
+		} else {
+			showAlert("Something went wrong");
+		}
+	}
+	
+	private void showAlert(String message) {
+		Alert alert = new Alert(Alert.AlertType.ERROR);
+		alert.setContentText(message);
+		alert.showAndWait();
+	}
+}
diff --git a/src/main/java/lab/controller/LoginController.java b/src/main/java/lab/controller/LoginController.java
new file mode 100644
index 0000000..d377539
--- /dev/null
+++ b/src/main/java/lab/controller/LoginController.java
@@ -0,0 +1,80 @@
+package lab.controller;
+
+import com.mashape.unirest.http.HttpResponse;
+import com.mashape.unirest.http.exceptions.UnirestException;
+import javafx.fxml.FXML;
+import javafx.scene.control.Alert;
+import javafx.scene.control.PasswordField;
+import javafx.scene.control.TextField;
+import lab.App;
+import lab.exceptions.EmptyFieldException;
+import lab.exceptions.UnsuccessfulLoginException;
+import lab.model.User;
+import lab.request.Login;
+
+import static lab.utils.Status.UNSUCCESSFUL_LOGIN;
+import static org.valid4j.Validation.otherwiseThrowing;
+import static org.valid4j.Validation.validate;
+
+public class LoginController {
+	@FXML
+	private TextField usernameTextField;
+	@FXML
+	private PasswordField passwordTextField;
+	
+	private User user = new User();
+	private String sessionHeader = "";
+	private App mainApp;
+	
+	public LoginController() {
+	}
+	
+	@FXML
+	private void initialize() {
+		usernameTextField.textProperty().bindBidirectional(user.user_nameProperty());
+		passwordTextField.textProperty().bindBidirectional(user.user_passProperty());
+	}
+	
+	@FXML
+	private void handleLogin() {
+		try {
+			validate(!user.getUser_name().isEmpty(), otherwiseThrowing(EmptyFieldException.class));
+			validate(!user.getUser_pass().isEmpty(), otherwiseThrowing(EmptyFieldException.class));
+			HttpResponse response = (HttpResponse) new Login(user).doRequest();
+			validate(
+				   response.getStatus() != UNSUCCESSFUL_LOGIN,
+				   otherwiseThrowing(UnsuccessfulLoginException.class));
+			sessionHeader = response.getHeaders().getFirst("Set-Cookie");
+			mainApp.showMainLayout(sessionHeader, user);
+		} catch (Exception e) {
+			handleException(e);
+		}
+	}
+	
+	private void handleException(Exception e) {
+		user.setUser_name("");
+		user.setUser_pass("");
+		if (e instanceof EmptyFieldException) {
+			showAlert("Fields cannot be empty");
+		} else if (e instanceof UnsuccessfulLoginException) {
+			showAlert("Wrong username or password");
+		} else {
+			showAlert("Something went wrong");
+		}
+	}
+	
+	private void showAlert(String message) {
+		Alert alert = new Alert(Alert.AlertType.ERROR);
+		alert.setContentText(message);
+		alert.showAndWait();
+	}
+	
+	@FXML
+	private void handleCreateAccount() throws UnirestException {
+		mainApp.showCreateAccountLayout();
+	}
+	
+	public void setMainApp(App mainApp) {
+		this.mainApp = mainApp;
+	}
+}
diff --git a/src/main/java/lab/controller/MainController.java b/src/main/java/lab/controller/MainController.java
new file mode 100644
index 0000000..3c19663
--- /dev/null
+++ b/src/main/java/lab/controller/MainController.java
@@ -0,0 +1,281 @@
+package lab.controller;
+
+import com.google.gson.Gson;
+import com.mashape.unirest.http.HttpResponse;
+import com.mashape.unirest.http.exceptions.UnirestException;
+import javafx.beans.property.SimpleStringProperty;
+import javafx.beans.property.StringProperty;
+import javafx.fxml.FXML;
+import javafx.scene.control.*;
+import lab.App;
+import lab.exceptions.BaseException;
+import lab.exceptions.UnsuccessfulLoginException;
+import lab.model.FileSystem;
+import lab.model.FolderContent;
+import lab.model.RemotePath;
+import lab.model.User;
+import lab.request.*;
+import lab.utils.Status;
+
+import java.io.File;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Optional;
+
+import static lab.model.FileSystem.currentLocalFileProperty;
+import static lab.model.RemotePath.FileType;
+import static lab.utils.Status.*;
+import static org.valid4j.Validation.otherwiseThrowing;
+import static org.valid4j.Validation.validate;
+
+public class MainController {
+	final Gson gson = new Gson();
+	private App app;
+	private String sessionHeader;
+	private User user;
+	private FolderContent rootFolderContent;
+	private FileSystem fileSystem;
+	
+	private StringProperty request = new SimpleStringProperty("Write request here");
+	private StringProperty response = new SimpleStringProperty("Server response");
+	
+	@FXML
+	private Label usernameLabel;
+	@FXML
+	private TextField requestTextField;
+	@FXML
+	private TextArea responseTextArea;
+	@FXML
+	private TreeView<File> localFileSystemTreeView;
+	@FXML
+	private TreeView<RemotePath> remoteFileSystemTreeView;
+	@FXML
+	private TextField currentRemoteFileTextField;
+	@FXML
+	private TextField currentLocalFileTextField;
+	@FXML
+	private Label possibleOperationsLabel;
+	
+	@FXML
+	private void sendRequest() {
+		try {
+			Path local = Paths.get(currentLocalFileProperty.get());
+			FileType fileType =
+				   FileSystem.remoteFileSystemTree.getResourceType(
+						 FileSystem.currentRemoteFileProperty.get());
+			RemotePath remote = new RemotePath(FileSystem.currentRemoteFileProperty.get(), fileType);
+			HttpResponse httpResponse = (HttpResponse) new TextRequestHandler(local, remote,
+																 sessionHeader).sendRequest(
+				   request.getValue());
+			if (statusCodeIsSuccess(httpResponse)) {
+				updateTreeViews();
+			} else {
+				showErrorStatus(httpResponse);
+			}
+			response.setValue(httpResponse.getBody().toString());
+		} catch (Exception e) {
+			handleException(e);
+		}
+	}
+	
+	private void handleException(Exception e) {
+		if (e instanceof BaseException) {
+			showAlert(e.getMessage());
+			return;
+		} else if (e instanceof UnirestException) {
+			showAlert("Problem with connection");
+		} else e.printStackTrace();
+	}
+	
+	private boolean statusCodeIsSuccess(HttpResponse httpResponse) {
+		return httpResponse.getStatus() == SUCCESS_GET || httpResponse.getStatus() == SUCCESS_CREATED;
+	}
+	
+	private void showErrorStatus(HttpResponse httpResponse) {
+		if (httpResponse.getStatus() == Status.SESSION_EXPIRED) {
+			logIn();
+			sendRequest();
+		}
+		if (httpResponse.getStatus() == Status.INVALID_PATH
+		    || httpResponse.getStatus() == Status.NONEXISTENT_FOLDER) {
+			showAlert("Invalid path");
+		}
+		if (httpResponse.getStatus() == Status.WRONG_PARAM_FORMAT) {
+			showAlert("Wrong query format");
+		}
+		if (httpResponse.getStatus() == Status.DATABASE_ACCESS_PROBLEM) {
+			showAlert("Something went wrong while connecting to database");
+		}
+		if (httpResponse.getStatus() == Status.AUTHORISATION_REQUIRED) {
+			showAlert("Authorisation required");
+		}
+	}
+	
+	private void showAlert(String message) {
+		Alert alert = new Alert(Alert.AlertType.ERROR);
+		alert.setContentText(message);
+		alert.showAndWait();
+	}
+	
+	@FXML
+	private void handleLogout() {
+		try {
+			new Logout(sessionHeader).doRequest();
+			app.showLoginLayout();
+		} catch (UnirestException e) {
+			e.printStackTrace();
+		}
+	}
+	
+	private void logIn() {
+		try {
+			HttpResponse response = (HttpResponse) new Login(user).doRequest();
+			validate(response.getStatus() != Status.UNSUCCESSFUL_LOGIN,
+				    otherwiseThrowing(UnsuccessfulLoginException.class));
+			sessionHeader = response.getHeaders().getFirst("Set-Cookie");
+			
+		} catch (Exception e) {
+			handleException(e);
+		}
+	}
+	
+	@FXML
+	private void handleMove_fromMenu() {
+		changeRemotePathToSelectedInTreeView();
+		
+		TextInputDialog dialog = new TextInputDialog(FileSystem.currentRemoteFileProperty.get());
+		dialog.setContentText("New path:");
+		Optional<String> result = dialog.showAndWait();
+		try {
+			if (result.isPresent()) {
+				FileType fileType =
+					   FileSystem.remoteFileSystemTree.getResourceType(
+							 FileSystem.currentRemoteFileProperty.get());
+				RemotePath remote = new RemotePath(FileSystem.currentRemoteFileProperty.get(), fileType);
+				HttpResponse httpResponse =
+					   (HttpResponse) new Move(remote, result.get(), sessionHeader).doRequest();
+				statusCodeIsSuccess(httpResponse);
+				updateTreeViews();
+			}
+		} catch (Exception e) {
+			handleException(e);
+		}
+	}
+	
+	@FXML
+	private void handleRename_fromMenu() {
+		changeRemotePathToSelectedInTreeView();
+		
+		TextInputDialog dialog = new TextInputDialog();
+		dialog.setContentText("New name:");
+		Optional<String> result = dialog.showAndWait();
+		if (result.isPresent()) {
+			FileType fileType = FileSystem.remoteFileSystemTree.getResourceType(
+				   FileSystem.currentRemoteFileProperty.get());
+			RemotePath remote = new RemotePath(FileSystem.currentRemoteFileProperty.get(), fileType);
+			try {
+				HttpResponse httpResponse =
+					   (HttpResponse) new Rename(remote, result.get(), sessionHeader).doRequest();
+				statusCodeIsSuccess(httpResponse);
+				updateTreeViews();
+			} catch (Exception e) {
+				handleException(e);
+			}
+		}
+	}
+	
+	@FXML
+	private void changeLocalPathToSelectedInTreeView() {
+		currentLocalFileProperty.setValue(
+			   localFileSystemTreeView
+					 .getSelectionModel()
+					 .selectedItemProperty()
+					 .get()
+					 .getValue()
+					 .toString());
+	}
+	
+	@FXML
+	private void changeRemotePathToSelectedInTreeView() {
+		FileSystem.currentRemoteFileProperty.setValue(
+			   remoteFileSystemTreeView
+					 .getSelectionModel()
+					 .selectedItemProperty()
+					 .get()
+					 .getValue()
+					 .toString());
+	}
+	
+	private FolderContent getUpdatedRootContent() {
+		try {
+			HttpResponse httpResponse;
+			do {
+				httpResponse = (HttpResponse) new ListFolderContent(
+					   new RemotePath(fileSystem.remoteRoot, FileType.DIR), sessionHeader, true).doRequest();
+				if (httpResponse.getStatus() == SESSION_EXPIRED) {
+					logIn();
+				} else {
+					break;
+				}
+			} while (true);
+			return gson.fromJson(httpResponse.getBody().toString(), FolderContent.class);
+		} catch (Exception e) {
+			handleException(e);
+			return rootFolderContent;
+		}
+	}
+	
+	@FXML
+	private void showPossibleTextCommandsLabel() {
+		possibleOperationsLabel.setVisible(true);
+	}
+	
+	@FXML
+	private void hidePossibleTextCommandsLabel() {
+		possibleOperationsLabel.setVisible(false);
+	}
+	
+	public void initView(String sessionHeader, User user) {
+		this.sessionHeader = sessionHeader;
+		this.user = user;
+		this.fileSystem = new FileSystem(String.format("/%s", user.getUser_name()));
+		
+		request.setValue("Write request here");
+		response.setValue("Server response");
+		
+		usernameLabel.textProperty().bind(user.user_nameProperty());
+		request.bind(requestTextField.textProperty());
+		responseTextArea.textProperty().bind(response);
+		
+		FileSystem.currentRemoteFileProperty.setValue(fileSystem.remoteRoot);
+		currentLocalFileTextField.textProperty().bindBidirectional(currentLocalFileProperty);
+		currentRemoteFileTextField
+			   .textProperty()
+			   .bindBidirectional(FileSystem.currentRemoteFileProperty);
+		
+		FileSystem.localFileSystem = SimpleFileTreeItem.getTreeView(FileSystem.LOCAL_ROOT);
+		localFileSystemTreeView.rootProperty().bind(FileSystem.localFileSystem.rootProperty());
+		
+		rootFolderContent = getUpdatedRootContent();
+		FileSystem.remoteFileSystemTree = new RemoteFileSystemTree(sessionHeader);
+		FileSystem.remoteFileSystem =
+			   FileSystem.remoteFileSystemTree.buildRemoteFileSystem(rootFolderContent);
+		remoteFileSystemTreeView.rootProperty().bind(FileSystem.remoteFileSystem.rootProperty());
+	}
+	
+	private void updateTreeViews() {
+		remoteFileSystemTreeView.rootProperty().unbind();
+		FileSystem.remoteFileSystem = FileSystem.remoteFileSystemTree.getUpdatedRemoteFileSystem(
+			   getUpdatedRootContent());
+		remoteFileSystemTreeView.rootProperty().bind(FileSystem.remoteFileSystem.rootProperty());
+		
+		localFileSystemTreeView.rootProperty().unbind();
+		FileSystem.localFileSystem = SimpleFileTreeItem.getTreeView(FileSystem.LOCAL_ROOT);
+		localFileSystemTreeView.rootProperty().bind(FileSystem.localFileSystem.rootProperty());
+	}
+	
+	public void setMainApp(App app) {
+		this.app = app;
+	}
+}
+
diff --git a/src/main/java/lab/controller/RemoteFileSystemTree.java b/src/main/java/lab/controller/RemoteFileSystemTree.java
new file mode 100644
index 0000000..463fa8a
--- /dev/null
+++ b/src/main/java/lab/controller/RemoteFileSystemTree.java
@@ -0,0 +1,73 @@
+package lab.controller;
+
+import com.google.common.base.MoreObjects;
+import com.google.gson.Gson;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.scene.control.TreeItem;
+import javafx.scene.control.TreeView;
+import lab.model.FolderContent;
+import lab.model.RemotePath;
+
+import java.util.HashMap;
+
+public class RemoteFileSystemTree {
+	final Gson gson = new Gson();
+	HashMap<String, RemotePath.FileType> filesAndFolders = new HashMap<>();
+	private TreeView remoteFileSystem;
+	private String sessionHeader;
+	
+	public RemoteFileSystemTree(String sessionHeader) {
+		this.sessionHeader = sessionHeader;
+	}
+	
+	public TreeView getUpdatedRemoteFileSystem(FolderContent rootFolderContent) {
+		remoteFileSystem = buildRemoteFileSystem(rootFolderContent);
+		remoteFileSystem.setRoot(
+			   new TreeItem<>(
+					 new RemotePath(rootFolderContent.getRoot().getPathDisplay(), RemotePath.FileType.DIR)));
+		remoteFileSystem.getRoot().setExpanded(true);
+		addChildren(remoteFileSystem.getRoot(), rootFolderContent);
+		return remoteFileSystem;
+	}
+	
+	public TreeView<RemotePath> buildRemoteFileSystem(FolderContent folderContent) {
+		remoteFileSystem = new TreeView<>(new TreeItem<>(
+			   new RemotePath(folderContent.getRoot().getPathDisplay(), RemotePath.FileType.DIR)));
+		addChildren(remoteFileSystem.getRoot(), folderContent);
+		remoteFileSystem.getRoot().setExpanded(true);
+		return remoteFileSystem;
+	}
+	
+	public void addChildren(TreeItem<RemotePath> resource, FolderContent folderContent) {
+		ObservableList<TreeItem<RemotePath>> files = FXCollections.observableArrayList();
+		folderContent
+			   .getFiles()
+			   .forEach(
+					 file -> {
+						 RemotePath r = new RemotePath(file.getPathDisplay(), RemotePath.FileType.FILE);
+						 files.add(new TreeItem<>(r));
+						 filesAndFolders.put(r.getPath(), r.getFileType());
+					 });
+		resource.getChildren().addAll(files);
+		
+		ObservableList<TreeItem<RemotePath>> folders = FXCollections.observableArrayList();
+		folderContent
+			   .getFolders()
+			   .forEach(
+					 folder -> {
+						 RemotePath r =
+							    new RemotePath(folder.getRoot().getPathDisplay(), RemotePath.FileType.DIR);
+						 TreeItem<RemotePath> resourceTreeItem = new TreeItem<RemotePath>(r);
+						 resourceTreeItem.setExpanded(true);
+						 folders.add(resourceTreeItem);
+						 filesAndFolders.put(r.getPath(), r.getFileType());
+						 addChildren(resourceTreeItem, folder);
+					 });
+		resource.getChildren().addAll(folders);
+	}
+	
+	RemotePath.FileType getResourceType(String path) {
+		return MoreObjects.firstNonNull(filesAndFolders.get(path), RemotePath.FileType.DIR);
+	}
+}
diff --git a/src/main/java/lab/controller/SimpleFileTreeItem.java b/src/main/java/lab/controller/SimpleFileTreeItem.java
new file mode 100644
index 0000000..b2b90b5
--- /dev/null
+++ b/src/main/java/lab/controller/SimpleFileTreeItem.java
@@ -0,0 +1,69 @@
+package lab.controller;
+
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.scene.control.TreeItem;
+import javafx.scene.control.TreeView;
+
+import java.io.File;
+
+public class SimpleFileTreeItem extends TreeItem<File> {
+	private boolean isFirstTimeChildren = true;
+	private boolean isFirstTimeLeaf = true;
+	private boolean isLeaf;
+	
+	public static TreeView<File> getTreeView(String root) {
+		TreeView newView = new TreeView<>(new SimpleFileTreeItem(new File(root)));
+		newView.getRoot().setExpanded(true);
+		return newView;
+	}
+	
+	public SimpleFileTreeItem(File f) {
+		super(f);
+	}
+	
+	@Override
+	public ObservableList<TreeItem<File>> getChildren() {
+		if (isFirstTimeChildren) {
+			isFirstTimeChildren = false;
+			super.getChildren().setAll(buildChildren(this));
+		}
+		return super.getChildren();
+	}
+	
+	@Override
+	public boolean isLeaf() {
+		if (isFirstTimeLeaf) {
+			isFirstTimeLeaf = false;
+			File f = (File) getValue();
+			isLeaf = f.isFile();
+		}
+		
+		return isLeaf;
+	}
+	
+	private ObservableList<TreeItem<File>> buildChildren(TreeItem<File> TreeItem) {
+		File f = TreeItem.getValue();
+		if (f != null && f.isDirectory()) {
+			File[] files = f.listFiles();
+			if (files != null) {
+				ObservableList<TreeItem<File>> children = FXCollections.observableArrayList();
+				for (TreeItem<File> childFile : children) {
+					childFile.setExpanded(true);
+				}
+				
+				for (File childFile : files) {
+					SimpleFileTreeItem item = new SimpleFileTreeItem(childFile);
+					item.setExpanded(true);
+					children.add(item);
+				}
+				
+				return children;
+			}
+		}
+		
+		return FXCollections.emptyObservableList();
+	}
+
+}
+
diff --git a/src/main/java/lab/controller/TextRequestHandler.java b/src/main/java/lab/controller/TextRequestHandler.java
new file mode 100644
index 0000000..d0e0b23
--- /dev/null
+++ b/src/main/java/lab/controller/TextRequestHandler.java
@@ -0,0 +1,25 @@
+package lab.controller;
+
+import com.mashape.unirest.http.exceptions.UnirestException;
+import lab.model.RemotePath;
+import lab.request.*;
+
+import java.nio.file.Path;
+import java.util.HashMap;
+
+public class TextRequestHandler {
+	private HashMap<String, Request> requestMap = new HashMap<>();
+	
+	public TextRequestHandler(Path local, RemotePath remote, String sessionHeader) {
+		requestMap.put("mkdir", new CreateDirectory(remote, sessionHeader));
+		requestMap.put("ls", new ListFolderContent(remote, sessionHeader, true));
+		requestMap.put("rm", new Delete(remote, sessionHeader));
+		requestMap.put("get_met", new GetMetadata(remote, sessionHeader));
+		requestMap.put("put", new Upload(local, remote, sessionHeader));
+		requestMap.put("get", new Download(local, remote, sessionHeader));
+	}
+	
+	public Object sendRequest(String request) throws UnirestException {
+		return requestMap.get(request).doRequest();
+	}
+}
diff --git a/src/main/java/lab/exceptions/AuthorisationRequiredException.java b/src/main/java/lab/exceptions/AuthorisationRequiredException.java
new file mode 100644
index 0000000..093b231
--- /dev/null
+++ b/src/main/java/lab/exceptions/AuthorisationRequiredException.java
@@ -0,0 +1,7 @@
+package lab.exceptions;
+
+public class AuthorisationRequiredException extends BaseException {
+	public AuthorisationRequiredException() {
+		super("Authorisation required");
+	}
+}
diff --git a/src/main/java/lab/exceptions/BaseException.java b/src/main/java/lab/exceptions/BaseException.java
new file mode 100644
index 0000000..b4ca888
--- /dev/null
+++ b/src/main/java/lab/exceptions/BaseException.java
@@ -0,0 +1,7 @@
+package lab.exceptions;
+
+public class BaseException extends RuntimeException {
+	public BaseException(String message) {
+		super(message);
+	}
+}
diff --git a/src/main/java/lab/exceptions/EmptyFieldException.java b/src/main/java/lab/exceptions/EmptyFieldException.java
new file mode 100644
index 0000000..20c9f21
--- /dev/null
+++ b/src/main/java/lab/exceptions/EmptyFieldException.java
@@ -0,0 +1,7 @@
+package lab.exceptions;
+
+public class EmptyFieldException extends RuntimeException {
+	public EmptyFieldException() {
+		super("Fields cannot be empty");
+	}
+}
diff --git a/src/main/java/lab/exceptions/EncodingProblemException.java b/src/main/java/lab/exceptions/EncodingProblemException.java
new file mode 100644
index 0000000..6f3ed34
--- /dev/null
+++ b/src/main/java/lab/exceptions/EncodingProblemException.java
@@ -0,0 +1,7 @@
+package lab.exceptions;
+
+public class EncodingProblemException extends BaseException {
+	public EncodingProblemException() {
+		super("Problem with encoding");
+	}
+}
diff --git a/src/main/java/lab/exceptions/FileOperationException.java b/src/main/java/lab/exceptions/FileOperationException.java
new file mode 100644
index 0000000..7f17842
--- /dev/null
+++ b/src/main/java/lab/exceptions/FileOperationException.java
@@ -0,0 +1,7 @@
+package lab.exceptions;
+
+public class FileOperationException extends BaseException {
+	public FileOperationException() {
+		super("Something went wrong while reading/writing to file");
+	}
+}
diff --git a/src/main/java/lab/exceptions/InvalidPathParametherException.java b/src/main/java/lab/exceptions/InvalidPathParametherException.java
new file mode 100644
index 0000000..61b778d
--- /dev/null
+++ b/src/main/java/lab/exceptions/InvalidPathParametherException.java
@@ -0,0 +1,7 @@
+package lab.exceptions;
+
+public class InvalidPathParametherException extends BaseException {
+	public InvalidPathParametherException() {
+		super("Invalid path");
+	}
+}
diff --git a/src/main/java/lab/exceptions/UnsuccessfulLoginException.java b/src/main/java/lab/exceptions/UnsuccessfulLoginException.java
new file mode 100644
index 0000000..78cadfc
--- /dev/null
+++ b/src/main/java/lab/exceptions/UnsuccessfulLoginException.java
@@ -0,0 +1,7 @@
+package lab.exceptions;
+
+public class UnsuccessfulLoginException extends BaseException {
+	public UnsuccessfulLoginException() {
+		super("Unsuccessful login");
+	}
+}
diff --git a/src/main/java/lab/exceptions/UserAlreadyExistException.java b/src/main/java/lab/exceptions/UserAlreadyExistException.java
new file mode 100644
index 0000000..3cf7d7e
--- /dev/null
+++ b/src/main/java/lab/exceptions/UserAlreadyExistException.java
@@ -0,0 +1,7 @@
+package lab.exceptions;
+
+public class UserAlreadyExistException extends BaseException {
+	public UserAlreadyExistException() {
+		super("User already exist");
+	}
+}
diff --git a/src/main/java/lab/model/FileMetadata.java b/src/main/java/lab/model/FileMetadata.java
new file mode 100644
index 0000000..9a566c4
--- /dev/null
+++ b/src/main/java/lab/model/FileMetadata.java
@@ -0,0 +1,23 @@
+/**
+ * This class is generated by jOOQ
+ */
+package lab.model;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class FileMetadata implements Serializable {
+	private static final long serialVersionUID = -1953963826;
+	
+	private Integer fileId;
+	private String name;
+	private String pathLower;
+	private String pathDisplay;
+	private Integer enclosingFolderId;
+	private Integer size;
+	private String serverCreatedAt;
+	private String serverChangedAt;
+	private Integer ownerId;
+}
diff --git a/src/main/java/lab/model/FileSystem.java b/src/main/java/lab/model/FileSystem.java
new file mode 100644
index 0000000..52c8189
--- /dev/null
+++ b/src/main/java/lab/model/FileSystem.java
@@ -0,0 +1,27 @@
+package lab.model;
+
+import javafx.beans.property.SimpleStringProperty;
+import javafx.beans.property.StringProperty;
+import javafx.scene.control.TreeView;
+import lab.controller.RemoteFileSystemTree;
+import lombok.Data;
+
+import java.io.File;
+
+@Data
+public class FileSystem {
+	
+	public static final String LOCAL_ROOT = "D:\\";
+	public static StringProperty currentLocalFileProperty = new SimpleStringProperty(LOCAL_ROOT);
+	public static StringProperty currentRemoteFileProperty =
+		   new SimpleStringProperty("");
+	public static TreeView<File> localFileSystem;
+	public static TreeView<RemotePath> remoteFileSystem;
+	public String remoteRoot;
+	public static RemoteFileSystemTree remoteFileSystemTree;
+	
+	public FileSystem(String remoteRoot) {
+		this.remoteRoot = remoteRoot;
+	}
+}
+
diff --git a/src/main/java/lab/model/FolderContent.java b/src/main/java/lab/model/FolderContent.java
new file mode 100644
index 0000000..5f9c275
--- /dev/null
+++ b/src/main/java/lab/model/FolderContent.java
@@ -0,0 +1,17 @@
+package lab.model;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class FolderContent {
+	FolderMetadata root;
+	List<FolderContent> folders;
+	List<FileMetadata> files;
+	
+	@Override
+	public String toString() {
+		return root.getPathDisplay();
+	}
+}
diff --git a/src/main/java/lab/model/FolderMetadata.java b/src/main/java/lab/model/FolderMetadata.java
new file mode 100644
index 0000000..308fc97
--- /dev/null
+++ b/src/main/java/lab/model/FolderMetadata.java
@@ -0,0 +1,19 @@
+package lab.model;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class FolderMetadata implements Serializable {
+	
+	private static final long serialVersionUID = 313897513;
+	
+	private Integer folderId;
+	private Integer parentFolderId;
+	private String name;
+	private String pathLower;
+	private String pathDisplay;
+	private String serverCreatedAt;
+	private Integer ownerId;
+}
diff --git a/src/main/java/lab/model/RemotePath.java b/src/main/java/lab/model/RemotePath.java
new file mode 100644
index 0000000..697da3f
--- /dev/null
+++ b/src/main/java/lab/model/RemotePath.java
@@ -0,0 +1,36 @@
+package lab.model;
+
+import lab.exceptions.EncodingProblemException;
+import lombok.Data;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+@Data
+public class RemotePath {
+	private String path;
+	private FileType fileType;
+	
+	public String getEncodedPath() {
+		try {
+			return URLEncoder.encode(path, "UTF-8");
+		} catch (UnsupportedEncodingException e) {
+			throw new EncodingProblemException();
+		}
+	}
+	
+	public RemotePath(String path, FileType fileType) {
+		this.path = path;
+		this.fileType = fileType;
+	}
+	
+	public enum FileType {
+		FILE,
+		DIR,
+	}
+	
+	@Override
+	public String toString() {
+		return getPath();
+	}
+}
\ No newline at end of file
diff --git a/src/main/java/lab/model/User.java b/src/main/java/lab/model/User.java
new file mode 100644
index 0000000..2e23d7e
--- /dev/null
+++ b/src/main/java/lab/model/User.java
@@ -0,0 +1,43 @@
+package lab.model;
+
+import javafx.beans.property.SimpleStringProperty;
+import javafx.beans.property.StringProperty;
+
+public class User {
+	private final StringProperty user_name;
+	private final StringProperty user_pass;
+	
+	public User(StringProperty user_name, StringProperty user_pass) {
+		this.user_name = user_name;
+		this.user_pass = user_pass;
+	}
+	
+	public User() {
+		this.user_name = new SimpleStringProperty("username");
+		this.user_pass = new SimpleStringProperty("password");
+	}
+	
+	public StringProperty user_passProperty() {
+		return user_pass;
+	}
+	
+	public StringProperty user_nameProperty() {
+		return user_name;
+	}
+	
+	public String getUser_name() {
+		return user_name.get();
+	}
+	
+	public String getUser_pass() {
+		return user_pass.get();
+	}
+	
+	public void setUser_name(String user_name) {
+		this.user_name.set(user_name);
+	}
+	
+	public void setUser_pass(String user_pass) {
+		this.user_pass.set(user_pass);
+	}
+}
diff --git a/src/main/java/lab/request/CreateDirectory.java b/src/main/java/lab/request/CreateDirectory.java
new file mode 100644
index 0000000..b7de790
--- /dev/null
+++ b/src/main/java/lab/request/CreateDirectory.java
@@ -0,0 +1,26 @@
+package lab.request;
+
+import com.mashape.unirest.http.HttpResponse;
+import com.mashape.unirest.http.JsonNode;
+import com.mashape.unirest.http.Unirest;
+import com.mashape.unirest.http.exceptions.UnirestException;
+import lab.model.RemotePath;
+import lab.utils.RequestURI;
+import lombok.AllArgsConstructor;
+
+@AllArgsConstructor
+public class CreateDirectory implements Request {
+	private final RemotePath remotePath;
+	private final String sessionHeader;
+	
+	@Override
+	public Object doRequest() throws UnirestException {
+		HttpResponse<JsonNode> jsonResponse =
+			   Unirest.put(uri(RequestURI.CREATE_DIR, remotePath.getFileType()))
+					.routeParam("path", remotePath.getEncodedPath())
+					.header("Cookie", sessionHeader)
+					.asJson();
+		
+		return jsonResponse;
+	}
+}
diff --git a/src/main/java/lab/request/CreateUser.java b/src/main/java/lab/request/CreateUser.java
new file mode 100644
index 0000000..986f92c
--- /dev/null
+++ b/src/main/java/lab/request/CreateUser.java
@@ -0,0 +1,21 @@
+package lab.request;
+
+import com.mashape.unirest.http.HttpResponse;
+import com.mashape.unirest.http.JsonNode;
+import com.mashape.unirest.http.Unirest;
+import com.mashape.unirest.http.exceptions.UnirestException;
+import lab.model.User;
+import lab.utils.RequestURI;
+import lombok.AllArgsConstructor;
+
+@AllArgsConstructor
+public class CreateUser implements Request {
+	private final User user;
+	
+	@Override
+	public Object doRequest() throws UnirestException {
+		HttpResponse<JsonNode> jsonResponse =
+			   Unirest.post(uri(RequestURI.CREATE_USER)).body(user).asJson();
+		return jsonResponse;
+	}
+}
diff --git a/src/main/java/lab/request/Delete.java b/src/main/java/lab/request/Delete.java
new file mode 100644
index 0000000..8bc5cc3
--- /dev/null
+++ b/src/main/java/lab/request/Delete.java
@@ -0,0 +1,25 @@
+package lab.request;
+
+import com.mashape.unirest.http.HttpResponse;
+import com.mashape.unirest.http.JsonNode;
+import com.mashape.unirest.http.Unirest;
+import com.mashape.unirest.http.exceptions.UnirestException;
+import lab.model.RemotePath;
+import lab.utils.RequestURI;
+import lombok.AllArgsConstructor;
+
+@AllArgsConstructor
+public class Delete implements Request {
+	private final RemotePath remotePath;
+	private final String session;
+	
+	@Override
+	public Object doRequest() throws UnirestException {
+		HttpResponse<JsonNode> jsonResponse =
+			   Unirest.delete(uri(RequestURI.DELETE, remotePath.getFileType()))
+					.routeParam("path", remotePath.getEncodedPath())
+					.header("Cookie", session)
+					.asJson();
+		return jsonResponse;
+	}
+}
diff --git a/src/main/java/lab/request/Download.java b/src/main/java/lab/request/Download.java
new file mode 100644
index 0000000..9c9ed4e
--- /dev/null
+++ b/src/main/java/lab/request/Download.java
@@ -0,0 +1,50 @@
+package lab.request;
+
+import com.mashape.unirest.http.HttpResponse;
+import com.mashape.unirest.http.Unirest;
+import com.mashape.unirest.http.exceptions.UnirestException;
+import lab.exceptions.FileOperationException;
+import lab.exceptions.InvalidPathParametherException;
+import lab.model.RemotePath;
+import lab.utils.RequestURI;
+import lombok.AllArgsConstructor;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import static org.valid4j.Validation.otherwiseThrowing;
+import static org.valid4j.Validation.validate;
+
+//import com.google.common.io.Files;
+
+@AllArgsConstructor
+public class Download implements Request {
+	private Path local;
+	private final RemotePath remotePath;
+	private final String session;
+	
+	@Override
+	public Object doRequest() throws UnirestException {
+		validate(
+			   remotePath.getFileType() == RemotePath.FileType.FILE,
+			   otherwiseThrowing(InvalidPathParametherException.class));
+		
+		HttpResponse<InputStream> binaryResponse =
+			   Unirest.get(uri(RequestURI.DOWNLOAD_FILE, RemotePath.FileType.FILE))
+					.routeParam("path", remotePath.getEncodedPath())
+					.header("Cookie", session)
+					.asBinary();
+		try {
+//			Files.write(file, lines, Charset.forName("UTF-8"));
+//			Charset utf8 = StandardCharsets.UTF_8;
+//			Files.write(local, data);
+			Files.copy(binaryResponse.getBody(), local);
+		} catch (IOException e) {
+			throw new FileOperationException();
+		}
+		return binaryResponse;
+	}
+}
+
diff --git a/src/main/java/lab/request/GetMetadata.java b/src/main/java/lab/request/GetMetadata.java
new file mode 100644
index 0000000..5a2003a
--- /dev/null
+++ b/src/main/java/lab/request/GetMetadata.java
@@ -0,0 +1,25 @@
+package lab.request;
+
+import com.mashape.unirest.http.HttpResponse;
+import com.mashape.unirest.http.JsonNode;
+import com.mashape.unirest.http.Unirest;
+import com.mashape.unirest.http.exceptions.UnirestException;
+import lab.model.RemotePath;
+import lab.utils.RequestURI;
+import lombok.AllArgsConstructor;
+
+@AllArgsConstructor
+public class GetMetadata implements Request {
+	private RemotePath remotePath;
+	private String session;
+	
+	@Override
+	public Object doRequest() throws UnirestException {
+		HttpResponse<JsonNode> jsonResponse =
+			   Unirest.get(uri(RequestURI.GET_METADATA, remotePath.getFileType()))
+					.routeParam("path", remotePath.getEncodedPath())
+					.header("Cookie", session)
+					.asJson();
+		return jsonResponse;
+	}
+}
diff --git a/src/main/java/lab/request/ListFolderContent.java b/src/main/java/lab/request/ListFolderContent.java
new file mode 100644
index 0000000..b9d0f7f
--- /dev/null
+++ b/src/main/java/lab/request/ListFolderContent.java
@@ -0,0 +1,27 @@
+package lab.request;
+
+import com.mashape.unirest.http.HttpResponse;
+import com.mashape.unirest.http.JsonNode;
+import com.mashape.unirest.http.Unirest;
+import com.mashape.unirest.http.exceptions.UnirestException;
+import lab.model.RemotePath;
+import lab.utils.RequestURI;
+import lombok.AllArgsConstructor;
+
+@AllArgsConstructor
+public class ListFolderContent implements Request {
+	private RemotePath remotePath;
+	private String session;
+	private boolean recursive;
+	
+	@Override
+	public Object doRequest() throws UnirestException {
+		HttpResponse<JsonNode> jsonResponse =
+			   Unirest.get(uri(RequestURI.LIST_FOLDER_CONTENT, remotePath.getFileType()))
+					.routeParam("path", remotePath.getEncodedPath())
+					.queryString("recursive", recursive)
+					.header("Cookie", session)
+					.asJson();
+		return jsonResponse;
+	}
+}
diff --git a/src/main/java/lab/request/Login.java b/src/main/java/lab/request/Login.java
new file mode 100644
index 0000000..48231be
--- /dev/null
+++ b/src/main/java/lab/request/Login.java
@@ -0,0 +1,22 @@
+package lab.request;
+
+import com.mashape.unirest.http.HttpResponse;
+import com.mashape.unirest.http.Unirest;
+import com.mashape.unirest.http.exceptions.UnirestException;
+import lab.model.User;
+import lab.utils.RequestURI;
+import lombok.AllArgsConstructor;
+
+@AllArgsConstructor
+public class Login implements Request {
+	private User user;
+	
+	@Override
+	public Object doRequest() throws UnirestException {
+		HttpResponse<String> response =
+			   Unirest.get(uri(RequestURI.USER_LOGIN))
+					.basicAuth(user.getUser_name(), user.getUser_pass())
+					.asString();
+		return response;
+	}
+}
diff --git a/src/main/java/lab/request/Logout.java b/src/main/java/lab/request/Logout.java
new file mode 100644
index 0000000..8296c0a
--- /dev/null
+++ b/src/main/java/lab/request/Logout.java
@@ -0,0 +1,19 @@
+package lab.request;
+
+import com.mashape.unirest.http.HttpResponse;
+import com.mashape.unirest.http.Unirest;
+import com.mashape.unirest.http.exceptions.UnirestException;
+import lab.utils.RequestURI;
+import lombok.AllArgsConstructor;
+
+@AllArgsConstructor
+public class Logout implements Request {
+	private String session;
+	
+	@Override
+	public Object doRequest() throws UnirestException {
+		HttpResponse<String> response =
+			   Unirest.get(uri(RequestURI.USER_LOGOUT)).header("Cookie", session).asString();
+		return response;
+	}
+}
diff --git a/src/main/java/lab/request/Move.java b/src/main/java/lab/request/Move.java
new file mode 100644
index 0000000..3350c16
--- /dev/null
+++ b/src/main/java/lab/request/Move.java
@@ -0,0 +1,27 @@
+package lab.request;
+
+import com.mashape.unirest.http.HttpResponse;
+import com.mashape.unirest.http.JsonNode;
+import com.mashape.unirest.http.Unirest;
+import com.mashape.unirest.http.exceptions.UnirestException;
+import lab.model.RemotePath;
+import lab.utils.RequestURI;
+import lombok.AllArgsConstructor;
+
+@AllArgsConstructor
+public class Move implements Request {
+	private RemotePath remotePath;
+	private String newPath;
+	private String session;
+	
+	@Override
+	public Object doRequest() throws UnirestException {
+		HttpResponse<JsonNode> jsonResponse =
+			   Unirest.put(uri(RequestURI.MOVE, remotePath.getFileType()))
+					.routeParam("path", remotePath.getEncodedPath())
+					.queryString("newPath", newPath)
+					.header("Cookie", session)
+					.asJson();
+		return jsonResponse;
+	}
+}
diff --git a/src/main/java/lab/request/Rename.java b/src/main/java/lab/request/Rename.java
new file mode 100644
index 0000000..ae8b7f3
--- /dev/null
+++ b/src/main/java/lab/request/Rename.java
@@ -0,0 +1,27 @@
+package lab.request;
+
+import com.mashape.unirest.http.HttpResponse;
+import com.mashape.unirest.http.JsonNode;
+import com.mashape.unirest.http.Unirest;
+import com.mashape.unirest.http.exceptions.UnirestException;
+import lab.model.RemotePath;
+import lab.utils.RequestURI;
+import lombok.AllArgsConstructor;
+
+@AllArgsConstructor
+public class Rename implements Request {
+	private RemotePath remotePath;
+	private String newName;
+	private String session;
+	
+	@Override
+	public Object doRequest() throws UnirestException {
+		HttpResponse<JsonNode> jsonResponse =
+			   Unirest.put(uri(RequestURI.RENAME, remotePath.getFileType()))
+					.header("Cookie", session)
+					.routeParam("path", remotePath.getEncodedPath())
+					.queryString("newName", newName)
+					.asJson();
+		return jsonResponse;
+	}
+}
diff --git a/src/main/java/lab/request/Request.java b/src/main/java/lab/request/Request.java
new file mode 100644
index 0000000..35ec0b5
--- /dev/null
+++ b/src/main/java/lab/request/Request.java
@@ -0,0 +1,22 @@
+package lab.request;
+
+import com.mashape.unirest.http.exceptions.UnirestException;
+import lab.model.RemotePath;
+
+public interface Request {
+	String BASE_URI = "http://localhost:4567";
+
+	Object doRequest() throws UnirestException;
+	
+	default String uri(String requestURI, RemotePath.FileType fileType) {
+		
+		return (fileType == RemotePath.FileType.FILE)
+			   ? String.format("%s/files%s", BASE_URI, requestURI)
+			   : String.format("%s/folders%s", BASE_URI, requestURI);
+	}
+	
+	default String uri(String requestURI) {
+		return String.format("%s%s", BASE_URI, requestURI);
+	}
+}
+
diff --git a/src/main/java/lab/request/Upload.java b/src/main/java/lab/request/Upload.java
new file mode 100644
index 0000000..38c8c97
--- /dev/null
+++ b/src/main/java/lab/request/Upload.java
@@ -0,0 +1,53 @@
+package lab.request;
+
+import com.mashape.unirest.http.HttpResponse;
+import com.mashape.unirest.http.JsonNode;
+import com.mashape.unirest.http.Unirest;
+import com.mashape.unirest.http.exceptions.UnirestException;
+import lab.exceptions.InvalidPathParametherException;
+import lab.model.RemotePath;
+import lab.utils.RequestURI;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import static org.valid4j.Validation.otherwiseThrowing;
+import static org.valid4j.Validation.validate;
+
+public class Upload implements Request {
+	private byte[] fileContent;
+	private String fileContent2;
+	private final RemotePath remote;
+	private final String session;
+	private Path localPath;
+	
+	@Override
+	public Object doRequest() throws UnirestException {
+		File file = new File(localPath.toUri());
+		validate(file.exists(), otherwiseThrowing(InvalidPathParametherException.class));
+		validate(file.isFile(), otherwiseThrowing(InvalidPathParametherException.class));
+		
+		try {
+			fileContent = Files.readAllBytes(localPath);
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		
+		HttpResponse<JsonNode> binaryResponse =
+			   Unirest.post(uri(RequestURI.UPLOAD_FILE, RemotePath.FileType.FILE))
+					.queryString("path", remote.getEncodedPath())
+					.header("Cookie", session)
+					.body(fileContent)
+					.asJson();
+		return binaryResponse;
+	}
+	
+	public Upload(Path path, RemotePath remote, String session) {
+		this.remote = remote;
+		this.session = session;
+		this.localPath = path;
+	}
+}
+
diff --git a/src/main/java/lab/utils/RequestURI.java b/src/main/java/lab/utils/RequestURI.java
new file mode 100644
index 0000000..9215870
--- /dev/null
+++ b/src/main/java/lab/utils/RequestURI.java
@@ -0,0 +1,15 @@
+package lab.utils;
+
+public class RequestURI {
+	public static final String LIST_FOLDER_CONTENT = "/{path}/list_folder_content";
+	public static final String DELETE = "/{path}/delete";
+	public static final String CREATE_DIR = "/{path}/create_directory";
+	public static final String RENAME = "/{path}/rename";
+	public static final String MOVE = "/{path}/move";
+	public static final String GET_METADATA = "/{path}/get_meta_data";
+	public static final String DOWNLOAD_FILE = "/{path}/download";
+	public static final String UPLOAD_FILE = "/upload";
+	public static final String CREATE_USER = "/users/create_user";
+	public static final String USER_LOGIN = "/users/access";
+	public static final String USER_LOGOUT = "/users/logout";
+}
diff --git a/src/main/java/lab/utils/Status.java b/src/main/java/lab/utils/Status.java
new file mode 100644
index 0000000..6956add
--- /dev/null
+++ b/src/main/java/lab/utils/Status.java
@@ -0,0 +1,14 @@
+package lab.utils;
+
+public class Status {
+	public static final int SUCCESS_GET = 200;
+	public static final int SUCCESS_CREATED = 201;
+	public static final int USER_ALREADY_EXIST = 400;
+	public static final int DATABASE_ACCESS_PROBLEM = 401;
+	public static final int WRONG_PARAM_FORMAT = 402;
+	public static final int UNSUCCESSFUL_LOGIN = 403;
+	public static final int AUTHORISATION_REQUIRED = 403;
+	public static final int NONEXISTENT_FOLDER = 404;
+	public static final int INVALID_PATH = 405;
+	public static final int SESSION_EXPIRED = 406;
+}
diff --git a/src/main/resources/createAccountView.fxml b/src/main/resources/createAccountView.fxml
new file mode 100644
index 0000000..af443f9
--- /dev/null
+++ b/src/main/resources/createAccountView.fxml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<?import java.lang.*?>
+<?import java.net.*?>
+<?import javafx.geometry.Insets?>
+<?import javafx.scene.control.*?>
+<?import javafx.scene.control.Button?>
+<?import javafx.scene.control.Label?>
+<?import javafx.scene.image.*?>
+<?import javafx.scene.layout.*?>
+<?import javafx.scene.layout.AnchorPane?>
+
+<AnchorPane prefHeight="500.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
+            fx:controller="lab.controller.CreateAccountController">
+    <children>
+        <PasswordField fx:id="passwordTextField" layoutX="290.0" layoutY="141.0" prefHeight="43.0" prefWidth="181.0"/>
+        <TextField fx:id="usernameTextField" layoutX="290.0" layoutY="82.0" prefHeight="43.0" prefWidth="181.0"/>
+        <Button layoutX="322.0" layoutY="261.0" mnemonicParsing="false" onAction="#handleLogin"
+                text="Back to Login View"/>
+        <Button fx:id="createNewAccountButton" layoutX="294.0" layoutY="200.0" mnemonicParsing="false"
+                onAction="#handleCreateNewAccount" prefHeight="43.0" prefWidth="174.0" text="Create new account"/>
+    </children>
+</AnchorPane>
diff --git a/src/main/resources/loginView.fxml b/src/main/resources/loginView.fxml
new file mode 100644
index 0000000..46f84fe
--- /dev/null
+++ b/src/main/resources/loginView.fxml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<?import java.lang.*?>
+<?import java.net.*?>
+<?import javafx.geometry.Insets?>
+<?import javafx.scene.control.*?>
+<?import javafx.scene.control.Button?>
+<?import javafx.scene.control.Label?>
+<?import javafx.scene.image.*?>
+<?import javafx.scene.layout.*?>
+<?import javafx.scene.layout.AnchorPane?>
+
+<AnchorPane prefHeight="500.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/null" xmlns:fx="http://javafx.com/fxml/1"
+            fx:controller="lab.controller.LoginController">
+    <children>
+        <PasswordField fx:id="passwordTextField" layoutX="313.0" layoutY="142.0" prefHeight="40.0" prefWidth="170.0"/>
+        <TextField fx:id="usernameTextField" layoutX="315.0" layoutY="87.0" prefHeight="40.0" prefWidth="170.0"/>
+        <Button layoutX="315.0" layoutY="198.0" mnemonicParsing="false" onAction="#handleLogin" prefHeight="32.0"
+                prefWidth="170.0" text="Login"/>
+        <Button fx:id="createNewAccountButton" layoutX="336.0" layoutY="250.0" mnemonicParsing="false"
+                onAction="#handleCreateAccount" prefHeight="20.0" prefWidth="125.0" text="Sign up"/>
+    </children>
+</AnchorPane>
diff --git a/src/main/resources/mainView.fxml b/src/main/resources/mainView.fxml
new file mode 100644
index 0000000..989dd7e
--- /dev/null
+++ b/src/main/resources/mainView.fxml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<?import javafx.scene.control.Button?>
+<?import javafx.scene.control.ContextMenu?>
+<?import javafx.scene.control.Label?>
+<?import javafx.scene.control.MenuItem?>
+<?import javafx.scene.control.SplitPane?>
+<?import javafx.scene.control.TextArea?>
+<?import javafx.scene.control.TextField?>
+<?import javafx.scene.control.TreeView?>
+<?import javafx.scene.layout.AnchorPane?>
+
+<AnchorPane minHeight="500.0" minWidth="900.0" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1" fx:controller="lab.controller.MainController">
+    <children>
+        <SplitPane dividerPositions="0.8017817371937639" layoutX="172.0" layoutY="47.0" prefHeight="300.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
+            <items>
+                <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
+                    <children>
+                        <SplitPane dividerPositions="0.04040404040404041" layoutX="113.0" layoutY="62.0" orientation="VERTICAL" prefHeight="498.0" prefWidth="717.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
+                            <items>
+                                <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0" />
+                                <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0">
+                                    <children>
+                                        <SplitPane dividerPositions="0.5021037868162693" layoutX="109.0" layoutY="42.0" prefHeight="231.0" prefWidth="418.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
+                                            <items>
+                                                <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
+                                                    <children>
+                                                        <TreeView fx:id="localFileSystemTreeView" layoutX="2.0" layoutY="15.0" prefHeight="308.0" prefWidth="273.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
+                                                            <contextMenu>
+                                                                <ContextMenu fx:id="possibleOperations">
+                                                                    <items>
+                                                                        <MenuItem mnemonicParsing="false" onAction="#changeLocalPathToSelectedInTreeView" text="Set as current path" />
+                                                                    </items>
+                                                                </ContextMenu>
+                                                            </contextMenu>
+                                                        </TreeView>
+                                                    </children>
+                                                </AnchorPane>
+                                                <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
+                                                    <children>
+                                                        <TreeView fx:id="remoteFileSystemTreeView" layoutX="4.0" layoutY="15.0" prefHeight="308.0" prefWidth="278.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
+                                                            <contextMenu>
+                                                                <ContextMenu>
+                                                                    <items>
+                                                                        <MenuItem mnemonicParsing="false" onAction="#changeRemotePathToSelectedInTreeView" text="Set as current path" />
+                                                                        <MenuItem mnemonicParsing="false" onAction="#handleRename_fromMenu" text="Rename" />
+                                                                        <MenuItem mnemonicParsing="false" onAction="#handleMove_fromMenu" text="Move" />
+                                                                    </items>
+                                                                </ContextMenu>
+                                                            </contextMenu>
+                                                        </TreeView>
+                                                    </children>
+                                                </AnchorPane>
+                                            </items>
+                                        </SplitPane>
+                                    </children>
+                                </AnchorPane>
+                            </items>
+                        </SplitPane>
+                        <TextArea fx:id="responseTextArea" layoutX="2.0" layoutY="378.0" prefHeight="120.0" prefWidth="675.0" wrapText="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="2.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="378.0" />
+                    </children>
+                </AnchorPane>
+                <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="158.0" prefWidth="370.0">
+                    <children>
+                        <Label layoutX="10.0" layoutY="6.0" prefHeight="25.0" prefWidth="200.0" text="You are logged in as ">
+                        </Label>
+                        <Label fx:id="usernameLabel" layoutX="125.0" layoutY="6.0" prefHeight="25.0" prefWidth="94.0" />
+                        <TextField fx:id="requestTextField" layoutX="19.0" layoutY="189.0" onMouseExited="#hidePossibleTextCommandsLabel" onMouseMoved="#showPossibleTextCommandsLabel" prefHeight="37.0" prefWidth="139.0" AnchorPane.bottomAnchor="272.0" AnchorPane.leftAnchor="19.0" AnchorPane.rightAnchor="17.0" AnchorPane.topAnchor="189.0" />
+                        <Button fx:id="sendRequestButton" layoutX="19.0" layoutY="237.0" mnemonicParsing="false" onAction="#sendRequest" prefHeight="25.0" prefWidth="138.0" text="Send request" />
+                        <TextArea layoutX="-42.0" layoutY="-54.0" prefHeight="25.0" prefWidth="200.0" />
+                        <TextField fx:id="currentLocalFileTextField" layoutX="16.0" layoutY="51.0" prefHeight="37.0" prefWidth="150.0" AnchorPane.bottomAnchor="410.0" AnchorPane.leftAnchor="16.0" AnchorPane.rightAnchor="9.0" AnchorPane.topAnchor="51.0" />
+                        <TextField fx:id="currentRemoteFileTextField" layoutX="16.0" layoutY="96.0" prefHeight="37.0" prefWidth="150.0" />
+                        <Label fx:id="possibleOperationsLabel" layoutX="21.0" layoutY="142.0" opacity="0.56" prefHeight="37.0" prefWidth="172.0" text="mkdir, ls, get, put, rm, get_met" visible="false" />
+                        <Button layoutX="23.0" layoutY="439.0" mnemonicParsing="false" onAction="#handleLogout" prefHeight="28.0" prefWidth="131.0" text="Logout" />
+                    </children>
+                </AnchorPane>
+            </items>
+        </SplitPane>
+    </children>
+</AnchorPane>
