summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/imagemaster/serverconnection/ConnectionData.java
blob: aeba3b9317a617eebb394e5947ec521c14b0dcf3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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();
	}
}