diff --git a/main/build.gradle b/build.gradle similarity index 79% rename from main/build.gradle rename to build.gradle index 3b4e1c3..5663819 100644 --- a/main/build.gradle +++ b/build.gradle @@ -1,10 +1,10 @@ group 'com.nafeezabrar' -version '1.0-SNAPSHOT' +version '0.0.0-Alpha-Testing' apply plugin: 'java' apply plugin: 'application' -mainClassName = "com.nafeezabrar.mqtt.client.Main" +mainClassName = "Main" repositories { mavenCentral() diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index ca78035..6ffa237 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/settings.gradle b/settings.gradle index 955e56a..872015f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,4 @@ -include 'main' +rootProject.name = 'mqtt-client' include 'ui' include 'core' include 'paho-mqtt' diff --git a/main/src/main/java/com/nafeezabrar/mqtt/client/Main.java b/src/main/java/Main.java similarity index 77% rename from main/src/main/java/com/nafeezabrar/mqtt/client/Main.java rename to src/main/java/Main.java index 0ddf7aa..a457963 100644 --- a/main/src/main/java/com/nafeezabrar/mqtt/client/Main.java +++ b/src/main/java/Main.java @@ -1,5 +1,5 @@ -package com.nafeezabrar.mqtt.client; - +import com.nafeezabrar.mqtt.client.MqttClient; +import com.nafeezabrar.mqtt.client.PahoMqttClientWrapper; import com.nafeezabrar.mqtt.client.conversion.AnySeparatorStringToBytesConverter; import com.nafeezabrar.mqtt.client.conversion.BytesToStringConverter; import com.nafeezabrar.mqtt.client.conversion.DecimalColonSeparatorBytesToStringConverter; @@ -8,23 +8,24 @@ import com.nafeezabrar.mqtt.client.ui.MqttClientWindow; import com.nafeezabrar.mqtt.client.ui.UiApplication; +import java.io.IOException; import java.util.UUID; public class Main { - public static void main(String[] args) { + public static void main(String[] args) throws IOException { String serverURI = "tcp://iot.eclipse.org:1883"; String clientId = UUID.randomUUID().toString(); + MqttClient mqttClient = new PahoMqttClientWrapper(serverURI, clientId); UiApplication.viewActivatedListener = () -> { MqttClientWindow mqttClientWindow = UiApplication.ActualWindow; StringToBytesConverter stringToBytesConverter = new AnySeparatorStringToBytesConverter(); BytesToStringConverter bytesToStringConverter = new DecimalColonSeparatorBytesToStringConverter(); - MqttClient mqttClient = new PahoMqttClientWrapper(serverURI, clientId); MqttClientWindowPresenter mqttClientWindowPresenter = new MqttClientWindowPresenter(mqttClientWindow, stringToBytesConverter, bytesToStringConverter, mqttClient); mqttClientWindowPresenter.initialize(); }; - - UiApplication.run(args); + UiApplication.run(args, (Class) Main.class); + mqttClient.close(); } } diff --git a/main/src/main/resources/main.fxml b/src/main/java/com/nafeezabrar/mqtt/client/main.fxml similarity index 100% rename from main/src/main/resources/main.fxml rename to src/main/java/com/nafeezabrar/mqtt/client/main.fxml diff --git a/src/main/resources/main.fxml b/src/main/resources/main.fxml new file mode 100644 index 0000000..f02d5b2 --- /dev/null +++ b/src/main/resources/main.fxml @@ -0,0 +1,22 @@ + + + + + + + + + + + +