rename extensionserver to extensionhandler

This commit is contained in:
sirjonasxx 2020-04-26 02:43:40 +02:00
parent 15628b5eec
commit eb8f6afecd
22 changed files with 56 additions and 70 deletions

View File

@ -2,9 +2,7 @@ package gearth.extensions;
import gearth.protocol.HMessage; import gearth.protocol.HMessage;
import gearth.protocol.HPacket; import gearth.protocol.HPacket;
import gearth.services.extensionserver.ExtensionServer; import gearth.services.extensionhandler.extensions.network.NetworkExtensionInfo;
import gearth.services.extensionserver.extensions.network.NetworkExtensionInfo;
import gearth.ui.extensions.Extensions;
import java.io.*; import java.io.*;
import java.net.Socket; import java.net.Socket;

View File

@ -1,26 +1,26 @@
package gearth.services.extensionserver; package gearth.services.extensionhandler;
import gearth.Main; import gearth.Main;
import gearth.misc.harble_api.HarbleAPIFetcher; import gearth.misc.harble_api.HarbleAPIFetcher;
import gearth.protocol.HConnection; import gearth.protocol.HConnection;
import gearth.protocol.HMessage; import gearth.protocol.HMessage;
import gearth.protocol.HPacket; import gearth.protocol.HPacket;
import gearth.services.extensionserver.extensions.ExtensionListener; import gearth.services.extensionhandler.extensions.ExtensionListener;
import gearth.services.extensionserver.extensions.extensionproducers.ExtensionProducer; import gearth.services.extensionhandler.extensions.extensionproducers.ExtensionProducer;
import gearth.services.extensionserver.extensions.extensionproducers.ExtensionProducerFactory; import gearth.services.extensionhandler.extensions.extensionproducers.ExtensionProducerFactory;
import gearth.services.extensionserver.extensions.extensionproducers.ExtensionProducerObserver; import gearth.services.extensionhandler.extensions.extensionproducers.ExtensionProducerObserver;
import gearth.services.extensionserver.extensions.GEarthExtension; import gearth.services.extensionhandler.extensions.GEarthExtension;
import java.util.*; import java.util.*;
public class ExtensionServer { public class ExtensionHandler {
private final List<GEarthExtension> gEarthExtensions = new ArrayList<>(); private final List<GEarthExtension> gEarthExtensions = new ArrayList<>();
private final HConnection hConnection; private final HConnection hConnection;
private List<ExtensionProducer> extensionProducers; private List<ExtensionProducer> extensionProducers;
public ExtensionServer(HConnection hConnection) { public ExtensionHandler(HConnection hConnection) {
this.hConnection = hConnection; this.hConnection = hConnection;
initialize(); initialize();
} }

View File

@ -1,4 +1,4 @@
package gearth.services.extensionserver.extensions; package gearth.services.extensionhandler.extensions;
import gearth.protocol.HMessage; import gearth.protocol.HMessage;
import gearth.protocol.HPacket; import gearth.protocol.HPacket;

View File

@ -1,4 +1,4 @@
package gearth.services.extensionserver.extensions; package gearth.services.extensionhandler.extensions;
import gearth.protocol.HMessage; import gearth.protocol.HMessage;
import gearth.protocol.HPacket; import gearth.protocol.HPacket;

View File

@ -1,4 +1,4 @@
package gearth.services.extensionserver.extensions.extensionproducers; package gearth.services.extensionhandler.extensions.extensionproducers;
public interface ExtensionProducer { public interface ExtensionProducer {

View File

@ -1,7 +1,7 @@
package gearth.services.extensionserver.extensions.extensionproducers; package gearth.services.extensionhandler.extensions.extensionproducers;
import gearth.services.extensionserver.extensions.network.NetworkExtensionsProducer; import gearth.services.extensionhandler.extensions.network.NetworkExtensionsProducer;
import gearth.services.extensionserver.extensions.simple.SimpleExtensionProducer; import gearth.services.extensionhandler.extensions.simple.SimpleExtensionProducer;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;

View File

@ -0,0 +1,7 @@
package gearth.services.extensionhandler.extensions.extensionproducers;
import gearth.services.extensionhandler.extensions.GEarthExtension;
public interface ExtensionProducerObserver {
void onExtensionConnect(GEarthExtension extension);
}

View File

@ -1,18 +1,13 @@
package gearth.services.extensionserver.extensions.network; package gearth.services.extensionhandler.extensions.network;
import gearth.Main;
import gearth.protocol.HMessage; import gearth.protocol.HMessage;
import gearth.services.extensionserver.extensions.GEarthExtension; import gearth.services.extensionhandler.extensions.GEarthExtension;
import javafx.beans.InvalidationListener;
import gearth.protocol.HPacket; import gearth.protocol.HPacket;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import gearth.services.extensionserver.extensions.network.authentication.Authenticator;
import java.net.Socket; import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
/** /**
* Created by Jonas on 21/06/18. * Created by Jonas on 21/06/18.

View File

@ -1,4 +1,4 @@
package gearth.services.extensionserver.extensions.network; package gearth.services.extensionhandler.extensions.network;
public class NetworkExtensionInfo { public class NetworkExtensionInfo {

View File

@ -1,9 +1,9 @@
package gearth.services.extensionserver.extensions.network; package gearth.services.extensionhandler.extensions.network;
import gearth.protocol.HPacket; import gearth.protocol.HPacket;
import gearth.services.extensionserver.extensions.extensionproducers.ExtensionProducer; import gearth.services.extensionhandler.extensions.extensionproducers.ExtensionProducer;
import gearth.services.extensionserver.extensions.extensionproducers.ExtensionProducerObserver; import gearth.services.extensionhandler.extensions.extensionproducers.ExtensionProducerObserver;
import gearth.services.extensionserver.extensions.network.authentication.Authenticator; import gearth.services.extensionhandler.extensions.network.authentication.Authenticator;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.IOException; import java.io.IOException;

View File

@ -1,7 +1,7 @@
package gearth.services.extensionserver.extensions.network.authentication; package gearth.services.extensionhandler.extensions.network.authentication;
import gearth.misc.ConfirmationDialog; import gearth.misc.ConfirmationDialog;
import gearth.services.extensionserver.extensions.network.NetworkExtension; import gearth.services.extensionhandler.extensions.network.NetworkExtension;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.scene.control.Alert; import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType; import javafx.scene.control.ButtonType;

View File

@ -1,4 +1,4 @@
package gearth.services.extensionserver.extensions.network.executer; package gearth.services.extensionhandler.extensions.network.executer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;

View File

@ -1,4 +1,4 @@
package gearth.services.extensionserver.extensions.network.executer; package gearth.services.extensionhandler.extensions.network.executer;
/** /**
* Created by Jonas on 21/09/18. * Created by Jonas on 21/09/18.

View File

@ -1,4 +1,4 @@
package gearth.services.extensionserver.extensions.network.executer; package gearth.services.extensionhandler.extensions.network.executer;
/** /**
* Created by Jonas on 22/09/18. * Created by Jonas on 22/09/18.

View File

@ -1,7 +1,7 @@
package gearth.services.extensionserver.extensions.network.executer; package gearth.services.extensionhandler.extensions.network.executer;
import gearth.Main; import gearth.Main;
import gearth.services.extensionserver.extensions.network.authentication.Authenticator; import gearth.services.extensionhandler.extensions.network.authentication.Authenticator;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;

View File

@ -1,10 +1,7 @@
package gearth.services.extensionserver.extensions.simple; package gearth.services.extensionhandler.extensions.simple;
import gearth.protocol.HMessage; import gearth.protocol.HMessage;
import gearth.protocol.HPacket; import gearth.services.extensionhandler.extensions.GEarthExtension;
import gearth.services.extensionserver.extensions.GEarthExtension;
import java.util.Arrays;
public class ExampleExtension extends GEarthExtension { public class ExampleExtension extends GEarthExtension {
@Override @Override

View File

@ -1,7 +1,7 @@
package gearth.services.extensionserver.extensions.simple; package gearth.services.extensionhandler.extensions.simple;
import gearth.services.extensionserver.extensions.extensionproducers.ExtensionProducer; import gearth.services.extensionhandler.extensions.extensionproducers.ExtensionProducer;
import gearth.services.extensionserver.extensions.extensionproducers.ExtensionProducerObserver; import gearth.services.extensionhandler.extensions.extensionproducers.ExtensionProducerObserver;
public class SimpleExtensionProducer implements ExtensionProducer { public class SimpleExtensionProducer implements ExtensionProducer {

View File

@ -1,8 +0,0 @@
package gearth.services.extensionserver.extensions.extensionproducers;
import gearth.services.extensionserver.extensions.GEarthExtension;
import gearth.services.extensionserver.extensions.network.NetworkExtension;
public interface ExtensionProducerObserver {
void onExtensionConnect(GEarthExtension extension);
}

View File

@ -1,6 +1,6 @@
package gearth.ui.extensions; package gearth.ui.extensions;
import gearth.services.extensionserver.extensions.GEarthExtension; import gearth.services.extensionhandler.extensions.GEarthExtension;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.event.EventHandler; import javafx.event.EventHandler;
import javafx.geometry.Insets; import javafx.geometry.Insets;
@ -12,10 +12,10 @@ import javafx.scene.paint.Paint;
import javafx.scene.text.Font; import javafx.scene.text.Font;
import gearth.misc.ConfirmationDialog; import gearth.misc.ConfirmationDialog;
import gearth.ui.buttons.*; import gearth.ui.buttons.*;
import gearth.services.extensionserver.extensions.network.executer.ExecutionInfo; import gearth.services.extensionhandler.extensions.network.executer.ExecutionInfo;
import gearth.services.extensionserver.extensions.network.executer.ExtensionRunner; import gearth.services.extensionhandler.extensions.network.executer.ExtensionRunner;
import gearth.services.extensionserver.extensions.network.executer.ExtensionRunnerFactory; import gearth.services.extensionhandler.extensions.network.executer.ExtensionRunnerFactory;
import gearth.services.extensionserver.extensions.network.executer.NormalExtensionRunner; import gearth.services.extensionhandler.extensions.network.executer.NormalExtensionRunner;
import java.nio.file.Paths; import java.nio.file.Paths;

View File

@ -1,7 +1,6 @@
package gearth.ui.extensions; package gearth.ui.extensions;
import gearth.services.extensionserver.extensions.GEarthExtension; import gearth.services.extensionhandler.extensions.GEarthExtension;
import gearth.services.extensionserver.extensions.network.NetworkExtension;
import javafx.scene.Node; import javafx.scene.Node;
import javafx.scene.control.ScrollPane; import javafx.scene.control.ScrollPane;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;

View File

@ -1,11 +1,10 @@
package gearth.ui.extensions; package gearth.ui.extensions;
import gearth.services.extensionserver.ExtensionServer; import gearth.services.extensionhandler.ExtensionHandler;
import gearth.services.extensionserver.extensions.extensionproducers.ExtensionProducer; import gearth.services.extensionhandler.extensions.network.NetworkExtensionsProducer;
import gearth.services.extensionserver.extensions.network.NetworkExtensionsProducer; import gearth.services.extensionhandler.extensions.network.executer.ExecutionInfo;
import gearth.services.extensionserver.extensions.network.executer.ExecutionInfo; import gearth.services.extensionhandler.extensions.network.executer.ExtensionRunner;
import gearth.services.extensionserver.extensions.network.executer.ExtensionRunner; import gearth.services.extensionhandler.extensions.network.executer.ExtensionRunnerFactory;
import gearth.services.extensionserver.extensions.network.executer.ExtensionRunnerFactory;
import gearth.ui.SubForm; import gearth.ui.SubForm;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
@ -17,7 +16,6 @@ import javafx.scene.layout.VBox;
import javafx.stage.FileChooser; import javafx.stage.FileChooser;
import java.io.File; import java.io.File;
import java.util.function.Predicate;
/** /**
* Created by Jonas on 06/04/18. * Created by Jonas on 06/04/18.
@ -34,7 +32,7 @@ public class Extensions extends SubForm {
public ScrollPane scroller; public ScrollPane scroller;
private ExtensionRunner extensionRunner = null; private ExtensionRunner extensionRunner = null;
private ExtensionServer extensionServer; private ExtensionHandler extensionHandler;
private NetworkExtensionsProducer networkExtensionsProducer; // needed for port private NetworkExtensionsProducer networkExtensionsProducer; // needed for port
@ -44,14 +42,14 @@ public class Extensions extends SubForm {
protected void onParentSet() { protected void onParentSet() {
ExtensionItemContainerProducer producer = new ExtensionItemContainerProducer(extensioncontainer, scroller); ExtensionItemContainerProducer producer = new ExtensionItemContainerProducer(extensioncontainer, scroller);
extensionServer = new ExtensionServer(getHConnection()); extensionHandler = new ExtensionHandler(getHConnection());
extensionServer.onExtensionConnected((e -> { extensionHandler.onExtensionConnected((e -> {
Platform.runLater(() -> producer.extensionConnected(e)); Platform.runLater(() -> producer.extensionConnected(e));
})); }));
//noinspection OptionalGetWithoutIsPresent //noinspection OptionalGetWithoutIsPresent
networkExtensionsProducer networkExtensionsProducer
= (NetworkExtensionsProducer) extensionServer.getExtensionProducers().stream() = (NetworkExtensionsProducer) extensionHandler.getExtensionProducers().stream()
.filter(producer1 -> producer1 instanceof NetworkExtensionsProducer) .filter(producer1 -> producer1 instanceof NetworkExtensionsProducer)
.findFirst().get(); .findFirst().get();