Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.paypal.base.nvp;
  
  import java.util.HashMap;
  import java.util.Map;
  
PlatformAPICallPreHandler is an implementation of com.paypal.base.APICallPreHandler for NVP based API service
 
 public class PlatformAPICallPreHandler implements APICallPreHandler {

Service Name
 
 	private final String serviceName;

API method
 
 	private final String method;

Raw payload from stubs
 
 	private final String rawPayLoad;

API Username for authentication
 
 	private String apiUserName;

 
 	private ICredential credential;

Access token if any for authorization
 
 	private String accessToken;

TokenSecret if any for authorization
 
 	private String tokenSecret;

SDK Name used in tracking
 
 	private String sdkName;

SDK Version
 
 	private String sdkVersion;

PortName to which a particular operation is bound;
 
 	private String portName;

Internal variable to hold headers
 
 	private Map<StringStringheaders;

Map used for to override ConfigManager configurations
 
 	private Map<StringStringconfigurationMap = null;

Deprecated:
Private Constructor
 
 	private PlatformAPICallPreHandler(String rawPayLoadString serviceName,
 			String method) {
 		super();
 		this. = rawPayLoad;
 		this. = serviceName;
 		this. = method;
 	}

Private Constructor

Parameters:
rawPayLoad
serviceName
method
configurationMap
	private PlatformAPICallPreHandler(String rawPayLoadString serviceName,
			String methodMap<StringStringconfigurationMap) {
		super();
		this. = rawPayLoad;
		this. = serviceName;
		this. = method;
		this. = configurationMap;
	}

PlatformAPICallPreHandler

Deprecated:
Parameters:
serviceName Service Name
rawPayLoad Payload
method API method
apiUserName API Username
accessToken Access Token
tokenSecret Token Secret
Throws:
com.paypal.base.exception.MissingCredentialException
com.paypal.base.exception.InvalidCredentialException
	public PlatformAPICallPreHandler(String rawPayLoadString serviceName,
			String methodString apiUserNameString accessToken,
			String tokenSecretthrows InvalidCredentialException,
		this(rawPayLoadserviceNamemethod);
		this. = apiUserName;
		this. = accessToken;
		this. = tokenSecret;
	}

PlatformAPICallPreHandler

Deprecated:
Parameters:
serviceName Service Name
rawPayLoad Payload
method API method
credential com.paypal.base.credential.ICredential instance
	public PlatformAPICallPreHandler(String rawPayLoadString serviceName,
			String methodICredential credential) {
		this(rawPayLoadserviceNamemethod);
		if (credential == null) {
					"Credential is null in PlatformAPICallPreHandler");
		}
		this. = credential;
	}

PlatformAPICallPreHandler

Parameters:
serviceName Service Name
rawPayLoad Payload
method API method
credential com.paypal.base.credential.ICredential instance
sdkName SDK Name
sdkVersion sdkVersion
portName Port Name
configurationMap
	public PlatformAPICallPreHandler(String rawPayLoadString serviceName,
			String methodICredential credentialString sdkName,
			String sdkVersionString portName,
			Map<StringStringconfigurationMap) {
		this(rawPayLoadserviceNamemethodconfigurationMap);
		if (credential == null) {
					"Credential is null in PlatformAPICallPreHandler");
		}
		this. = credential;
		this. = sdkName;
		this. = sdkVersion;
		this. = portName;
	}

PlatformAPICallPreHandler

Parameters:
serviceName Service Name
rawPayLoad Payload
method API method
apiUserName API Username
accessToken Access Token
tokenSecret Token Secret
sdkName SDK Name
sdkVersion sdkVersion
portName Port Name
configurationMap
Throws:
com.paypal.base.exception.MissingCredentialException
com.paypal.base.exception.InvalidCredentialException
	public PlatformAPICallPreHandler(String rawPayLoadString serviceName,
			String methodString apiUserNameString accessToken,
			String tokenSecretString sdkNameString sdkVersion,
			String portNameMap<StringStringconfigurationMap)
		this(rawPayLoadserviceNamemethodconfigurationMap);
		this. = apiUserName;
		this. = accessToken;
		this. = tokenSecret;
		this. = sdkName;
		this. = sdkVersion;
		this. = portName;
	}

