From 3866a756db6c85e36d1896af8461682c8c19a2ec Mon Sep 17 00:00:00 2001
From: ulrich
Date: Wed, 11 May 2022 08:40:14 +0000
Subject: [PATCH] Rueckmeldung fuer Lautstaerkeregelung unterbunden

---
 src/de/uhilger/tango/Server.java |   42 +++++++++++++++++++++++-------------------
 1 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/src/de/uhilger/tango/Server.java b/src/de/uhilger/tango/Server.java
index 3421d47..88be4db 100644
--- a/src/de/uhilger/tango/Server.java
+++ b/src/de/uhilger/tango/Server.java
@@ -36,6 +36,7 @@
 import de.uhilger.tango.entity.Entity;
 import java.util.Iterator;
 import java.util.List;
+import java.util.ResourceBundle;
 
 /**
  * Die Klasse Server stellt Methoden zur Ausführung eines HTTP-Servers
@@ -64,7 +65,7 @@
 
   private String ctx;
   
-  private HttpServer server;
+  //private HttpServer server;
 
   /**
    * Ein neues Objekt der Kalsse Server erzeugen
@@ -73,7 +74,7 @@
    */
   public Server(int port) {
     this.port = port;
-  }
+  }  
 
   /**
    * Den Port angeben, unter dem der Server erreichbar sein soll
@@ -106,38 +107,41 @@
    * Objekt
    * @throws java.lang.ClassNotFoundException
    */
-  public void start() throws IOException, ClassNotFoundException {
-    logger.log(Level.INFO, App.getRs(RB_SERVER_START_MSG), Integer.toString(port));
+  public void start(String wwwData, String conf) throws IOException, ClassNotFoundException {
+    ResourceBundle rb = ResourceBundle.getBundle(App.RB_NAME);
+    logger.log(Level.INFO, rb.getString(RB_SERVER_START_MSG), Integer.toString(port));
 
-    String wwwData = App.getInitParameter(App.getRs(App.RB_AP_WWW_DATA));
+    //String wwwData = App.getInitParameter(rb.getString(App.RB_AP_WWW_DATA));
     File wwwDir = new File(wwwData);
 
-    server = HttpServer.create(new InetSocketAddress(port), 0);
-    server.createContext(ctx + App.getRs(RB_WEBROOT), new FileHandler(wwwDir.getAbsolutePath()));
-    ablageorteEinklinken(server);
-    server.createContext(ctx + App.getRs(RB_STORE), new StorageHandler());
-    server.createContext(ctx + App.getRs(RB_STRG), new MediaSteuerung());
-    server.createContext(ctx + App.getRs(RB_GSTRG), new GeraetSteuerung());
-    server.createContext(ctx + App.getRs(RB_ALIST), new ListHandler());
-    server.createContext(ctx + App.getRs(RB_STOP_SERVER), new StopServerHandler());
+    HttpServer server = HttpServer.create(new InetSocketAddress(port), 0);
+    server.createContext(ctx + rb.getString(RB_WEBROOT), new FileHandler(wwwDir.getAbsolutePath()));
+    ablageorteEinklinken(server, rb, conf);
+    server.createContext(ctx + rb.getString(RB_STORE), new StorageHandler(conf));
+    server.createContext(ctx + rb.getString(RB_STRG), new MediaSteuerung(conf));
+    server.createContext(ctx + rb.getString(RB_GSTRG), new GeraetSteuerung(conf));
+    server.createContext(ctx + rb.getString(RB_ALIST), new ListHandler(conf));
+    server.createContext(ctx + rb.getString(RB_STOP_SERVER), new StopServerHandler());
     //server.setExecutor(Executors.newFixedThreadPool(20));
-    server.setExecutor(Executors.newCachedThreadPool());
+    server.setExecutor(Executors.newFixedThreadPool(5));
     server.start();
   }
   
+  /*
   public void ablageortEntfernen(String url) {
     server.removeContext(ctx + url);
   }
 
-  public void ablageortHinzufuegen(Ablageort ort) {
+  public void ablageortHinzufuegen(Ablageort ort, String conf) {
     server.createContext(ctx + ort.getUrl(),  
-          new ListFileHandler(new File(ort.getOrt()).getAbsolutePath()));
+          new ListFileHandler(new File(ort.getOrt()).getAbsolutePath(), conf));
   }
+  */
   
-  private void ablageorteEinklinken(HttpServer server) 
+  private void ablageorteEinklinken(HttpServer server, ResourceBundle rb, String conf) 
               throws ClassNotFoundException, IOException {
     String typ = Ablageort.class.getSimpleName();
-    FileStorage store = new FileStorage(App.getInitParameter(App.getRs(App.RB_AP_CONF)));
+    FileStorage store = new FileStorage(conf);
     List<String> orte = store.list(typ);
     Iterator<String> i = orte.iterator();
     while(i.hasNext()) {
@@ -148,7 +152,7 @@
         logger.log(Level.FINE, "{0}{1}", new Object[]{ctx, ablageort.getUrl()});
         logger.fine(ablageort.getOrt());
         server.createContext(ctx + ablageort.getUrl(),  
-          new ListFileHandler(new File(ablageort.getOrt()).getAbsolutePath()));
+          new ListFileHandler(new File(ablageort.getOrt()).getAbsolutePath(), conf));
       }
     }
   }

--
Gitblit v1.9.3