RightTrackAgency

RightTrackAgency

RightTrackAgency Abstract Class

This abstract class is implemented by various Right Track Agencies which provide the agency-specific configuration information and real-time status information.

The abstract class handles the agency configuration properties and the reading of additional agency configuration files. An implementation of this class should override the feed-related functions to provide a real-time Station Feed.

Constructor

(abstract) new RightTrackAgency(moduleDirectoryopt, configurationopt)

Source:

Abstract class constructor. The implementing agency should call this constructor: super(moduleDirectory) in order to read the default agency configuration and set the initial configuration properties.

This will set the following properties, which are accessible from the implementing agency's Class:

  • moduleDirectory = the root of the agency's module directory
  • config = the agency's configuration (the default configuration or the default merged with an additional configuration if readConfig is used).
  • id = the agency id code
  • name = the agency's full name
Parameters:
Name Type Attributes Description
moduleDirectory string <optional>

The full path to the root of the agency's module directory. This is where relative paths to configuration files will be relative to.

configuration Object <optional>

The Agency configuration settings

Members

config

Source:

The Agency's configuration properties

id

Source:

The Agency's id code

moduleDirectory

Source:

The Agency's module directory

name

Source:

The Agency's full name

Methods

getConfig() → {object}

Source:

Get the agency configuration

Returns:

Agency configuration

Type
object

(abstract) isFeedSupported() → {boolean}

Source:

Check if the Agency supports real-time Station Feeds.

This will return false by default unless the implementing agency overrides the function to indicate support for Station Feeds.

Returns:

true if the agency has implemented Station Feeds

Type
boolean

(abstract) loadFeed(db, origin, callback)

Source:

Load the Agency's Station Feed for the specified Origin Stop.

This function will need to be overridden by the implementing agency.

Parameters:
Name Type Description
db RightTrackDB

The Right Track DB to query

origin Stop

The origin Stop

callback function

Callback function

Properties
Name Type Attributes Description
error Error

Station Feed Error. The Error's message will be a pipe (|) separated string in the format of: Error Code|Error Type|Error Message that will be parsed out by the Right Track API Server into a more specific error Response.

feed StationFeed <optional>

The built StationFeed for the Stop

readConfig(configFile)

Source:

Read an additional agency configuration file

Parameters:
Name Type Description
configFile string

Path to agency configuration file. Relative paths will be relative to the root of the agency's module directory.

resetConfig()

Source:

Reset the agency configuration to the default values