nl.madline.opendp500
Class JDPServer

java.lang.Object
  |
  +--nl.madline.opendp500.JDPServer

public class JDPServer
extends java.lang.Object

Author:
svmaris

Constructor Summary
JDPServer(JDPConfig config)
          Default constructor
 
Method Summary
 void addPlayer(java.lang.String ip)
          Add a player to the connected players-list
 JDPPlaylist addPlaylist()
          Add a playlist with a default name and return the playlist
 JDPPlaylist addPlaylist(java.lang.String name)
          Adds a playlist with the given name and returns it.
 void debugMsg(java.lang.String message)
          Print a debugmessage to the console if debugging is enabled
 void deletePlayer(java.lang.String ip)
          Remove a connected player by IP-address
 java.lang.String getAudioPath()
          Get the default audiopath as given on the commandline
 JDPConfig getConfig()
           
 java.lang.String getConnectedPlayers()
          Get a String with all the connected players
 java.lang.String getCurrentMediaType()
          Get the current media type
 java.lang.String getLastCommand()
          Return the last command received by the player
 java.lang.String getMainCommand(java.lang.String command)
          Returns the internal mainCommand.
 java.util.Hashtable getMainCommands()
          Get a Hashtable with the translation-table for the player mainCommands and internal commands
 java.lang.String getNowPlaying()
          Returns the currently playing file, or 'Not Playling' if there's not a file playing at the moment
 java.lang.String getOptionCommand(java.lang.String command)
          Returns the internal optionCommand.
 java.util.Hashtable getOptionCommands()
          Get a HAshtable with the translation-table for the player optionCommands and internal commands
 java.lang.String getPath(java.lang.String mediaType)
          Get the root path of a certain mediaType
 java.lang.String getPicturePath()
          Get the default picturepath as given on the commandline
 JDPPlaylist getPlaylist(java.lang.String name)
          Get the playlist with a given name
 java.lang.String getPlaylistCommand(java.lang.String command)
          Returns the internal playlistCommand.
 java.util.Hashtable getPlaylistCommands()
          Get a Hashtable with the translation-table for the player playlistCommands and internal commands
 java.lang.String[] getPlaylists(java.lang.String mediaType)
          Get all playlists from a certain media-type
 java.lang.String getProperty(java.lang.String property)
           
 java.lang.String getRoot()
          Get APPNAME and VERSION-string for the about-screen
 java.lang.String getVideoPath()
          Get the default videopath as given on the commandline
 boolean isAllowedToConnect(java.lang.String ip)
           
 void reloadConfig()
          Reload the configuration from the file
 void removePlaylist(java.lang.String name)
          Remove playlist by name
 void saveConfig()
          Tell the config to save itself to disk
 void setAudioPath(java.lang.String audioPath)
          Set the audioPath
 void setCurrentMediaType(java.lang.String currentMediaType)
          Set the current media type
 void setLastCommand(java.lang.String string)
          Set the lastCommand to a given value.
 void setNowPlaying(java.lang.String nowPlaying)
          Set the nowPlaying-property
 void setPicturePath(java.lang.String picturePath)
          Set the picturePath
 void setVideoPath(java.lang.String videoPath)
          Set the videoPath
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDPServer

public JDPServer(JDPConfig config)
Default constructor

Method Detail

addPlaylist

public JDPPlaylist addPlaylist()
Add a playlist with a default name and return the playlist

Returns:
playlist The newly created playlist

removePlaylist

public void removePlaylist(java.lang.String name)
Remove playlist by name

Parameters:
name - The name of the playlist to be removed

addPlaylist

public JDPPlaylist addPlaylist(java.lang.String name)
Adds a playlist with the given name and returns it. This is not used on the player yet, because there's currently no way to enter the name on the DP-500

Parameters:
name - The name for the playlist
Returns:
playlist The newly created playlist

getPlaylists

public java.lang.String[] getPlaylists(java.lang.String mediaType)
Get all playlists from a certain media-type

Parameters:
mediaType - The mediatype (AUDIO, VIDEO, PICTURE)
Returns:
playlists An array of Strings containing all the playlists

getPlaylist

public JDPPlaylist getPlaylist(java.lang.String name)
Get the playlist with a given name

Parameters:
name - The name of the playlist
Returns:
playlist The playlist with that name

getAudioPath

public java.lang.String getAudioPath()
Get the default audiopath as given on the commandline

