atg.svc.clicktoconnect
Class C2CTools

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.svc.clicktoconnect.C2CTools
All Implemented Interfaces:
atg.naming.NameContextBindingListener, atg.naming.NameContextElement, atg.naming.NameResolver, atg.nucleus.AdminableService, atg.nucleus.logging.ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, atg.nucleus.naming.ComponentNameResolver, atg.nucleus.Service, atg.nucleus.ServiceListener, java.util.EventListener

public class C2CTools
extends atg.nucleus.GenericService

This class contains helper API used for managing click to connect operations in Service applications.

See Also:
C2CConstants

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String EXCEPTION_RESOURCE_NAME
          Resource name for log errors and exceptions
protected  boolean mCheckFTCallID
           
protected  EnvironmentTools mEnvironmentTools
           
protected  java.lang.String mProfileComponentPath
           
protected  java.lang.String mSecretKeyForHashCompare
           
protected static java.util.ResourceBundle sExceptionResourceBundle
          Resource bundle for log errors and exceptions
static java.lang.String USER_RESOURCE_NAME
          Resource name for user localized messages
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
C2CTools()
           
 
Method Summary
 boolean compareHash(C2CRequestData pC2CRequestData)
          Checks that the hash from the request matches the hash generated from the data on the request.
 java.lang.String computeHash(java.lang.String clearText)
          Computes a hash from a string.
 C2CRequestData createClickToCallRequestData(atg.servlet.DynamoHttpServletRequest pRequest)
          Initializes a new C2CRequestData data object from the given request
 C2CRequestData createClickToCallRequestData(java.lang.String pUserTelephoneNumber)
          Creates the C2CRequestData.
protected  C2CRequestData createNewClickToCallRequestData()
          Creates a new instance of the C2CRequestData object.
 java.lang.String generateHashText(C2CRequestData pC2CRequestData)
          Returns the string that's used to generate the hash value.
 atg.clicktoconnect.C2CSessionDataManager getC2CSessionDataManager()
          Get property C2CSessionDataManager
 C2CWebServiceManager getC2CWebServiceManager()
          Get property C2CWebServiceManager
 EnvironmentTools getEnvironmentTools()
           
 java.lang.String getExceptionMessage(java.lang.String pKey, java.lang.String[] pMessageArgs)
          Returns the message string from the exception resource library.
 java.lang.String getHashingAlgorithm()
          Returns property SomeProperty
 java.lang.String getProfileComponentPath()
          Path to the profile component used to determine if the session has been logged in.
 java.lang.String getSecretKeyForHashCompare()
          Returns the key value that uses to generate the hash value when comparing the hash generated by eStara for the request.
 java.lang.String getUserResource(java.lang.String pKey, java.lang.String[] pMsgArgs, java.util.Locale pLocale)
          Returns a resource from the user resource bundle
 boolean isCheckFTCallID()
          get CheckFTCallID
 boolean isLoggedIn()
          Returns true if the current session is logged in
 atg.repository.RepositoryItem loadC2CSessionData(java.lang.String pTokenID)
          Returns a repository item with the supplied token ID
 void setC2CSessionDataManager(atg.clicktoconnect.C2CSessionDataManager pC2CSessionDataManager)
          Set property C2CSessionDataManager
 void setC2CWebServiceManager(C2CWebServiceManager pC2CWebServiceManager)
          Set property C2CWebServiceManager
 void setCheckFTCallID(boolean pCheckFTCallID)
          If true, the ftcallid supplied on the original request is validated against the ftcallid returned from the estara web service.
 void setEnvironmentTools(EnvironmentTools pEnvironmentTools)
           
 void setHashingAlgorithm(java.lang.String pHashingAlgorithm)
          Sets property HashingAlgorithm
 void setProfileComponentPath(java.lang.String pProfileComponentPath)
           
 void setSecretKeyForHashCompare(java.lang.String pSecretKeyForHashCompare)
           
 void startNewC2CCall(C2CRequestData pC2CRequestData)
          Initializes the environment for a new c2c request.
 boolean validateFTCallId(C2CRequestData pC2CRequestData)
          validateFTCallId Checks that we have a valid eStara ftCallId by comparing the one provided as a request parameter to the one returned from the eStara web service.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
Class version string

See Also:
Constant Field Values

EXCEPTION_RESOURCE_NAME

public static final java.lang.String EXCEPTION_RESOURCE_NAME
Resource name for log errors and exceptions

See Also:
Constant Field Values

sExceptionResourceBundle

protected static java.util.ResourceBundle sExceptionResourceBundle
Resource bundle for log errors and exceptions


USER_RESOURCE_NAME

public static final java.lang.String USER_RESOURCE_NAME
Resource name for user localized messages

See Also:
Constant Field Values

mProfileComponentPath

protected java.lang.String mProfileComponentPath

mSecretKeyForHashCompare

protected java.lang.String mSecretKeyForHashCompare

mCheckFTCallID

protected boolean mCheckFTCallID

mEnvironmentTools

protected EnvironmentTools mEnvironmentTools
Constructor Detail

C2CTools

public C2CTools()
Method Detail

getProfileComponentPath

public java.lang.String getProfileComponentPath()
Path to the profile component used to determine if the session has been logged in.

Returns:
String

setProfileComponentPath

public void setProfileComponentPath(java.lang.String pProfileComponentPath)

getSecretKeyForHashCompare

