summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/imagemaster/serverconnection/ConnectionData.java
diff options
context:
space:
mode:
authorNils Schwabe2014-07-04 12:50:59 +0200
committerNils Schwabe2014-07-04 12:50:59 +0200
commitd1ab55e39b392e62ca1f1e41e3c70cf48d676885 (patch)
tree2fcf410f3a7ff4a3acae9ad5502fc933f8887e2c /src/main/java/org/openslx/imagemaster/serverconnection/ConnectionData.java
parentFix that Globals are initialized before servers are starting up (diff)
downloadmasterserver-d1ab55e39b392e62ca1f1e41e3c70cf48d676885.tar.gz
masterserver-d1ab55e39b392e62ca1f1e41e3c70cf48d676885.tar.xz
masterserver-d1ab55e39b392e62ca1f1e41e3c70cf48d676885.zip
Change handling of connections and add support for download
Diffstat (limited to 'src/main/java/org/openslx/imagemaster/serverconnection/ConnectionData.java')
-rw-r--r--src/main/java/org/openslx/imagemaster/serverconnection/ConnectionData.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/main/java/org/openslx/imagemaster/serverconnection/ConnectionData.java b/src/main/java/org/openslx/imagemaster/serverconnection/ConnectionData.java
new file mode 100644
index 0000000..aeba3b9
--- /dev/null
+++ b/src/main/java/org/openslx/imagemaster/serverconnection/ConnectionData.java
@@ -0,0 +1,45 @@
+package org.openslx.imagemaster.serverconnection;
+
+import org.openslx.filetransfer.Listener;
+
+public class ConnectionData
+{
+ /**
+ * Where the file is stored locally.
+ */
+ protected final String filepath;
+
+ /**
+ * Type of this connection.
+ * True if uploading, false if downloading
+ */
+ protected final boolean type;
+ public final static boolean UPLOADING = true;
+ public final static boolean DOWNLOADING = false;
+
+ /**
+ * The active listener thread that listens for incoming connections.
+ */
+ protected final Listener listenerThread;
+
+ /**
+ * Create a new connection data
+ * @param filepath Where the file is stored locally
+ * @param type True if uploading, false if downloading
+ * @param listenerThread The active listener thread that listens for incoming connections
+ */
+ protected ConnectionData(String filepath, boolean type, Listener listenerThread)
+ {
+ this.filepath = filepath;
+ this.type = type;
+ this.listenerThread = listenerThread;
+ }
+
+ /**
+ * The port where this connection is running.
+ * @return The port where this connection is running.
+ */
+ protected int getPort() {
+ return this.listenerThread.getPort();
+ }
+}