Returns:
the sdkName
	public String getSdkName() {
		return ;
	}

Deprecated:
Parameters:
sdkName the sdkName to set
	public void setSdkName(String sdkName) {
		this. = sdkName;
	}

Returns:
the sdkVersion
	public String getSdkVersion() {
		return ;
	}

Deprecated:
Parameters:
sdkVersion the sdkVersion to set
	public void setSdkVersion(String sdkVersion) {
		this. = sdkVersion;
	}

Returns:
the portName
	public String getPortName() {
		return ;
	}

Deprecated:
Parameters:
portName the portName to set
	public void setPortName(String portName) {
		this. = portName;
	}
	public Map<StringStringgetHeaderMap() throws OAuthException {
		if ( == null) {
			if ( instanceof SignatureCredential) {
				SignatureHttpHeaderAuthStrategy signatureHttpHeaderAuthStrategy = new SignatureHttpHeaderAuthStrategy(
				 = signatureHttpHeaderAuthStrategy
else if ( instanceof CertificateCredential) {
				CertificateHttpHeaderAuthStrategy certificateHttpHeaderAuthStrategy = new CertificateHttpHeaderAuthStrategy(
				 = certificateHttpHeaderAuthStrategy
			}
		}
		return ;
	}
	public String getPayLoad() {
		// No processing necessary for NVP return the raw payload
		return ;
	}
	public String getEndPoint() {
		String endPoint = searchEndpoint();
		if (endPoint != null) {
			if (endPoint.endsWith("/")) {
				endPoint +=  + "/" + ;
else {
				endPoint += "/" +  + "/" + ;
			}
		}
		return endPoint;
	}
		return ;
	}
	public void validate() throws ClientActionRequiredException {
		if (mode == null && searchEndpoint() == null) {
			// Mandatory Mode not specified.
					"mode[production/live] OR endpoint not specified");
		}
		if ((mode != null)
				&& (!mode.trim().equalsIgnoreCase(.) && !mode
			// Mandatory Mode not specified.
					"mode[production/live] OR endpoint not specified");
		}
	}
	/*
	 * Search a valid endpoint in the configuration, returning null if not found
	 */
	private String searchEndpoint() {
		String endPoint = this..get(. + "."
getPortName()) != null ? this.
						.get(.) : null);
		if (endPoint != null && endPoint.trim().length() <= 0) {
			endPoint = null;
		}
		return endPoint;
	}
		ICredential returnCredential = null;
		CredentialManager credentialManager = new CredentialManager(
		returnCredential = credentialManager.getCredentialObject();
		if ( != null && .length() != 0) {
			if (returnCredential instanceof SignatureCredential) {
				SignatureCredential sigCred = (SignatureCredentialreturnCredential;
				sigCred.setThirdPartyAuthorization(tokenAuth);
else if (returnCredential instanceof CertificateCredential) {
				CertificateCredential certCred = (CertificateCredentialreturnCredential;
				certCred.setThirdPartyAuthorization(tokenAuth);
			}
		}
		return returnCredential;
	}
		Map<StringStringreturnMap = new HashMap<StringString>();
		// Add user-agent header
		returnMap.putAll(uaHeader.getHeader());
		String sandboxEmailAddress = this.
		if (sandboxEmailAddress != null) {
					sandboxEmailAddress);
		}
		return returnMap;
	}
	private String getApplicationId() {
		String applicationId = null;
		if ( instanceof CertificateCredential) {
			applicationId = ((CertificateCredential)
else if ( instanceof SignatureCredential) {
			applicationId = ((SignatureCredential)
		}
		return applicationId;
	}
	private void initCredential() throws InvalidCredentialException,
		if ( == null) {
		}
	}
New to GrepCode? Check out our FAQ X