public java.lang.String getSecretKeyForHashCompare()
Returns the key value that uses to generate the hash value when comparing the hash generated by eStara for the request.

This value should match the key value provided to eStara.

Returns:
String

setSecretKeyForHashCompare

public void setSecretKeyForHashCompare(java.lang.String pSecretKeyForHashCompare)

setCheckFTCallID

public void setCheckFTCallID(boolean pCheckFTCallID)
If true, the ftcallid supplied on the original request is validated against the ftcallid returned from the estara web service.

Parameters:
pCheckFTCallID - the CheckFTCallID

isCheckFTCallID

public boolean isCheckFTCallID()
get CheckFTCallID

Returns:
the CheckFTCallID

setC2CSessionDataManager

public void setC2CSessionDataManager(atg.clicktoconnect.C2CSessionDataManager pC2CSessionDataManager)
Set property C2CSessionDataManager

Parameters:
pC2CSessionDataManager -

getC2CSessionDataManager

public atg.clicktoconnect.C2CSessionDataManager getC2CSessionDataManager()
Get property C2CSessionDataManager

Returns:
C2CSessionDataManager

setC2CWebServiceManager

public void setC2CWebServiceManager(C2CWebServiceManager pC2CWebServiceManager)
Set property C2CWebServiceManager

Parameters:
pC2CWebServiceManager -

getC2CWebServiceManager

public C2CWebServiceManager getC2CWebServiceManager()
Get property C2CWebServiceManager

Returns:
C2CWebServiceManager

setHashingAlgorithm

public void setHashingAlgorithm(java.lang.String pHashingAlgorithm)
Sets property HashingAlgorithm

Parameters:
pHashingAlgorithm - an argument

getHashingAlgorithm

public java.lang.String getHashingAlgorithm()
Returns property SomeProperty

Returns:
The algorithm used to create the hash

getEnvironmentTools

public EnvironmentTools getEnvironmentTools()

setEnvironmentTools

public void setEnvironmentTools(EnvironmentTools pEnvironmentTools)

createClickToCallRequestData

public C2CRequestData createClickToCallRequestData(atg.servlet.DynamoHttpServletRequest pRequest)
                                            throws C2CException
Initializes a new C2CRequestData data object from the given request

This method is executed from the request pipeline to initialize the connect data from an initial request.

Parameters:
pRequest -
Returns:
C2CRequestData
Throws:
C2CException

createClickToCallRequestData

public C2CRequestData createClickToCallRequestData(java.lang.String pUserTelephoneNumber)
                                            throws C2CException
Creates the C2CRequestData.

Makes a call to webcare using pUserTelephoneNumber.

Retrieves the ClickToConnect application repository item and sets it in the C2CRequestData.

Parameters:
pUserTelephoneNumber -
Returns:
C2CRequestData
Throws:
C2CException

createNewClickToCallRequestData

protected C2CRequestData createNewClickToCallRequestData()
Creates a new instance of the C2CRequestData object. Extend this method if you have extended the C2CRequestData class

Returns:
ClickToConnectRequestData

getExceptionMessage

public java.lang.String getExceptionMessage(java.lang.String pKey,
                                            java.lang.String[] pMessageArgs)
Returns the message string from the exception resource library.

Parameters:
pKey -
pMessageArgs -
Returns:
message string from the execption resource bundle

getUserResource

public java.lang.String getUserResource(java.lang.String pKey,
                                        java.lang.String[] pMsgArgs,
                                        java.util.Locale pLocale)
Returns a resource from the user resource bundle

Parameters:
pKey -
pMsgArgs - msg arguments
pLocale - the locale
Returns:
String

startNewC2CCall

public void startNewC2CCall(C2CRequestData pC2CRequestData)
                     throws C2CException
Initializes the environment for a new c2c request.

Parameters:
pC2CRequestData -
Throws:
C2CException

computeHash

public java.lang.String computeHash(java.lang.String clearText)
                             throws java.security.NoSuchAlgorithmException
Computes a hash from a string. The algorithm for the hash is configurable

Parameters:
clearText - an argument
Returns:
hash of the username, sessionID, callerID and the hashKey
Throws:
java.security.NoSuchAlgorithmException

validateFTCallId

public boolean validateFTCallId(C2CRequestData pC2CRequestData)
validateFTCallId Checks that we have a valid eStara ftCallId by comparing the one provided as a request parameter to the one returned from the eStara web service.

Returns:
boolean, True if the ftCallId is valid, false if the ftCallId is invalid

generateHashText

public java.lang.String generateHashText(C2CRequestData pC2CRequestData)
Returns the string that's used to generate the hash value.

Consists of username, callerid and secret key. ftCallId is also included if isCheckFTCallId returns true

Parameters:
pC2CRequestData -
Returns:
text to be hashed

compareHash

public boolean compareHash(C2CRequestData pC2CRequestData)
Checks that the hash from the request matches the hash generated from the data on the request.

Returns:
boolean, True if the hash is valid false is the hash is invalid

isLoggedIn

public boolean isLoggedIn()
Returns true if the current session is logged in

Returns:
boolean

loadC2CSessionData

public atg.repository.RepositoryItem loadC2CSessionData(java.lang.String pTokenID)
                                                 throws C2CException
Returns a repository item with the supplied token ID

Parameters:
pTokenID -
Returns:
RepositoryItem with supplied token ID
Throws:
C2CException