diff --git a/README.md b/README.md index eb34c38..bc7a2e2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,17 @@ # Course Project at UNAH-MM545: Distributed Text File System -Implementation of a server/client application in Java RMI and JavaFX to manage concurrent connections for managing a file system that accepts operations on users text files. +[![GitHub Repository](https://raw.githubusercontent.com/tobiasbriones/general-images/main/example-projects/badges/ep-gh-repo-badge.svg)](https://github.com/tobiasbriones/cp-unah-mm545-distributed-text-file-system) + +[![Project GitHub License](https://img.shields.io/github/license/tobiasbriones/cp-unah-mm545-distributed-text-file-system.svg?style=flat-square)](https://github.com/tobiasbriones/cp-unah-mm545-distributed-text-file-system/blob/main/LICENSE) + +Implementation of a server/client application in Java RMI and JavaFX to manage concurrent +connections for managing a file system that accepts operations on users' text files. + +The original course project required a much simpler implementation, and the main objective was to +apply DevOps skills. Needless to say, as I often do, I have added a huge amount of extra value to +this project to make it worth it. My objectives are to keep working on some new features after the +first release and build good DevOps documentation. Additionally, it's a good chance to show good use +cases of the main underlying technologies: Java and JavaFX. ## Required technologies @@ -8,11 +19,295 @@ Implementation of a server/client application in Java RMI and JavaFX to manage c - Anything that works for the client. - Linux containers. +## Getting started + +This system can be deployed in several ways. According to the course topics, you should use linux +containers for the server applications. For this server, there are two applications that run the +distributed system: + +- **RMI Registry:** Receives the request from clients to connect to the remote object from the file + server. + + +- **RMI File System Server:** Manages the actual file system and physical files in storage. The + clients access the remote object of this application through the RMI Registry, so the registry may + be deployed separately from the server storing the actual files. + +On the other side, for the client application you should run three or more of them to show the real +time functionality. + +One way to deploy all the system is as a standalone fashion. This way you need tons of RAM to run +many VMs, JVMs, Linux Containers and other open applications as depicted by the following diagram: + +![All-In-One Deployment](./docs/img/deployment.svg) + +In that case, I would even suggest trying to use GraalVM to avoid that crazy amount of JVMs. That is +something I haven't tested yet and the project at this stage is quite unstable. GraalVM also doesn't +play well with the latest non-LTS Java versions and just properly deploying JavaFX is a bit of a +mess by itself these days mostly if you use the latest versions of tools prior waiting for issue +fixes. So let's keep that game for later with Java 17 LTS since I am also using `JDK 16` + +`--enable-preview` as a good mathematician to take advantage of the new data oriented and FP +features for the *model* (or domain) layer. + +### Requirements + +#### AIO deploy + +For the "All-In-One" deployment model the requirements are as follows: + +**Minimum requirements** + +- Intel® Core™ i3-6100 / Intel® Core™ i5-2400 +- 8 GB of system memory +- 35 GB of available storage + +**Recommended requirements** + +- Intel® Core™ i5-4590 / Intel® Core™ i7-2600 +- 12 GB of system memory +- 50 GB of available SSD storage +- Nvidia GT-730 / 256 MB of dedicated VRAM + +Additionally, a broadband internet connection is required to install all the tools. + +Some of these requirements are for the Ubuntu VM installation and accelerated graphics boots to make +the VM run smoother. + +#### Cloud deploy + +For a cloud deployment the requirements are simple: + +- An Ubuntu VM with at least 1 vCPU, 2 GB RAM, 8 GB storage. +- A desktop computer to run the JavaFX clients. + +It doesn't hurt to pick a better one. An Azure B2s / B2ms size is plenty enough for testing. + +**Important:** If you plan to set up a cloud deployment over a WAN or the Internet then you must +have a good background in networking since this is a really tough/impossible endeavor. I have +tried for many days to achieve this goal but it is not feasible to fulfill. I don't plan on doing so, +because the underlying technology is archaic (RMI) and I'm a Software Engineer and not a DevOps. +The problem is likely due to the system using callbacks and the client has to be a server too to +export its object, then firewall and inbound rules have to be configured for each client machine, +the IPs and ports are another mess and a machine might just be able to run only one client at a +time. Then, just make an "AIO"-fashioned deploy where all of the machines run on the same LAN if +you don't have a larger infraestructure running on the same LAN. +More on this: + +- [How to send a message from Server to Client using Java RMI?](https://stackoverflow.com/questions/29284276/how-to-send-a-message-from-server-to-client-using-java-rmi) +- [Can I invoke a client´s method from a server with RMI](https://stackoverflow.com/questions/21665300/can-i-invoke-a-client%C2%B4s-method-from-a-server-with-rmi) +- [Java rmi over the internet](https://stackoverflow.com/questions/16268391/java-rmi-over-the-internet) + +### Deployment + +For this version of the software, you need to do some manual configs regarding IP addresses or +hostnames. This is because the RMI technology requires knowing not only the server hostname where +the JVM is running but also the client's hostname to answer back to it. If the hostname property +isn't set on the client app then the server won't be able to respond to that client, or it might +take a huge amount of time to respond. Fortunately, everything is set up already, and the config +process just requires a bit of work. + +#### Server applications + +On server machine (assumed to be Ubuntu 20.x x64), install LXC, configure LXD and create two +containers: `registry` and `fs`; for the registry server and the file-system server respectively. I +don't recommend using snap along with LXC since I had a trouble which made me uninstall it later. +Then install a proxy device into the registry container to map the VM RMI port to the registry +container port: + +`sudo apt update` + +`sudo apt upgrade` + +`sudo apt install lxd` + +Choose the latest version of LXD (4.x+) and run `lxc list` to check it appears an empty list of +containers, and the installation was successful. Run `sudo lxd init` and choose all the defaults to +finish the lxd set up. Now install an Ubuntu image (in this case 20.04) and create the two +containers required: + +`lxc launch ubuntu:20.04 registry` + +`lxc launch ubuntu:20.04 fs` + +Then check with `lxc list` that you have created two new linux containers. + +##### Common set up + +Next, run the following commands on both containers `registry` and `fs` to install common tools that +are suggested to deploy the applications: + +`lxc exec { container } -- bash` + +`sudo apt update` + +`sudo apt upgrade` + +`sudo apt install zip` + +`sudo apt install unzip` + +Install SDKMAN: + +`curl -s "https://get.sdkman.io" | bash` + +`source "$HOME/.sdkman/bin/sdkman-init.sh"` + +Check SDKMAN installation: `sdk version`. Now install Gradle and Java. The current non-LTS version +of Java I used is JDK16 with enable-preview, I suggest installing JDK17+ (which is not GA yet at the +time of this release) for the current release v0.1.0: + +`sdk list java` (choose the latest 17.0.x, 17+ version) + +`sdk install java 17.0.{ x }-open` + +`sdk install gradle` + +Clone the project repository into a directory of choice: + +`git clone https://github.com/tobiasbriones/cp-unah-mm545-distributed-text-file-system.git` + +Now the common configuration has finished for both containers. + +##### Registry container + +Install the proxy device into the registry container to accept communication to the outside: + +`lxc config device add registry rmi-port proxy listen=tcp:0.0.0.0:1099 connect=tcp:127.0.0.1:1099` + +Prior to continuing, you'd like to take note of both container's IP addresses, check it out +with `lxc list`. + +Enter into the registry container and run the server as a registry application assuming you are into +the project root directory: + +`lxc exec registry -- bash` + +`cd server` + +`gradle run --args="{ registry-ip-address } reg"` + +Thus, the server should be running as an RMI registry server and listening to incoming clients. + +##### FileSystem container + +Enter into the fs container and run the server as a file-system server: + +`lxc exec fs -- bash` + +`cd server` + +`gradle run --args="{ fs-ip-address } fs { registry-ip-address }"` + +Thus, the server should be running as an RMI file-system server. So, the remote object of this +server has been bound to the registry server so that the registry server knows that clients want to +access *that* remote object located at *this* container. + +##### Troubleshooting + +- Don't forget to configure the inbound/outbound security groups to allow traffic pass by your VM. + +- Since I haven't added the dynamic IP config via the `NetworkInterface` Java API, and they have to + be passed manually by JVM args, don't forget that IP addresses change when restarting the network. + I was playing with that API though JShell, and I think it will work well when I implement it. + +- [Storage issues](./docs/troubleshooting/storage/storage.md): Container out of space, "no space left on device" when running an app. + +#### Desktop client + +Finally, to deploy the client into a desktop machine: clone the repository, install SDKMAN, Gradle +and a version of JDK with FX mods (Zulu FX or Liberica). If you use IntelliJ IDEA then it can be +faster to run from the Gradle window. You will need the familiar commands if you are in Linux or +Mac, for Windows the installations may be harder that's why I recommend using IntelliJ IDEA if you' +re using Windows. The following commands work for an Ubuntu desktop: + +`sudo apt update` + +`sudo apt upgrade` + +`sudo apt install zip` + +`sudo apt install unzip` + +`curl -s "https://get.sdkman.io" | bash` + +`source "$HOME/.sdkman/bin/sdkman-init.sh"` + +`sdk install gradle` + +Install a JDK version of your choice (JDK17+) but make sure it contains the `fx` modules: + +`sdk list java | grep fx` + +`sdk install java 17.0.{ x }.fx-zulu` + +Now edit the source file: + +`cd client` + +`sudo nano src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/FileSystemServices.java` + +Then set the `HOST` constant of that file to the public IP address or hostname of your VM. + +Finally, run the application and pass the IP address of your current desktop machine where the +client will run: + +`gradle run --args="{ client-ip-address }"` + +##### Troubleshooting + +- If you get a weird error when running the app, + like [Error initializing QuantumRenderer: no suitable pipeline found](https://stackoverflow.com/questions/68204320/javafx-installation-issues-error-initializing-quantumrenderer) + make sure to had installed an updated JDK version containing the JavaFX mods like Azul FX or + BellSoft Liberica and run the application with that JDK. + +##### Suggested reading + +In [this article](./docs/troubleshooting/binary-incompatibility/binary-incompatibility.md), I talk about an experience I had with the famous binary compatibility. + +##### Issues + +One of the main issue of `v0.1.0` is the local FS update regarding deleting files. When a user +deletes a file form the system, it's physically deleted from the user machine but not physically +deleted from the other client machines. This feature will be implemented in a further project +version. Significant performance optimizations will be scheduled for later releases too. + +### Bibliography + +- Linux Containers. (2021). Linuxcontainers.Org. https://linuxcontainers.org/ + +- Home - SDKMAN! the Software Development Kit Manager. (2021). Sdkman.Io. https://sdkman.io/ + +- Xenitellis, S. (2021, February 8). How to use the LXD Proxy Device to map ports between the host + and the containers. + Blog.Simos.Info. https://blog.simos.info/how-to-use-the-lxd-proxy-device-to-map-ports-between-the-host-and-the-containers/ + +## Screenshots + +**LXC and Registry Container** +![Registry](./docs/img/lxc-list-and-registry-screenshot.png) + +**LXC and FS container** +![FS](./docs/img/lxc-list-and-fs-screenshot.png) + +**Client running and FS Server files** +![Client](./docs/img/client-and-fs-files-screenshot.png) + +**Demo Animation** +![Demo Animation](./docs/img/demo.gif) + +## Contact + +This project: [Docs](https://tobiasbriones.github.io/cp-unah-mm545-distributed-text-file-system), +[Repository](https://github.com/tobiasbriones/cp-unah-mm545-distributed-text-file-system) + +Tobias Briones: [GitHub](https://github.com/tobiasbriones) + ## About **Course Project at UNAH-MM545: Distributed Text File System** -Implementation of a server/client application in Java RMI and JavaFX to manage concurrent connections for managing a file system that accepts operations on users text files. +Implementation of a server/client application in Java RMI and JavaFX to manage concurrent +connections for managing a file system that accepts operations on users' text files. Copyright © 2021 Tobias Briones. All rights reserved. diff --git a/client/build.gradle.kts b/client/build.gradle.kts index bcbc292..d02ba69 100644 --- a/client/build.gradle.kts +++ b/client/build.gradle.kts @@ -18,12 +18,11 @@ plugins { id("application") } -group = "io.github.tobiasbriones.cp" -version = "1.0-SNAPSHOT" +version = "0.1.0" application { - mainModule.set("io.github.tobiasbriones.cp.rmifilesystem.client") - mainClass.set("io.github.tobiasbriones.cp.rmifilesystem.client.Launcher") + mainModule.set("com.github.tobiasbriones.cp.rmifilesystem.client") + mainClass.set("com.github.tobiasbriones.cp.rmifilesystem.client.Launcher") } repositories { diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/App.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/App.java similarity index 88% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/App.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/App.java index 9953dc4..4b00949 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/App.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/App.java @@ -11,17 +11,17 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client; - -import io.github.tobiasbriones.cp.rmifilesystem.client.info.Info; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileRepository; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.Initializable; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.MvpPresenter; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.MvpView; -import io.github.tobiasbriones.cp.rmifilesystem.client.content.Content; -import io.github.tobiasbriones.cp.rmifilesystem.client.header.Header; -import io.github.tobiasbriones.cp.rmifilesystem.client.menu.AppMenu; -import io.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService; +package com.github.tobiasbriones.cp.rmifilesystem.client; + +import com.github.tobiasbriones.cp.rmifilesystem.client.content.Content; +import com.github.tobiasbriones.cp.rmifilesystem.client.header.Header; +import com.github.tobiasbriones.cp.rmifilesystem.client.info.Info; +import com.github.tobiasbriones.cp.rmifilesystem.client.menu.AppMenu; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileRepository; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.Initializable; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.MvpPresenter; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.MvpView; +import com.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService; import javafx.application.Platform; import javafx.scene.Node; import javafx.scene.Parent; diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/AppLocalFiles.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/AppLocalFiles.java similarity index 88% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/AppLocalFiles.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/AppLocalFiles.java index 23d77a6..253fd1a 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/AppLocalFiles.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/AppLocalFiles.java @@ -11,15 +11,15 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client; +package com.github.tobiasbriones.cp.rmifilesystem.client; -import io.github.tobiasbriones.cp.rmifilesystem.impl.io.file.text.AppLocalTextFileRepository; -import io.github.tobiasbriones.cp.rmifilesystem.impl.io.file.text.CommonPaths; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.Directory; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.File; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileRepository; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.DirectoryNode; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem; +import com.github.tobiasbriones.cp.rmifilesystem.impl.io.file.text.AppLocalTextFileRepository; +import com.github.tobiasbriones.cp.rmifilesystem.impl.io.file.text.CommonPaths; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.Directory; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.File; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileRepository; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.DirectoryNode; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem; import java.io.*; import java.nio.file.Files; @@ -29,7 +29,7 @@ import java.util.Map; import java.util.Set; -import static io.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem.*; +import static com.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem.*; /** * @author Tobias Briones diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/AppMenuOutput.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/AppMenuOutput.java similarity index 83% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/AppMenuOutput.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/AppMenuOutput.java index 8391664..5d6c9dc 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/AppMenuOutput.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/AppMenuOutput.java @@ -11,11 +11,11 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client; +package com.github.tobiasbriones.cp.rmifilesystem.client; -import io.github.tobiasbriones.cp.rmifilesystem.client.header.Header; -import io.github.tobiasbriones.cp.rmifilesystem.client.menu.AppMenu; -import io.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService; +import com.github.tobiasbriones.cp.rmifilesystem.client.header.Header; +import com.github.tobiasbriones.cp.rmifilesystem.client.menu.AppMenu; +import com.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService; import java.io.File; diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/AppPresenter.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/AppPresenter.java similarity index 80% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/AppPresenter.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/AppPresenter.java index 806dee8..07fb536 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/AppPresenter.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/AppPresenter.java @@ -11,10 +11,10 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client; +package com.github.tobiasbriones.cp.rmifilesystem.client; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.AbstractMvpPresenter; -import io.github.tobiasbriones.cp.rmifilesystem.client.header.Header; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.AbstractMvpPresenter; +import com.github.tobiasbriones.cp.rmifilesystem.client.header.Header; /** * @author Tobias Briones diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/AppView.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/AppView.java similarity index 95% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/AppView.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/AppView.java index 55b9303..df850fd 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/AppView.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/AppView.java @@ -11,7 +11,7 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client; +package com.github.tobiasbriones.cp.rmifilesystem.client; import javafx.geometry.Insets; import javafx.scene.Node; diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/FileSystemServices.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/FileSystemServices.java similarity index 75% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/FileSystemServices.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/FileSystemServices.java index ba58851..c30515e 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/FileSystemServices.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/FileSystemServices.java @@ -11,9 +11,9 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client; +package com.github.tobiasbriones.cp.rmifilesystem.client; -import io.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService; +import com.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService; import java.rmi.NotBoundException; import java.rmi.RemoteException; @@ -23,9 +23,9 @@ * @author Tobias Briones */ public final class FileSystemServices { - public static final String HOST = "localhost"; + public static final String HOST = "localhost"; // Registry hostname private static final int PORT = 1099; - private static final String SERVICE_NAME = "FileSystemService"; + private static final String SERVICE_NAME = "RMIServer"; // Registry server name public static FileSystemService obtainService() throws RemoteException, NotBoundException { return (FileSystemService) LocateRegistry.getRegistry(HOST, PORT) diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/Launcher.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/Launcher.java similarity index 90% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/Launcher.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/Launcher.java index cab32f5..850fde1 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/Launcher.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/Launcher.java @@ -11,7 +11,7 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client; +package com.github.tobiasbriones.cp.rmifilesystem.client; public final class Launcher { public static void main(String[] args) { diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/Main.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/Main.java similarity index 79% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/Main.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/Main.java index 02050b8..2a03547 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/Main.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/Main.java @@ -11,7 +11,7 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client; +package com.github.tobiasbriones.cp.rmifilesystem.client; import javafx.application.Application; import javafx.stage.Stage; @@ -21,6 +21,11 @@ */ public final class Main extends Application { public static void main(String[] args) { + if (args.length > 0) { + final var hostname = args[0]; + + System.setProperty("java.rmi.server.hostname", hostname); + } launch(args); } diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/Content.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/Content.java similarity index 80% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/Content.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/Content.java index 2083e31..8b0a271 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/Content.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/Content.java @@ -11,23 +11,23 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.content; - -import io.github.tobiasbriones.cp.rmifilesystem.client.FileSystemServices; -import io.github.tobiasbriones.cp.rmifilesystem.client.header.Header; -import io.github.tobiasbriones.cp.rmifilesystem.client.info.Info; -import io.github.tobiasbriones.cp.rmifilesystem.model.OnFileUpdateListener; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.File; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileRepository; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystems; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.Initializable; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.MvpPresenter; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.MvpView; -import io.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService; -import io.github.tobiasbriones.cp.rmifilesystem.client.content.editor.Editor; -import io.github.tobiasbriones.cp.rmifilesystem.client.content.files.Files; -import io.github.tobiasbriones.cp.rmifilesystem.client.AppLocalFiles; +package com.github.tobiasbriones.cp.rmifilesystem.client.content; + +import com.github.tobiasbriones.cp.rmifilesystem.client.header.Header; +import com.github.tobiasbriones.cp.rmifilesystem.client.FileSystemServices; +import com.github.tobiasbriones.cp.rmifilesystem.client.info.Info; +import com.github.tobiasbriones.cp.rmifilesystem.model.OnFileUpdateListener; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.File; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileRepository; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystems; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.Initializable; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.MvpPresenter; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.MvpView; +import com.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService; +import com.github.tobiasbriones.cp.rmifilesystem.client.content.editor.Editor; +import com.github.tobiasbriones.cp.rmifilesystem.client.content.files.Files; +import com.github.tobiasbriones.cp.rmifilesystem.client.AppLocalFiles; import javafx.application.Platform; import javafx.scene.Node; @@ -36,8 +36,8 @@ import java.rmi.server.UnicastRemoteObject; import java.util.Map; -import static io.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService.*; -import static io.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem.*; +import static com.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService.*; +import static com.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem.*; /** * @author Tobias Briones diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/ContentOnFileUpdateListener.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/ContentOnFileUpdateListener.java similarity index 73% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/ContentOnFileUpdateListener.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/ContentOnFileUpdateListener.java index 3a13c79..15ab189 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/ContentOnFileUpdateListener.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/ContentOnFileUpdateListener.java @@ -11,13 +11,13 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.content; +package com.github.tobiasbriones.cp.rmifilesystem.client.content; -import io.github.tobiasbriones.cp.rmifilesystem.client.AppLocalFiles; -import io.github.tobiasbriones.cp.rmifilesystem.model.OnFileUpdateListener; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.File; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystems; +import com.github.tobiasbriones.cp.rmifilesystem.client.AppLocalFiles; +import com.github.tobiasbriones.cp.rmifilesystem.model.OnFileUpdateListener; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.File; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystems; import javafx.application.Platform; import java.io.IOException; @@ -26,8 +26,8 @@ import java.rmi.server.UnicastRemoteObject; import java.util.Map; -import static io.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService.*; -import static io.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem.*; +import static com.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService.*; +import static com.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem.*; /** * Receives the file changes from the RMI server broadcast. diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/ContentPresenter.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/ContentPresenter.java similarity index 83% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/ContentPresenter.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/ContentPresenter.java index c3162f8..5532064 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/ContentPresenter.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/ContentPresenter.java @@ -11,9 +11,9 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.content; +package com.github.tobiasbriones.cp.rmifilesystem.client.content; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.AbstractMvpPresenter; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.AbstractMvpPresenter; /** * @author Tobias Briones diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/ContentView.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/ContentView.java similarity index 94% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/ContentView.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/ContentView.java index 5161bfa..08e86c0 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/ContentView.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/ContentView.java @@ -11,7 +11,7 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.content; +package com.github.tobiasbriones.cp.rmifilesystem.client.content; import javafx.scene.Node; import javafx.scene.layout.HBox; diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/EditorOutput.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/EditorOutput.java similarity index 84% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/EditorOutput.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/EditorOutput.java index 82b4375..7c20c98 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/EditorOutput.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/EditorOutput.java @@ -11,18 +11,18 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.content; - -import io.github.tobiasbriones.cp.rmifilesystem.client.AppLocalFiles; -import io.github.tobiasbriones.cp.rmifilesystem.client.content.editor.Editor; -import io.github.tobiasbriones.cp.rmifilesystem.client.content.files.Files; -import io.github.tobiasbriones.cp.rmifilesystem.client.info.Info; -import io.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.File; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.Nothing; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.Result; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileContent; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileRepository; +package com.github.tobiasbriones.cp.rmifilesystem.client.content; + +import com.github.tobiasbriones.cp.rmifilesystem.client.AppLocalFiles; +import com.github.tobiasbriones.cp.rmifilesystem.client.content.editor.Editor; +import com.github.tobiasbriones.cp.rmifilesystem.client.content.files.Files; +import com.github.tobiasbriones.cp.rmifilesystem.client.info.Info; +import com.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.File; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.Nothing; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.Result; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileContent; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileRepository; import javafx.application.Platform; import java.io.IOException; @@ -187,8 +187,14 @@ private void onFilePullFailed(File.TextFile file, String message) { } private void updateLocalContent(TextFileContent content) { - final Result result = repository.set(content); + Result result; + if (repository.exists(content.file())) { + result = repository.set(content); + } + else { + result = repository.add(content); + } if (result instanceof Result.Failure fail) { fail.ifPresent(System.out::println); } diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/FilesOutput.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/FilesOutput.java similarity index 87% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/FilesOutput.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/FilesOutput.java index 426f2e1..def626b 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/FilesOutput.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/FilesOutput.java @@ -11,20 +11,20 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.content; - -import io.github.tobiasbriones.cp.rmifilesystem.client.info.Info; -import io.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService; -import io.github.tobiasbriones.cp.rmifilesystem.client.AppLocalFiles; -import io.github.tobiasbriones.cp.rmifilesystem.client.content.editor.Editor; -import io.github.tobiasbriones.cp.rmifilesystem.client.content.files.Files; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.CommonFile; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.Directory; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.File; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.Nothing; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.Result; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileContent; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileRepository; +package com.github.tobiasbriones.cp.rmifilesystem.client.content; + +import com.github.tobiasbriones.cp.rmifilesystem.client.info.Info; +import com.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService; +import com.github.tobiasbriones.cp.rmifilesystem.client.AppLocalFiles; +import com.github.tobiasbriones.cp.rmifilesystem.client.content.editor.Editor; +import com.github.tobiasbriones.cp.rmifilesystem.client.content.files.Files; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.CommonFile; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.Directory; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.File; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.Nothing; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.Result; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileContent; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileRepository; import javafx.application.Platform; import java.io.IOException; diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/editor/Editor.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/editor/Editor.java similarity index 81% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/editor/Editor.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/editor/Editor.java index 3aa78d6..f78e9c1 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/editor/Editor.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/editor/Editor.java @@ -11,13 +11,13 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.content.editor; +package com.github.tobiasbriones.cp.rmifilesystem.client.content.editor; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.File; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileRepository; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.Initializable; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.MvpPresenter; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.MvpView; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.File; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileRepository; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.Initializable; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.MvpPresenter; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.MvpView; import javafx.scene.Node; /** diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/editor/EditorPresenter.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/editor/EditorPresenter.java similarity index 84% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/editor/EditorPresenter.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/editor/EditorPresenter.java index ee386f2..4655365 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/editor/EditorPresenter.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/editor/EditorPresenter.java @@ -11,15 +11,15 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.content.editor; - -import io.github.tobiasbriones.cp.rmifilesystem.client.AppLocalFiles; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.File; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.Nothing; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.Result; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileContent; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileRepository; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.AbstractMvpPresenter; +package com.github.tobiasbriones.cp.rmifilesystem.client.content.editor; + +import com.github.tobiasbriones.cp.rmifilesystem.client.AppLocalFiles; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.File; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.Nothing; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.Result; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileContent; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileRepository; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.AbstractMvpPresenter; import java.io.IOException; diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/editor/EditorView.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/editor/EditorView.java similarity index 97% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/editor/EditorView.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/editor/EditorView.java index 5f4a9b2..63cd9a2 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/editor/EditorView.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/editor/EditorView.java @@ -11,7 +11,7 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.content.editor; +package com.github.tobiasbriones.cp.rmifilesystem.client.content.editor; import javafx.geometry.Insets; import javafx.geometry.Pos; diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/files/package-info.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/editor/package-info.java similarity index 85% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/files/package-info.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/editor/package-info.java index dcabb48..50da847 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/files/package-info.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/editor/package-info.java @@ -14,4 +14,4 @@ /** * @author Tobias Briones */ -package io.github.tobiasbriones.cp.rmifilesystem.client.content.files; +package com.github.tobiasbriones.cp.rmifilesystem.client.content.editor; diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/files/FileItemView.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/files/FileItemView.java similarity index 91% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/files/FileItemView.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/files/FileItemView.java index 6e7ee49..83cec9f 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/files/FileItemView.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/files/FileItemView.java @@ -11,10 +11,10 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.content.files; +package com.github.tobiasbriones.cp.rmifilesystem.client.content.files; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.DirectoryNode; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.Node; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.DirectoryNode; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.Node; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.control.TreeItem; diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/files/Files.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/files/Files.java similarity index 75% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/files/Files.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/files/Files.java index e3366b8..55699ed 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/files/Files.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/files/Files.java @@ -11,17 +11,17 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.content.files; - -import io.github.tobiasbriones.cp.rmifilesystem.model.io.CommonFile; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.File; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileRepository; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.DirectoryNode; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.Initializable; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.MvpPresenter; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.MvpView; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.Node; +package com.github.tobiasbriones.cp.rmifilesystem.client.content.files; + +import com.github.tobiasbriones.cp.rmifilesystem.model.io.CommonFile; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.File; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileRepository; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.DirectoryNode; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.Initializable; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.MvpPresenter; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.MvpView; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.Node; /** * @author Tobias Briones diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/files/FilesPresenter.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/files/FilesPresenter.java similarity index 81% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/files/FilesPresenter.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/files/FilesPresenter.java index 09cacab..ed2ca6c 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/files/FilesPresenter.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/files/FilesPresenter.java @@ -11,24 +11,24 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.content.files; - -import io.github.tobiasbriones.cp.rmifilesystem.client.AppLocalFiles; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.CommonFile; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.CommonPath; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.Directory; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.File; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.Nothing; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.Result; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileContent; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileRepository; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.DirectoryNode; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileNode; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.Node; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.AbstractMvpPresenter; - -import io.github.tobiasbriones.cp.rmifilesystem.model.io.File.TextFile; +package com.github.tobiasbriones.cp.rmifilesystem.client.content.files; + +import com.github.tobiasbriones.cp.rmifilesystem.client.AppLocalFiles; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.CommonFile; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.CommonPath; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.Directory; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.File; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.Nothing; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.Result; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileContent; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileRepository; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.DirectoryNode; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileNode; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.Node; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.AbstractMvpPresenter; + +import com.github.tobiasbriones.cp.rmifilesystem.model.io.File.TextFile; import javafx.scene.control.TextInputDialog; import java.io.IOException; diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/files/FilesView.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/files/FilesView.java similarity index 95% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/files/FilesView.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/files/FilesView.java index 0b30b1e..0c160a0 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/files/FilesView.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/files/FilesView.java @@ -11,12 +11,12 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.content.files; +package com.github.tobiasbriones.cp.rmifilesystem.client.content.files; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.CommonFile; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.File; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.DirectoryNode; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.Node; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.CommonFile; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.File; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.DirectoryNode; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.Node; import javafx.beans.value.ChangeListener; import javafx.scene.control.*; import javafx.scene.image.Image; diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/editor/package-info.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/files/package-info.java similarity index 85% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/editor/package-info.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/files/package-info.java index bfacac5..53f724b 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/editor/package-info.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/files/package-info.java @@ -14,4 +14,4 @@ /** * @author Tobias Briones */ -package io.github.tobiasbriones.cp.rmifilesystem.client.content.editor; +package com.github.tobiasbriones.cp.rmifilesystem.client.content.files; diff --git a/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/package-info.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/package-info.java new file mode 100644 index 0000000..6f540fb --- /dev/null +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/content/package-info.java @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2021 Tobias Briones. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * This file is part of Course Project at UNAH-MM545: Distributed Text File + * System. + * + * This source code is licensed under the BSD-3-Clause License found in the + * LICENSE file in the root directory of this source tree or at + * https://opensource.org/licenses/BSD-3-Clause. + */ + +/** + * @author Tobias Briones + */ +package com.github.tobiasbriones.cp.rmifilesystem.client.content; diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/header/Header.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/header/Header.java similarity index 81% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/header/Header.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/header/Header.java index a051566..089f232 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/header/Header.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/header/Header.java @@ -11,11 +11,11 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.header; +package com.github.tobiasbriones.cp.rmifilesystem.client.header; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.Initializable; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.MvpPresenter; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.MvpView; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.Initializable; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.MvpPresenter; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.MvpView; import javafx.scene.Node; /** diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/header/HeaderPresenter.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/header/HeaderPresenter.java similarity index 83% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/header/HeaderPresenter.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/header/HeaderPresenter.java index 5065171..a244596 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/header/HeaderPresenter.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/header/HeaderPresenter.java @@ -11,9 +11,9 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.header; +package com.github.tobiasbriones.cp.rmifilesystem.client.header; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.AbstractMvpPresenter; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.AbstractMvpPresenter; /** * @author Tobias Briones diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/header/HeaderView.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/header/HeaderView.java similarity index 97% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/header/HeaderView.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/header/HeaderView.java index 1670b7f..8073833 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/header/HeaderView.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/header/HeaderView.java @@ -11,7 +11,7 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.header; +package com.github.tobiasbriones.cp.rmifilesystem.client.header; import javafx.geometry.Insets; import javafx.scene.Node; diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/package-info.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/header/package-info.java similarity index 86% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/package-info.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/header/package-info.java index 47d8bf6..349e6dc 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/content/package-info.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/header/package-info.java @@ -14,4 +14,4 @@ /** * @author Tobias Briones */ -package io.github.tobiasbriones.cp.rmifilesystem.client.content; +package com.github.tobiasbriones.cp.rmifilesystem.client.header; diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/info/Info.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/info/Info.java similarity index 81% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/info/Info.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/info/Info.java index 4b8cc9b..7216db9 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/info/Info.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/info/Info.java @@ -11,11 +11,11 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.info; +package com.github.tobiasbriones.cp.rmifilesystem.client.info; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.Initializable; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.MvpPresenter; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.MvpView; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.Initializable; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.MvpPresenter; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.MvpView; import javafx.scene.Node; /** diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/info/InfoPresenter.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/info/InfoPresenter.java similarity index 83% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/info/InfoPresenter.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/info/InfoPresenter.java index 54c283f..19c2285 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/info/InfoPresenter.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/info/InfoPresenter.java @@ -11,9 +11,9 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.info; +package com.github.tobiasbriones.cp.rmifilesystem.client.info; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.AbstractMvpPresenter; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.AbstractMvpPresenter; /** * @author Tobias Briones diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/info/InfoView.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/info/InfoView.java similarity index 97% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/info/InfoView.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/info/InfoView.java index 8eabd27..8d5b1f7 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/info/InfoView.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/info/InfoView.java @@ -11,7 +11,7 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.info; +package com.github.tobiasbriones.cp.rmifilesystem.client.info; import javafx.geometry.Insets; import javafx.geometry.Pos; diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/info/package-info.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/info/package-info.java similarity index 87% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/info/package-info.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/info/package-info.java index 2ae8643..cd66ca6 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/info/package-info.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/info/package-info.java @@ -14,4 +14,4 @@ /** * @author Tobias Briones */ -package io.github.tobiasbriones.cp.rmifilesystem.client.info; +package com.github.tobiasbriones.cp.rmifilesystem.client.info; diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/menu/AppMenu.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/menu/AppMenu.java similarity index 85% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/menu/AppMenu.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/menu/AppMenu.java index c8ec814..23524b8 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/menu/AppMenu.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/menu/AppMenu.java @@ -11,11 +11,11 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.menu; +package com.github.tobiasbriones.cp.rmifilesystem.client.menu; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.Initializable; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.MvpPresenter; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.MvpView; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.Initializable; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.MvpPresenter; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.MvpView; import javafx.scene.Node; import java.io.File; diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/menu/AppMenuPresenter.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/menu/AppMenuPresenter.java similarity index 92% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/menu/AppMenuPresenter.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/menu/AppMenuPresenter.java index 21cfe6b..07e56b9 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/menu/AppMenuPresenter.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/menu/AppMenuPresenter.java @@ -11,9 +11,9 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.menu; +package com.github.tobiasbriones.cp.rmifilesystem.client.menu; -import io.github.tobiasbriones.cp.rmifilesystem.mvp.AbstractMvpPresenter; +import com.github.tobiasbriones.cp.rmifilesystem.mvp.AbstractMvpPresenter; import javafx.scene.control.TextInputDialog; /** diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/menu/AppMenuView.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/menu/AppMenuView.java similarity index 98% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/menu/AppMenuView.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/menu/AppMenuView.java index 379746b..1c1fd07 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/menu/AppMenuView.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/menu/AppMenuView.java @@ -11,7 +11,7 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.client.menu; +package com.github.tobiasbriones.cp.rmifilesystem.client.menu; import javafx.scene.Node; import javafx.scene.control.Menu; diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/menu/package-info.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/menu/package-info.java similarity index 87% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/menu/package-info.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/menu/package-info.java index da75124..e08cab6 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/menu/package-info.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/menu/package-info.java @@ -14,4 +14,4 @@ /** * @author Tobias Briones */ -package io.github.tobiasbriones.cp.rmifilesystem.client.menu; +package com.github.tobiasbriones.cp.rmifilesystem.client.menu; diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/package-info.java b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/package-info.java similarity index 88% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/package-info.java rename to client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/package-info.java index 1a79f31..dd365f4 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/package-info.java +++ b/client/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/client/package-info.java @@ -14,4 +14,4 @@ /** * @author Tobias Briones */ -package io.github.tobiasbriones.cp.rmifilesystem.client; +package com.github.tobiasbriones.cp.rmifilesystem.client; diff --git a/client/src/main/java/module-info.java b/client/src/main/java/module-info.java index 7c2b1fe..88a9d66 100644 --- a/client/src/main/java/module-info.java +++ b/client/src/main/java/module-info.java @@ -14,16 +14,16 @@ /** * */ -module io.github.tobiasbriones.cp.rmifilesystem.client { +module com.github.tobiasbriones.cp.rmifilesystem.client { requires java.rmi; requires javafx.base; requires javafx.graphics; requires javafx.controls; requires javafx.fxml; - requires io.github.tobiasbriones.cp.rmifilesystem.model; - requires io.github.tobiasbriones.cp.rmifilesystem.impl; - requires io.github.tobiasbriones.cp.rmifilesystem.mvp; + requires com.github.tobiasbriones.cp.rmifilesystem.model; + requires com.github.tobiasbriones.cp.rmifilesystem.impl; + requires com.github.tobiasbriones.cp.rmifilesystem.mvp; - opens io.github.tobiasbriones.cp.rmifilesystem.client + opens com.github.tobiasbriones.cp.rmifilesystem.client to javafx.graphics, java.rmi; } diff --git a/docs/img/client-and-fs-files-screenshot.png b/docs/img/client-and-fs-files-screenshot.png new file mode 100644 index 0000000..131c6b0 Binary files /dev/null and b/docs/img/client-and-fs-files-screenshot.png differ diff --git a/docs/img/demo.gif b/docs/img/demo.gif new file mode 100644 index 0000000..394febb Binary files /dev/null and b/docs/img/demo.gif differ diff --git a/docs/img/deployment.svg b/docs/img/deployment.svg new file mode 100644 index 0000000..7f63dcf --- /dev/null +++ b/docs/img/deployment.svg @@ -0,0 +1,89 @@ + + cp-file-system + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/img/lxc-list-and-fs-screenshot.png b/docs/img/lxc-list-and-fs-screenshot.png new file mode 100644 index 0000000..63d825f Binary files /dev/null and b/docs/img/lxc-list-and-fs-screenshot.png differ diff --git a/docs/img/lxc-list-and-registry-screenshot.png b/docs/img/lxc-list-and-registry-screenshot.png new file mode 100644 index 0000000..2618001 Binary files /dev/null and b/docs/img/lxc-list-and-registry-screenshot.png differ diff --git a/docs/troubleshooting/binary-incompatibility/binary-incompatibility.md b/docs/troubleshooting/binary-incompatibility/binary-incompatibility.md new file mode 100644 index 0000000..f896d93 --- /dev/null +++ b/docs/troubleshooting/binary-incompatibility/binary-incompatibility.md @@ -0,0 +1,38 @@ +# Binary Incompatibility Issues + +Many features haven't been implemented in Java because of binary compatibilities. A clear case of +this problem regarding this application is the following scenario: + +Check +out [this commit](https://github.com/tobiasbriones/cp-unah-mm545-distributed-text-file-system/commit/4eb1ab7787f96720097075e52b6250c38606671c) +where I renamed the package names to replace the `io.github.tobiasbriones` +to `com.github.tobiasbriones`. Since the fully-qualified class names are changing then the objects +that are serialized, say +the [FileSystem](https://github.com/tobiasbriones/cp-unah-mm545-distributed-text-file-system/blob/v0.1.0/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/FileSystem.java) +itself, will not be compatible with the serialized version of existing clients where the +fully-qualified class name starts with `io.`. This also implies that for example, many other modules +depend on the model module and will have to compile their classes again due to the public facing +change that was introduced. + +Then one of the obvious solutions is to clean up the app local data and start fresh and new again. +This is not a viable option for production systems!. When I ran the client app after that commit I +got an expected error: + +**StreamCorruptedException** +![StreamCorruptedException](./binary-incompatibility.png) + +Due to opening an invalid version of the binary serialized object `fs.data` representing the past " +io." version of the FileSystem class. + +Hence, Java is the language of choice for enterprise applications by allowing clients to rely on +further versions of the language and not dealing with tons of breaking changes. Breaking changes +many times don't even add any new value to the software, but you still have to manage them. Because +of this, the Java architects design pretty carefully new features added to the language (and not add +helpless trendy or domain-specific stuff), because once added, it is quite impossible to get rid of +them if you got it wrong. That's why there are many bloated languages out there that have to carry +old mistakes forever (or introduce breaking changes all the time) and that's a way to measure +whether a programming language has aged well. + +My job is also to carefully design robust systems. This leads us to the conclusion that before a +stable release (a.k.a. v1.0.0) the public API must be well-defined and tested to avoid troubles in +the future. diff --git a/docs/troubleshooting/binary-incompatibility/binary-incompatibility.png b/docs/troubleshooting/binary-incompatibility/binary-incompatibility.png new file mode 100644 index 0000000..679aab9 Binary files /dev/null and b/docs/troubleshooting/binary-incompatibility/binary-incompatibility.png differ diff --git a/docs/troubleshooting/storage/move-container-to-new-storage-pool.png b/docs/troubleshooting/storage/move-container-to-new-storage-pool.png new file mode 100644 index 0000000..5c7eed6 Binary files /dev/null and b/docs/troubleshooting/storage/move-container-to-new-storage-pool.png differ diff --git a/docs/troubleshooting/storage/new-def-storage-pool-info.png b/docs/troubleshooting/storage/new-def-storage-pool-info.png new file mode 100644 index 0000000..c4e7251 Binary files /dev/null and b/docs/troubleshooting/storage/new-def-storage-pool-info.png differ diff --git a/docs/troubleshooting/storage/storage.md b/docs/troubleshooting/storage/storage.md new file mode 100644 index 0000000..768bfa6 --- /dev/null +++ b/docs/troubleshooting/storage/storage.md @@ -0,0 +1,104 @@ +# Storage Issues + +If a linux container gets out of space, you might experience a similar error when running a Java +application: + +``` +Starting a Gradle Daemon, 2 busy Daemons could not be reused, use --status for details + +FAILURE: Build failed with an exception. + +* What went wrong: +Unable to start the daemon process. +This problem might be caused by incorrect configuration of the daemon. +For example, an unrecognized jvm option is used. +Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/7.1.1/userguide/gradle_daemon.html +Process command line: /root/.sdkman/candidates/java/16.0.1-open/bin/java --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.base/java.nio.charset=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /root/.sdkman/candidates/gradle/7.1.1/lib/gradle-launcher-7.1.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 7.1.1 +Please read the following process output to find out more: +----------------------- + +FAILURE: Build failed with an exception. + +* What went wrong: +java.io.IOException: No space left on device + +* Try: +Run with --info or --debug option to get more log output. Run with --scan to get full insights. + +* Exception is: +org.gradle.api.UncheckedIOException: java.io.IOException: No space left on device + at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:61) + at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:41) + at org.gradle.cache.internal.DefaultFileLockManager.lock(DefaultFileLockManager.java:113) + at org.gradle.cache.internal.DefaultFileLockManager.lock(DefaultFileLockManager.java:96) + at org.gradle.cache.internal.DefaultFileLockManager.lock(DefaultFileLockManager.java:91) + at org.gradle.cache.internal.OnDemandFileAccess.updateFile(OnDemandFileAccess.java:51) + at org.gradle.cache.internal.SimpleStateCache.update(SimpleStateCache.java:87) + at org.gradle.cache.internal.FileIntegrityViolationSuppressingPersistentStateCacheDecorator$1.create(FileIntegrityViolationSuppressingPersistentStateCacheDecorator.java:50) + at org.gradle.cache.internal.FileIntegrityViolationSuppressingPersistentStateCacheDecorator.doUpdate(FileIntegrityViolationSuppressingPersistentStateCacheDecorator.java:67) + at org.gradle.cache.internal.FileIntegrityViolationSuppressingPersistentStateCacheDecorator.update(FileIntegrityViolationSuppressingPersistentStateCacheDecorator.java:47) + at org.gradle.launcher.daemon.registry.PersistentDaemonRegistry.store(PersistentDaemonRegistry.java:232) + at org.gradle.launcher.daemon.server.DaemonRegistryUpdater.onStart(DaemonRegistryUpdater.java:80) + at org.gradle.launcher.daemon.server.Daemon.start(Daemon.java:171) + at org.gradle.launcher.daemon.bootstrap.DaemonMain.doAction(DaemonMain.java:125) + at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:50) + at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) + at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.base/java.lang.reflect.Method.invoke(Method.java:567) + at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60) + at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37) + at org.gradle.launcher.daemon.bootstrap.GradleDaemon.main(GradleDaemon.java:22) +Caused by: java.io.IOException: No space left on device + at java.base/java.io.RandomAccessFile.writeBytes(Native Method) + at java.base/java.io.RandomAccessFile.write(RandomAccessFile.java:557) + at org.gradle.internal.io.RandomAccessFileOutputStream.write(RandomAccessFileOutputStream.java:46) + at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81) + at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142) + at java.base/java.io.DataOutputStream.flush(DataOutputStream.java:128) + at org.gradle.cache.internal.filelock.LockInfoAccess.writeLockInfo(LockInfoAccess.java:63) + at org.gradle.cache.internal.filelock.LockFileAccess.writeLockInfo(LockFileAccess.java:48) + at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.lock(DefaultFileLockManager.java:323) + at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.(DefaultFileLockManager.java:164) + at org.gradle.cache.internal.DefaultFileLockManager.lock(DefaultFileLockManager.java:110) + ... 19 more +``` + +That happened to me just before the last steps when testing the system the last time, and the client +applications stopped working since the servers went down!. When running `lxc init` at the beginning +I accepted the default 6 GB storage pool and that wasn't enough!. I realized that my LXC storage +pool was out of space. The solution is to create a new storage pool and move the container(s) to the +new larger pool: + +![Move Container to New Storage Pool](./move-container-to-new-storage-pool.png) + +Then the server will go back to function properly. I just moved the `fs` container from the default +pool to the new pool, and so I left much more free space on the default pool for the `registry` +container: + +![New Default Storage Pool](./new-def-storage-pool-info.png) + +The following commands may be useful: + +- `lxc storage list` + +- `lxc storage show default` + +- `lxc storage info default` + +- `lxc storage create { pool-name } zfs --size={ pool-size }GB` + +To move a container to another pool: + +`lxc stop { container }` + +`lxc move { container } { container }-tmp` + +`lxc move { container }-tmp { container } --storage={ pool }` + +`lxc start { container }` + +# Bibliography + +- F. (2019, November 7). Change Storage (Size and Driver). Linux Containers + Forum. https://discuss.linuxcontainers.org/t/change-storage-size-and-driver/6097 diff --git a/impl/build.gradle.kts b/impl/build.gradle.kts index 4e747bf..08b7bd5 100644 --- a/impl/build.gradle.kts +++ b/impl/build.gradle.kts @@ -15,8 +15,7 @@ plugins { java } -group = "io.github.tobiasbriones.cp" -version = "1.0.0-SNAPSHOT" +version = "0.1.0" repositories { mavenCentral() diff --git a/impl/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/impl/io/file/text/AppLocalTextFileRepository.java b/impl/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/impl/io/file/text/AppLocalTextFileRepository.java similarity index 87% rename from impl/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/impl/io/file/text/AppLocalTextFileRepository.java rename to impl/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/impl/io/file/text/AppLocalTextFileRepository.java index 92b9db7..bd16682 100644 --- a/impl/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/impl/io/file/text/AppLocalTextFileRepository.java +++ b/impl/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/impl/io/file/text/AppLocalTextFileRepository.java @@ -11,20 +11,20 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.impl.io.file.text; +package com.github.tobiasbriones.cp.rmifilesystem.impl.io.file.text; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.Nothing; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.Result; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileContent; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileRepository; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.Nothing; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.Result; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileContent; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileRepository; import java.io.FileNotFoundException; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import static io.github.tobiasbriones.cp.rmifilesystem.model.io.file.Nothing.Nothing; -import static io.github.tobiasbriones.cp.rmifilesystem.model.io.File.TextFile; +import static com.github.tobiasbriones.cp.rmifilesystem.model.io.file.Nothing.Nothing; +import static com.github.tobiasbriones.cp.rmifilesystem.model.io.File.TextFile; /** * @author Tobias Briones diff --git a/impl/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/impl/io/file/text/CommonPaths.java b/impl/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/impl/io/file/text/CommonPaths.java similarity index 85% rename from impl/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/impl/io/file/text/CommonPaths.java rename to impl/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/impl/io/file/text/CommonPaths.java index 4020df5..fa1f431 100644 --- a/impl/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/impl/io/file/text/CommonPaths.java +++ b/impl/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/impl/io/file/text/CommonPaths.java @@ -11,9 +11,9 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.impl.io.file.text; +package com.github.tobiasbriones.cp.rmifilesystem.impl.io.file.text; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.CommonPath; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.CommonPath; import java.io.File; import java.nio.file.Path; diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/text/package-info.java b/impl/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/impl/io/file/text/package-info.java similarity index 87% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/text/package-info.java rename to impl/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/impl/io/file/text/package-info.java index 0a3f55d..1ba7a06 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/text/package-info.java +++ b/impl/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/impl/io/file/text/package-info.java @@ -14,4 +14,4 @@ /** * @author Tobias Briones */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text; +package com.github.tobiasbriones.cp.rmifilesystem.impl.io.file.text; diff --git a/impl/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/impl/io/file/text/package-info.java b/impl/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/impl/io/file/text/package-info.java deleted file mode 100644 index 23960ab..0000000 --- a/impl/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/impl/io/file/text/package-info.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2021 Tobias Briones. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - * This file is part of Course Project at UNAH-MM545: Distributed Text File - * System. - * - * This source code is licensed under the BSD-3-Clause License found in the - * LICENSE file in the root directory of this source tree or at - * https://opensource.org/licenses/BSD-3-Clause. - */ - -/** - * @author Tobias Briones - */ -package io.github.tobiasbriones.cp.rmifilesystem.impl.io.file.text; diff --git a/impl/src/main/java/module-info.java b/impl/src/main/java/module-info.java index 7d453a4..b5ecd37 100644 --- a/impl/src/main/java/module-info.java +++ b/impl/src/main/java/module-info.java @@ -14,8 +14,8 @@ /** * @author Tobias Briones */ -module io.github.tobiasbriones.cp.rmifilesystem.impl { - requires io.github.tobiasbriones.cp.rmifilesystem.model; +module com.github.tobiasbriones.cp.rmifilesystem.impl { + requires com.github.tobiasbriones.cp.rmifilesystem.model; - exports io.github.tobiasbriones.cp.rmifilesystem.impl.io.file.text; + exports com.github.tobiasbriones.cp.rmifilesystem.impl.io.file.text; } diff --git a/model/build.gradle.kts b/model/build.gradle.kts index ba59920..1d60ff1 100644 --- a/model/build.gradle.kts +++ b/model/build.gradle.kts @@ -1,7 +1,6 @@ plugins { java } -group = "io.github.tobiasbriones.cp" -version = "1.0-SNAPSHOT" +version = "0.1.0" repositories { mavenCentral() diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/FileSystemService.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/FileSystemService.java similarity index 64% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/FileSystemService.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/FileSystemService.java index 76a1948..1d50054 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/FileSystemService.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/FileSystemService.java @@ -11,15 +11,16 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model; +package com.github.tobiasbriones.cp.rmifilesystem.model; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.CommonFile; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.Directory; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.File; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.Nothing; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.Result; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileContent; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.DirectoryNode; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.CommonFile; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.Directory; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.File; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileContent; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.DirectoryNode; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.Nothing; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.Result; import java.io.IOException; import java.io.Serializable; @@ -27,15 +28,13 @@ import java.rmi.RemoteException; import java.util.Map; -import static io.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem.*; - /** * @author Tobias Briones */ public interface FileSystemService extends Remote { record RealTimeFileSystem( DirectoryNode root, - Map statuses + Map statuses ) implements Serializable {} RealTimeFileSystem getRealTimeFileSystem() throws IOException; diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/OnFileUpdateListener.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/OnFileUpdateListener.java similarity index 73% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/OnFileUpdateListener.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/OnFileUpdateListener.java index 1772778..c67b01c 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/OnFileUpdateListener.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/OnFileUpdateListener.java @@ -11,18 +11,16 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model; +package com.github.tobiasbriones.cp.rmifilesystem.model; import java.rmi.Remote; import java.rmi.RemoteException; -import static io.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService.RealTimeFileSystem; - /** * @author Tobias Briones */ @FunctionalInterface public interface OnFileUpdateListener extends Remote { // Pass the full system to make it easier to implement - void onFSChanged(RealTimeFileSystem system) throws RemoteException; + void onFSChanged(FileSystemService.RealTimeFileSystem system) throws RemoteException; } diff --git a/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/RegistryService.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/RegistryService.java new file mode 100644 index 0000000..1bc38da --- /dev/null +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/RegistryService.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2021 Tobias Briones. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * This file is part of Course Project at UNAH-MM545: Distributed Text File + * System. + * + * This source code is licensed under the BSD-3-Clause License found in the + * LICENSE file in the root directory of this source tree or at + * https://opensource.org/licenses/BSD-3-Clause. + */ + +package com.github.tobiasbriones.cp.rmifilesystem.model; + +import java.rmi.Remote; +import java.rmi.RemoteException; + +/** + * @author Tobias Briones + */ +public interface RegistryService extends Remote { + boolean regObject(String name, Remote obj) throws RemoteException; +} diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/CommonFile.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/CommonFile.java similarity index 92% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/CommonFile.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/CommonFile.java index 9e68069..5f9c6fd 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/CommonFile.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/CommonFile.java @@ -11,7 +11,7 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io; +package com.github.tobiasbriones.cp.rmifilesystem.model.io; import java.io.Serializable; diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/CommonPath.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/CommonPath.java similarity index 98% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/CommonPath.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/CommonPath.java index 1da6c63..71d4d1c 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/CommonPath.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/CommonPath.java @@ -11,7 +11,7 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io; +package com.github.tobiasbriones.cp.rmifilesystem.model.io; import java.io.Serializable; import java.nio.file.Path; diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/Directory.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/Directory.java similarity index 93% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/Directory.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/Directory.java index fbafcd6..ef83b17 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/Directory.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/Directory.java @@ -11,7 +11,7 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io; +package com.github.tobiasbriones.cp.rmifilesystem.model.io; /** * @author Tobias Briones diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/File.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/File.java similarity index 97% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/File.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/File.java index 67f0570..37377b5 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/File.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/File.java @@ -11,7 +11,7 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io; +package com.github.tobiasbriones.cp.rmifilesystem.model.io; import java.util.Optional; import java.util.function.Function; diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/InvalidPathException.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/InvalidPathException.java similarity index 93% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/InvalidPathException.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/InvalidPathException.java index 394b881..a7eac52 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/InvalidPathException.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/InvalidPathException.java @@ -11,7 +11,7 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io; +package com.github.tobiasbriones.cp.rmifilesystem.model.io; import java.io.Serial; diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/JavaFile.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/JavaFile.java similarity index 95% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/JavaFile.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/JavaFile.java index c5c0ef4..d466bd1 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/JavaFile.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/JavaFile.java @@ -11,7 +11,7 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io; +package com.github.tobiasbriones.cp.rmifilesystem.model.io; import java.io.File; import java.io.Serial; diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/FileContent.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/FileContent.java similarity index 87% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/FileContent.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/FileContent.java index ee1958a..bca0750 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/FileContent.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/FileContent.java @@ -11,9 +11,9 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io.file; +package com.github.tobiasbriones.cp.rmifilesystem.model.io.file; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.CommonFile; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.CommonFile; import java.io.Serializable; diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/FileRepository.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/FileRepository.java similarity index 87% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/FileRepository.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/FileRepository.java index 2462da0..655e62d 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/FileRepository.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/FileRepository.java @@ -11,9 +11,9 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io.file; +package com.github.tobiasbriones.cp.rmifilesystem.model.io.file; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.CommonFile; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.CommonFile; /** * Defines a FileRepository to access and perform operations on any diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/Nothing.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/Nothing.java similarity index 91% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/Nothing.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/Nothing.java index 4cf8b32..e119947 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/Nothing.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/Nothing.java @@ -11,7 +11,7 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io.file; +package com.github.tobiasbriones.cp.rmifilesystem.model.io.file; import java.io.Serializable; diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/Result.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/Result.java similarity index 96% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/Result.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/Result.java index aa75faa..f7bf958 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/Result.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/Result.java @@ -11,7 +11,7 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io.file; +package com.github.tobiasbriones.cp.rmifilesystem.model.io.file; import java.io.Serializable; import java.util.function.Consumer; diff --git a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/header/package-info.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/package-info.java similarity index 86% rename from client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/header/package-info.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/package-info.java index 3353d29..76ef0c7 100644 --- a/client/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/client/header/package-info.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/package-info.java @@ -14,4 +14,4 @@ /** * @author Tobias Briones */ -package io.github.tobiasbriones.cp.rmifilesystem.client.header; +package com.github.tobiasbriones.cp.rmifilesystem.model.io.file; diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/text/TextFileContent.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/text/TextFileContent.java similarity index 70% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/text/TextFileContent.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/text/TextFileContent.java index 68e9b5e..7cf9bb0 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/text/TextFileContent.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/text/TextFileContent.java @@ -11,11 +11,11 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text; +package com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.FileContent; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.FileContent; -import static io.github.tobiasbriones.cp.rmifilesystem.model.io.File.TextFile; +import static com.github.tobiasbriones.cp.rmifilesystem.model.io.File.TextFile; /** * @author Tobias Briones diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/text/TextFileRepository.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/text/TextFileRepository.java similarity index 69% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/text/TextFileRepository.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/text/TextFileRepository.java index cff2383..5c10209 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/text/TextFileRepository.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/text/TextFileRepository.java @@ -11,11 +11,11 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text; +package com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.FileRepository; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.FileRepository; -import static io.github.tobiasbriones.cp.rmifilesystem.model.io.File.TextFile; +import static com.github.tobiasbriones.cp.rmifilesystem.model.io.File.TextFile; /** * @author Tobias Briones diff --git a/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/text/package-info.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/text/package-info.java new file mode 100644 index 0000000..ebc8842 --- /dev/null +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/file/text/package-info.java @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2021 Tobias Briones. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * This file is part of Course Project at UNAH-MM545: Distributed Text File + * System. + * + * This source code is licensed under the BSD-3-Clause License found in the + * LICENSE file in the root directory of this source tree or at + * https://opensource.org/licenses/BSD-3-Clause. + */ + +/** + * @author Tobias Briones + */ +package com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text; diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/DirectoryNode.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/DirectoryNode.java similarity index 93% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/DirectoryNode.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/DirectoryNode.java index fa0bc5e..f737ab0 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/DirectoryNode.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/DirectoryNode.java @@ -11,11 +11,11 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io.node; +package com.github.tobiasbriones.cp.rmifilesystem.model.io.node; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.CommonFile; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.CommonPath; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.Directory; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.CommonFile; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.CommonPath; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.Directory; import java.io.Serial; import java.io.Serializable; diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/FileNode.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/FileNode.java similarity index 83% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/FileNode.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/FileNode.java index 975696d..01ac4dd 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/FileNode.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/FileNode.java @@ -11,10 +11,10 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io.node; +package com.github.tobiasbriones.cp.rmifilesystem.model.io.node; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.CommonPath; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.File; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.CommonPath; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.File; import java.io.Serial; import java.io.Serializable; diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/FileSystem.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/FileSystem.java similarity index 95% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/FileSystem.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/FileSystem.java index 137b127..c912597 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/FileSystem.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/FileSystem.java @@ -11,9 +11,9 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io.node; +package com.github.tobiasbriones.cp.rmifilesystem.model.io.node; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.File; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.File; import java.io.Serial; import java.io.Serializable; diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/FileSystems.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/FileSystems.java similarity index 60% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/FileSystems.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/FileSystems.java index b22479d..e04fa90 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/FileSystems.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/FileSystems.java @@ -11,37 +11,35 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io.node; +package com.github.tobiasbriones.cp.rmifilesystem.model.io.node; -import io.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.File; +import com.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.File; import java.util.Map; -import static io.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem.*; - /** * @author Tobias Briones */ public final class FileSystems { public static FileSystem buildFileSystem( FileSystemService.RealTimeFileSystem system, - Map localStatuses + Map localStatuses ) { final var fs = new FileSystem(system.root()); - final Map statuses = system.statuses(); + final Map statuses = system.statuses(); fs.updateStatuses(file -> getStatus(file, statuses, localStatuses)); return fs; } - private static Status getStatus( + private static FileSystem.Status getStatus( File file, - Map recentStatuses, - Map localStatuses + Map recentStatuses, + Map localStatuses ) { - final LastUpdateStatus recent = recentStatuses.get(file); - final LastUpdateStatus local = localStatuses.get(file); + final FileSystem.LastUpdateStatus recent = recentStatuses.get(file); + final FileSystem.LastUpdateStatus local = localStatuses.get(file); var isInvalid = true; if (recent != null && local != null) { @@ -50,7 +48,7 @@ private static Status getStatus( else if (recent == null) { // The file has never been modified as it's not in the server changed status registry isInvalid = false; } - return new Status(file, isInvalid); + return new FileSystem.Status(file, isInvalid); } private FileSystems() {} diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/InvalidChildException.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/InvalidChildException.java similarity index 82% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/InvalidChildException.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/InvalidChildException.java index d1aa970..0da397e 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/InvalidChildException.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/InvalidChildException.java @@ -11,10 +11,10 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io.node; +package com.github.tobiasbriones.cp.rmifilesystem.model.io.node; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.CommonFile; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.Directory; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.CommonFile; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.Directory; import java.io.Serial; diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/Node.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/Node.java similarity index 87% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/Node.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/Node.java index 75d00a7..947dd60 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/Node.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/Node.java @@ -11,9 +11,9 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io.node; +package com.github.tobiasbriones.cp.rmifilesystem.model.io.node; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.*; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.*; /** * @author Tobias Briones diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/Nodes.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/Nodes.java similarity index 92% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/Nodes.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/Nodes.java index 145b200..260d5ad 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/Nodes.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/Nodes.java @@ -11,11 +11,11 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io.node; +package com.github.tobiasbriones.cp.rmifilesystem.model.io.node; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.CommonFile; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.CommonPath; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.Directory; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.CommonFile; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.CommonPath; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.Directory; import java.util.Arrays; import java.util.List; diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/package-info.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/package-info.java similarity index 87% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/package-info.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/package-info.java index 8f555e9..00ad4f4 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/package-info.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/package-info.java @@ -18,4 +18,4 @@ /** * @author Tobias Briones */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io.node; +package com.github.tobiasbriones.cp.rmifilesystem.model.io.node; diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/package-info.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/package-info.java similarity index 88% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/package-info.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/package-info.java index 2d4308c..2e27095 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/package-info.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/package-info.java @@ -18,4 +18,4 @@ /** * @author Tobias Briones */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io; +package com.github.tobiasbriones.cp.rmifilesystem.model.io; diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/package-info.java b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/package-info.java similarity index 88% rename from model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/package-info.java rename to model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/package-info.java index 7cb9f4c..d507033 100644 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/package-info.java +++ b/model/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/model/package-info.java @@ -14,4 +14,4 @@ /** * @author Tobias Briones */ -package io.github.tobiasbriones.cp.rmifilesystem.model; +package com.github.tobiasbriones.cp.rmifilesystem.model; diff --git a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/package-info.java b/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/package-info.java deleted file mode 100644 index 45848ca..0000000 --- a/model/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/file/package-info.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2021 Tobias Briones. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - * This file is part of Course Project at UNAH-MM545: Distributed Text File - * System. - * - * This source code is licensed under the BSD-3-Clause License found in the - * LICENSE file in the root directory of this source tree or at - * https://opensource.org/licenses/BSD-3-Clause. - */ - -/** - * @author Tobias Briones - */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io.file; diff --git a/model/src/main/java/module-info.java b/model/src/main/java/module-info.java index 2a156e9..d342944 100644 --- a/model/src/main/java/module-info.java +++ b/model/src/main/java/module-info.java @@ -14,12 +14,12 @@ /** * @author Tobias Briones */ -module io.github.tobiasbriones.cp.rmifilesystem.model { +module com.github.tobiasbriones.cp.rmifilesystem.model { requires java.rmi; - exports io.github.tobiasbriones.cp.rmifilesystem.model; - exports io.github.tobiasbriones.cp.rmifilesystem.model.io; - exports io.github.tobiasbriones.cp.rmifilesystem.model.io.node; - exports io.github.tobiasbriones.cp.rmifilesystem.model.io.file; - exports io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text; + exports com.github.tobiasbriones.cp.rmifilesystem.model; + exports com.github.tobiasbriones.cp.rmifilesystem.model.io; + exports com.github.tobiasbriones.cp.rmifilesystem.model.io.node; + exports com.github.tobiasbriones.cp.rmifilesystem.model.io.file; + exports com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text; } diff --git a/model/src/test/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/CommonPathTest.java b/model/src/test/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/CommonPathTest.java similarity index 90% rename from model/src/test/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/CommonPathTest.java rename to model/src/test/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/CommonPathTest.java index 6093e2f..9d0ee48 100644 --- a/model/src/test/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/CommonPathTest.java +++ b/model/src/test/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/CommonPathTest.java @@ -11,8 +11,9 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io; +package com.github.tobiasbriones.cp.rmifilesystem.model.io; +import org.hamcrest.CoreMatchers; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.is; @@ -29,7 +30,7 @@ void testVarargsConstructor() { final var expected = new CommonPath("root/dir1/dir11/kittens/fluffy/pics"); final CommonPath actual = CommonPath.of(p1, p2, p3); - assertThat(actual, is(expected)); + assertThat(actual, CoreMatchers.is(expected)); } @Test diff --git a/model/src/test/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/DirectoryNodeTest.java b/model/src/test/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/DirectoryNodeTest.java similarity index 97% rename from model/src/test/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/DirectoryNodeTest.java rename to model/src/test/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/DirectoryNodeTest.java index 23679ab..7a95c9b 100644 --- a/model/src/test/java/io/github/tobiasbriones/cp/rmifilesystem/model/io/node/DirectoryNodeTest.java +++ b/model/src/test/java/com/github/tobiasbriones/cp/rmifilesystem/model/io/node/DirectoryNodeTest.java @@ -11,10 +11,10 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.model.io.node; +package com.github.tobiasbriones.cp.rmifilesystem.model.io.node; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.Directory; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.File; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.Directory; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.File; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; diff --git a/mvp/build.gradle.kts b/mvp/build.gradle.kts index 7ce4d70..4324448 100644 --- a/mvp/build.gradle.kts +++ b/mvp/build.gradle.kts @@ -17,8 +17,7 @@ plugins { java } -group = "io.github.tobiasbriones.cp" -version = "0.1.0.RELEASE" +version = "0.1.0" repositories { mavenCentral() diff --git a/mvp/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/mvp/AbstractMvpPresenter.java b/mvp/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/mvp/AbstractMvpPresenter.java similarity index 93% rename from mvp/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/mvp/AbstractMvpPresenter.java rename to mvp/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/mvp/AbstractMvpPresenter.java index c674858..ab48e08 100644 --- a/mvp/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/mvp/AbstractMvpPresenter.java +++ b/mvp/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/mvp/AbstractMvpPresenter.java @@ -11,7 +11,7 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.mvp; +package com.github.tobiasbriones.cp.rmifilesystem.mvp; import java.util.Optional; diff --git a/mvp/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/mvp/Initializable.java b/mvp/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/mvp/Initializable.java similarity index 90% rename from mvp/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/mvp/Initializable.java rename to mvp/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/mvp/Initializable.java index 6fa4e2d..8758c92 100644 --- a/mvp/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/mvp/Initializable.java +++ b/mvp/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/mvp/Initializable.java @@ -11,7 +11,7 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.mvp; +package com.github.tobiasbriones.cp.rmifilesystem.mvp; /** * @author Tobias Briones diff --git a/mvp/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/mvp/MvpPresenter.java b/mvp/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/mvp/MvpPresenter.java similarity index 90% rename from mvp/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/mvp/MvpPresenter.java rename to mvp/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/mvp/MvpPresenter.java index fff07f5..9284928 100644 --- a/mvp/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/mvp/MvpPresenter.java +++ b/mvp/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/mvp/MvpPresenter.java @@ -11,7 +11,7 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.mvp; +package com.github.tobiasbriones.cp.rmifilesystem.mvp; /** * @author Tobias Briones diff --git a/mvp/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/mvp/MvpView.java b/mvp/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/mvp/MvpView.java similarity index 91% rename from mvp/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/mvp/MvpView.java rename to mvp/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/mvp/MvpView.java index a626759..0d3081e 100644 --- a/mvp/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/mvp/MvpView.java +++ b/mvp/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/mvp/MvpView.java @@ -11,7 +11,7 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.mvp; +package com.github.tobiasbriones.cp.rmifilesystem.mvp; import javafx.scene.Node; diff --git a/mvp/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/mvp/package-info.java b/mvp/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/mvp/package-info.java similarity index 88% rename from mvp/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/mvp/package-info.java rename to mvp/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/mvp/package-info.java index cf10da2..28ce3a6 100644 --- a/mvp/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/mvp/package-info.java +++ b/mvp/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/mvp/package-info.java @@ -14,4 +14,4 @@ /** * @author Tobias Briones */ -package io.github.tobiasbriones.cp.rmifilesystem.mvp; +package com.github.tobiasbriones.cp.rmifilesystem.mvp; diff --git a/mvp/src/main/java/module-info.java b/mvp/src/main/java/module-info.java index a384a15..29e2cfc 100644 --- a/mvp/src/main/java/module-info.java +++ b/mvp/src/main/java/module-info.java @@ -14,9 +14,9 @@ /** * @author Tobias Briones */ -module io.github.tobiasbriones.cp.rmifilesystem.mvp { +module com.github.tobiasbriones.cp.rmifilesystem.mvp { requires javafx.base; requires javafx.graphics; - exports io.github.tobiasbriones.cp.rmifilesystem.mvp; + exports com.github.tobiasbriones.cp.rmifilesystem.mvp; } diff --git a/server/build.gradle.kts b/server/build.gradle.kts index 57f2599..75f0707 100644 --- a/server/build.gradle.kts +++ b/server/build.gradle.kts @@ -11,17 +11,16 @@ * https://opensource.org/licenses/BSD-3-Clause. */ +version = "0.1.0" + plugins { java id("application") } -group = "io.github.tobiasbriones.cp" -version = "1.0-SNAPSHOT" - application { - mainModule.set("io.github.tobiasbriones.cp.rmifilesystem.server") - mainClass.set("io.github.tobiasbriones.cp.rmifilesystem.server.Main") + mainModule.set("com.github.tobiasbriones.cp.rmifilesystem.server") + mainClass.set("com.github.tobiasbriones.cp.rmifilesystem.server.Main") } repositories { @@ -55,6 +54,6 @@ tasks.withType().all { tasks.withType { manifest { - attributes("Main-Class" to "io.github.tobiasbriones.cp.rmifilesystem.server.Main") + attributes("Main-Class" to "com.github.tobiasbriones.cp.rmifilesystem.server.Main") } } diff --git a/server/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/server/AppFileSystemService.java b/server/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/server/AppFileSystemService.java similarity index 85% rename from server/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/server/AppFileSystemService.java rename to server/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/server/AppFileSystemService.java index 22c1b61..03bb0ef 100644 --- a/server/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/server/AppFileSystemService.java +++ b/server/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/server/AppFileSystemService.java @@ -11,35 +11,41 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.server; - -import io.github.tobiasbriones.cp.rmifilesystem.impl.io.file.text.AppLocalTextFileRepository; -import io.github.tobiasbriones.cp.rmifilesystem.model.*; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.*; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.File; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.Nothing; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.Result; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileContent; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.DirectoryNode; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileNode; +package com.github.tobiasbriones.cp.rmifilesystem.server; + +import com.github.tobiasbriones.cp.rmifilesystem.impl.io.file.text.AppLocalTextFileRepository; +import com.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService; +import com.github.tobiasbriones.cp.rmifilesystem.model.OnFileUpdateListener; +import com.github.tobiasbriones.cp.rmifilesystem.model.RegistryService; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.File; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.*; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.Nothing; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.Result; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileContent; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.DirectoryNode; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileNode; import java.io.*; import java.nio.file.DirectoryNotEmptyException; import java.nio.file.Files; import java.nio.file.Path; import java.rmi.ConnectException; +import java.rmi.Remote; import java.rmi.RemoteException; +import java.rmi.registry.LocateRegistry; +import java.rmi.registry.Registry; import java.rmi.server.UnicastRemoteObject; import java.util.*; import java.util.function.Consumer; -import static io.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem.*; -import static io.github.tobiasbriones.cp.rmifilesystem.model.io.file.Nothing.Nothing; +import static com.github.tobiasbriones.cp.rmifilesystem.model.io.file.Nothing.Nothing; +import static com.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem.LastUpdateStatus; /** * @author Tobias Briones */ -public final class AppFileSystemService extends UnicastRemoteObject implements FileSystemService { +public final class AppFileSystemService extends UnicastRemoteObject implements FileSystemService, + RegistryService { @Serial private static final long serialVersionUID = 7826374551124313303L; private static final String RELATIVE_ROOT = "fs"; @@ -167,6 +173,20 @@ public boolean removeOnFileUpdateListener(OnFileUpdateListener l) throws RemoteE return clients.remove(l); } + @Override + public boolean regObject(String name, Remote obj) { + try { + final Registry registry = LocateRegistry.getRegistry(); + + registry.bind(name, obj); + } + catch (Exception e) { + e.printStackTrace(); + return false; + } + return true; + } + private void onFileWrote(File file) { try { setChanged(file); diff --git a/server/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/server/Main.java b/server/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/server/Main.java new file mode 100644 index 0000000..b3b4727 --- /dev/null +++ b/server/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/server/Main.java @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2021 Tobias Briones. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * This file is part of Course Project at UNAH-MM545: Distributed Text File + * System. + * + * This source code is licensed under the BSD-3-Clause License found in the + * LICENSE file in the root directory of this source tree or at + * https://opensource.org/licenses/BSD-3-Clause. + */ + +package com.github.tobiasbriones.cp.rmifilesystem.server; + +import com.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService; +import com.github.tobiasbriones.cp.rmifilesystem.model.RegistryService; + +import java.rmi.NotBoundException; +import java.rmi.RemoteException; +import java.rmi.registry.LocateRegistry; +import java.rmi.registry.Registry; +import java.util.Arrays; + +/** + * @author Tobias Briones + */ +public final class Main { + private static final String REG_SERVER_NAME = "FileSystemService"; + private static final String FS_SERVER_NAME = "RMIServer"; + + private record ServerConfig( + String hostname, + String type, + String registryHostname // This arg is only used for FS server types + ) { + static final int PORT = 1099; + static final String LOCAL_HOST = "localhost"; + static final String SERVER_TYPE_REG = "reg"; + static final String SERVER_TYPE_FS = "fs"; + + static ServerConfig from(String[] args) { + return new ServerConfig( + getHostname(args), + getServerType(args), + getRegistryHostname(args) + ); + } + + static String getHostname(String[] args) { + return args.length > 0 ? args[0] : LOCAL_HOST; + } + + static String getServerType(String[] args) { + return args.length > 1 ? args[1] : SERVER_TYPE_FS; + } + + static String getRegistryHostname(String[] args) { + return args.length > 2 ? args[2] : ""; + } + } + + public static void main(String[] args) { + final var config = ServerConfig.from(args); + final var main = new Main(config); + + main.start(); + } + + private final ServerConfig config; + private FileSystemService server; + + private Main(ServerConfig config) { + this.config = config; + server = null; + + System.setProperty("java.rmi.server.hostname", config.hostname()); + try { + server = new AppFileSystemService(); + } + catch (RemoteException e) { + e.printStackTrace(); + System.exit(-1); + } + } + + private void start() { + if (config.type().equals(ServerConfig.SERVER_TYPE_REG)) { + startRegServer(); + } + else { + startFileSystemServer(); + } + } + + private void startRegServer() { + try { + final Registry registry = LocateRegistry.createRegistry(ServerConfig.PORT); + + System.out.println("Binding registry server at " + config.hostname()); + registry.rebind(REG_SERVER_NAME, server); + } + catch (RemoteException e) { + e.printStackTrace(); + System.exit(-1); + } + } + + private void startFileSystemServer() { + try { + final String registryHostname = config.registryHostname(); + final Registry registry = LocateRegistry.getRegistry(registryHostname, ServerConfig.PORT); + final var service = (RegistryService) registry.lookup(REG_SERVER_NAME); + + System.out.println("Binding file server at " + config.hostname()); + service.regObject(FS_SERVER_NAME, server); + } + catch (Exception e) { + e.printStackTrace(); + System.exit(-1); + } + } +} diff --git a/server/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/server/package-info.java b/server/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/server/package-info.java similarity index 88% rename from server/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/server/package-info.java rename to server/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/server/package-info.java index 6687448..a48ab96 100644 --- a/server/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/server/package-info.java +++ b/server/src/main/java/com/github/tobiasbriones/cp/rmifilesystem/server/package-info.java @@ -14,4 +14,4 @@ /** * @author Tobias Briones */ -package io.github.tobiasbriones.cp.rmifilesystem.server; +package com.github.tobiasbriones.cp.rmifilesystem.server; diff --git a/server/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/server/Main.java b/server/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/server/Main.java deleted file mode 100644 index b7d40db..0000000 --- a/server/src/main/java/io/github/tobiasbriones/cp/rmifilesystem/server/Main.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2021 Tobias Briones. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - * This file is part of Course Project at UNAH-MM545: Distributed Text File - * System. - * - * This source code is licensed under the BSD-3-Clause License found in the - * LICENSE file in the root directory of this source tree or at - * https://opensource.org/licenses/BSD-3-Clause. - */ - -package io.github.tobiasbriones.cp.rmifilesystem.server; - -import io.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService; - -import java.rmi.RemoteException; -import java.rmi.registry.LocateRegistry; -import java.rmi.registry.Registry; - -/** - * @author Tobias Briones - */ -public final class Main { - private static final int PORT = 1099; - - public static void main(String[] args) { - final var main = new Main(); - - main.start(); - } - - private FileSystemService server; - - private Main() { - server = null; - - try { - server = new AppFileSystemService(); - } - catch (RemoteException e) { - e.printStackTrace(); - System.exit(-1); - } - } - - private void start() { - try { - final Registry registry = LocateRegistry.createRegistry(PORT); - registry.rebind("FileSystemService", server); - } - catch (RemoteException e) { - e.printStackTrace(); - } - } -} diff --git a/server/src/main/java/module-info.java b/server/src/main/java/module-info.java index 0a87ca2..9d6f8ba 100644 --- a/server/src/main/java/module-info.java +++ b/server/src/main/java/module-info.java @@ -14,10 +14,10 @@ /** * @author Tobias Briones */ -module io.github.tobiasbriones.cp.rmifilesystem.server { +module com.github.tobiasbriones.cp.rmifilesystem.server { requires java.rmi; - requires io.github.tobiasbriones.cp.rmifilesystem.model; - requires io.github.tobiasbriones.cp.rmifilesystem.impl; + requires com.github.tobiasbriones.cp.rmifilesystem.model; + requires com.github.tobiasbriones.cp.rmifilesystem.impl; - exports io.github.tobiasbriones.cp.rmifilesystem.server; + exports com.github.tobiasbriones.cp.rmifilesystem.server; } diff --git a/server/src/test/java/io/github/tobiasbriones/cp/rmifilesystem/server/AppFileSystemServiceTest.java b/server/src/test/java/com/github/tobiasbriones/cp/rmifilesystem/server/AppFileSystemServiceTest.java similarity index 88% rename from server/src/test/java/io/github/tobiasbriones/cp/rmifilesystem/server/AppFileSystemServiceTest.java rename to server/src/test/java/com/github/tobiasbriones/cp/rmifilesystem/server/AppFileSystemServiceTest.java index 4d9320e..b1c1f39 100644 --- a/server/src/test/java/io/github/tobiasbriones/cp/rmifilesystem/server/AppFileSystemServiceTest.java +++ b/server/src/test/java/com/github/tobiasbriones/cp/rmifilesystem/server/AppFileSystemServiceTest.java @@ -11,17 +11,17 @@ * https://opensource.org/licenses/BSD-3-Clause. */ -package io.github.tobiasbriones.cp.rmifilesystem.server; - -import io.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.Directory; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.File; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.Result; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileContent; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.DirectoryNode; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileNode; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem; -import io.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystems; +package com.github.tobiasbriones.cp.rmifilesystem.server; + +import com.github.tobiasbriones.cp.rmifilesystem.model.FileSystemService; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.Directory; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.File; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.Result; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.file.text.TextFileContent; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.DirectoryNode; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileNode; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystem; +import com.github.tobiasbriones.cp.rmifilesystem.model.io.node.FileSystems; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test;