TV-Browser 3.3.3 API

tvbrowser.core
Class TvDataInventory

java.lang.Object
  extended by tvbrowser.core.TvDataInventory

public class TvDataInventory
extends java.lang.Object

Remembers the day programs that are known to the user (or the user's plugins).

This way the TV data directory may be changed by other users, other clients or by hand and events of these changes will be sent anyway. This ensures that all plugins can react on data changed by third parties.

Author:
Til Schneider, www.murfman.de

Field Summary
static int KNOWN
           
static int OTHER_VERSION
           
static int UNKNOWN
           
 
Constructor Summary
TvDataInventory()
           
 
Method Summary
 java.lang.String[] getKnownDayPrograms()
          Gets the keys of all known day programs.
 int getKnownStatus(Date date, Channel channel, int version)
          Gets whether the given day program is already known to the user.
 void readData(java.io.File file)
          Loads the inventory list.
 void setKnown(Date date, Channel channel, int version)
          Sets the day program to "known to the user".
 void setUnknown(Date date, Channel channel)
          Sets the day program to "NOT known to the user".
 void setUnknown(java.lang.String key)
          Sets the day program to "NOT known to the user".
 void writeData(java.io.File file)
          Saves the inventory list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN

public static final int UNKNOWN
See Also:
Constant Field Values

OTHER_VERSION

public static final int OTHER_VERSION
See Also:
Constant Field Values

KNOWN

public static final int KNOWN
See Also:
Constant Field Values
Constructor Detail

TvDataInventory

public TvDataInventory()
Method Detail

getKnownStatus

public int getKnownStatus(Date date,
                          Channel channel,
                          int version)
Gets whether the given day program is already known to the user.

Returns

Parameters:
date - The day program's date
channel - The day program's channel
version - The day program's version (e.g. file size)
Returns:
whether the given day program is already known to the user.

setKnown

public void setKnown(Date date,
                     Channel channel,
                     int version)
Sets the day program to "known to the user".

Parameters:
date - The day program's date
channel - The day program's channel
version - The day program's version (e.g. file size)

setUnknown

public void setUnknown(Date date,
                       Channel channel)
Sets the day program to "NOT known to the user".

Parameters:
date - The day program's date
channel - The day program's channel

setUnknown

public void setUnknown(java.lang.String key)
Sets the day program to "NOT known to the user".


getKnownDayPrograms

public java.lang.String[] getKnownDayPrograms()
Gets the keys of all known day programs.

The keys of the day programs are equal to their file name.

Returns:
The keys of all known day programs.
See Also:
TvDataBase.getDayProgramKey(Date, Channel)

readData

public void readData(java.io.File file)
              throws java.io.IOException,
                     java.lang.ClassNotFoundException
Loads the inventory list.

Throws:
java.io.IOException
java.lang.ClassNotFoundException
See Also:
writeData(File)

writeData

public void writeData(java.io.File file)
               throws java.io.IOException
Saves the inventory list.

It is essential that this list is saved at the shut down of TV-Browser! If TV-Browser failes to save the plugin data then the inventory list should NOT be saved too. Doing so the plugins will update themselves automatically on the next startup, because new TV data will be treated as unknown.

Throws:
java.io.IOException
See Also:
readData(File)

TV-Browser 3.3.3 API

TV-Browser 3.3.3, Copyright (C) 2004-2008 TV-Browser Team (dev@tvbrowser.org)