diff options
| author | guest <guest@f059d3a0-6783-47b7-97ff-1fe0bbf25129> | 2008-09-29 21:06:20 +0000 |
|---|---|---|
| committer | guest <guest@f059d3a0-6783-47b7-97ff-1fe0bbf25129> | 2008-09-29 21:06:20 +0000 |
| commit | 4030bb57d8a9c9f3f2e1ba44b6b17492d3c79eaa (patch) | |
| tree | 05b13c13cb3570f88c261475e9a8d0e5b7cbe902 | |
| parent | 408445cc49f360b979266ea93cf3bcb25a50a8e4 (diff) | |
vlcstreamer creates streams now :-), but they're not played back, by the client
due to suspicious "cannot fill perfill buffer" error msg
git-svn-id: http://manut.eu/svn/yalp/trunk@8 f059d3a0-6783-47b7-97ff-1fe0bbf25129
| -rw-r--r-- | build.xml | 2 | ||||
| -rw-r--r-- | log4j_output_plugin.conf | 8 | ||||
| -rwxr-xr-x | src/YalpClients/SwtClient/Model.java | 8 | ||||
| -rw-r--r-- | src/YalpOutputs/YalpVlcTelnetOutput/TelnetInterface.java | 254 | ||||
| -rw-r--r-- | src/YalpOutputs/YalpVlcTelnetOutput/YalpOutputPluginImpl.java | 460 | ||||
| -rwxr-xr-x | src/YalpServer/InitServer.java | 1 | ||||
| -rw-r--r-- | src/YalpServer/OutputPluginHandler.java | 55 | ||||
| -rwxr-xr-x | src/YalpServer/ServerControlImpl.java | 40 | ||||
| -rw-r--r-- | src/yalp.idl | 1 |
9 files changed, 460 insertions, 369 deletions
@@ -79,7 +79,7 @@ <manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="YalpOutputs.YalpVlcTelnetOutput.YalpVlcTelnetOutput"/>
- <attribute name="Class-Path" value="${outputLibs}"/>
+ <attribute name="Class-Path" value="${vlctelnetLibs} ${log4jLibs}"/>
</manifest>
</jar>
</target>
diff --git a/log4j_output_plugin.conf b/log4j_output_plugin.conf new file mode 100644 index 0000000..79c355b --- /dev/null +++ b/log4j_output_plugin.conf @@ -0,0 +1,8 @@ +log4j.rootLogger=debug, stdout + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout + +# Pattern to output the caller's file name and line number. +log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n + diff --git a/src/YalpClients/SwtClient/Model.java b/src/YalpClients/SwtClient/Model.java index 912a3bb..111d1ca 100755 --- a/src/YalpClients/SwtClient/Model.java +++ b/src/YalpClients/SwtClient/Model.java @@ -500,12 +500,14 @@ public class Model { */
private boolean startVLC(){
- String vlcCmd = settings.vlcCommand +
- " --reset-srvConfig --video-on-top -I telnet --telnet-port 12345 ";
+ String vlcCmd = "/usr/bin/vlc" + //settings.vlcCommand +
+ " --reset-config --video-on-top -I telnet --telnet-port 12345 ";
/*
switch (this.actualStream.getAccess()){
case UDP:
+ */
vlcCmd += "udp:@";
+ /*
break;
case HTTP:
vlcCmd += "http://";
@@ -515,7 +517,7 @@ public class Model { "client.Model.startVLC: playback this type is not supported" );
}
*/
- vlcCmd += actualStream.info.params;
+ vlcCmd += "9993"; // actualStream.info.params;
System.out.println(vlcCmd);
try {
diff --git a/src/YalpOutputs/YalpVlcTelnetOutput/TelnetInterface.java b/src/YalpOutputs/YalpVlcTelnetOutput/TelnetInterface.java index c8441ac..cafa0b8 100644 --- a/src/YalpOutputs/YalpVlcTelnetOutput/TelnetInterface.java +++ b/src/YalpOutputs/YalpVlcTelnetOutput/TelnetInterface.java @@ -1,5 +1,4 @@ -/*********************************************************************** - * +/* * Copyright (c) 2006 Manuel Traut and Volker Dahnke * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 @@ -7,8 +6,7 @@ * http://www.eclipse.org/legal/cpl-v10.html * * Contributors: Manuel Traut and Volker Dahnke - * - ************************************************************************/ + */ package YalpOutputs.YalpVlcTelnetOutput; @@ -17,131 +15,129 @@ import java.io.*; import org.apache.commons.net.telnet.*; -/******************************************************************************* -* -* Class TelnetInterface -* -* <em>handels telnet connection</em> -* -* @author Volker Dahnke / Manuel Traut -* -* @version 0.1 20-11-2005<br> -* -* @see VlcStreamer -* -******************************************************************************/ +import org.apache.log4j.Logger; +import org.apache.log4j.PropertyConfigurator; + +/* + * Class TelnetInterface + * + * <em>handels telnet connection</em> + * + * @author Volker Dahnke / Manuel Traut + * + * @version 0.1 20-11-2005<br> + * + * @see VlcStreamer + */ + public class TelnetInterface { - private PrintStream out; - private InputStream in; - private TelnetClient tc = new TelnetClient(); - - /** - * creates socket, logs on - * - * @param host - * hostname of telnetserver - * @param port - * destination port - * @param pass - * password - * - */ - - public TelnetInterface(String host, int port, String pass){ - try{ - this.tc.connect(host,port); - this.out = new PrintStream(this.tc.getOutputStream()); - this.in = this.tc.getInputStream(); - } catch(IOException e){ - System.out.println("server.TelnetInterface.java: Telnet connection "+host+":"+port+" failed"); - return; - } - - readUntil( "Password:" ); - write(pass); - // Advance to a prompt - readUntil("> "); - } - - /** - * write to TelnetInterface - * @param value - * String to write to Interface - */ - public void write( String value ) { - try { - out.println( value ); - out.flush(); - System.out.println( value ); - } - catch( Exception e ) { - e.printStackTrace(); - } - } - - /** - * reads output of telnet client - * @param pattern - * for stop reading - * @return String - */ - public String readUntil( String pattern ) { - try { - char lastChar = pattern.charAt( pattern.length() - 1 ); - StringBuffer sb = new StringBuffer(); - char ch = ( char )in.read(); - while( true ) { - System.out.print( ch ); - sb.append( ch ); - if( ch == lastChar ) { - if( sb.toString().endsWith( pattern ) ) { - return sb.toString(); - } - } - ch = ( char )in.read(); - } - } - catch( Exception e ) { - e.printStackTrace(); - } - return null; - } - - /** - * executes command - * @param cmd - * any telnet command - * @return String - * telnet output caused by the command - * null if failed - */ - public String exec(String cmd){ - - try { - write(cmd); - return readUntil( "> " ); - } - catch( Exception e ) { - e.printStackTrace(); - } - return null; - } - - /** - * close telnet connection - * - * @return boolean - * true: connection closed - * false: connection close failed - */ - - public boolean close(){ - try { - this.tc.disconnect(); - } catch(IOException e){ - return false; - } - return true; - } + private PrintStream out; + private InputStream in; + private TelnetClient tc = new TelnetClient(); + + private String log4jFile = "log4j_output_plugin.conf"; + + private static Logger logger = + Logger.getLogger("Yalp.OutputPlugins.VlcTelnetOutput.TelnetInterface"); + + public TelnetInterface(String host, int port, String pass) { + + PropertyConfigurator.configureAndWatch(log4jFile); + logger.debug("TelnetInterface("+host+" "+port+" "+pass+")"); + + try { + tc.connect(host, port); + out = new PrintStream(this.tc.getOutputStream()); + in = this.tc.getInputStream(); + } catch(IOException e) { + System.out.println("server.TelnetInterface.java: Telnet connection "+host+":"+port+" failed"); + return; + } + + readUntil( "Password:" ); + write(pass); + // Advance to a prompt + readUntil("> "); + } + +/* + * write to TelnetInterface + * @param value + * String to write to Interface + */ + public void write( String value ) { + logger.debug("write("+value+")"); + try { + out.println( value ); + out.flush(); + } catch( Exception e ) { + e.printStackTrace(); + } + } + +/* + * reads output of telnet client + * @param pattern + * for stop reading + * @return String + */ + public String readUntil( String pattern ) { + logger.debug("readUntil("+pattern+")"); + try { + char lastChar = pattern.charAt( pattern.length() - 1 ); + StringBuffer sb = new StringBuffer(); + char ch = ( char )in.read(); + while( true ) { + System.out.print( ch ); + sb.append( ch ); + if( ch == lastChar ) { + if( sb.toString().endsWith( pattern ) ) { + return sb.toString(); + } + } + ch = ( char )in.read(); + } + } catch( Exception e ) { + e.printStackTrace(); + } + return null; + } + +/* + * executes command + * @param cmd + * any telnet command + * @return String + * telnet output caused by the command + * null if failed + */ + public String exec(String cmd){ + logger.debug("exec("+cmd+")"); + try { + write(cmd); + return readUntil( "> " ); + } catch( Exception e ) { + e.printStackTrace(); + } + return null; + } + +/* + * close telnet connection + * + * @return boolean + * true: connection closed + * false: connection close failed + */ + public boolean close(){ + logger.debug("close()"); + try { + tc.disconnect(); + } catch(IOException e) { + return false; + } + return true; + } + } diff --git a/src/YalpOutputs/YalpVlcTelnetOutput/YalpOutputPluginImpl.java b/src/YalpOutputs/YalpVlcTelnetOutput/YalpOutputPluginImpl.java index 50bdaa4..fee8de5 100644 --- a/src/YalpOutputs/YalpVlcTelnetOutput/YalpOutputPluginImpl.java +++ b/src/YalpOutputs/YalpVlcTelnetOutput/YalpOutputPluginImpl.java @@ -19,6 +19,9 @@ import org.omg.CORBA.*; import java.util.*; import java.io.IOException; +import org.apache.log4j.Logger; +import org.apache.log4j.PropertyConfigurator; + /* * Class YalpOutputPluginImpl * @@ -39,6 +42,17 @@ public class YalpOutputPluginImpl extends OutputPluginInterfacePOA { private ServerControlInterface srvCon; private PluginInfo pluginInfo; + private String log4jFile = "log4j_output_plugin.conf"; + + private static Logger logger = + Logger.getLogger("Yalp.OutputPlugins.VlcTelnetOutput.YalpOutputPluginImpl"); + + public YalpOutputPluginImpl() + { + PropertyConfigurator.configureAndWatch(log4jFile); + logger.debug("YalpOutputPluginImpl()"); + } + /* * starts a vlc player in a new process * @@ -53,6 +67,9 @@ public class YalpOutputPluginImpl extends OutputPluginInterfacePOA { * @throws ClassNotFoundException */ public void setORB(ORB _orb) { + + logger.debug("setORB()"); + orb = _orb; pluginInfo = new PluginInfo(); @@ -82,6 +99,7 @@ public class YalpOutputPluginImpl extends OutputPluginInterfacePOA { } public void shutdown() { + logger.debug("shutdown()"); /* t.b.d. */ } @@ -93,6 +111,20 @@ public class YalpOutputPluginImpl extends OutputPluginInterfacePOA { */ public void control(OutputHolder howtoStream, YalpErrorHolder err) { + logger.debug("control(howtoStream.value.id: "+howtoStream.value.id+")"); + + YalpError error = new YalpError(); + error.descr = ""; + error.msg = ""; + error.code = YalpErrorCode.OK; + error.level = YalpErrorLevel.ERROR_LEVEL_DEBUG; + + err.value = error; + + Output output = new Output(); + output = howtoStream.value; + howtoStream.value = output; + switch( howtoStream.value.outputAction.value() ) { case Action._START: @@ -134,6 +166,7 @@ public class YalpOutputPluginImpl extends OutputPluginInterfacePOA { */ public void getInfo(PluginInfoHolder info, YalpErrorHolder err) { + logger.debug("getInfo()"); info = new PluginInfoHolder(); err = new YalpErrorHolder(); err.value.code = YalpErrorCode.OK; @@ -141,6 +174,35 @@ public class YalpOutputPluginImpl extends OutputPluginInterfacePOA { } /* + * register Stream at vlcPlayer + * @param howtoStream + */ + private void add(Output howtoStream){ + + logger.debug("add()"); + + String input = ""; + TelnetInterface telnet = new TelnetInterface(hostIP, 4212, "admin"); + + input += "new "+howtoStream.info.name+" broadcast"; + + for(int i=0; i < howtoStream.playlist.length; i++){ + input += " input "; + input += howtoStream.playlist[i].path + "/"; + input += howtoStream.playlist[i].fileName; + } + telnet.exec(input); + + input = "setup " + howtoStream.info.name + " enabled"; + telnet.exec(input); + + input = "setup " + howtoStream.info.name + " loop"; + telnet.exec(input); + + telnet.close(); +} + +/* * request Streaming of submitted Output * * @param stream @@ -148,224 +210,182 @@ public class YalpOutputPluginImpl extends OutputPluginInterfacePOA { * @return Output * extends Information "how to receive" of submitted Output */ - public Output request(Output stream) { - //stream.setIP(hostIP); for UDP - stream.info.name = streamName(); - stream.info.params = new Integer(++startPort).toString(); - currentStreams.add(stream); - return stream; - } - - - /** - * starts streaming of submitted streamInfo - * @param howtoStream - */ - private void start(Output howtoStream){ - /* - String newString, setup2; - this.streamCounter.actualStreams++; - this.streamCounter.allStreams++; - - switch (howtoStream.info.type.value()){ - case AccessType._VOD: - newString = "new "+howtoStream.info.name+" vod enabled"; - break; - case AccessType._BROADCAST: - newString = "new "+howtoStream.info.name+" broadcast enabled"; - break; - default: - newString =""; - System.out.println("server.VlcStreamer.start: unsupported Type"); - break; - } - - String comp = "#transcode{vcodec=mp2v,vb=1024,scale=1,acodec=mpga,ab=192,channels=2}:duplicate{dst="; - - setup2 = "setup "+howtoStream.info.name+" output "+comp+"std{"; - - switch (howtoStream.access_type.value()){ - case Access._STREAM: - setup2 += "access=http,"; - break; - case Access._UDP: - setup2 += "access=udp,"; - break; - default: - System.out.println("server.VlcStreamer.start: unsupported Accesstype"); - break; - } - - switch (howtoStream.mux_type.value()){ - case Mux._TS: - setup2 += "mux=ts,url="+howtoStream.ip+":"+howtoStream.port+"}"; - break; - case Mux._ES: - setup2 += "mux=es,url="+howtoStream.ip+":"+howtoStream.port+"}"; - break; - case Mux._OGG: - setup2 += "mux=ogg,url="+howtoStream.ip+":"+howtoStream.port+"}"; - break; - default: - System.out.println("server.VlcStreamer.start: unsupported Muxer"); - break; - } - - // DEBUG COMP - setup2 += "}"; - - String control = "control "+howtoStream.info.name+" play"; - - // telnet connection - TelnetInterface telnet = new TelnetInterface(hostIP, 4212, "admin"); - - // execute telnet commands - telnet.exec(newString); - - // Playlist - String input = ""; - for(int i=0; i < howtoStream.list.length; i++){ - input = "setup "+howtoStream.info.name+" "; - String fileItem = howtoStream.list[i]; - fileItem.replace(" ", "\\ "); - input += fileItem; - telnet.exec(input); - } - - telnet.exec(setup2); - telnet.exec(control); - - // close telnet connection - telnet.close(); - */ - } - - /** - * plays submitted streamInfo - * @param howtoStream - */ - private void play(Output howtoStream){ - - String control = "control "+howtoStream.info.name+" play"; - - // telnet connection - TelnetInterface telnet = new TelnetInterface(hostIP, 4212, "admin"); - - telnet.exec(control); - - // close telnet connection - telnet.close(); - } - - /** - * pause submitted streamInfo - * @param howtoStream - */ - private void pause(Output howtoStream){ - - String control = "control "+howtoStream.info.name+" pause"; - - // DEBUG - System.out.println("client.VlcStreamer: Telnetcmd: "); - System.out.println(control); - - // telnet connection - TelnetInterface telnet = new TelnetInterface(hostIP, 4212, "admin"); - - telnet.exec(control); - - // close telnet connection - telnet.close(); - } - - /** - * go to next file in playlist - * - * @param howtoStream - */ - private void next(Output howtoStream){ - - String control = "control "+howtoStream.info.name+" seek 100"; - - // DEBUG - System.out.println("client.VlcStreamer: Telnetcmd: "); - System.out.println(control); - - // telnet connection - TelnetInterface telnet = new TelnetInterface(hostIP, 4212, "admin"); - - telnet.exec(control); - - // close telnet connection - telnet.close(); - } - - /** - * stop streaming, delete stream - * - * @param howtoStream - */ - private void stop(Output howtoStream){ - - String del = "del "+howtoStream.info.name; - this.streamCounter.actualStreams--; - - // telnet connection - TelnetInterface telnet = new TelnetInterface(hostIP, 4212, "admin"); - - telnet.exec(del); - - // close telnet connection - telnet.close(); - - currentStreams.remove(howtoStream); - } - - /** - * register Stream at vlcPlayer - * @param howtoStream - */ - private void add(Output howtoStream){ - - String input = ""; - - // telnet connection - TelnetInterface telnet = new TelnetInterface(hostIP, 4212, "admin"); - - for(int i=0; i < howtoStream.playlist.length; i++){ - input += "setup "+howtoStream.info.name+" "; - input += howtoStream.playlist[i]; - telnet.exec(input); - input = ""; - } - telnet.close(); - } - - /** - * calculates streamName - * @return String streamName - */ - - private String streamName(){ - String streamName = "stream"; - streamName += streamCounter.allStreams; - return streamName; - } - - /** - * stops the streaming server - * - */ - - public void quit(){ - vlcPlayer.destroy(); - } - - /** - * returns the streamcounter - * @return StreamCounter - */ - public StreamCounter getStreamCounter(){ - return this.streamCounter; - } + public Output request(Output stream) { + + logger.debug("request()"); + + //stream.setIP(hostIP); for UDP + stream.info.name = streamName(); + stream.info.params = new Integer(++startPort).toString(); + currentStreams.add(stream); + return stream; + } + + +/* + * starts streaming of submitted streamInfo + * @param howtoStream + */ + private void start(Output howtoStream) { + + logger.debug("start()"); + + String newString, setup2; + streamCounter.actualStreams++; + streamCounter.allStreams++; + + switch (howtoStream.info.type.value()) { + case AccessType._STREAM: + newString = "control "+howtoStream.info.name+" vod enabled"; + break; + /* + case AccessType._BROADCAST: + newString = "new "+howtoStream.info.name+" broadcast enabled"; + break; + */ + default: + newString =""; + System.out.println("server.VlcStreamer.start: unsupported Type"); + break; + } + + String comp = "#transcode{vcodec=mp2v,vb=1024,scale=1,acodec=mpga,ab=192,channels=2}:duplicate{dst="; + + setup2 = "setup "+howtoStream.info.name+" output "+comp+"std{"; +/* + switch (howtoStream.access_type.value()){ + case Access._STREAM: + setup2 += "access=http,"; + break; + case Access._UDP: +*/ + setup2 += "access=udp,"; +/* + break; + default: + System.out.println("server.VlcStreamer.start: unsupported Accesstype"); + break; + } + + switch (howtoStream.mux_type.value()){ + case Mux._TS: +*/ + setup2 += "mux=es,url=" + howtoStream.destIp + ":"; + setup2 += /*howtoStream.info.params +*/ "9993}"; +/* break; + case Mux._ES: + setup2 += "mux=es,url="+howtoStream.ip+":"+howtoStream.port+"}"; + break; + case Mux._OGG: + setup2 += "mux=ogg,url="+howtoStream.ip+":"+howtoStream.port+"}"; + break; + default: + System.out.println("server.VlcStreamer.start: unsupported Muxer"); + break; + } +*/ + setup2 += "}"; + + String control = "control "+howtoStream.info.name+" play"; + TelnetInterface telnet = new TelnetInterface(hostIP, 4212, "admin"); + telnet.exec(newString); + telnet.exec(setup2); + telnet.exec(control); + telnet.close(); + } + +/* + * plays submitted streamInfo + * @param howtoStream + */ + private void play(Output howtoStream){ + + logger.debug("play()"); + + String control = "control "+howtoStream.info.name+" play"; + // telnet connection + TelnetInterface telnet = new TelnetInterface(hostIP, 4212, "admin"); + telnet.exec(control); + // close telnet connection + telnet.close(); + } + +/* + * pause submitted streamInfo + * @param howtoStream + */ + private void pause(Output howtoStream){ + + logger.debug("pause()"); + + String control = "control "+howtoStream.info.name+" pause"; + logger.debug("client.VlcStreamer: Telnetcmd: " + control); + + TelnetInterface telnet = new TelnetInterface(hostIP, 4212, "admin"); + telnet.exec(control); + telnet.close(); + } + +/* + * go to next file in playlist + * + * @param howtoStream + */ + private void next(Output howtoStream){ + + logger.debug("next()"); + + String control = "control "+howtoStream.info.name+" seek 100"; + logger.debug("client.VlcStreamer: Telnetcmd: " + control); + TelnetInterface telnet = new TelnetInterface(hostIP, 4212, "admin"); + telnet.exec(control); + telnet.close(); + } + +/* + * stop streaming, delete stream + * + * @param howtoStream + */ + private void stop(Output howtoStream){ + + logger.debug("stop()"); + + String del = "del "+howtoStream.info.name; + this.streamCounter.actualStreams--; + TelnetInterface telnet = new TelnetInterface(hostIP, 4212, "admin"); + telnet.exec(del); + telnet.close(); + currentStreams.remove(howtoStream); + } + +/* + * calculates streamName + * @return String streamName + */ + private String streamName(){ + logger.debug("streamName()"); + String streamName = "stream"; + streamName += streamCounter.allStreams; + return streamName; + } + +/* + * stops the streaming server + * + */ + public void quit(){ + logger.debug("quit()"); + vlcPlayer.destroy(); + } + +/* + * returns the streamcounter + * @return StreamCounter + */ + public StreamCounter getStreamCounter(){ + logger.debug("getStreamCounter()"); + return this.streamCounter; + } + } diff --git a/src/YalpServer/InitServer.java b/src/YalpServer/InitServer.java index 3e77ea5..8ad17cf 100755 --- a/src/YalpServer/InitServer.java +++ b/src/YalpServer/InitServer.java @@ -54,6 +54,7 @@ public class InitServer { private static ServerSettings settings = new ServerSettings(); public static InputPluginHandler inputHandler = new InputPluginHandler(); + public static OutputPluginHandler outputHandler = new OutputPluginHandler(); private ServerControlImpl srvCon; private ServerControlInterface srv; diff --git a/src/YalpServer/OutputPluginHandler.java b/src/YalpServer/OutputPluginHandler.java new file mode 100644 index 0000000..4a12f2b --- /dev/null +++ b/src/YalpServer/OutputPluginHandler.java @@ -0,0 +1,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; + } +} diff --git a/src/YalpServer/ServerControlImpl.java b/src/YalpServer/ServerControlImpl.java index 44984c7..5612e2c 100755 --- a/src/YalpServer/ServerControlImpl.java +++ b/src/YalpServer/ServerControlImpl.java @@ -41,6 +41,7 @@ public class ServerControlImpl extends ServerControlInterfacePOA { private InitServer srv;
private InputPluginHandler inputHandler;
+ private OutputPluginHandler outputHandler;
private String log4jFile = "log4j_server.conf";
@@ -61,6 +62,7 @@ public ServerControlImpl() { logger.debug("init()");
srv = _srv;
inputHandler = srv.inputHandler;
+ outputHandler = srv.outputHandler;
}
/*
@@ -191,9 +193,7 @@ public ServerControlImpl() { error.level = YalpErrorLevel.ERROR_LEVEL_INFO;
err.value = error;
- Output out = new Output();
- out = ctlOutput.value;
- ctlOutput.value = out;
+ outputHandler.control(ctlOutput, err);
}
/*
@@ -221,23 +221,31 @@ public ServerControlImpl() { {
logger.debug("registerOutputPlugin()");
/* t.b.d. itf handling */
- System.out.println("registering output plugin: " + info.value.name );
+ logger.info("registering output plugin: " + info.value.name );
+ OutputPluginInterface outputItf;
+
+ try {
+ outputItf = OutputPluginInterfaceHelper.narrow(itf);
+ } catch( Exception e ) {
+ e.printStackTrace();
+ return;
+ }
+
+ OutputPlugin newPlugin = new OutputPlugin(outputItf, info.value);
+
+ PluginInfo inf = new PluginInfo();
+
+ if( newPlugin != null )
+ inf = outputHandler.addPlugin( newPlugin );
+
+ info.value = inf;
+
YalpError error = new YalpError();
- error.msg = "huhu";
- error.descr = "hihi";
+ error.msg = "plugin registered";
+ error.descr = "";
error.code = YalpErrorCode.OK;
error.level = YalpErrorLevel.ERROR_LEVEL_INFO;
err.value = error;
- PluginInfo inf = new PluginInfo();
- inf.id = 666;
- inf.name = info.value.name;
- inf.description = info.value.description;
- inf.type = info.value.type;
- inf.supportedTypes= info.value.supportedTypes;
- inf.access = info.value.access;
- inf.maxClients = info.value.maxClients;
- inf.actClients = info.value.actClients;
- info.value = inf;
}
/*
diff --git a/src/yalp.idl b/src/yalp.idl index 6fb5203..9d87fc2 100644 --- a/src/yalp.idl +++ b/src/yalp.idl @@ -4,6 +4,7 @@ module YalpInterfaces enum YalpErrorCode { OK, ERROR_SQL, + ERROR_OUTPUT_PLUGIN_NA, ERROR_UNDEFINED }; |
