package de.uhilger.avdirektor;
|
|
import java.io.File;
|
import java.io.IOException;
|
import java.util.HashMap;
|
import java.util.logging.Level;
|
import java.util.logging.Logger;
|
|
/**
|
* Hauptklasse des av-director
|
*
|
* Aufruf mit
|
* java -jar av-director.jar port=9000
|
* java -jar av-director.jar nfs-prefix="/media/mc" port=9000
|
* java -Djava.util.logging.config.file=logging.properties -jar ..
|
*
|
* Der Parameter nfs-prefix bewirkt, dass beim Abspielen relative Pfade
|
* mit diesem Praefix verbunden werden und setzt voraus, dass auf der
|
* Maschine ein NFS-Mount ueber /etc/fstab eingerichtet ist.
|
*
|
* @author ulrich
|
*/
|
public class App {
|
|
private static final Logger logger = Logger.getLogger(App.class.getName());
|
|
public static final String IP_PORT = "port";
|
public static final String IP_WWW_DATA = "www-data";
|
public static final String IP_NFS_PREFIX = "nfs-prefix";
|
|
private static HashMap initParams;
|
private static Process playerproc;
|
|
/**
|
* @param args the command line arguments
|
*/
|
public static void main(String[] args) {
|
initParams = new HashMap();
|
for(String arg: args) {
|
String[] argParts = arg.split("=");
|
initParams.put(argParts[0], argParts[1]);
|
}
|
|
Server server = new Server(Integer.parseInt(getInitParameter(IP_PORT)));
|
try {
|
server.start();
|
} catch (IOException ex) {
|
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
|
}
|
}
|
|
public static void stop() {
|
System.exit(0);
|
}
|
|
public static String getInitParameter(String pname) {
|
String param = null;
|
Object o = initParams.get(pname);
|
if(o != null) {
|
param = o.toString();
|
}
|
return param;
|
}
|
|
public static Process getPlayerProcess() {
|
return playerproc;
|
}
|
|
public static void setPlayerProcess(Process p) {
|
playerproc = p;
|
}
|
}
|