HiRISE

HiRISE.HiCat.Utilities
Class Retired_Suggestion_Notifier

java.lang.Object
  extended by HiRISE.HiCat.Utilities.Retired_Suggestion_Notifier

public class Retired_Suggestion_Notifier
extends Object

Retired_Suggestion_Notifier is a class for sending email notifications about suggestions that have been retired or released within various contexts. There are currently 3 supported notification contexts: Science Theme Leads (STLs), team members, and PDS releases. See the documentation for the different notify methods below for more information.

Note: It is assumed that this utility will be run shortly after the geometry retirement step has completed.

Version:
1.24
Author:
Rodney Heyd UA/PIRL, Sean Whitsitt UA/PIRL, Ashley Ramsey UA/PIRL
See Also:
Retire_Suggestions, notifySTLs(), notifyTeamMembers(), notifyPDS()

Nested Class Summary
static class Retired_Suggestion_Notifier.ExitCode
          Exit status
 
Field Summary
static String DEBUG_EMAILS_PROPERTY
          System properties related to debugging.
static String DEBUG_MAIN_PROPERTY
          System properties related to debugging.
static String DEBUG_NOTIFY_PROPERTY
          System properties related to debugging.
static String DEBUG_PDS_PROPERTY
          System properties related to debugging.
static String DEBUG_TEAM_PROPERTY
          System properties related to debugging.
static String DEFAULT_CONFIGURATION_FILE
          The default configuration file used if none is specified.
static int DEFAULT_SEARCH_DAYS
          The default number of elapsed days to use when generating the retirement reports.
static String ID
          Class identifier
 
Constructor Summary
Retired_Suggestion_Notifier()
          The default constructor, creates a notifier using the DEFAULT_CONFIGURATION_FILE
Retired_Suggestion_Notifier(Configuration configuration)
          This constructor allows the specification of a configuration to use for setting up the database connection.
 
Method Summary
static void main(String[] arguments)
          Sends email notifications about suggestions that have been retired or Observations that have been released (release functionality is pending).
 void noop(boolean noop)
          Sets the noop option.
 void notifyPDS()
          Sends PDS release notifications to all users that have opted in to receive these emails.
 void notifySTLs()
          This method initiates the STL notification process.
 void notifyTeamMembers()
          Send retirement email notifications to team members.
 void SetCurrentDate(String date)
           
 int STLSearchDays()
          Get the current number days the STL report uses as a search window to find retired suggestions to report on.
 void STLSearchDays(int search_days)
          Sets the number of days to subtract from the current date to form a search window for Observations that have been processed through retirement and reported in the STL Science Theme retirement reports.
static void Usage(int exit_status, org.apache.commons.cli.Options options)
          Print usage information and exit.
 void verbose(boolean verbose)
          Sets the output to verbose.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

public static final String ID
Class identifier

See Also:
Constant Field Values

DEFAULT_CONFIGURATION_FILE

public static final String DEFAULT_CONFIGURATION_FILE
The default configuration file used if none is specified.

See Also:
Constant Field Values

DEFAULT_SEARCH_DAYS

public static final int DEFAULT_SEARCH_DAYS
The default number of elapsed days to use when generating the retirement reports. This indicates the number of days measured from the current time, that the database is searched for retirement operations. The default is 7.

See Also:
Constant Field Values

DEBUG_MAIN_PROPERTY

public static final String DEBUG_MAIN_PROPERTY
System properties related to debugging. Setting any of these system properties to true will cause additional debugging information to be output during the program execution that relates to operations named by the property. In addition, full stack traces will be output to stdout for any exceptions that are thrown during the execution of the program while if any of these properties are set prior to the initialization of the class.

See Also:
Constant Field Values

DEBUG_NOTIFY_PROPERTY

public static final String DEBUG_NOTIFY_PROPERTY
System properties related to debugging. Setting any of these system properties to true will cause additional debugging information to be output during the program execution that relates to operations named by the property. In addition, full stack traces will be output to stdout for any exceptions that are thrown during the execution of the program while if any of these properties are set prior to the initialization of the class.

See Also:
Constant Field Values

DEBUG_EMAILS_PROPERTY

public static final String DEBUG_EMAILS_PROPERTY
System properties related to debugging. Setting any of these system properties to true will cause additional debugging information to be output during the program execution that relates to operations named by the property. In addition, full stack traces will be output to stdout for any exceptions that are thrown during the execution of the program while if any of these properties are set prior to the initialization of the class.

See Also:
Constant Field Values

DEBUG_PDS_PROPERTY

public static final String DEBUG_PDS_PROPERTY
System properties related to debugging. Setting any of these system properties to true will cause additional debugging information to be output during the program execution that relates to operations named by the property. In addition, full stack traces will be output to stdout for any exceptions that are thrown during the execution of the program while if any of these properties are set prior to the initialization of the class.

