org.hackystat.tickertape.tickerlingua
Class TickerLingua

java.lang.Object
  extended by org.hackystat.tickertape.tickerlingua.TickerLingua

public class TickerLingua
extends java.lang.Object

Reads a TickerLingua definition file, validates it, and provides access to its components.

A valid TickerLingua definition file is both syntactically and semantically valid.

Syntactic validity means that it satisfies the XmlSchema definition for a TickerLingua file. See the tickerlingua.definition.xsd file for details on syntactic validity. This is assessed by the JAXB parser when the file is read in.

Semantic validity involves ensuring the following:

In addition, if a HackystatProject refers to a sensorbase that cannot be contacted, or a user/password combination that is not legal, then a warning message is logged.

If a tickerlingua.xml definition file cannot be found, or is not both syntactically and semantically valid, then a RuntimeException is thrown.

Author:
Philip Johnson

Constructor Summary
TickerLingua()
          Creates a TickerLingua instance from default location ~/.hackystat/tickertape/tickertape.xml.
TickerLingua(java.lang.String filePath)
          Creates a TickerLingua instance from the passed file.
 
Method Summary
 java.lang.String findFullName(java.lang.String email)
          Returns the full name associated with the email, or null if not found.
 java.util.Collection<HackystatUser> getHackystatUsers()
          Returns the set of defined HackystatUsers.
 java.lang.String getLoggingLevel()
          Returns the logging level specified in the globals section, or "INFO" if none specified.
(package private)  java.util.Map<java.lang.String,HackystatProject> getProjects()
          Return the services.
(package private)  java.util.Map<java.lang.String,HackystatService> getServices()
          Return the services.
 java.lang.String getSmtpServer()
          Returns the smtp server specified in the Globals section, or null if none specified.
 Tickertape getTickertape(java.lang.String id)
          Return the Tickertape instance with the specified ID, or null if not found.
 java.util.List<Tickertape> getTickertapes()
          Return a list of all Tickertape instances.
(package private)  java.util.Map<java.lang.String,HackystatUser> getUsers()
          Return the services.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TickerLingua

public TickerLingua()
             throws TickerLinguaException
Creates a TickerLingua instance from default location ~/.hackystat/tickertape/tickertape.xml.

Throws:
TickerLinguaException - If problems occur while getting or processing the file.

TickerLingua

public TickerLingua(java.lang.String filePath)
             throws TickerLinguaException
Creates a TickerLingua instance from the passed file.

Parameters:
filePath - A path to the file.
Throws:
TickerLinguaException - If problems occur while getting or processing the file.
Method Detail

getSmtpServer

public java.lang.String getSmtpServer()
Returns the smtp server specified in the Globals section, or null if none specified.

Returns:
The smtp server, or null.

getLoggingLevel

public java.lang.String getLoggingLevel()
Returns the logging level specified in the globals section, or "INFO" if none specified.

Returns:
The logging level, or "INFO" if not specified.

getServices

java.util.Map<java.lang.String,HackystatService> getServices()
Return the services. Package-private for testing.

Returns:
The services.

getUsers

java.util.Map<java.lang.String,HackystatUser> getUsers()
Return the services. Package-private for testing.

Returns:
The services.

getProjects

java.util.Map<java.lang.String,HackystatProject> getProjects()
Return the services. Package-private for testing.

Returns:
The services.

getTickertape

public Tickertape getTickertape(java.lang.String id)
Return the Tickertape instance with the specified ID, or null if not found.

Parameters:
id - The id.
Returns:
The Tickertape instance, or null.

getTickertapes

public java.util.List<Tickertape> getTickertapes()
Return a list of all Tickertape instances.

Returns:
The list of Tickertape instances.

getHackystatUsers

public java.util.Collection<HackystatUser> getHackystatUsers()
Returns the set of defined HackystatUsers.

Returns:
The hackystat user definitions.

findFullName

public java.lang.String findFullName(java.lang.String email)
Returns the full name associated with the email, or null if not found.

Parameters:
email - The email.
Returns:
The full name, or null if not found.