com.ecebs.rtd.enabler
Class ConfigManager

java.lang.Object
  extended by com.ecebs.rtd.enabler.ConfigManager
All Implemented Interfaces:
IConfigManager

public abstract class ConfigManager
extends Object
implements IConfigManager

Provides settings used throught the RTD Enabler, abstracting some of the platform-specific checks. An appropriate initialise call must be made before attempting to retreive values

Author:
kyleb

Method Summary
 void clearCertificateAlias()
          Clear the alias for a certificate to be used for client authentication
 void clearLoginCredentials()
          Clear the basic auth credentials to be used for communicating with RTD
 String getCustomerId()
          Get the customer ID (specified by the KEYS#CUSTOMER_ID parameter).
abstract  String getDeviceId()
          Get a device ID to be used when generating the request ID for ModifyRequest instances
 URL getDownloadInterfaceURL()
          Get the download interface URL
static ConfigManager getInstance()
          Get the initialised instance.
 com.squareup.okhttp.OkHttpClient getOkHttpClient()
           
 String getOriginator()
          Get the originator used for RTD requests.
abstract  String getPlatform()
          Get the name of the current platform.
 URL getQueryInterfaceURL()
          Get the query interface URL
 URL getRetailInterfaceURL()
          Get the retail interface URL
abstract  String getSoftwareBuildVersion()
          Get the current software build version
abstract  boolean hasConnection()
          Can be used to determine if there is currently a connection that can be used for carrying out network operations.
 boolean isInTestMode()
          Determine if test parameters are being returned.
 void setCertificateAlias(String alias)
          Set the alias for a certificate to be used for client authentication when communicating with RTD
 void setLoginCredentials(String username, String password)
          Set the basic auth credentials to be used for communicating with RTD
 void setTestMode(boolean testMode)
          Sets whether test parameters should be returned.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ecebs.rtd.enabler.IConfigManager
closeEnabler
 

Method Detail

getInstance

public static ConfigManager getInstance()
                                 throws IllegalStateException
Get the initialised instance. Calling this method before initialising a platform-specific ConfigManager will result in an IllegalStateException being thrown.

Returns:
The initialised ConfigManager
Throws:
IllegalStateException - Thrown if a ConfigManager has not been initialised

hasConnection

public abstract boolean hasConnection()
Can be used to determine if there is currently a connection that can be used for carrying out network operations.

Returns:
true if a connection is available, else false

getPlatform

public abstract String getPlatform()
Get the name of the current platform.

Returns:
The name of the platform.

getOkHttpClient

public com.squareup.okhttp.OkHttpClient getOkHttpClient()
Returns:
An appropriately authenticated okHttpClient instance

getSoftwareBuildVersion

public abstract String getSoftwareBuildVersion()
Get the current software build version

Returns:
Current software build version

getDeviceId

public abstract String getDeviceId()
Get a device ID to be used when generating the request ID for ModifyRequest instances

Returns:
Device ID to be used in request ID

setTestMode

public void setTestMode(boolean testMode)
Sets whether test parameters should be returned.

Specified by:
setTestMode in interface IConfigManager
Parameters:
testMode - If true, test parameters will be returned by methods. Else, "live" parameters will be returned

isInTestMode

public boolean isInTestMode()
Determine if test parameters are being returned.

Returns:
True if returning test parameters, else false

setCertificateAlias

public void setCertificateAlias(String alias)
                         throws GeneralSecurityException
Set the alias for a certificate to be used for client authentication when communicating with RTD

Parameters:
alias - Alias of the client certificate
Throws:
GeneralSecurityException

clearCertificateAlias

public void clearCertificateAlias()
Clear the alias for a certificate to be used for client authentication


setLoginCredentials

public void setLoginCredentials(String username,
                                String password)
Set the basic auth credentials to be used for communicating with RTD

Specified by:
setLoginCredentials in interface IConfigManager
Parameters:
username - username for credentials
password - password for credentials

clearLoginCredentials

public void clearLoginCredentials()
Clear the basic auth credentials to be used for communicating with RTD

Specified by:
clearLoginCredentials in interface IConfigManager

getRetailInterfaceURL

public URL getRetailInterfaceURL()
Get the retail interface URL

Returns:
If in test mode, the test value will be returned (null if not specified). If not, the "live" URL will be returned (null if not specified)

getDownloadInterfaceURL

public URL getDownloadInterfaceURL()
Get the download interface URL

Returns:
If in test mode, the test value will be returned (null if not specified). If not, the "live" URL

getQueryInterfaceURL

public URL getQueryInterfaceURL()
Get the query interface URL

Returns:
If in test mode, the test value will be returned (null if not specified). If not, the "live" URL

getCustomerId

public String getCustomerId()
Get the customer ID (specified by the KEYS#CUSTOMER_ID parameter).

Returns:
The value associated with KEYS#CUSTOMER_ID (null if not specified).

getOriginator

public String getOriginator()
Get the originator used for RTD requests. if a KEYS#ORIGINATOR has been set, it will be returned. Otherwise, the KEYS#CUSTOMER_ID is used with the platform name and software build version to create an originator.

Returns:
The name of the platform.


Copyright © 2013 Ecebs Ltd. All Rights Reserved.