Package org.silverpeas.looks.aurora.service.weather

# Class WeatherSettings

java.lang.Object
org.silverpeas.looks.aurora.service.weather.WeatherSettings

All Implemented Interfaces:
  `Serializable`

@SessionScoped public class WeatherSettings extends Object implements Serializable
Settings of a weather module dedicated to work with a remote weather service. By default, those settings are defined in the properties/org/silverpeas/weather/settings/weather.properties file, but they can be defined in another properties file. In that case, the path of this file must be specified with `setSettingsFile(String)` method. Only the cache time-to-live defined in the default properties file is taken into account.

Author:
  mmoquillon
See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `DEFAULT_SETTINGS`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WeatherSettings()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static WeatherSettings`
  `get()`
  Gets an instance of the `WeatherSettings` bundle.
  `String`
  `getAPIKey()`
  Gets the API key to use to request the remote weather service used by Silverpeas.
  `List<City>`
  `getCities()`
  Gets the list of cities for which the weather forecast have to be requested.
  `String`
  `getClientKey()`
  Gets the client key to use to request the remote weather service used by Silverpeas.
  `String`
  `getClientSecret()`
  Gets the client secret to use to request the remote weather service used by Silverpeas.
  `String`
  `getService()`
  Gets the weather service to request for weather forecast.
  `void`
  `setSettingsFile(String settingsFile)`
  Sets the name of the properties file in which are defined the weather settings to be taken in charge by this `WeatherSettings` instance.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### DEFAULT_SETTINGS

    public static final String DEFAULT_SETTINGS
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### WeatherSettings

    public WeatherSettings()

- ## Method Details

  - ### get

    public static WeatherSettings get()
    Gets an instance of the `WeatherSettings` bundle.
    Returns:
      a `WeatherSettings` instance.

  - ### setSettingsFile

    public void setSettingsFile(String settingsFile)
    Sets the name of the properties file in which are defined the weather settings to be taken in charge by this `WeatherSettings` instance. The properties file has to be located into the `properties/org/silverpeas/weather/settings/` directory of the Silverpeas installation.
    Parameters:
      `settingsFile` - the name of the properties file without its extension. It must be located into the `properties/org/silverpeas/weather/settings/` directory to be found and loaded by this object.

  - ### getCities

    public List<City> getCities()
    Gets the list of cities for which the weather forecast have to be requested.
    Returns:
      a list of cities. Can be empty.

  - ### getAPIKey

    public String getAPIKey()
    Gets the API key to use to request the remote weather service used by Silverpeas. The API key is used by the remote weather service to identify the requester and for weather requesting authorization.
    Returns:
      an API key.

  - ### getService

    public String getService()
    Gets the weather service to request for weather forecast. From this service name, the matching requester will be used.
    Returns:
      the name of the service.

  - ### getClientKey

    public String getClientKey()
    Gets the client key to use to request the remote weather service used by Silverpeas. Only some weather service requires a client key for authentication.
    Returns:
      a client key.

  - ### getClientSecret

    public String getClientSecret()
    Gets the client secret to use to request the remote weather service used by Silverpeas. Only some weather service requires a client secret for authentication. A client secret is always associated with a client key.
    Returns:
      a client secret.