Returns:
audioPath The base path to the audio-files

setAudioPath

public void setAudioPath(java.lang.String audioPath)
Set the audioPath

Parameters:
audioPath - The base path to the audio-files

getVideoPath

public java.lang.String getVideoPath()
Get the default videopath as given on the commandline

Returns:
videoPath The base path to the video-files

setVideoPath

public void setVideoPath(java.lang.String videoPath)
Set the videoPath

Parameters:
videoPath - The base path to the video-files

getPicturePath

public java.lang.String getPicturePath()
Get the default picturepath as given on the commandline

Returns:
picturePath The base path to the pictures

setPicturePath

public void setPicturePath(java.lang.String picturePath)
Set the picturePath

Parameters:
picturePath - The base path to the pictures

getRoot

public java.lang.String getRoot()
Get APPNAME and VERSION-string for the about-screen

Returns:
root Application name and version information

getMainCommand

public java.lang.String getMainCommand(java.lang.String command)
Returns the internal mainCommand. mainCommands are the functions that are reached from the main menu on the DP-500

Parameters:
command - The command received from the player
Returns:
command The translated (internal) command

getPlaylistCommand

public java.lang.String getPlaylistCommand(java.lang.String command)
Returns the internal playlistCommand. playlistCommands are the functions that are reached from the Playlist menu on the DP-500

Parameters:
command - The command received from the player
Returns:
command The translated (internal) command

getOptionCommand

public java.lang.String getOptionCommand(java.lang.String command)
Returns the internal optionCommand. optionCommands are the functions that are reached from the Option menu on the DP-500

Parameters:
command - The command received from the player
Returns:
command The translated (internal) command

getMainCommands

public java.util.Hashtable getMainCommands()
Get a Hashtable with the translation-table for the player mainCommands and internal commands

Returns:
commands The hashtable containing the translation

getPlaylistCommands

public java.util.Hashtable getPlaylistCommands()
Get a Hashtable with the translation-table for the player playlistCommands and internal commands

Returns:
commands The hashtable containing the translation

getOptionCommands

public java.util.Hashtable getOptionCommands()
Get a HAshtable with the translation-table for the player optionCommands and internal commands

Returns:
commands The hashtable containing the translation

getPath

public java.lang.String getPath(java.lang.String mediaType)
Get the root path of a certain mediaType

Parameters:
mediaType - The media type (AUDIO/VIDEO/PICTURE)
Returns:
path The root path of the given media type

getNowPlaying

public java.lang.String getNowPlaying()
Returns the currently playing file, or 'Not Playling' if there's not a file playing at the moment

Returns:
nowPlaying The currently playing file

setNowPlaying

public void setNowPlaying(java.lang.String nowPlaying)
Set the nowPlaying-property

Parameters:
nowPlaying - The name of the file that is currently playing

getCurrentMediaType

public java.lang.String getCurrentMediaType()
Get the current media type

Returns:
mediaType The current media type of the player

setCurrentMediaType

public void setCurrentMediaType(java.lang.String currentMediaType)
Set the current media type

Parameters:
currentMediaType - The media type the player is in right now

getConnectedPlayers

public java.lang.String getConnectedPlayers()
Get a String with all the connected players

Returns:
connectedPlayers The IP-addresses of the connected players, seperated by a space

addPlayer

public void addPlayer(java.lang.String ip)
Add a player to the connected players-list

Parameters:
ip - The IP-address of the new player

deletePlayer

public void deletePlayer(java.lang.String ip)
Remove a connected player by IP-address

Parameters:
ip - The IP-address of the player to be removed

getLastCommand

public java.lang.String getLastCommand()
Return the last command received by the player

Returns:
lastCommand The last command received by the player

setLastCommand

public void setLastCommand(java.lang.String string)
Set the lastCommand to a given value.

Parameters:
string - The command received from the player

getProperty

public java.lang.String getProperty(java.lang.String property)
Parameters:
property - The property to be fetched
Returns:
propery The requested property

isAllowedToConnect

public boolean isAllowedToConnect(java.lang.String ip)
Parameters:
ip - The IP of the connecting client
Returns:
allowed true if allowed to connect

saveConfig

public void saveConfig()
Tell the config to save itself to disk


getConfig

public JDPConfig getConfig()

reloadConfig

public void reloadConfig()
Reload the configuration from the file


debugMsg

public void debugMsg(java.lang.String message)
Print a debugmessage to the console if debugging is enabled