org.lyra.Database
Class Audit

java.lang.Object
  extended by org.lyra.Database.Audit
All Implemented Interfaces:
UpdateListener

public class Audit
extends java.lang.Object
implements UpdateListener

Attaches an auditing stream to the connection with the Music Player Daemon enabling us to track songs played, skipped, added to the playlist whilst in operation. This can be tied later on to list generation and player habits.

Version:
1.0.5, %Revision, 174%, %LastChangedDate, 27/10/12 3:33PM%
Author:
Martin Foster

Field Summary
private static java.lang.String CLASS
           
private  java.lang.String CurrentFilename
           
private  java.util.Set<java.lang.String> CurrentListing
           
private  Status Info
           
private  java.util.Map<java.lang.String,java.lang.String> Lang
           
private  Ledger Logger
           
private  Comptroller Manager
           
 
Constructor Summary
Audit(Comptroller manager, Status info, Ledger logger, java.util.Map<java.lang.String,java.lang.String> lang)
          Constructor requires an element from the database and daemon side in order to function properly.
 
Method Summary
 void hostUpdated(UpdateEvent update)
          Updates of host information as passed through this specific method.
private  void logReplace(java.lang.String msg, java.lang.String file, java.lang.String state)
          Since filenames can carry with them certain undesired elements, we make ensure they will have no effect in the logging.
private  java.util.Set<java.lang.String> updateCurrent()
          Extracts a list of filenames within the the current playlist connection in order to more easily compare.
private  java.lang.String updateFilename(java.util.Map<java.lang.String,java.lang.String> state)
          Extracts the information from the org.lyra.Host.Status class and extracts the currently playing song.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Manager

private Comptroller Manager

Info

private Status Info

Logger

private Ledger Logger

Lang

private java.util.Map<java.lang.String,java.lang.String> Lang

CurrentFilename

private java.lang.String CurrentFilename

CurrentListing

private java.util.Set<java.lang.String> CurrentListing

CLASS

private static final java.lang.String CLASS
See Also:
Constant Field Values
Constructor Detail

Audit

public Audit(Comptroller manager,
             Status info,
             Ledger logger,
             java.util.Map<java.lang.String,java.lang.String> lang)
Constructor requires an element from the database and daemon side in order to function properly. Only then can it create a link between the two elements.

Parameters:
manager - Database interface for insertion into the auditing table.
info - Information handle on the daemon.
logger - Ledger instance for logging of information.
lang - Independent language instance.
Method Detail

hostUpdated

public void hostUpdated(UpdateEvent update)
Description copied from interface: UpdateListener
Updates of host information as passed through this specific method. Multiple updates can be triggered from this, so it becomes important to check for a specific update if necessary in order to avoid undue

Specified by:
hostUpdated in interface UpdateListener
Parameters:
update - Update notification method.
See Also:
UpdateEvent

updateCurrent

private java.util.Set<java.lang.String> updateCurrent()
Extracts a list of filenames within the the current playlist connection in order to more easily compare.

Returns:
Set containing all songs in the Current playlist.

updateFilename

private java.lang.String updateFilename(java.util.Map<java.lang.String,java.lang.String> state)
Extracts the information from the org.lyra.Host.Status class and extracts the currently playing song. Based on state and currently playing elements.

Returns:
String containing the filename currently playing.

logReplace

private void logReplace(java.lang.String msg,
                        java.lang.String file,
                        java.lang.String state)
Since filenames can carry with them certain undesired elements, we make ensure they will have no effect in the logging.

Parameters:
msg - Error message to pass up.
file - Filename that is affected.
state - State to change to.