blob: 4a12f2b25450d370af155cc52ce75bb1e0afa583 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
package YalpServer;
import java.util.ArrayList;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import YalpInterfaces.*;
public class OutputPluginHandler {
private ArrayList<OutputPlugin> plugins;
private static int outputIds = 0;
private String log4jFile = "log4j_server.conf";
private static Logger logger =
Logger.getLogger("Yalp.Server.OutputPluginHandler");
public OutputPluginHandler() {
PropertyConfigurator.configureAndWatch(log4jFile);
logger.debug("OutputPluginHandler()");
plugins = new ArrayList<OutputPlugin>();
}
public PluginInfo addPlugin(OutputPlugin plugin)
{
logger.debug("addPlugin("+plugin.info.name+")");
plugin.info.id = outputIds++;
plugins.add(plugin);
return plugin.info;
}
public void control( OutputHolder ctlOutput, YalpErrorHolder err ) {
logger.debug("control()");
for( OutputPlugin plugin : plugins ) {
if( plugin.info.id == ctlOutput.value.id ) {
plugin.itf.control( ctlOutput, err );
return;
}
}
YalpError error = new YalpError();
error.descr = "output plugin not found";
error.msg = "selected output plugin is not available";
error.code = YalpErrorCode.ERROR_OUTPUT_PLUGIN_NA;
error.level = YalpErrorLevel.ERROR_LEVEL_ERROR;
err.value = error;
Output dummy = new Output();
ctlOutput.value = dummy;
}
}
|