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