bbc.rd.tvanytime.util
Class ScheduleManager

java.lang.Object
  extended by bbc.rd.tvanytime.util.ScheduleManager

public class ScheduleManager
extends java.lang.Object

Manages TV-Anytime metadata and acts as a central point for accessing it.

What does it expect?

ServiceInformation.xml
Group content referencing table: groups_cr.xml
Group information table: groups_gr.xml
Program information, location and content referencing tables: _.xml e.g. 20040504BBCSeven_pl.xml

Version:
1.0 Modified T.Ferne September 2004
Author:
Tristan Ferne, BBC Research & Development, April 2004

Method Summary
static void clear()
          Clear all schedule information from all tables.
static ContentReferencingTable getContentReferencingTable()
          Get content referencing table.
static GroupInformationTable getGroupInformationTable()
          Get group information table.
static int getNumDays()
          Get number of days the EPG displays.
static int getNumDaysBack()
          Get number of days backwards the EPG displays.
static int getNumServices()
          Get number of services described in SI file.
static java.lang.String getOwner(java.lang.Object id)
          Get the owner of a service.
static ProgramInformationTable getProgramInformationTable()
          Get program information table.
static ProgramLocationTable getProgramLocationTable()
          Get program location table.
static SegmentInformationTable getSegmentInformationTable()
          Get segment information table.
static java.lang.String getServiceID(URI serviceURL)
          Get the service URL ID the service with the specified service URL.
static ServiceInformationTable getServiceInformationTable()
          Get service information table.
static java.lang.String getServiceName(java.lang.Object id)
          Get the name of a service.
static URI getServiceURL(java.lang.String serviceID)
          Get the service URL for the service with the specified service ID.
static java.util.Date getStartDate()
          Get the date the EPG starts on.
static ContentReference getTopLevelGroupCRID()
          Get the top-level group CRID that is used for this set of data.
static java.lang.String getXMLLocation()
          Get the location of the TV-Anytime schedule files.
static void initialise()
          Initialises and loads schedules using default parameters.
static void initialise(java.util.Date startDate)
          Initialises and loads schedules using default parameters.
static void initialise(java.lang.String configFilename)
          Reads configuration file and load schedules.
static void loadFile(java.lang.String filename)
          Loads the contents of a single file and adds the contents to the appropriate table.
static void loadSchedules()
          Read XML schedules.
static void main(java.lang.String[] args)
          Testing.
static void setLogging(boolean logging)
          Set whether to log progress to console.
static void setNumDays(int numDays)
          Set number of days the EPG displays.
static void setNumDaysBack(int numDaysBack)
          Set number of days backwards the EPG displays.
static void setStartDate(java.util.Date startDate)
          Set the date the EPG starts on.
static void setTopLevelGroupCRID(ContentReference topLevelGroupCRID)
          Set the top-level group CRID that is used for this set of data.
static void setXMLLocation(java.lang.String xmlLocation)
          Set the location of the TV-Anytime schedule files.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

initialise

public static void initialise(java.util.Date startDate)
Initialises and loads schedules using default parameters. This must be called before the manager is used.


initialise

public static void initialise(java.lang.String configFilename)
Reads configuration file and load schedules. This must be called before the manager is used. The configuration file should be a properties file with the following (optional) properties:

start=, e.g. 26-Apr-2004
numdays=, e.g. 7
numdaysback=, e.g. 1
location=, e.g. I:/tv-anytime/tvdata/tvadb/xml13/
toplevelgroup=, e.g. crid://bbc.co.uk/BBCGroups
Default is today, 7 days and /project/tv-anytime/tvdata/tvadb/xml13/

Parameters:
The - filename of the configuration file.

initialise

public static void initialise()
Initialises and loads schedules using default parameters. This must be called before the manager is used.


getNumDays

public static int getNumDays()
Get number of days the EPG displays.

Returns:
The number of days.

setNumDays

public static void setNumDays(int numDays)
Set number of days the EPG displays.

Parameters:
numDays - The number of days.

