diff options
| author | unknown <Administrator@.(none)> | 2009-12-29 18:25:47 +0100 |
|---|---|---|
| committer | unknown <Administrator@.(none)> | 2009-12-29 18:25:47 +0100 |
| commit | fee6fe4d468c2e7fcc3403b9f3b8412b8d4e2dbd (patch) | |
| tree | 26baa66a010aa459f3c8ba530d57af6e633e3b89 /src/YalpServer/ServerControlImpl.java | |
| parent | bec20df70966484d7592ea80a17c7decc1bdd81e (diff) | |
added windows start scripts
Signed-off-by: unknown <Administrator@.(none)>
Diffstat (limited to 'src/YalpServer/ServerControlImpl.java')
| -rwxr-xr-x | src/YalpServer/ServerControlImpl.java | 904 |
1 files changed, 452 insertions, 452 deletions
diff --git a/src/YalpServer/ServerControlImpl.java b/src/YalpServer/ServerControlImpl.java index 1064dd0..f8e4579 100755 --- a/src/YalpServer/ServerControlImpl.java +++ b/src/YalpServer/ServerControlImpl.java @@ -1,452 +1,452 @@ -/* - * 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 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: Manuel Traut and Volker Dahnke - */ - -package YalpServer; - -import YalpInterfaces.*; - -import java.net.*; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Properties; - -import org.omg.CosNaming.*; -import org.omg.CosNaming.NamingContextPackage.*; -import org.omg.CORBA.*; -import org.omg.PortableServer.*; -import org.omg.PortableServer.POA; - -import org.apache.log4j.Logger; -import org.apache.log4j.PropertyConfigurator; - -/* - * Class ServerControlImpl - * - * <em>Implements functionality of the ServerControl Interface</em> - * - * @author Volker Dahnke / Manuel Traut - * @version 0.6 14-12-2005<br> - * @see client - */ -public class ServerControlImpl extends ServerControlInterfacePOA -{ - private ORB orb; - - private InitServer srv; - private InputPluginHandler inputHandler; - private OutputPluginHandler outputHandler; - private AuthPluginHandler authHandler; - - private ArrayList<Session> sessions; - private ArrayList<PluginInfo> plugin_infos; - - private String log4jFile = "log4j_server.conf"; - - private static Logger logger = - Logger.getLogger("Yalp.Server.ServerControlImpl"); - -public ServerControlImpl() -{ - this.sessions = new ArrayList<Session> (); - this.plugin_infos = new ArrayList<PluginInfo> (); - - PropertyConfigurator.configureAndWatch(log4jFile); - logger.debug("ServerControlImpl()"); -} - - public void setORB(ORB _orb) - { - logger.debug("setOrb()"); - orb = _orb; - } - - public void init(InitServer _srv) - { - logger.debug("init()"); - srv = _srv; - inputHandler = srv.inputHandler; - outputHandler = srv.outputHandler; - authHandler = srv.authHandler; - } - -/* - * client logon - * - * @param userName - * @param password - * @param ipAdress - * @param session (out) - * @param error (out) - */ - public void clientLogon( String name, - String password, - String ipAddress, - SessionHolder session, - YalpErrorHolder err ) - { - logger.debug("clientLogon()"); - - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - error.descr = "authentication successfull"; - error.msg = "nice isn't it"; - error.level = YalpErrorLevel.ERROR_LEVEL_INFO; - err.value = error; - - session.value = authHandler.logon(name, password, ipAddress, session, err); - - ArrayList<PluginInfo> all_plugins = new ArrayList<PluginInfo>(); - - PluginInfo[] t = {}; - session.value.availablePlugins = plugin_infos.toArray(t); - sessions.add(session.value); - } - -/* - * client logoff - * - * @param session - * @param error (out) - */ - public void clientLogoff( Session bye, YalpErrorHolder err) - { - logger.debug("clientLogoff"); - - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - error.descr = "logged out"; - error.msg = "sad isn't it"; - error.level = YalpErrorLevel.ERROR_LEVEL_INFO; - err.value = error; - - sessions.remove(bye); - } - -/* - * get user list - * - * @param user list (out) - * @param error (out) - */ - public void getUser(UsersHolder list, YalpErrorHolder err) { - logger.debug("getUser()"); - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - err = new YalpErrorHolder(error); - } - -/* - * change user details - * - * @param user - * @param password - * @param action (create, delete, alter) - * @param error (out) - */ - public void changeUser(YalpUser usr, String passwd, Action todo, - YalpErrorHolder err) { - logger.debug("changeUser()"); - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - err = new YalpErrorHolder(error); - } - -/* - * alter media informations - * - * @param media to change - * @param action (update, delete, create) - * @param error (out) - */ - public void changeMedia( Media toChange, Action todo, YalpErrorHolder err ) { - logger.debug("changeMedia()"); - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - err = new YalpErrorHolder(error); - } - -/* - * count yalp medias - * - * @param num (out) - * @param error (out) - */ - public void getNumOfMedias( IntHolder num, YalpErrorHolder err ) { - logger.debug("getNumOfMedias()"); - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - err = new YalpErrorHolder(error); - } - -/* - * control yalp medias - * - * @param control description (inout) - * @param error (out) - */ - public void control( OutputHolder ctlOutput, YalpErrorHolder err ) { - logger.debug("control()"); - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - error.descr = "streaming ;-)"; - error.msg = "nice isn't it"; - error.level = YalpErrorLevel.ERROR_LEVEL_INFO; - err.value = error; - - outputHandler.control(ctlOutput, err); - } - -/* - * search yalp media - * - * @param search string - * @param list of mediatypes - * @param result as list of medias (out) - */ - public void search( String str, MediaType[] types, MediasHolder result, - YalpErrorHolder err ) { - logger.debug("search()"); - YalpError error = new YalpError(); - inputHandler.search(str, types, result, err); - } - -/* - * register new output plugin - * - * @param plugin which should be registered - * @param error - */ - public void registerOutputPlugin( OutputPluginInterface itf, - PluginInfoHolder info, YalpErrorHolder err ) - { - 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; - plugin_infos.add( inf ); - - YalpError error = new YalpError(); - error.msg = "plugin registered"; - error.descr = ""; - error.code = YalpErrorCode.OK; - error.level = YalpErrorLevel.ERROR_LEVEL_INFO; - err.value = error; - } - -/* - * remove output plugin - * - * @param plugin which should be registered - * @param error - */ - public void removeOutputPlugin( PluginInfo itf, YalpErrorHolder err ) - { - logger.debug("removeOutputPlugin()"); - /* t.b.d. itf handling */ - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - err = new YalpErrorHolder(error); - } - -/* - * get all registered output plugins - * - * @param plugin list - * @param error - */ - public void getOutputPlugins( PluginInfosHolder itfs, String name, - YalpErrorHolder err ) - { - logger.debug("getOutputPlugins()"); - /* t.b.d. itf handling */ - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - err = new YalpErrorHolder(error); - } - -/* - * register new input plugin - * - * @param plugin which should be registered - * @param error - */ - public void registerInputPlugin( org.omg.CORBA.Object itf, - PluginInfoHolder info, YalpErrorHolder err ) - { - logger.info("registering input plugin: " + info.value.name ); - - InputPluginInterface inputItf; - - try { - inputItf = InputPluginInterfaceHelper.narrow(itf); - } catch( Exception e ) { - e.printStackTrace(); - return; - } - - InputPlugin newPlugin = new InputPlugin(inputItf, info.value); - - PluginInfo inf = new PluginInfo(); - - if( newPlugin != null ) - inf = inputHandler.addPlugin( newPlugin ); - - info.value = inf; - plugin_infos.add( inf ); - - YalpError error = new YalpError(); - error.msg = "plugin registered"; - error.descr = ""; - error.code = YalpErrorCode.OK; - error.level = YalpErrorLevel.ERROR_LEVEL_INFO; - err.value = error; - } - -/* - * remove input plugin - * - * @param plugin which should be registered - * @param error - */ - public void removeInputPlugin( PluginInfo itf, YalpErrorHolder err ) - { - logger.debug("removeInputPlugin()"); - /* t.b.d. itf handling */ - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - err = new YalpErrorHolder(error); - } - -/* - * get all registered input plugins - * - * @param plugin list - * @param error - */ - public void getInputPlugins( PluginInfosHolder itfs, - String name, YalpErrorHolder err ) - { - logger.debug("getInputPlugins()"); - /* t.b.d. itf handling */ - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - err = new YalpErrorHolder(error); - } - -/* - * register new auth plugin - * - * @param plugin which should be registered - * @param error - */ - public void registerAuthPlugin( org.omg.CORBA.Object itf, - PluginInfoHolder info, YalpErrorHolder err ) - { - logger.info("registering auth plugin: " + info.value.name ); - - AuthPluginInterface authItf; - - try { - authItf = AuthPluginInterfaceHelper.narrow(itf); - } catch( Exception e ) { - e.printStackTrace(); - return; - } - - AuthPlugin newPlugin = new AuthPlugin(authItf, info.value); - - PluginInfo inf = new PluginInfo(); - - if( newPlugin != null ) - inf = authHandler.addPlugin( newPlugin ); - - info.value = inf; - plugin_infos.add (inf); - - YalpError error = new YalpError(); - error.msg = "plugin registered"; - error.descr = ""; - error.code = YalpErrorCode.OK; - error.level = YalpErrorLevel.ERROR_LEVEL_INFO; - err.value = error; - } - -/* - * remove auth plugin - * - * @param plugin which should be registered - * @param error - */ - public void removeAuthPlugin( PluginInfo itf, - YalpErrorHolder err ) - { - logger.debug("removeAuthPlugin()"); - /* t.b.d. itf handling */ - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - err = new YalpErrorHolder(error); - } - -/* - * get all registered auth plugins - * - * @param plugin list - * @param error - */ - public void getAuthPlugins( PluginInfosHolder itfs, - String name, YalpErrorHolder err ) - { - logger.debug("getAuthPlugins()"); - /* t.b.d. itf handling */ - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - err = new YalpErrorHolder(error); - } - -/* - * to check if server is still ok - * - * @return Boolean true - if ok - */ - public void ping(YalpErrorHolder pong) { - logger.debug("ping()"); - YalpError err = new YalpError(); - err.descr = "PONG"; - err.msg = "huhu"; - err.level = YalpErrorLevel.ERROR_LEVEL_INFO; - err.code = YalpErrorCode.OK; - pong.value = err; - System.out.println("pong"); - } - -/* - * server shutdown - */ - public void serverShutdown() - { - logger.debug("server shutdown()"); - /* t.b.d. clear server shutdown */ - } -} +/*
+ * 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: Manuel Traut and Volker Dahnke
+ */
+
+package YalpServer;
+
+import YalpInterfaces.*;
+
+import java.net.*;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Properties;
+
+import org.omg.CosNaming.*;
+import org.omg.CosNaming.NamingContextPackage.*;
+import org.omg.CORBA.*;
+import org.omg.PortableServer.*;
+import org.omg.PortableServer.POA;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.PropertyConfigurator;
+
+/*
+ * Class ServerControlImpl
+ *
+ * <em>Implements functionality of the ServerControl Interface</em>
+ *
+ * @author Volker Dahnke / Manuel Traut
+ * @version 0.6 14-12-2005<br>
+ * @see client
+ */
+public class ServerControlImpl extends ServerControlInterfacePOA
+{
+ private ORB orb;
+
+ private InitServer srv;
+ private InputPluginHandler inputHandler;
+ private OutputPluginHandler outputHandler;
+ private AuthPluginHandler authHandler;
+
+ private ArrayList<Session> sessions;
+ private ArrayList<PluginInfo> plugin_infos;
+
+ private String log4jFile = "log4j_server.conf";
+
+ private static Logger logger =
+ Logger.getLogger("Yalp.Server.ServerControlImpl");
+
+public ServerControlImpl()
+{
+ this.sessions = new ArrayList<Session> ();
+ this.plugin_infos = new ArrayList<PluginInfo> ();
+
+ PropertyConfigurator.configureAndWatch(log4jFile);
+ logger.debug("ServerControlImpl()");
+}
+
+ public void setORB(ORB _orb)
+ {
+ logger.debug("setOrb()");
+ orb = _orb;
+ }
+
+ public void init(InitServer _srv)
+ {
+ logger.debug("init()");
+ srv = _srv;
+ inputHandler = srv.inputHandler;
+ outputHandler = srv.outputHandler;
+ authHandler = srv.authHandler;
+ }
+
+/*
+ * client logon
+ *
+ * @param userName
+ * @param password
+ * @param ipAdress
+ * @param session (out)
+ * @param error (out)
+ */
+ public void clientLogon( String name,
+ String password,
+ String ipAddress,
+ SessionHolder session,
+ YalpErrorHolder err )
+ {
+ logger.debug("clientLogon()");
+
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ error.descr = "authentication successfull";
+ error.msg = "nice isn't it";
+ error.level = YalpErrorLevel.ERROR_LEVEL_INFO;
+ err.value = error;
+
+ session.value = authHandler.logon(name, password, ipAddress, session, err);
+
+ ArrayList<PluginInfo> all_plugins = new ArrayList<PluginInfo>();
+
+ PluginInfo[] t = {};
+ session.value.availablePlugins = plugin_infos.toArray(t);
+ sessions.add(session.value);
+ }
+
+/*
+ * client logoff
+ *
+ * @param session
+ * @param error (out)
+ */
+ public void clientLogoff( Session bye, YalpErrorHolder err)
+ {
+ logger.debug("clientLogoff");
+
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ error.descr = "logged out";
+ error.msg = "sad isn't it";
+ error.level = YalpErrorLevel.ERROR_LEVEL_INFO;
+ err.value = error;
+
+ sessions.remove(bye);
+ }
+
+/*
+ * get user list
+ *
+ * @param user list (out)
+ * @param error (out)
+ */
+ public void getUser(UsersHolder list, YalpErrorHolder err) {
+ logger.debug("getUser()");
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * change user details
+ *
+ * @param user
+ * @param password
+ * @param action (create, delete, alter)
+ * @param error (out)
+ */
+ public void changeUser(YalpUser usr, String passwd, Action todo,
+ YalpErrorHolder err) {
+ logger.debug("changeUser()");
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * alter media informations
+ *
+ * @param media to change
+ * @param action (update, delete, create)
+ * @param error (out)
+ */
+ public void changeMedia( Media toChange, Action todo, YalpErrorHolder err ) {
+ logger.debug("changeMedia()");
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * count yalp medias
+ *
+ * @param num (out)
+ * @param error (out)
+ */
+ public void getNumOfMedias( IntHolder num, YalpErrorHolder err ) {
+ logger.debug("getNumOfMedias()");
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * control yalp medias
+ *
+ * @param control description (inout)
+ * @param error (out)
+ */
+ public void control( OutputHolder ctlOutput, YalpErrorHolder err ) {
+ logger.debug("control()");
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ error.descr = "streaming ;-)";
+ error.msg = "nice isn't it";
+ error.level = YalpErrorLevel.ERROR_LEVEL_INFO;
+ err.value = error;
+
+ outputHandler.control(ctlOutput, err);
+ }
+
+/*
+ * search yalp media
+ *
+ * @param search string
+ * @param list of mediatypes
+ * @param result as list of medias (out)
+ */
+ public void search( String str, MediaType[] types, MediasHolder result,
+ YalpErrorHolder err ) {
+ logger.debug("search()");
+ YalpError error = new YalpError();
+ inputHandler.search(str, types, result, err);
+ }
+
+/*
+ * register new output plugin
+ *
+ * @param plugin which should be registered
+ * @param error
+ */
+ public void registerOutputPlugin( OutputPluginInterface itf,
+ PluginInfoHolder info, YalpErrorHolder err )
+ {
+ 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;
+ plugin_infos.add( inf );
+
+ YalpError error = new YalpError();
+ error.msg = "plugin registered";
+ error.descr = "";
+ error.code = YalpErrorCode.OK;
+ error.level = YalpErrorLevel.ERROR_LEVEL_INFO;
+ err.value = error;
+ }
+
+/*
+ * remove output plugin
+ *
+ * @param plugin which should be registered
+ * @param error
+ */
+ public void removeOutputPlugin( PluginInfo itf, YalpErrorHolder err )
+ {
+ logger.debug("removeOutputPlugin()");
+ /* t.b.d. itf handling */
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * get all registered output plugins
+ *
+ * @param plugin list
+ * @param error
+ */
+ public void getOutputPlugins( PluginInfosHolder itfs, String name,
+ YalpErrorHolder err )
+ {
+ logger.debug("getOutputPlugins()");
+ /* t.b.d. itf handling */
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * register new input plugin
+ *
+ * @param plugin which should be registered
+ * @param error
+ */
+ public void registerInputPlugin( org.omg.CORBA.Object itf,
+ PluginInfoHolder info, YalpErrorHolder err )
+ {
+ logger.info("registering input plugin: " + info.value.name );
+
+ InputPluginInterface inputItf;
+
+ try {
+ inputItf = InputPluginInterfaceHelper.narrow(itf);
+ } catch( Exception e ) {
+ e.printStackTrace();
+ return;
+ }
+
+ InputPlugin newPlugin = new InputPlugin(inputItf, info.value);
+
+ PluginInfo inf = new PluginInfo();
+
+ if( newPlugin != null )
+ inf = inputHandler.addPlugin( newPlugin );
+
+ info.value = inf;
+ plugin_infos.add( inf );
+
+ YalpError error = new YalpError();
+ error.msg = "plugin registered";
+ error.descr = "";
+ error.code = YalpErrorCode.OK;
+ error.level = YalpErrorLevel.ERROR_LEVEL_INFO;
+ err.value = error;
+ }
+
+/*
+ * remove input plugin
+ *
+ * @param plugin which should be registered
+ * @param error
+ */
+ public void removeInputPlugin( PluginInfo itf, YalpErrorHolder err )
+ {
+ logger.debug("removeInputPlugin()");
+ /* t.b.d. itf handling */
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * get all registered input plugins
+ *
+ * @param plugin list
+ * @param error
+ */
+ public void getInputPlugins( PluginInfosHolder itfs,
+ String name, YalpErrorHolder err )
+ {
+ logger.debug("getInputPlugins()");
+ /* t.b.d. itf handling */
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * register new auth plugin
+ *
+ * @param plugin which should be registered
+ * @param error
+ */
+ public void registerAuthPlugin( org.omg.CORBA.Object itf,
+ PluginInfoHolder info, YalpErrorHolder err )
+ {
+ logger.info("registering auth plugin: " + info.value.name );
+
+ AuthPluginInterface authItf;
+
+ try {
+ authItf = AuthPluginInterfaceHelper.narrow(itf);
+ } catch( Exception e ) {
+ e.printStackTrace();
+ return;
+ }
+
+ AuthPlugin newPlugin = new AuthPlugin(authItf, info.value);
+
+ PluginInfo inf = new PluginInfo();
+
+ if( newPlugin != null )
+ inf = authHandler.addPlugin( newPlugin );
+
+ info.value = inf;
+ plugin_infos.add (inf);
+
+ YalpError error = new YalpError();
+ error.msg = "plugin registered";
+ error.descr = "";
+ error.code = YalpErrorCode.OK;
+ error.level = YalpErrorLevel.ERROR_LEVEL_INFO;
+ err.value = error;
+ }
+
+/*
+ * remove auth plugin
+ *
+ * @param plugin which should be registered
+ * @param error
+ */
+ public void removeAuthPlugin( PluginInfo itf,
+ YalpErrorHolder err )
+ {
+ logger.debug("removeAuthPlugin()");
+ /* t.b.d. itf handling */
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * get all registered auth plugins
+ *
+ * @param plugin list
+ * @param error
+ */
+ public void getAuthPlugins( PluginInfosHolder itfs,
+ String name, YalpErrorHolder err )
+ {
+ logger.debug("getAuthPlugins()");
+ /* t.b.d. itf handling */
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * to check if server is still ok
+ *
+ * @return Boolean true - if ok
+ */
+ public void ping(YalpErrorHolder pong) {
+ logger.debug("ping()");
+ YalpError err = new YalpError();
+ err.descr = "PONG";
+ err.msg = "huhu";
+ err.level = YalpErrorLevel.ERROR_LEVEL_INFO;
+ err.code = YalpErrorCode.OK;
+ pong.value = err;
+ System.out.println("pong");
+ }
+
+/*
+ * server shutdown
+ */
+ public void serverShutdown()
+ {
+ logger.debug("server shutdown()");
+ /* t.b.d. clear server shutdown */
+ }
+}
|
