com.cybersource.ws.client
Class MerchantConfig

java.lang.Object
  extended by com.cybersource.ws.client.MerchantConfig

public class MerchantConfig
extends Object

An internal class used by the clients to hold and derive the properties applicable to the current transaction.


Constructor Summary
MerchantConfig(Properties _props, String _merchantID)
          Constructor.
 
Method Summary
 String getEffectiveNamespaceURI()
          Returns the effective namespace URI to be used to parse the request and reply documents.
 String getEffectivePassword()
          Returns the effective key password.
 String getEffectiveServerURL()
          Returns the effective server URL to which the request will be sent.
 boolean getEnableLog()
           
 String getKeyAlias()
           
 File getKeyFile()
          Returns a File object representing the key file.
 String getKeyFilename()
           
 String getKeyPassword()
           
 String getKeysDirectory()
           
 String getLogDirectory()
           
 File getLogFile()
          Returns a File object representing the log file.
 String getLogFilename()
           
 int getLogMaximumSize()
           
 boolean getLogSignedData()
           
 String getLogString()
          Returns a string representation of the properties for logging purposes.
 String getMerchantID()
           
 String getNamespaceURI()
           
 String getPassword()
           
 String getProperty(String merchantID, String prop)
          Returns the value of the specified property.
 String getProperty(String merchantID, String prop, String defaultVal)
          Returns the value of the specified property.
 String getProxyHost()
           
 String getProxyPassword()
           
 int getProxyPort()
           
 String getProxyUser()
           
 boolean getSendToAkamai()
           
 boolean getSendToProduction()
           
 String getServerURL()
           
 String getTargetAPIVersion()
           
 int getTimeout()
           
 boolean getUseHttpClient()
           
 boolean getUseSignAndEncrypted()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MerchantConfig

public MerchantConfig(Properties _props,
                      String _merchantID)
               throws com.cybersource.ws.client.ConfigException
Constructor.

Parameters:
_props - Properties object to get properties from. May be null, in which case, all properties will be read from the System properties.
_merchantID - merchantID. May be null. If specified, merchant- specific properties will take precedence over the generic ones (i.e. those that do not start with a merchant id prefix).
Throws:
ConfigException - if something is missing of invalid in the configuration.
Method Detail

getUseSignAndEncrypted

public boolean getUseSignAndEncrypted()

getMerchantID

public String getMerchantID()

getKeysDirectory

public String getKeysDirectory()

getKeyAlias

public String getKeyAlias()

getKeyPassword

public String getKeyPassword()

getSendToProduction

public boolean getSendToProduction()

getSendToAkamai

public boolean getSendToAkamai()

getTargetAPIVersion

public String getTargetAPIVersion()

getKeyFilename

public String getKeyFilename()

getServerURL

public String getServerURL()

getNamespaceURI

public String getNamespaceURI()

getPassword

public String getPassword()

getEnableLog

public boolean getEnableLog()

getLogSignedData

public boolean getLogSignedData()

getLogDirectory

public String getLogDirectory()

getLogFilename

public String getLogFilename()

getLogMaximumSize

public int getLogMaximumSize()

getUseHttpClient

public boolean getUseHttpClient()

getTimeout

public int getTimeout()

getProxyHost

public String getProxyHost()

getProxyPort

public int getProxyPort()

getProxyUser

public String getProxyUser()

getProxyPassword

public String getProxyPassword()

getEffectiveServerURL

public String getEffectiveServerURL()
Returns the effective server URL to which the request will be sent. If a serverURL is specified, then that is what is returned. Otherwise, the effective server URL is derived from the values of sendToAkamai, sendToProduction and targetAPIVersion.

Returns:
the effective server URL.

getEffectiveNamespaceURI

public String getEffectiveNamespaceURI()
Returns the effective namespace URI to be used to parse the request and reply documents. If a namespaceURI is specified, then that is what is returned. Otherwise, the effective namespace URI is derived from the value of targetAPIVersion.

Returns:
the effective namespace URI.

getEffectivePassword

public String getEffectivePassword()
Returns the effective key password. If a password is specified, then that is what is returned. Otherwise, the effective password is the same as the merchantID.

Returns:
the effective key password.

getKeyFile

public File getKeyFile()
                throws com.cybersource.ws.client.ConfigException
Returns a File object representing the key file. If a keyFilename is specified, that will be the one used. Otherwise, the filename will be derived from the merchantID.

Throws:
ConfigException - if the file is missing, is not a file, or is not readable.

getLogFile

public File getLogFile()
                throws com.cybersource.ws.client.ConfigException
Returns a File object representing the log file.

Throws:
ConfigException - if the directory specified for the log file is missing or is not a directory.

getProperty

public String getProperty(String merchantID,
                          String prop)
Returns the value of the specified property. See the other version of this method for the complete behavior.

Parameters:
merchantID - merchant id.
prop - property to search for.
Returns:
the value of the specified property or null if none is found.

getProperty

public String getProperty(String merchantID,
                          String prop,
                          String defaultVal)
Returns the value of the specified property. The search behavior is as follows:
  1. In the Properties object supplied in the constructor, it looks for the property whose format is "merchantID.prop", e.g. "myMerchant.keysDirectory", unless the merchantID parameter is null, in which case, this step is skipped. If the Properties object is null, this and the second step are skipped.
  2. If it doesn't find one, it looks in the same Properties object for the property without the merchantID prefix, e.g. "keysDirectory".
  3. If it doesn't find one, it repeats steps 1 and 2, but looking in the System properties this time.
  4. If none is found, it returns the default value specified.

Parameters:
merchantID - merchant id.
prop - property to search for.
defaultVal - default value to return if property is not found (may be null).
Returns:
the value of the specified property or the default value specified if none is found.

getLogString

public String getLogString()
Returns a string representation of the properties for logging purposes.



Copyright © 2016. All Rights Reserved.