getNumDaysBack

public static int getNumDaysBack()
Get number of days backwards the EPG displays.

Returns:
The number of days back.

setNumDaysBack

public static void setNumDaysBack(int numDaysBack)
Set number of days backwards the EPG displays.

Parameters:
numDays - The number of days back.

getStartDate

public static java.util.Date getStartDate()
Get the date the EPG starts on.

Returns:
The start date.

setStartDate

public static void setStartDate(java.util.Date startDate)
Set the date the EPG starts on. Zeros time to 00:00:00 on the day concerned.

Parameters:
startDate - The start date.

getTopLevelGroupCRID

public static ContentReference getTopLevelGroupCRID()
Get the top-level group CRID that is used for this set of data.

Returns:
The top-level group CRID.

setTopLevelGroupCRID

public static void setTopLevelGroupCRID(ContentReference topLevelGroupCRID)
Set the top-level group CRID that is used for this set of data.

Parameters:
topLevelGroupCRID - The top-level group CRID.

getXMLLocation

public static java.lang.String getXMLLocation()
Get the location of the TV-Anytime schedule files.

Returns:
The directory containing the TV-Anytime XML files.

setXMLLocation

public static void setXMLLocation(java.lang.String xmlLocation)
Set the location of the TV-Anytime schedule files. Should include trailing slash in directory structure (e.g. /project/shareit/). Should also use forward slashes regardless of platform. Note: Now adds trailing slash if not present.

Parameters:
xmlLocation - The directory containing the TV-Anytime XML files.

setLogging

public static void setLogging(boolean logging)
Set whether to log progress to console.

Parameters:
logging - Whether to log.

getProgramInformationTable

public static ProgramInformationTable getProgramInformationTable()
Get program information table.

Returns:
Program information table.

getProgramLocationTable

public static ProgramLocationTable getProgramLocationTable()
Get program location table.

Returns:
Program location table.

getGroupInformationTable

public static GroupInformationTable getGroupInformationTable()
Get group information table.

Returns:
Group information table.

getContentReferencingTable

public static ContentReferencingTable getContentReferencingTable()
Get content referencing table.

Returns:
Content referencing table.

getSegmentInformationTable

public static SegmentInformationTable getSegmentInformationTable()
Get segment information table.

Returns:
Segment information table.

clear

public static void clear()
Clear all schedule information from all tables.


getServiceInformationTable

public static ServiceInformationTable getServiceInformationTable()
Get service information table.

Returns:
Service information table.

getNumServices

public static int getNumServices()
Get number of services described in SI file.

Returns:
Number of services.

getServiceURL

public static URI getServiceURL(java.lang.String serviceID)
Get the service URL for the service with the specified service ID.

Parameters:
serviceID - Service ID of the service.
Returns:
Service URL of the service. Returns null if not found.

getServiceID

public static java.lang.String getServiceID(URI serviceURL)
Get the service URL ID the service with the specified service URL.

Parameters:
serviceURL - Service URL of the service.
Returns:
Service ID of the service. Returns null if not found.

getServiceName

public static java.lang.String getServiceName(java.lang.Object id)
Get the name of a service.

Parameters:
id - Either service ID (as a string) or service URL (as a URI object).
Returns:
The service name. Returns null if not found.

getOwner

public static java.lang.String getOwner(java.lang.Object id)
Get the owner of a service.

Parameters:
id - Either service ID (as a string) or service URL (as a URI object).
Returns:
The service owner. Returns null if not found.

loadSchedules

public static void loadSchedules()
Read XML schedules. Resets all tables first.


loadFile

public static void loadFile(java.lang.String filename)
                     throws NonFatalXMLException,
                            TVAnytimeException,
                            java.io.IOException
Loads the contents of a single file and adds the contents to the appropriate table.

Parameters:
filename - Location of file to load
Throws:
NonFatalXMLException
TVAnytimeException
java.io.IOException

main

public static void main(java.lang.String[] args)
Testing.

Parameters:
args -