See Also:
Constant Field Values

DEBUG_TEAM_PROPERTY

public static final String DEBUG_TEAM_PROPERTY
System properties related to debugging. Setting any of these system properties to true will cause additional debugging information to be output during the program execution that relates to operations named by the property. In addition, full stack traces will be output to stdout for any exceptions that are thrown during the execution of the program while if any of these properties are set prior to the initialization of the class.

See Also:
Constant Field Values
Constructor Detail

Retired_Suggestion_Notifier

public Retired_Suggestion_Notifier()
                            throws Configuration_Exception,
                                   Database_Exception
The default constructor, creates a notifier using the DEFAULT_CONFIGURATION_FILE

Throws:
Configuration_Exception - if the DEFAULT_CONFIGURATION_FILE could not be found or parsed.
Database_Exception - if a database connection can not be initiated.

Retired_Suggestion_Notifier

public Retired_Suggestion_Notifier(Configuration configuration)
                            throws Database_Exception,
                                   Configuration_Exception
This constructor allows the specification of a configuration to use for setting up the database connection.

Parameters:
configuration - the configuration to use to connect to the database
Throws:
Database_Exception - if a database connection can not be initiated
Configuration_Exception - if there is a problem with the provided configuration
Method Detail

notifySTLs

public void notifySTLs()
                throws Database_Exception

This method initiates the STL notification process. A list of suggestions retired is compiled for each science theme and sent to the Science Theme Lead via an email. The email is html formatted text holding a table which displays the list of suggestions retired by a given observation id (with hyperlinks to HiReport), as well as a some ancillary information, like the relation a suggestion is a member of, and the number of observations acquired in the relation.

The time frame over which the list of suggestions is compiled based on the value of the STL_Search_Days field. Defaulting to 7 days from the current time. The current time can be redefined however for debugging purposes

Finally, if a pair of stereo suggestions were retired by the same observation, then these are flagged as a warning in the table, so the STL can take action - if needed.

If no suggestions were retired within a given theme, then a "null" notification will be sent that indicates that no suggestions were retired.

Throws:
Database_Exception - if any of the underlying database queries fail
MessagingException - if an error occurs while sending mail
See Also:
STLSearchDays(int)

notifyTeamMembers

public void notifyTeamMembers()
                       throws Database_Exception
Send retirement email notifications to team members. As with the notifySTLs() method, this method uses the STL_Search_Days variable to determine the time period overwhich retired suggestions are searched for.

Throws:
Database_Exception - if an error occurs during the database searches.
See Also:
STLSearchDays(int)

notifyPDS

public void notifyPDS()
               throws Database_Exception
Sends PDS release notifications to all users that have opted in to receive these emails. Unlike the team and STL notifications, this notifier sends email when observations retiring a suggestion are released to the PDS rather than retired. As with the STL and team member search, the STL_Search_Days field determines the time interval of the search window.

Throws:
Database_Exception - if a database error occurrs during any of the database interactions
See Also:
STLSearchDays(int)

STLSearchDays

public void STLSearchDays(int search_days)
Sets the number of days to subtract from the current date to form a search window for Observations that have been processed through retirement and reported in the STL Science Theme retirement reports. The default search time is set by the DEFAULT_SEARCH_DAYS field.

Parameters:
search_days - - the number of days to search backward
See Also:
notifySTLs(), notifyTeamMembers(), notifyPDS()

SetCurrentDate

public void SetCurrentDate(String date)

STLSearchDays

public int STLSearchDays()
Get the current number days the STL report uses as a search window to find retired suggestions to report on.

Returns:
- an integer specifying the size of the search window in days

verbose

public void verbose(boolean verbose)
Sets the output to verbose. Additional status information will be output when verbose is set to true.

Parameters:
verbose -

noop

public void noop(boolean noop)
Sets the noop option. If set to true, then no emails will be sent, but the email contents will be sent to STDOUT.

Parameters:
noop -

main

public static void main(String[] arguments)
Sends email notifications about suggestions that have been retired or Observations that have been released (release functionality is pending). Command line syntax is described in the Usage(int, Options) method.

Exist status values

0 - Success
1 - Configuration Error
2 - Database Error
3 - Command line syntax error

Parameters:
arguments - - command line string.

Usage

public static void Usage(int exit_status,
                         org.apache.commons.cli.Options options)
Print usage information and exit.

Usage: Retired_Suggestion_Notifier <Options>
  Options -
    [-Configuration <filename>
    [-Days <integer>
    [-Noop
    [-PDS_Release_Notice
    [-STL_Notice
    [-Team_Retirement_Notice
    [-Verbose
    [-Help]

Parameters:
exit_status -

HiRISE

Copyright (C) Arizona Board of Regents on behalf of the Planetary Image Research Laboratory, Lunar and Planetary Laboratory at the University of Arizona