summaryrefslogtreecommitdiff
path: root/src/YalpServer
diff options
context:
space:
mode:
authorguest <guest@f059d3a0-6783-47b7-97ff-1fe0bbf25129>2008-09-23 21:29:27 +0000
committerguest <guest@f059d3a0-6783-47b7-97ff-1fe0bbf25129>2008-09-23 21:29:27 +0000
commitd6fa96b4cd67cf4fa18b5b9b6739f9bc2494a9f4 (patch)
tree00aa9a27acb6b4c8d9868795a5295e9231f1eb20 /src/YalpServer
initial import
git-svn-id: http://manut.eu/svn/yalp/trunk@1 f059d3a0-6783-47b7-97ff-1fe0bbf25129
Diffstat (limited to 'src/YalpServer')
-rwxr-xr-xsrc/YalpServer/FileBrowser.java175
-rwxr-xr-xsrc/YalpServer/FileFinder.java110
-rwxr-xr-xsrc/YalpServer/FileInfoManager.java126
-rwxr-xr-xsrc/YalpServer/InitServer.java283
-rwxr-xr-xsrc/YalpServer/ServerControlImpl.java385
-rwxr-xr-xsrc/YalpServer/ServerSettings.java68
-rwxr-xr-xsrc/YalpServer/YalpServer.java40
7 files changed, 1187 insertions, 0 deletions
diff --git a/src/YalpServer/FileBrowser.java b/src/YalpServer/FileBrowser.java
new file mode 100755
index 0000000..2f2a3a5
--- /dev/null
+++ b/src/YalpServer/FileBrowser.java
@@ -0,0 +1,175 @@
+/*
+ * 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 java.util.ArrayList;
+import java.io.File;
+import java.io.Serializable;
+
+import YalpInterfaces.*;
+
+/*
+ * Class FileBrowser
+ *
+ * <em>each Admin Client has his own FileBrowser, to browse through the
+ * subDirectories of the as startDir defined Directory</em>
+ *
+ * @author Volker Dahnke / Manuel Traut
+ *
+ * @version 0.6 14-12-2005<br>
+ *
+ * @see client.GUI.Browser
+ */
+
+public class FileBrowser {
+
+ private File actualFile, startDir;
+ private String owner;
+ private String userName;
+ private ArrayList<YalpFile> fileList;
+
+ /* t.b.d. add some more types */
+ private String[] extensions = {".mp3",".mpg",".mpeg",".avi"};
+
+/*
+ * Constructor starts Browsing in startDir
+ *
+ * @param startdir
+ * directory which could be browser recursively
+ * @param owner
+ * of the Browser (IP of the Client)
+ * @param userName
+ * of the Admin using this browser
+ */
+
+ public FileBrowser(String startdir, String owner,String userName) {
+ this.owner = owner;
+ this.userName=userName;
+ this.actualFile = new File(startdir);
+ this.startDir = new File(startdir);
+ this.fileList = new ArrayList<YalpFile>();
+ }
+
+/*
+ * returns owner of the browser
+ *
+ * @return String
+ * owner
+ */
+
+ public String getOwner(){
+ return this.owner;
+ }
+
+/*
+ * returns user of the browser
+ *
+ * @return String
+ * user
+ */
+
+ public String getUserName(){
+ return this.userName;
+ }
+
+/*
+ * returns list of all files in actual Folder
+ * (none recursive)
+ *
+ * @return ArrayList<YalpFile>
+ * list of all files
+ */
+
+ public ArrayList<YalpFile> getFiles(){
+ return this.fileList;
+ }
+
+/*
+ * returns list of all files in actual Folder
+ * (recursive)
+ *
+ * @return ArrayList<YalpFile>
+ * list of all files
+ */
+
+ public ArrayList<File> findAll() {
+
+ System.out.println( "server.FileBrowser.findAll: lookin in - " +
+ this.actualFile.toString() );
+
+ FileFinder ff = new FileFinder(actualFile.getPath(), extensions);
+ return ff.getFiles();
+ }
+
+/*
+ * change actual Folder
+ *
+ * @param dirName
+ * String dir to change to
+ */
+
+ public void changeDir(String dirName) {
+
+ this.actualFile = new File(this.startDir+dirName);
+ this.fileList.clear();
+
+ if(actualFile.isDirectory()) {
+ for ( File aFile : this.actualFile.listFiles() ) {
+ /* add to fileList if extension is allowed or File is a Directory */
+ if (match(aFile.getName(), extensions) || aFile.isDirectory())
+ {
+ YalpFile tmp = new YalpFile();
+ tmp.name = aFile.getName();
+ tmp.isDir = aFile.isDirectory();
+ tmp.parent = aFile.getParent();
+ this.fileList.add( tmp );
+ }
+ }
+ }
+ }
+
+/*
+ * prints current directory out to console
+ *
+ * (for debugging)
+ */
+
+ public void printActualDir(){
+ for(YalpFile one : this.fileList){
+ if(one.isDir) System.out.print("+");
+ else System.out.print("|");
+ System.out.println(one.name);
+ }
+ }
+
+/*
+ * checks if file extension matches or not
+ *
+ * @param s
+ * fileName including Extension
+ * @param suffixes
+ * Array of allowed Extensions
+ * @return boolean
+ * true if yalp can handle this extension, else false
+ */
+
+ private static boolean match( String s, String suffixes[] ) {
+ for ( String suffix : suffixes ) {
+ int huhu = s.length();
+ int huhu2 = suffix.length();
+ int huhu3 = huhu - huhu2;
+ if ( s.length() >= suffix.length() &&
+ s.substring( huhu3, s.length()).equalsIgnoreCase(suffix) )
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/src/YalpServer/FileFinder.java b/src/YalpServer/FileFinder.java
new file mode 100755
index 0000000..2d6527c
--- /dev/null
+++ b/src/YalpServer/FileFinder.java
@@ -0,0 +1,110 @@
+/***********************************************************************
+ *
+ * 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 java.io.*;
+import java.util.*;
+
+/************************************************************************
+ *
+ * Class FileFinder
+ *
+ * <em>algorithm for scanning files recursively</em>
+ *
+ * @author Volker Dahnke / Manuel Traut
+ *
+ * @version 0.6 14-12-2005<br>
+ *
+ * @see FileBrowser
+ *
+ ************************************************************************/
+
+public class FileFinder
+{
+ private ArrayList<File> files;
+
+ /**
+ * Constructor: scans subdirectories of commited directory
+ * uses only files with allowed extensions
+ * @param start
+ * directory to scan
+ * @param extensions
+ * allowed extensions
+ */
+ public FileFinder( String start, String extensions[] ) {
+
+ this.files = new ArrayList<File>();
+ Stack<File> dirs = new Stack<File>();
+ File startdir = new File(start);
+
+ // push startdir to stack
+ if (startdir.isDirectory()) dirs.push(startdir);
+ // startdir is File
+ else {
+ if (match(startdir.getName(), extensions)) this.files.add(startdir);
+ return;
+ }
+ // for each dir on stack
+ while (dirs.size() > 0) {
+ // contents of dir on stack
+ for (File file : dirs.pop().listFiles()){
+ try {
+ // add subdirectory to stack
+ if (file.isDirectory()) dirs.push(file);
+ // if file is of correct filetype add it to filelist
+ else if (match(file.getName(), extensions)) this.files.add(file);
+ } catch (NullPointerException e) {
+ System.out.println("FileFinder: "+ file.getName() +"Premission denied");
+ }
+ }
+ }
+ }
+
+ /**
+ * returns and prints out all Medias found
+ * @return ArrayList<File>
+ * all found Medias
+ */
+ public ArrayList<File> getFiles(){
+ print();
+ return this.files;
+ }
+
+ /**
+ * prints out found medias
+ *
+ */
+ public void print() {
+ System.out.println( "Found " + files.size() + " file" + (files.size() == 1 ? "." : "s.") );
+ for ( File f : files ) System.out.println( f.getAbsolutePath() );
+ }
+
+ /**
+ * checks if file extension matches or not
+ *
+ * @param s
+ * file to check
+ * @param suffixes
+ * allowed extensions
+ *
+ * @return boolean: true if it's a media, yalp can handle
+ */
+ private static boolean match( String s, String suffixes[] ) {
+ for ( String suffix : suffixes ) {
+ int huhu = s.length();
+ int huhu2 = suffix.length();
+ int huhu3 = huhu - huhu2;
+ if ( s.length() >= suffix.length() && s.substring(huhu3, s.length()).equalsIgnoreCase(suffix) ) return true;
+ }
+ return false;
+ }
+}
diff --git a/src/YalpServer/FileInfoManager.java b/src/YalpServer/FileInfoManager.java
new file mode 100755
index 0000000..34fe49b
--- /dev/null
+++ b/src/YalpServer/FileInfoManager.java
@@ -0,0 +1,126 @@
+/*
+ * 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 java.io.File;
+import java.io.IOException;
+import java.io.FileNotFoundException;
+
+import de.hampelratte.id3.*;
+
+import YalpInterfaces.*;
+
+/*
+ * Class FileInfoManager
+ *
+ * <em>Creates a Result out of FileInformations (ID3, etc)</em>
+ *
+ * @author Volker Dahnke / Manuel Traut
+ *
+ * @version 0.1 14-12-2005<br>
+ *
+ * @see ServerControl
+ */
+
+public class FileInfoManager {
+
+ private Media fileInfo;
+ private EncodingType eType;
+
+/*
+ * Constructor: tries to get all Informations about a file
+ *
+ * @param file
+ */
+
+ public FileInfoManager(File file) {
+
+ this.eType = EncodingType.UNKNOWN;
+ this.fileInfo = new Media();
+ this.fileInfo.path = file.getParent()+file.separator;
+ this.fileInfo.fileName = file.getName();
+
+ /* check extensions is mp3 */
+ if( this.fileInfo.fileName.substring( this.fileInfo.fileName.length() - 3,
+ this.fileInfo.fileName.length()).equalsIgnoreCase( "mp3" ) )
+ {
+ this.eType = EncodingType.MP3;
+ }
+
+ switch(this.eType.value()) {
+ case EncodingType._MP3:
+ try
+ {
+ /* opening mp3 file for reading and writing */
+ MP3File mp3 = new de.hampelratte.id3.MP3File(file.toString(), "r");
+ this.fileInfo.type = MediaType.SOUND;
+
+ if(mp3.hasID3v1Tag){
+ ID3v1Tag tag = mp3.readID3v1Tag();
+ /* t.b.d. create StringProperties
+ this.fileInfo.album = tag.getAlbum();
+ this.fileInfo.author = tag.getArtist();
+ this.fileInfo.category = tag.getGenre();
+ this.fileInfo.name = tag.getTrack() +" - "+tag.getTitle();
+ this.fileInfo.year = tag.getYear();
+ */
+ }
+
+ if(mp3.hasID3v2Tag){
+
+ // reading the ID3v2Tag
+ ID3v2Tag tag = mp3.readID3v2Tag();
+ /* t.b.d. create StringProperties
+ this.fileInfo.album = tag.getAlbum();
+ this.fileInfo.author = tag.getArtist();
+ this.fileInfo.category = tag.getGenre();
+ this.fileInfo.year = tag.getYear();
+ */
+ if( !(tag.getTrack().equals(""))){
+ this.fileInfo.name = tag.getTrack() +" - "+tag.getTitle();
+ } else {
+ this.fileInfo.name = tag.getTitle();
+ }
+ }
+
+ if (this.fileInfo.name.equals("")) {
+
+ this.fileInfo.name =
+ file.getName().substring( 0, file.getName().length() - 4 );
+ }
+
+ mp3.close();
+ } catch (Exception e) {
+
+ this.fileInfo.name =
+ file.getName().substring(0,file.getName().length() - 4);
+ }
+ break;
+
+ default:
+ this.fileInfo.name =
+ file.getName().substring(0,file.getName().length()-4);
+
+ this.fileInfo.type = MediaType.VIDEO;
+ break;
+ }
+ }
+
+/*
+ * returns the information to an media, found
+ * @return MediaChange
+ * Informations about the media
+ */
+
+ public Media getInfo(){
+ return this.fileInfo;
+ }
+}
diff --git a/src/YalpServer/InitServer.java b/src/YalpServer/InitServer.java
new file mode 100755
index 0000000..ac9d507
--- /dev/null
+++ b/src/YalpServer/InitServer.java
@@ -0,0 +1,283 @@
+/*
+ * 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 java.net.Inet4Address;
+import java.net.MalformedURLException;
+import java.net.UnknownHostException;
+
+import java.beans.XMLDecoder;
+import java.beans.XMLEncoder;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.File;
+
+import java.util.ArrayList;
+import java.util.Properties;
+
+import java.security.*;
+
+import java.sql.SQLException;
+
+import org.omg.CosNaming.*;
+import org.omg.CosNaming.NamingContextPackage.*;
+import org.omg.CORBA.*;
+import org.omg.PortableServer.*;
+import org.omg.PortableServer.POA;
+
+import YalpInterfaces.*;
+
+/*
+ * Class InitServer
+ *
+ * <em>Establishes DBConnection and creates VlcStreamer waits for
+ * further Instructions via Interfaces</em>
+ *
+ * @author Volker Dahnke / Manuel Traut
+ *
+ * @version 0.1 20-11-2005<br>
+ *
+ * @see Server
+ *
+ */
+
+public class InitServer {
+
+ private ServerSettings settings = new ServerSettings();
+ private ServerControlImpl srvCon;
+ private ServerControlInterface srv;
+ private ORB orb;
+ private String[] orbArgs;
+ private POA poa;
+ private String serverIP;
+ private ArrayList<FileBrowser> browseList;
+
+ /*
+ * Constructor: starts Server initialization
+ */
+ public InitServer(String[] _orbArgs) {
+
+ loadConfig("ServerSettings.xml");
+ writeConfig("ServerSettings.xml");
+
+ this.browseList = new ArrayList<FileBrowser>();
+
+ this.orbArgs = _orbArgs; // t.b.d. read orbargs from config xml
+
+ try {
+ this.serverIP = Inet4Address.getLocalHost().getHostAddress();
+ } catch(UnknownHostException e) {
+ /* t.b.d. error handling */
+ System.out.println("couldn't resolve hostname");
+ }
+
+ /* bind ServerControl to ORB and NamingService */
+ this.orb = ORB.init(orbArgs, null);
+
+ try {
+ this.poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
+ } catch(org.omg.CORBA.ORBPackage.InvalidName e) {
+ /* t.b.d. error handling */
+ System.out.println("couldn't get name ref of root poa");
+ }
+
+ try {
+ poa.the_POAManager().activate();
+ } catch(org.omg.PortableServer.POAManagerPackage.AdapterInactive e) {
+ /* t.b.d. error handling */
+ System.out.println("poa inactive");
+ }
+
+ this.srvCon = new ServerControlImpl();
+ this.srvCon.setORB(this.orb);
+
+ try {
+ org.omg.CORBA.Object ref = poa.servant_to_reference(this.srvCon);
+ this.srv = ServerControlInterfaceHelper.narrow(ref);
+
+ org.omg.CORBA.Object objRef =
+ orb.resolve_initial_references("NameService");
+
+ NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
+ String name = "YALP_Server";
+ NameComponent path[] = ncRef.to_name(name);
+ ncRef.rebind(path, this.srv);
+
+ System.out.println("YALP Server ready");
+ this.orb.run();
+
+ } catch( org.omg.CosNaming.NamingContextPackage.InvalidName e) {
+ /* t.b.d. error handling */
+ System.out.println("couldn't narrow ref to path");
+ } catch( org.omg.CosNaming.NamingContextPackage.NotFound e) {
+ /* t.b.d. error handling */
+ System.out.println("naming context not found, couldn't bind server ctl");
+ } catch(org.omg.PortableServer.POAPackage.ServantNotActive e) {
+ /* t.b.d. error handling */
+ System.out.println("couldn't get name ref of root poa");
+ } catch (org.omg.CORBA.ORBPackage.InvalidName e) {
+ /* t.b.d. error handling */
+ System.out.println("couldn't get NameService");
+ } catch (org.omg.PortableServer.POAPackage.WrongPolicy e) {
+ /* t.b.d. error handling */
+ System.out.println("policies not set correctly");
+ } catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e) {
+ /* t.b.d. error handling */
+ System.out.println("rebind failed, cannot proceed");
+ }
+ }
+
+/*
+ * write Configuration to XML File
+ *
+ * @param fileName
+ * where to write the configuration file
+ * @return boolean
+ * false - if failed
+ */
+
+ public boolean writeConfig(String fileName) {
+ try{
+ FileOutputStream configFile = new FileOutputStream(fileName);
+ XMLEncoder configWriter = new XMLEncoder(configFile);
+ configWriter.writeObject(settings.imageDir);
+ configWriter.writeObject(settings.videoDir);
+ configWriter.writeObject(settings.soundDir);
+ configWriter.close();
+ } catch (FileNotFoundException fnfe){
+ return false;
+ }
+ return true;
+ }
+
+/*
+ * tries to load ServerSettings from XML File
+ * @param fileName
+ * Configuration file
+ * @return boolean
+ * false - if loading failed
+ */
+
+ public boolean loadConfig(String fileName) {
+ try{
+ FileInputStream configFile = new FileInputStream(fileName);
+ XMLDecoder configLoader = new XMLDecoder(configFile);
+ settings.imageDir = (String)configLoader.readObject();
+ settings.videoDir = (String)configLoader.readObject();
+ settings.soundDir = (String)configLoader.readObject();
+ configLoader.close();
+ } catch(FileNotFoundException fnfe) {
+ System.out.println("Configuration not found, loading defaults...");
+ return false;
+ } catch(ClassCastException cce) {
+ System.out.println("Errors in Configuration, loading defaults...");
+ return false;
+ }
+ return true;
+ }
+
+/*
+ * returns actual configuration of the server
+ * @return ServerSettings
+ * actual configuration
+ */
+
+ public ServerSettings getConfig() {
+ return this.settings;
+ }
+
+/*
+ * sets and saves a new ServerConfiguration
+ *
+ * @param set
+ * new ServerSettings
+ * @return boolean
+ * true if succesfully saved
+ */
+
+ public boolean setConfig(ServerSettings set){
+ this.settings = set;
+ return this.writeConfig("ServerConfiguration.xml");
+ }
+
+/*
+ * t.b.d. session management
+ *
+ * Client logon (give him,his fileBrowser)
+ *
+ * @param ipAdress
+ * of the Client
+ * @param userName
+ * using the Client
+ *
+
+ public void newClient(String ipAdress,String userName) {
+ this.browseList.add( new FileBrowser( this.settings.startDir,
+ ipAdress,
+ userName ) );
+ }
+ */
+
+/*
+ * Client logoff (free memory of his fileBrowser
+ *
+ * @param ipAdress
+ * of the Client
+ * @param userName
+ * using the Client
+ */
+
+ public void remClient(String ipAdress, String userName) {
+ for( FileBrowser aBrowser : this.browseList ) {
+ if( aBrowser.getOwner().equals(ipAdress) &&
+ aBrowser.getUserName().equals(userName) ) {
+ this.browseList.remove(aBrowser);
+ break;
+ }
+ }
+ }
+
+/*
+ * change Directory in fileBrowser
+ *
+ * @param ip
+ * of the Client
+ * @param dir
+ * to which should be changed
+ * @return ArrayList<YalpFile>
+ * content of the directory changed to
+ */
+
+ public ArrayList<YalpFile> changeDir(String ip, String dir) {
+ FileBrowser aBrowser = null;
+ for(FileBrowser oneMoreBrowser : this.browseList) {
+ if( oneMoreBrowser.getOwner().equals(ip) ) {
+ oneMoreBrowser.changeDir(dir);
+ aBrowser = oneMoreBrowser;
+ break;
+ }
+ }
+ return aBrowser.getFiles();
+ }
+
+/*
+ * Server Shutdown
+ */
+
+ public void serverShutdown() {
+ System.out.println("Server shutdown - Server is going down");
+ System.exit(0);
+ }
+}
diff --git a/src/YalpServer/ServerControlImpl.java b/src/YalpServer/ServerControlImpl.java
new file mode 100755
index 0000000..a88445a
--- /dev/null
+++ b/src/YalpServer/ServerControlImpl.java
@@ -0,0 +1,385 @@
+/*
+ * 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 String log4jFile = "log4j_server.conf";
+ private static Logger logger = Logger.getLogger("Yalp.Server");
+
+public ServerControlImpl() {
+ PropertyConfigurator.configureAndWatch(log4jFile);
+ logger.debug("ServerControlImpl()");
+}
+
+ public void setORB(ORB _orb) {
+ logger.debug("setOrb()");
+ orb = _orb;
+ }
+
+ public void init(InitServer srv) {
+ logger.debug("init()");
+ this.srv=srv;
+ }
+
+/*
+ * client logon
+ *
+ * @param userName
+ * @param password
+ * @param ipAdress
+ * @param session (out)
+ * @param error (out)
+ */
+ public void clientLogon( String userName,
+ String password,
+ String ipAdress,
+ SessionHolder session,
+ YalpErrorHolder err )
+ {
+ logger.debug("clientLogon()");
+ /* t.b.d. session managmnet */
+ try {
+ System.out.println("logon: "+userName+" - "+ipAdress);
+
+ session.value = new Session();
+ session.value.id = 666;
+ session.value.me = new YalpUser();
+ session.value.me.level = AccessRights.ADMIN;
+
+ err.value = new YalpError();
+ err.value.code = YalpErrorCode.OK;
+
+ } catch (Exception e) {
+ System.out.println(e.toString());
+ }
+ System.out.println("t.b.d. clientLogon nothing implemented at the moment");
+ }
+
+/*
+ * client logoff
+ *
+ * @param session
+ * @param error (out)
+ */
+ public void clientLogoff( Session bye, YalpErrorHolder err) {
+ logger.debug("clientLogoff");
+ srv.remClient( bye.ip, bye.me.name );
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * 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;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * 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();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * register new output plugin
+ *
+ * @param plugin which should be registered
+ * @param error
+ */
+ public void registerOutputPlugin( OutputPluginInterface itf,
+ PluginInfoHolder info, YalpErrorHolder err )
+ {
+ logger.debug("registerOutputPlugin()");
+ /* t.b.d. itf handling */
+ System.out.println("registering output plugin: " + info.value.name );
+ YalpError error = new YalpError();
+ error.msg = "huhu";
+ error.descr = "hihi";
+ 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;
+ }
+
+/*
+ * 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.debug("registerInputPlugins()");
+ /* t.b.d. itf handling */
+ System.out.println("registering input plugin: " + info.value.name );
+ YalpError error = new YalpError();
+ error.msg = "huhu";
+ error.descr = "hihi";
+ 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; }
+
+/*
+ * 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.debug("registerAuthPlugin()");
+ /* t.b.d. itf handling */
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * remove input 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 */
+ }
+}
diff --git a/src/YalpServer/ServerSettings.java b/src/YalpServer/ServerSettings.java
new file mode 100755
index 0000000..313e875
--- /dev/null
+++ b/src/YalpServer/ServerSettings.java
@@ -0,0 +1,68 @@
+/*
+ * 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;
+
+/*
+ * Class ServerSettings
+ *
+ * <em></em>
+ *
+ * @author Manuel Traut
+ *
+ * @version 0.1 27-03-2006<br>
+ *
+ * @see server.InitServer
+ */
+
+public class ServerSettings{
+
+ static final long serialVersionUID = 0;
+
+ public String imageDir = "/media/image";
+ public String videoDir = "/media/video";
+ public String soundDir = "/media/sound";
+
+ /**
+ * set Directories which contains media Files
+ * @param startDir
+ */
+ public void setImageDir(String startDir){
+ this.imageDir = startDir;
+ }
+
+ /**
+ * set Directories which contains media Files
+ * @param startDir
+ */
+ public void setVideoDir(String startDir){
+ this.videoDir = startDir;
+ }
+
+ /**
+ * set Directories which contains media Files
+ * @param startDir
+ */
+ public void setSoundDir(String startDir){
+ this.soundDir = startDir;
+ }
+
+ public String getVideoDir(){
+ return this.videoDir;
+ }
+
+ public String getImageDir(){
+ return this.imageDir;
+ }
+
+ public String getSoundDir(){
+ return this.soundDir;
+ }
+}
diff --git a/src/YalpServer/YalpServer.java b/src/YalpServer/YalpServer.java
new file mode 100755
index 0000000..0ddbe00
--- /dev/null
+++ b/src/YalpServer/YalpServer.java
@@ -0,0 +1,40 @@
+/*
+ * 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;
+
+/*
+ * Class Server
+ *
+ * <em>static main method</em>
+ *
+ * @author Volker Dahnke / Manuel Traut
+ *
+ * @version 0.1 20-11-2005<br>
+ */
+public class YalpServer{
+
+/*
+ * starts Server initialization
+ *
+ * @param argv
+ * arguments which are not used
+ */
+ public static void main (String[] argv) {
+ try{
+ System.setProperty("java.security.policy","server.policy");
+ } catch (Exception e) {//DEBUG
+ System.out.println ("Server SecurityManagerExeptions not caught jet " + e);
+ System.exit(0);
+ }
+ InitServer yalpServer = new InitServer(argv);
+ return;
+ }
+
+}