commit | author | age
|
8e2038
|
1 |
package de.uhilger.avdirektor; |
U |
2 |
|
ac1194
|
3 |
import java.io.File; |
8e2038
|
4 |
import java.io.IOException; |
U |
5 |
import java.util.HashMap; |
|
6 |
import java.util.logging.Level; |
|
7 |
import java.util.logging.Logger; |
|
8 |
|
|
9 |
/** |
cc2a32
|
10 |
* Hauptklasse des av-director |
U |
11 |
* |
|
12 |
* Aufruf mit |
|
13 |
* java -jar av-director.jar port=9000 |
|
14 |
* java -jar av-director.jar nfs-prefix="/media/mc" port=9000 |
|
15 |
* java -Djava.util.logging.config.file=logging.properties -jar .. |
|
16 |
* |
|
17 |
* Der Parameter nfs-prefix bewirkt, dass beim Abspielen relative Pfade |
|
18 |
* mit diesem Praefix verbunden werden und setzt voraus, dass auf der |
|
19 |
* Maschine ein NFS-Mount ueber /etc/fstab eingerichtet ist. |
|
20 |
* |
8e2038
|
21 |
* @author ulrich |
U |
22 |
*/ |
|
23 |
public class App { |
|
24 |
|
|
25 |
private static final Logger logger = Logger.getLogger(App.class.getName()); |
|
26 |
|
ac1194
|
27 |
public static final String IP_PORT = "port"; |
U |
28 |
public static final String IP_WWW_DATA = "www-data"; |
|
29 |
public static final String IP_NFS_PREFIX = "nfs-prefix"; |
|
30 |
|
0af362
|
31 |
private static HashMap initParams; |
a7f0a1
|
32 |
private static Process playerproc; |
U |
33 |
|
8e2038
|
34 |
/** |
U |
35 |
* @param args the command line arguments |
|
36 |
*/ |
|
37 |
public static void main(String[] args) { |
|
38 |
initParams = new HashMap(); |
|
39 |
for(String arg: args) { |
|
40 |
String[] argParts = arg.split("="); |
|
41 |
initParams.put(argParts[0], argParts[1]); |
|
42 |
} |
ac1194
|
43 |
|
U |
44 |
Server server = new Server(Integer.parseInt(getInitParameter(IP_PORT))); |
8e2038
|
45 |
try { |
U |
46 |
server.start(); |
|
47 |
} catch (IOException ex) { |
|
48 |
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex); |
|
49 |
} |
|
50 |
} |
|
51 |
|
|
52 |
public static void stop() { |
|
53 |
System.exit(0); |
|
54 |
} |
|
55 |
|
|
56 |
public static String getInitParameter(String pname) { |
|
57 |
String param = null; |
|
58 |
Object o = initParams.get(pname); |
|
59 |
if(o != null) { |
|
60 |
param = o.toString(); |
|
61 |
} |
|
62 |
return param; |
|
63 |
} |
|
64 |
|
a7f0a1
|
65 |
public static Process getPlayerProcess() { |
U |
66 |
return playerproc; |
|
67 |
} |
8e2038
|
68 |
|
a7f0a1
|
69 |
public static void setPlayerProcess(Process p) { |
U |
70 |
playerproc = p; |
|
71 |
} |
8e2038
|
72 |
} |