[vlma-devel] [PATCH] French to english javadoc translation
Pierre Gergondet
pbs at dinauz.org
Tue Apr 8 23:07:12 CEST 2008
---
.../org/videolan/vlma/daemon/IVlStreamWatcher.java | 9 +-
.../main/java/org/videolan/vlma/daemon/VLMad.java | 112 +++++++++---------
.../main/java/org/videolan/vlma/daemon/VlData.java | 108 ++++++++---------
.../vlma/daemon/VlDirectMulticastWatcher.java | 65 ++++++----
.../org/videolan/vlma/daemon/VlExtremeWatcher.java | 49 +++-----
.../org/videolan/vlma/daemon/VlOrderGiver.java | 127 ++++++++++----------
.../videolan/vlma/daemon/VlOrderMonitoring.java | 65 +++++-----
.../videolan/vlma/daemon/VlServerMonitoring.java | 49 ++++----
8 files changed, 290 insertions(+), 294 deletions(-)
diff --git a/daemon/src/main/java/org/videolan/vlma/daemon/IVlStreamWatcher.java b/daemon/src/main/java/org/videolan/vlma/daemon/IVlStreamWatcher.java
index 8d8c65d..ae7fa57 100644
--- a/daemon/src/main/java/org/videolan/vlma/daemon/IVlStreamWatcher.java
+++ b/daemon/src/main/java/org/videolan/vlma/daemon/IVlStreamWatcher.java
@@ -24,7 +24,8 @@ import java.net.InetAddress;
import java.util.Map;
/**
- * Cette interface représente un moyen d'obtenir les données sur les flux actuellement diffusés.
+ * This interface represents a way to fetch data about the streams being
+ * diffused
*
* @see VlOrderMonitoring
* @author SylV
@@ -33,8 +34,10 @@ import java.util.Map;
public interface IVlStreamWatcher {
/**
- * Cette méthode renvoie l'association des flux multicast aux serveurs de diffusion.
- * @return l'association des flux multicast aux serveurs de diffusion
+ * This method returns the association between multicast streams and
+ * streaming servers
+ *
+ * @return the association between multicast streams and streaming servers
*/
Map<InetAddress, InetAddress> getStreams();
diff --git a/daemon/src/main/java/org/videolan/vlma/daemon/VLMad.java b/daemon/src/main/java/org/videolan/vlma/daemon/VLMad.java
index 53068fa..6819594 100644
--- a/daemon/src/main/java/org/videolan/vlma/daemon/VLMad.java
+++ b/daemon/src/main/java/org/videolan/vlma/daemon/VLMad.java
@@ -1,23 +1,23 @@
-/*
- * Copyright (C) 2006-2008 the VideoLAN team
- *
- * This file is part of VLMa.
- *
- * VLMa is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * VLMa is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with VLMa. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
+/*
+ * Copyright (C) 2006-2008 the VideoLAN team
+ *
+ * This file is part of VLMa.
+ *
+ * VLMa is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * VLMa is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with VLMa. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
package org.videolan.vlma.daemon;
import jargs.gnu.CmdLineParser;
@@ -28,51 +28,49 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/*
- * Cette fonction contient la procédure de démarrage du programme VLMa.
+ * This function contains the boot process of VLMA software.
*/
public class VLMad {
- private static final Logger logger = Logger.getLogger(VLMad.class);
+ private static final Logger logger = Logger.getLogger(VLMad.class);
static VlData data;
-
+
public static void main(String[] args) {
// parsing of cmdline
-
- CmdLineParser parser = new CmdLineParser();
- CmdLineParser.Option springxml = parser.addStringOption("springxml");
- CmdLineParser.Option IPsDevel = parser.addBooleanOption("IPsDevel");
-
- try {
- parser.parse(args);
- }
- catch (CmdLineParser.OptionException e) {
- logger.log(Level.ERROR, "Erreur dans la ligne de commande : " + e.getMessage());
- logger.log(Level.INFO, "Usage: VLMad [{--springxml} daemon.xml]\n" );
- System.exit(2);
- }
- String springxmlvalue = (String)parser.getOptionValue(springxml);
- if (springxmlvalue == null) {
- springxmlvalue = "daemon.xml";
- }
-
- boolean IPsDevelvalue;
- if (parser.getOptionValue(IPsDevel) != null) {
- IPsDevelvalue = true;
- }
- else {
- IPsDevelvalue = false;
- }
-
+ CmdLineParser parser = new CmdLineParser();
+ CmdLineParser.Option springxml = parser.addStringOption("springxml");
+ CmdLineParser.Option IPsDevel = parser.addBooleanOption("IPsDevel");
+
+ try {
+ parser.parse(args);
+ } catch (CmdLineParser.OptionException e) {
+ logger.log(Level.ERROR, "Erreur dans la ligne de commande : " + e.getMessage());
+ logger.log(Level.INFO, "Usage: VLMad [{--springxml} daemon.xml]\n");
+ System.exit(2);
+ }
+
+ String springxmlvalue = (String) parser.getOptionValue(springxml);
+ if (springxmlvalue == null) {
+ springxmlvalue = "daemon.xml";
+ }
+
+ boolean IPsDevelvalue;
+ if (parser.getOptionValue(IPsDevel) != null) {
+ IPsDevelvalue = true;
+ } else {
+ IPsDevelvalue = false;
+ }
+
// Lancement de l'application serveur
- logger.log(Level.DEBUG, "Début de l'application");
- logger.log(Level.DEBUG, "Chargement de l'application Spring à partir du fichier de config XML : " + springxmlvalue);
+ logger.log(Level.DEBUG, "Début de l'application");
+ logger.log(Level.DEBUG, "Chargement de l'application Spring à partir du fichier de config XML : " + springxmlvalue);
ApplicationContext ac = new ClassPathXmlApplicationContext(springxmlvalue);
- data = (VlData)ac.getBean("dataSource");
- data.initIPs(IPsDevelvalue);
- logger.log(Level.DEBUG, "Lancement du thread de surveillance des serveurs");
- data.startServerMonitoringDaemon();
- logger.log(Level.DEBUG, "Lancement du thread de surveillance de la diffusion");
- data.startOrderMonitoringDaemon();
+ data = (VlData) ac.getBean("dataSource");
+ data.initIPs(IPsDevelvalue);
+ logger.log(Level.DEBUG, "Lancement du thread de surveillance des serveurs");
+ data.startServerMonitoringDaemon();
+ logger.log(Level.DEBUG, "Lancement du thread de surveillance de la diffusion");
+ data.startOrderMonitoringDaemon();
}
}
diff --git a/daemon/src/main/java/org/videolan/vlma/daemon/VlData.java b/daemon/src/main/java/org/videolan/vlma/daemon/VlData.java
index 4081426..b3879e1 100644
--- a/daemon/src/main/java/org/videolan/vlma/daemon/VlData.java
+++ b/daemon/src/main/java/org/videolan/vlma/daemon/VlData.java
@@ -82,12 +82,13 @@ import org.videolan.vlma.common.programs.VlProgram;
import com.thoughtworks.xstream.XStream;
-/**
- * Ceci est une implémentation de l'interface IVlData.
- * Cette classe sert à contenir les données et à les rendre disponibles par remoting.
- * @author SylV
- * @author vivi
- * @version 1.0
+/**
+ * This is an implementation of the IVlData interface. This class is used to
+ * contain the data and make them available through remoting.
+ *
+ * @author SylV
+ * @author vivi
+ * @version 1.0
*/
public class VlData implements IVlData {
@@ -143,8 +144,7 @@ public class VlData implements IVlData {
return s;
}
}
- throw new SatelliteDoesNotExistException("Le satellite "
- + satellite + " n'existe pas.");
+ throw new SatelliteDoesNotExistException("Le satellite " + satellite + " n'existe pas.");
}
synchronized public void clearSatelliteCoverages(int satellite)
@@ -165,8 +165,9 @@ public class VlData implements IVlData {
synchronized private void addSatelliteToTheList(VlSatellite s, String name)
{
- /**
- * This function adds the satellite to list of satellites of this VLData object.
+ /**
+ * This function adds the satellite to list of satellites of this VLData
+ * object.
*/
satellites.add(s);
logger.log(Level.DEBUG, "Satellite " + name + " ajouté");
@@ -219,8 +220,7 @@ public class VlData implements IVlData {
return s;
}
}
- throw new ServerDoesNotExistException("Le serveur " + server
- + " n'existe pas.");
+ throw new ServerDoesNotExistException("Le serveur " + server + " n'existe pas.");
}
synchronized public VlServer getServer(String server)
@@ -232,8 +232,7 @@ public class VlData implements IVlData {
return s;
}
}
- throw new ServerDoesNotExistException("Le serveur " + server
- + " n'existe pas.");
+ throw new ServerDoesNotExistException("Le serveur " + server + " n'existe pas.");
}
synchronized public void setServerIp(int server, InetAddress newIp)
@@ -253,16 +252,16 @@ public class VlData implements IVlData {
throw new ServerAlreadyExistsException("Serveur class type non valide");
}
- /*
- if( Monostate.g_FakeDaemon ) { s = Monostate.g_ServerClass.newInstance(name, null); }
- else { s = new VlServerReal(name, null); }
- */
+ /*
+ * if( Monostate.g_FakeDaemon ) { s =
+ * Monostate.g_ServerClass.newInstance(name, null); } else { s = new
+ * VlServerReal(name, null); }
+ */
if (servers.contains(s))
{
- throw new ServerAlreadyExistsException("Le serveur " + name
- + " existe déjà .");
+ throw new ServerAlreadyExistsException("Le serveur " + name + " existe déjà .");
} else {
servers.add(s);
logger.log(Level.DEBUG, "Serveur " + name + " ajouté");
@@ -281,8 +280,7 @@ public class VlData implements IVlData {
}
else
{
- throw new ServerDoesNotExistException("Le serveur " + server
- + " n'existe pas.");
+ throw new ServerDoesNotExistException("Le serveur " + server + " n'existe pas.");
}
}
@@ -299,8 +297,7 @@ public class VlData implements IVlData {
IVlAdapter a = (IVlAdapter) m.get(name);
if (a == null) {
- throw new AdapterDoesNotExistException("Le périphérique " + name
- + " n'existe pas dans le serveur " + server + ".");
+ throw new AdapterDoesNotExistException("Le périphérique " + name + " n'existe pas dans le serveur " + server + ".");
}
return a;
}
@@ -312,12 +309,10 @@ public class VlData implements IVlData {
Map<String, IVlAdapter> m = s.getAdapters();
IVlAdapter a = (IVlAdapter) m.get(name);
if (a == null) {
- throw new AdapterDoesNotExistException("Le périphérique " + name
- + " n'existe pas dans le serveur " + server + ".");
+ throw new AdapterDoesNotExistException("Le périphérique " + name + " n'existe pas dans le serveur " + server + ".");
}
if (m.containsKey(newName)) {
- throw new AdapterAlreadyExistsException("Le périphérique "
- + newName + " existe déjà dans le serveur " + server + ".");
+ throw new AdapterAlreadyExistsException("Le périphérique " + newName + " existe déjà dans le serveur " + server + ".");
}
a.setName(newName);
m.put(newName, a);
@@ -331,8 +326,7 @@ public class VlData implements IVlData {
Map m = s.getAdapters();
IVlAdapter a = (IVlAdapter) m.get(name);
if (a == null) {
- throw new AdapterDoesNotExistException("Le périphérique " + name
- + " n'existe pas dans le serveur " + server + ".");
+ throw new AdapterDoesNotExistException("Le périphérique " + name + " n'existe pas dans le serveur " + server + ".");
}
a.setParameter(parameter, value, this);
}
@@ -344,8 +338,7 @@ public class VlData implements IVlData {
VlServer s = this.getServer(server);
Map<String, IVlAdapter> m = s.getAdapters();
if (m.containsKey(name)) {
- throw new AdapterAlreadyExistsException("Le périphérique " + name
- + " existe déjà dans le serveur " + server + ".");
+ throw new AdapterAlreadyExistsException("Le périphérique " + name + " existe déjà dans le serveur " + server + ".");
}
Class<VlAdapter> c = (Class<VlAdapter>) Class.forName(type);
IVlAdapter a = c.newInstance();
@@ -359,8 +352,7 @@ public class VlData implements IVlData {
VlServer s = this.getServer(server);
Map m = s.getAdapters();
if (m.remove(name) == null) {
- throw new AdapterDoesNotExistException("Le périphérique " + name
- + " n'existe pas dans le serveur " + server + ".");
+ throw new AdapterDoesNotExistException("Le périphérique " + name + " n'existe pas dans le serveur " + server + ".");
}
}
@@ -388,8 +380,7 @@ public class VlData implements IVlData {
synchronized public int addMedia(IVlMedia media) {
if (medias.contains(media)) {
- throw new MediaAlreadyExistsException("Le média " + media.getName()
- + " existe déjà ");
+ throw new MediaAlreadyExistsException("Le média " + media.getName() + " existe déjà ");
} else {
medias.add(media);
logger.log(Level.DEBUG, "Média " + media.getName() + " ajouté");
@@ -402,8 +393,7 @@ public class VlData implements IVlData {
if (medias.remove(m)) {
logger.log(Level.DEBUG, "Média " + media + " supprimé");
} else {
- throw new MediaDoesNotExistException("Le média " + media
- + " n'existe pas");
+ throw new MediaDoesNotExistException("Le média " + media + " n'existe pas");
}
}
@@ -411,8 +401,7 @@ public class VlData implements IVlData {
IVlProgram program) throws MediaDoesNotExistException {
IVlMedia m = this.getMedia(media);
m.setProgram(program);
- logger.log(Level.DEBUG, "Nouvelle programmation pour le média "
- + media);
+ logger.log(Level.DEBUG, "Nouvelle programmation pour le média " + media);
}
synchronized public VlProgram addMediaProgram(int media)
@@ -443,12 +432,19 @@ public class VlData implements IVlData {
}
- /**
- * Extract data from a HTML row where, in each cell, several <br />-separated `rows' can be found.
- * @param nodes the list of nodes which represent the row
- * @param column the column (beginning with 0) where to find data
- * @param row the row (beginning with 0) where to find data
- * @param maxRow the expected number of rows - 1 (in fact the highest row number)
+ /**
+ * Extract data from a HTML row where, in each cell, several <br />
+ * -separated `rows' can be found.
+ *
+ * @param nodes
+ * the list of nodes which represent the row
+ * @param column
+ * the column (beginning with 0) where to find data
+ * @param row
+ * the row (beginning with 0) where to find data
+ * @param maxRow
+ * the expected number of rows - 1 (in fact the highest row
+ * number)
*/
private static String htmlCellExtract(NodeList nodes, int column, int row, int maxRow) throws ParserException {
String result = "";
@@ -627,12 +623,10 @@ public class VlData implements IVlData {
@SuppressWarnings({"unchecked","unchecked"})
synchronized public void loadFromDisk() throws FileNotFoundException,
IOException {
- String vlmaHomePath = new String(System.getProperty("user.home") +
- File.separator + ".vlma" + File.separator);
+ String vlmaHomePath = new String(System.getProperty("user.home") + File.separator + ".vlma" + File.separator);
try {
- FileInputStream f = new FileInputStream(vlmaHomePath +
- "data.xml");
+ FileInputStream f = new FileInputStream(vlmaHomePath + "data.xml");
List<List> loadList;
loadList = (List<List>) xstream.fromXML(f);
@@ -646,8 +640,7 @@ public class VlData implements IVlData {
logger.log(Level.WARN, "Impossible de lire le fichier data.xml");
}
try {
- FileInputStream f = new FileInputStream(vlmaHomePath +
- "config.xml");
+ FileInputStream f = new FileInputStream(vlmaHomePath + "config.xml");
Configuration configuration = getConfiguration();
configuration = (Configuration) xstream.fromXML(f);
@@ -659,10 +652,11 @@ public class VlData implements IVlData {
}
- /** This method inits the IP bank
- *
+ /**
+ * This method inits the IP bank
+ *
* @param IPsDevel
- * true if we devel IPs must be used for the orders
+ * true if we devel IPs must be used for the orders
*/
synchronized public void initIPs(boolean IPsDevel) {
try {
@@ -685,8 +679,8 @@ public class VlData implements IVlData {
Collections.sort(medias);
}
- /*
- * For the Monitoring class
+ /*
+ * For the Monitoring class
*/
/* Starts the deamons */
diff --git a/daemon/src/main/java/org/videolan/vlma/daemon/VlDirectMulticastWatcher.java b/daemon/src/main/java/org/videolan/vlma/daemon/VlDirectMulticastWatcher.java
index 2da8b82..f9e731c 100644
--- a/daemon/src/main/java/org/videolan/vlma/daemon/VlDirectMulticastWatcher.java
+++ b/daemon/src/main/java/org/videolan/vlma/daemon/VlDirectMulticastWatcher.java
@@ -35,12 +35,11 @@ import org.videolan.vlma.common.medias.IVlMedia;
import java.io.IOException;
import java.io.InterruptedIOException;
-/**
- * This Watcher direcly connects to the multicast groups to verify
- * if some data are broadcasted.
- * If yes, it considers that the media is broadcasted.
- *
- * @author MagSoft
+/**
+ * This Watcher direcly connects to the multicast groups to verify if some data
+ * are broadcasted. If yes, it considers that the media is broadcasted.
+ *
+ * @author MagSoft
*/
public class VlDirectMulticastWatcher implements IVlStreamWatcher {
@@ -48,29 +47,29 @@ public class VlDirectMulticastWatcher implements IVlStreamWatcher {
private static final Logger logger = Logger.getLogger(VlDirectMulticastWatcher.class);
- /**
- * The thread used to wait.
+ /**
+ * The thread used to wait.
*/
private Thread waitThread;
- /**
- * The multicast socket timeout
+ /**
+ * The multicast socket timeout
*/
private static int SOCKET_RECEIVE_TIMEOUT = 500;
- /**
- * The minimal lenght of the string to consider that the media is
- * broadcasted
+ /**
+ * The minimal lenght of the string to consider that the media is
+ * broadcasted
*/
private static int BUF_LENGHT_MIN = 300;
- /**
- * The time leaved to the multicast socket to get data.
+ /**
+ * The time leaved to the multicast socket to get data.
*/
private static int WAIT_SPAN = 500;
- /**
- * Is true when the socket try to receive data
+ /**
+ * Is true when the socket try to receive data
*/
private boolean isReceivingData = false;
@@ -82,7 +81,8 @@ public class VlDirectMulticastWatcher implements IVlStreamWatcher {
/* Lopp on the media if check if they have a program */
for (IVlMedia media : data.getMedias()) {
- if (media.getProgram() != null && media.getProgram().getIp() != null) { /* If yes, we can start the test */
+ if (media.getProgram() != null && media.getProgram().getIp() != null) {
+ /* If yes, we can start the test */
/* Join the multicast group */
logger.log(Level.DEBUG, "Joining the multicast group " + media.getProgram().getIp() + " of " + media.getName() + ".");
MulticastSocket s = new MulticastSocket(1234);
@@ -98,7 +98,10 @@ public class VlDirectMulticastWatcher implements IVlStreamWatcher {
while (isReceivingData) {
s.receive(recv);
bufLenght += recv.getLength();
- /* If the minimum data quantity has been receive, then ... */
+ /*
+ * If the minimum data quantity has been receive,
+ * then ...
+ */
if (bufLenght >= BUF_LENGHT_MIN)
{
/* It is no more necessary to wait */
@@ -107,8 +110,16 @@ public class VlDirectMulticastWatcher implements IVlStreamWatcher {
}
}
- /* This is a dirty test but I haven't seen something else at this moment */
- if (bufLenght >= BUF_LENGHT_MIN) { /* If some data is receidev, then the stream must be broadcast */
+ /*
+ * This is a dirty test but I haven't seen something
+ * else at this moment
+ */
+ if (bufLenght >= BUF_LENGHT_MIN) { /*
+ * If some data is
+ * receidev, then
+ * the stream must
+ * be broadcast
+ */
retour.put(media.getProgram().getIp(), media.getProgram().getPlayer());
logger.log(Level.DEBUG, "Some data has been received : " + bufLenght + " bytes.");
}
@@ -124,15 +135,15 @@ public class VlDirectMulticastWatcher implements IVlStreamWatcher {
}
} catch (IOException e) {
- //Do nothing
+ // Do nothing
}
return retour;
}
- /**
- * This wait WAIT_SPAN miliseconds for the multicast socket to
- * receive some data
+ /**
+ * This wait WAIT_SPAN miliseconds for the multicast socket to receive some
+ * data
*/
Runnable waiter = new Runnable() {
public void run() {
@@ -146,8 +157,8 @@ public class VlDirectMulticastWatcher implements IVlStreamWatcher {
}
};
- /**
- * Start the waiting thread
+ /**
+ * Start the waiting thread
*/
private synchronized void startWaitingForTheSocket() {
waitThread = new Thread(waiter);
diff --git a/daemon/src/main/java/org/videolan/vlma/daemon/VlExtremeWatcher.java b/daemon/src/main/java/org/videolan/vlma/daemon/VlExtremeWatcher.java
index e1c8001..de2ed82 100644
--- a/daemon/src/main/java/org/videolan/vlma/daemon/VlExtremeWatcher.java
+++ b/daemon/src/main/java/org/videolan/vlma/daemon/VlExtremeWatcher.java
@@ -37,47 +37,47 @@ import org.apache.log4j.Logger;
/**
- * Cette classe permet de récupérer les flux que reçoit un routeur Extreme.
+ * This class can get the streams which are received by an Extreme router.
*
* @see IVlStreamWatcher
* @author sylv
- *
+ *
*/
public class VlExtremeWatcher implements IVlStreamWatcher {
private static final Logger logger = Logger.getLogger(VlExtremeWatcher.class);
/**
- * Le pas d'attente pour les connexions Telnet.
+ * Wait step time for telnet connections.
*/
private static final int TELNET_DEFAULT_WAIT = 100;
/**
- * Le temps total d'attente pour les connexions Telnet.
+ * Overall wait time for telnet connections.
*/
private static final int TELNET_DEFAULT_DELAY = 1000;
/**
- * L'adresse IP du routeur à interroger.
+ * Router's ip to be asked.
*/
private static final String ROUTER_HOST = "138.195.131.126";
/**
- * Le port du routeur sur lequel se conecter;
+ * Router's port on which to connect.
*/
private static final int ROUTER_PORT = 23;
/**
- * Le nom de l'utilisateur pour la connexion au routeur.
+ * Username for the connection to the router.
*/
private static final String ROUTER_USER = "user";
/**
- * Le mot de passe pour la connexion au routeur.
+ * Password for the connection to the router.
*/
private static final String ROUTER_PASSWORD = "via";
/**
- * Le VLAN à contrôler.
+ * The VLAN to be checked.
*/
private static final String ROUTER_VLAN = "vlip-videolan";
@@ -85,15 +85,12 @@ public class VlExtremeWatcher implements IVlStreamWatcher {
public Map<InetAddress, InetAddress> getStreams() {
String toParse = "";
// Connexion au routeur en telnet
- logger.log(Level.DEBUG,
- "Connexion au routeur pour récupération de l'état de flux");
+ logger.log(Level.DEBUG, "Connexion au routeur pour récupération de l'état de flux");
try {
// Création du socket et connexion
Socket socket = new Socket(ROUTER_HOST, ROUTER_PORT);
- PrintWriter out = new PrintWriter(socket
- .getOutputStream(), true);
- BufferedReader in = new BufferedReader(
- new InputStreamReader(socket.getInputStream()));
+ PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
+ BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
// Envoi du login et du mot de passe
out.println(ROUTER_USER);
out.println(ROUTER_PASSWORD);
@@ -102,8 +99,7 @@ public class VlExtremeWatcher implements IVlStreamWatcher {
out.println(" ");
Thread.sleep(TELNET_DEFAULT_WAIT);
int m = TELNET_DEFAULT_DELAY;
- while ((!in.ready())
- && ((m -= TELNET_DEFAULT_WAIT) > 0)) {
+ while ((!in.ready()) && ((m -= TELNET_DEFAULT_WAIT) > 0)) {
Thread.sleep(TELNET_DEFAULT_WAIT);
}
while (in.ready()) {
@@ -114,33 +110,26 @@ public class VlExtremeWatcher implements IVlStreamWatcher {
in.close();
socket.close();
} catch (UnknownHostException e) {
- logger.log(Level.ERROR,
- "Erreur lors de l'interrogation du routeur", e);
+ logger.log(Level.ERROR, "Erreur lors de l'interrogation du routeur", e);
} catch (IOException e) {
- logger.log(Level.ERROR,
- "Erreur lors de l'interrogation du routeur", e);
+ logger.log(Level.ERROR, "Erreur lors de l'interrogation du routeur", e);
} catch (InterruptedException e) {
logger.log(Level.ERROR, "Le thread a été interrompu", e);
}
// Parsing des données du routeur
HashMap<InetAddress, InetAddress> streams = new HashMap<InetAddress, InetAddress>();
- Matcher m =
- Pattern.compile("\\s+\\w+\\s+(\\d+\\.\\d+\\.\\d+\\.\\d+)\\s+(\\d+\\.\\d+\\.\\d+\\.\\d+)").matcher(toParse);
+ Matcher m = Pattern.compile("\\s+\\w+\\s+(\\d+\\.\\d+\\.\\d+\\.\\d+)\\s+(\\d+\\.\\d+\\.\\d+\\.\\d+)").matcher(toParse);
while (m.find()) {
try {
InetAddress ip1 = InetAddress.getByName(m.group(1));
InetAddress ip2 = InetAddress.getByName(m.group(2));
- if ((ip1.isMulticastAddress())
- && (!ip2.isMulticastAddress())) {
+ if ((ip1.isMulticastAddress()) && (!ip2.isMulticastAddress())) {
streams.put(ip1, ip2);
- logger.log(Level.DEBUG, "Le serveur "
- + ip2.getHostName() + " diffuse "
- + ip1.getHostName());
+ logger.log(Level.DEBUG, "Le serveur " + ip2.getHostName() + " diffuse " + ip1.getHostName());
}
} catch (UnknownHostException e) {
- logger.log(Level.ERROR,
- "Impossible de résoudre une adresse", e);
+ logger.log(Level.ERROR, "Impossible de résoudre une adresse", e);
}
}
return streams;
diff --git a/daemon/src/main/java/org/videolan/vlma/daemon/VlOrderGiver.java b/daemon/src/main/java/org/videolan/vlma/daemon/VlOrderGiver.java
index 319a308..017d6d1 100644
--- a/daemon/src/main/java/org/videolan/vlma/daemon/VlOrderGiver.java
+++ b/daemon/src/main/java/org/videolan/vlma/daemon/VlOrderGiver.java
@@ -39,14 +39,14 @@ import org.videolan.vlma.common.medias.VlMediaGroup;
import org.videolan.vlma.common.orders.VlOrder;
import org.videolan.vlma.common.programs.IVlProgram;
-/**
- * Cette classe permet de calculer les ordres à donner aux serveurs en fonction
- * de la programmation des médias, de l'état des serveurs et de leurs
- * périphériques, des priorités des programmes.
- *
- * @author SylV
- * @version 1.0
- *
+/**
+ * This class can compute the orders to give to the servers depending on the
+ * medias' programmation, on the servers' and peripherics' state, and on the
+ * priority of the programms.
+ *
+ * @author SylV
+ * @version 1.0
+ *
*/
public class VlOrderGiver implements IVlOrderGiver {
private static final Logger logger = Logger.getLogger(VlOrderGiver.class);
@@ -55,46 +55,41 @@ public class VlOrderGiver implements IVlOrderGiver {
private Thread computingThread;
- /**
- * Ce constructeur a besoin de l'interface de données dont il contrôlera les
- * ordres.
- *
- * @param data
+ /**
+ * This constructor needs the data interface it will control orders.
+ *
+ * @param data
*/
public VlOrderGiver(IVlData data) {
this.data = data;
computingThread = null;
}
- /**
- * Cette méthode indique si l'objet est ou non en train de calculer les
- * ordres.
- *
- * @return vrai si et seulement si l'objet est en train de calculer les
- * ordres
+ /**
+ * This method indicates whether or not the object is computing the orders.
+ *
+ * @return true only and only if the object is computing the orders. ordres
*/
public boolean isComputing() {
return (computingThread != null) && (computingThread.isAlive());
}
- /**
- * Cette méthode est celle qui calcule réellement les ordres.
+ /**
+ * This method is the actual orders' computing method.
*/
private Runnable orderComputer = new Runnable() {
public void run() {
logger.log(Level.DEBUG, "Début du calcul de l'assignation des chaînes");
- Map<Integer, List<VlOrder>> orders = data.getOrders(); //Ordre de diffusions
- List<IVlMedia> medias = data.getMedias(); //Liste des médias
- List<VlServer> servers = data.getServers(); //Liste des serveurs
- Map<Integer, List<VlMediaGroup>> programGroups =
- new HashMap<Integer, List<VlMediaGroup>>();
- Map<Integer, List<IVlAdapter>> readyAdapters =
- new HashMap<Integer, List<IVlAdapter>>();
- Map<IVlAdapter, VlServer> readyAdaptersServers =
- new HashMap<IVlAdapter, VlServer>();
+ Map<Integer, List<VlOrder>> orders = data.getOrders(); // Ordre de
+ // diffusions
+ List<IVlMedia> medias = data.getMedias(); // Liste des médias
+ List<VlServer> servers = data.getServers(); // Liste des serveurs
+ Map<Integer, List<VlMediaGroup>> programGroups = new HashMap<Integer, List<VlMediaGroup>>();
+ Map<Integer, List<IVlAdapter>> readyAdapters = new HashMap<Integer, List<IVlAdapter>>();
+ Map<IVlAdapter, VlServer> readyAdaptersServers = new HashMap<IVlAdapter, VlServer>();
- //The ready adapters are listed and grouped by hashType.
+ // The ready adapters are listed and grouped by hashType.
{
int nbAdapters = 0;
logger.log(Level.DEBUG, "Passage en revue des périphériques disponibles");
@@ -119,7 +114,7 @@ public class VlOrderGiver implements IVlOrderGiver {
logger.log(Level.DEBUG, nbAdapters + " périphériques à disposition");
}
- // On passe en revue tous les médias à diffuser et on les regroupe
+ // On passe en revue tous les médias à diffuser et on les regroupe
{
int nbMedias = 0;
logger.log(Level.DEBUG, "Regroupement des médias à diffuser");
@@ -128,19 +123,21 @@ public class VlOrderGiver implements IVlOrderGiver {
if (p != null && p.isTimeToPlay()) {
logger.log(Level.DEBUG, "Média à diffuser : " + m.getName());
for (Integer h : readyAdapters.keySet()) {
- List<IVlAdapter> sameHashTypeAdapterList =
- readyAdapters.get(h);
- //If the first adapter of the list can read the media, then
+ List<IVlAdapter> sameHashTypeAdapterList = readyAdapters.get(h);
+ // If the first adapter of the list can read the
+ // media, then
if (sameHashTypeAdapterList.get(0).canRead(m)) {
- //Get or create the VLMediaGroup list of this type of media
+ // Get or create the VLMediaGroup list of this
+ // type of media
List<VlMediaGroup> sameHashTypeGroupList = programGroups.get(h);
if (sameHashTypeGroupList == null) {
sameHashTypeGroupList = new ArrayList<VlMediaGroup>();
programGroups.put(h, sameHashTypeGroupList);
}
- //Inside the the VlMediaGroup list, get the
- //VlMediaGroup of this type of media if it already exists.
+ // Inside the the VlMediaGroup list, get the
+ // VlMediaGroup of this type of media if it
+ // already exists.
VlMediaGroup mediaGroup = null;
for (VlMediaGroup j : sameHashTypeGroupList) {
if (m.belongsToGroup(j)) {
@@ -148,12 +145,12 @@ public class VlOrderGiver implements IVlOrderGiver {
break;
}
}
- //Create the mediaGroup if not ...
+ // Create the mediaGroup if not ...
if (mediaGroup == null) {
mediaGroup = new VlMediaGroup();
sameHashTypeGroupList.add(mediaGroup);
}
- //Add the media to its group
+ // Add the media to its group
mediaGroup.medias.add(m);
nbMedias++;
@@ -168,14 +165,15 @@ public class VlOrderGiver implements IVlOrderGiver {
logger.log(Level.DEBUG, nbMedias + " médias à diffuser");
}
- // On cherche à assigner un groupe de programmes par périphérique
+ // On cherche à assigner un groupe de programmes par périphérique
logger.log(Level.DEBUG, "Assignation des programmes aux périphériques");
for (Integer c : readyAdapters.keySet()) {
logger.log(Level.DEBUG, "Type de média : " + c.toString());
List<VlMediaGroup> sameHashTypeGroupList = programGroups.get(c);
List<IVlAdapter> sameHashTypeAdapterList = readyAdapters.get(c);
logger.log(Level.DEBUG, sameHashTypeAdapterList.size() + " périphériques");
- // On supprime les groupes de plus faible priorité (qu'on ne peut pas diffuser)
+ // On supprime les groupes de plus faible priorité (qu'on ne
+ // peut pas diffuser)
if (sameHashTypeGroupList != null) {
Collections.sort(sameHashTypeGroupList);
logger.log(Level.DEBUG, sameHashTypeGroupList.size() + " groupes de médias");
@@ -191,9 +189,9 @@ public class VlOrderGiver implements IVlOrderGiver {
logger.log(Level.DEBUG, "Suppression des ordres qui n'ont plus lieu d'être");
List<VlOrder> oldOrders = new ArrayList<VlOrder>();
- //Save the oldOrders list
+ // Save the oldOrders list
if (orders.containsKey(c)) {
- //Make a copy of the old orders
+ // Make a copy of the old orders
oldOrders.addAll(orders.get(c));
}
logger.log(Level.DEBUG, oldOrders.size() + " anciens ordres");
@@ -202,9 +200,11 @@ public class VlOrderGiver implements IVlOrderGiver {
while (groupIt.hasNext())
{
VlMediaGroup g = groupIt.next();
- /* The groups that are already diffused are removed from
- the list. Their correspondant adpater are also removed from
- the list of ready adapters. */
+ /*
+ * The groups that are already diffused are removed from
+ * the list. Their correspondant adpater are also
+ * removed from the list of ready adapters.
+ */
Iterator<VlOrder> orderIt = oldOrders.iterator();
while (orderIt.hasNext()) {
VlOrder order = orderIt.next();
@@ -212,11 +212,11 @@ public class VlOrderGiver implements IVlOrderGiver {
if ((order.getMedias().medias.containsAll(g.medias))
&& (g.medias.containsAll(order.getMedias().medias))
&& (order.getServer().getIp() == g.medias.get(0).getProgram().getPlayer())) {
- //Remove the mediaGroup
+ // Remove the mediaGroup
groupIt.remove();
- //Remove its correspondant adapter
+ // Remove its correspondant adapter
sameHashTypeAdapterList.remove(order.getAdapter());
- //Remove now the order
+ // Remove now the order
orderIt.remove();
break;
}
@@ -224,8 +224,10 @@ public class VlOrderGiver implements IVlOrderGiver {
}
}
- /* The orders that are no more maintened are stoped and
- removed from the order list. */
+ /*
+ * The orders that are no more maintened are stoped and removed
+ * from the order list.
+ */
for (VlOrder o : oldOrders)
{
try {
@@ -250,7 +252,7 @@ public class VlOrderGiver implements IVlOrderGiver {
}
- //The non existing orders are now created and executed.
+ // The non existing orders are now created and executed.
if (sameHashTypeGroupList != null) {
logger.log(Level.DEBUG, "Création des nouveaux ordres");
Iterator<VlMediaGroup> i = sameHashTypeGroupList.iterator();
@@ -259,16 +261,17 @@ public class VlOrderGiver implements IVlOrderGiver {
VlMediaGroup g = i.next();
IVlAdapter a = j.next();
VlServer adapterServer = a.getServer();
- //VlServer adapterServer = readyAdaptersServers.get(a);
+ // VlServer adapterServer = readyAdaptersServers.get(a);
VlOrder o = new VlOrder();
o.setAdapter(a);
o.setServer(adapterServer);
o.setMedias(g);
- logger.log(Level.DEBUG,
- "Attribution de chaînes sur le périphérique "
- + a.getName() + " du serveur "
- + adapterServer.getName());
- /* Set the server to the programs of the diffused medias for this adapeter */
+ logger.log(Level.DEBUG, "Attribution de chaînes sur le périphérique "
+ + a.getName() + " du serveur " + adapterServer.getName());
+ /*
+ * Set the server to the programs of the diffused medias
+ * for this adapeter
+ */
for (IVlMedia media : o.getMedias().medias) {
media.getProgram().setPlayer(adapterServer.getIp());
}
@@ -284,9 +287,9 @@ public class VlOrderGiver implements IVlOrderGiver {
}
};
- /**
- * Cette méthode lance le calcul des ordres dans un nouveau thread, si le
- * calcul n'était pas déjà en cours.
+ /**
+ * This method launches the computing of orders in a news thread, if it was
+ * not already running.
*/
synchronized public void computeOrders() {
if (!isComputing()) {
diff --git a/daemon/src/main/java/org/videolan/vlma/daemon/VlOrderMonitoring.java b/daemon/src/main/java/org/videolan/vlma/daemon/VlOrderMonitoring.java
index 12469ce..537ec14 100644
--- a/daemon/src/main/java/org/videolan/vlma/daemon/VlOrderMonitoring.java
+++ b/daemon/src/main/java/org/videolan/vlma/daemon/VlOrderMonitoring.java
@@ -33,17 +33,16 @@ import org.videolan.vlma.common.medias.IVlMedia;
import org.videolan.vlma.common.orders.VlOrder;
import org.videolan.vlma.common.programs.IVlProgram;
-/**
- * Cette classe est un démon de surveillance des ordres. Elle se connecte sur le
- * routeur et surveille que les ordres sont correctement exécutés.
- *
- * @author SylV
- * @version 1.0
+/**
+ * This class is an orders monitoring daemon. It connects to the router and
+ * checks that the orders are correctly executed.
+ *
+ * @author SylV
+ * @version 1.0
*/
public class VlOrderMonitoring {
- private static final Logger logger = Logger
- .getLogger(VlOrderMonitoring.class);
+ private static final Logger logger = Logger.getLogger(VlOrderMonitoring.class);
private IVlData data;
@@ -59,44 +58,48 @@ public class VlOrderMonitoring {
return (orderMonitorDeamonThread != null) && (orderMonitorDeamonThread.isAlive());
};
- /**
- * Le constructeur a besoin d'une interface de données, dont il contrôlera
- * les ordres. Dès le début le thread est lancé et la surveillance commence.
- *
- * @param data
+ /**
+ * The constructor need a data interface which he will monitore the orders.
+ * The thread is launched at start and monitoring starts.
+ *
+ * @param data
*/
public VlOrderMonitoring(IVlData data) {
this.data = data;
- //this.streamWatcher = new VlExtremeWatcher();
- //startMonitoringThread();
+ // this.streamWatcher = new VlExtremeWatcher();
+ // startMonitoringThread();
}
- /**
- * L'intervalle de temps entre deux interrogations RRD.
+ /**
+ * Time interval between two RRD interrogations.
*/
private static final int RRD_INTERVAL = 60;
- /**
- * L'objet qui donnera la liste des flux multicast.
+ /**
+ * The object which will give the multicast streams' list.
*/
private IVlStreamWatcher streamWatcher;
private Runnable orderMonitor = new Runnable() {
public void run() {
- // Récupération de l'état des flux depuis le routeur
+ // Récupération de l'état des flux depuis le routeur
Map<InetAddress, InetAddress> streams = streamWatcher.getStreams();
boolean shouldCompute = false;
- // Assignation de l'état des programmes
+ // Assignation de l'état des programmes
List<IVlMedia> medias = data.getMedias();
for (IVlMedia media : medias) {
IVlProgram program = media.getProgram();
if (program != null) {
- /* If the program must be played and is not then we have to recompute. */
+ /*
+ * If the program must be played and is not then we have to
+ * recompute.
+ */
if (program.isTimeToPlay()) {
if (streams.get(program.getIp()) == null && !data.getOrderGiver().isComputing()) {
- /* If the OrderGiver is not computing then
- * it can modify the data.
+ /*
+ * If the OrderGiver is not computing then it can
+ * modify the data.
*/
program.setPlayer(null);
program.setBroadcastState(false);
@@ -120,16 +123,16 @@ public class VlOrderMonitoring {
}
}
}
- /* Check if every media which belongs to a order has really
- * a program. If not, then it should compute.
+ /*
+ * Check if every media which belongs to a order has really a
+ * program. If not, then it should compute.
*/
for (List<VlOrder> orderList : data.getOrders().values()) {
for (VlOrder order : orderList) {
for (IVlMedia media : order.getMedias().medias) {
if (media.getProgram() == null) {
logger.log(Level.DEBUG, "The media " + media.getName()
- + " which belongs to an order has no more a"
- + "program.");
+ + " which belongs to an order has no more a program.");
shouldCompute = true;
break;
}
@@ -141,8 +144,8 @@ public class VlOrderMonitoring {
break;
}
- /* Something is wrong !
- * Ask for a new computation.
+ /*
+ * Something is wrong ! Ask for a new computation.
*/
if (shouldCompute) {
logger.log(Level.DEBUG, "Demande de réassignation des programmes");
@@ -164,7 +167,7 @@ public class VlOrderMonitoring {
public void run() {
while (true) {
startOrderMonitoringThread();
- //Wait before looping
+ // Wait before looping
try {
Thread.sleep(1000 * (RRD_INTERVAL - (Util.getTime() % RRD_INTERVAL)));
} catch (InterruptedException e) {
diff --git a/daemon/src/main/java/org/videolan/vlma/daemon/VlServerMonitoring.java b/daemon/src/main/java/org/videolan/vlma/daemon/VlServerMonitoring.java
index e6d6bf4..75266b3 100644
--- a/daemon/src/main/java/org/videolan/vlma/daemon/VlServerMonitoring.java
+++ b/daemon/src/main/java/org/videolan/vlma/daemon/VlServerMonitoring.java
@@ -36,9 +36,8 @@ import org.videolan.vlma.common.VlServer;
* @version 1.0
*/
public class VlServerMonitoring {
-
- private static final Logger logger = Logger
- .getLogger(VlServerMonitoring.class);
+
+ private static final Logger logger = Logger.getLogger(VlServerMonitoring.class);
private IVlData data;
@@ -48,25 +47,25 @@ public class VlServerMonitoring {
public static final int TIME_INTERVAL = 300;
private Thread checkVLCThread;
-
+
private Thread updateSNMPDataThread;
-
+
private Thread serverMonitorDeamonThread;
-
-
+
public boolean isCheckingVLC() {
return (checkVLCThread != null) && (checkVLCThread.isAlive());
};
-
+
public boolean isUpdatingSNMPData() {
- return (updateSNMPDataThread != null) && (updateSNMPDataThread.isAlive());
+ return (updateSNMPDataThread != null)
+ && (updateSNMPDataThread.isAlive());
};
-
+
public boolean isDeamonMonitoring() {
- return (serverMonitorDeamonThread != null) && (serverMonitorDeamonThread.isAlive());
+ return (serverMonitorDeamonThread != null)
+ && (serverMonitorDeamonThread.isAlive());
};
-
-
+
/**
* This thread try to connect to the VLCs of all servers to check if they
* run correctly or not.
@@ -91,8 +90,7 @@ public class VlServerMonitoring {
checkVLCThread.start();
}
}
-
-
+
/**
* This method is the main thread which monitores servers. At regular
* intervals, servers are sent SNMP requests and RRD graphs are updated.
@@ -103,18 +101,16 @@ public class VlServerMonitoring {
//logger.log(Level.DEBUG, "Test");
while (i.hasNext()) {
VlServer server = (VlServer) i.next();
- logger.log(Level.DEBUG, "Mise à jour RRD de "
- + server.getName());
+ logger.log(Level.DEBUG, "Mise à jour RRD de " + server.getName());
server.updateSnmpData();
server.updateRrdGraph();
}
}
};
-
-
+
/**
* This method starts the SNMP data updater in a thread
- */
+ */
synchronized public void startUpdateSNMPDataThread() {
if (!isUpdatingSNMPData()) {
updateSNMPDataThread = new Thread(snmpDataUpdater);
@@ -122,12 +118,11 @@ public class VlServerMonitoring {
updateSNMPDataThread.start();
}
}
-
-
+
/**
* This thread is the main thread which starts the VLC checker and the SNMP
* data updater once before waiting and then looping.
- */
+ */
Runnable serverMonitorDeamon = new Runnable() {
public void run() {
while (true) {
@@ -142,7 +137,7 @@ public class VlServerMonitoring {
}
}
};
-
+
/**
* This method is the constructor of the class.
* It needs the data object of the servers it will check and extract SNMP
@@ -151,15 +146,15 @@ public class VlServerMonitoring {
* @param data
* The data object whose servers will be controlled.
*/
-
+
public synchronized void startServerMonitoringDeamon() {
- if (!isDeamonMonitoring()) {
+ if (!isDeamonMonitoring()) {
serverMonitorDeamonThread = new Thread(serverMonitorDeamon);
serverMonitorDeamonThread.setName("serverMonitorThread");
serverMonitorDeamonThread.start();
}
}
-
+
public VlServerMonitoring(IVlData data) {
this.data = data;
}
--
1.5.3.7
More information about the vlma-devel
mailing list