Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.paypal.base;
  
  import java.io.File;
  import java.util.Map;
 
 
BaseService acts as base class for any concrete API service. The Service class generated may extend this class to make API calls through HTTP
 
 public abstract class BaseService {
 
 	private static final Logger log = LoggerFactory.getLogger(BaseService.class);
 
 	/*
 	 * Map used for to override ConfigManager configurations
 	 */
 	protected Map<StringStringconfigurationMap = null;

Access Token used in third party authorization
 
 	private String accessToken = null;

Token secret used in third party authorization
 
 	private String tokenSecret = null;

Last request processed
 
 	private String lastRequest = null;

Last response received
 
 	private String lastResponse = null;

Default Constructor
 
 	public BaseService() {
 		
 	}

Constructs BaseService using the supplied java.io.InputStream for java.util.Properties configuration

Parameters:
inputStream java.util.Properties configuration stream
Throws:
java.io.IOException
 
 	public BaseService(InputStream inputStreamthrows IOException {
 		Properties properties = new Properties();
 		properties.load(inputStream);
 		this. = SDKUtil.constructMap(properties);
 	}

Constructs BaseService using the supplied java.util.Properties for configuration

Parameters:
properties Configuration java.util.Properties
 
 	public BaseService(Properties properties) {
 		this. = SDKUtil.constructMap(properties);
 	}

Constructs BaseService using the supplied java.util.Map for configuration

Parameters:
configurationMap Configuration java.util.Map
 
 	public BaseService(Map<StringStringconfigurationMap) {
 		this. = SDKUtil.combineDefaultMap(configurationMap);
 	}

Gets the Access Token

Returns:
the accessToken
	public String getAccessToken() {
		return ;
	}

Sets the Access Token

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

Gets the Token Secret

Returns:
the tokenSecret
	public String getTokenSecret() {
		return ;
	}

Sets the Token Secret

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

Returns:
the lastRequest
	public String getLastRequest() {
		return ;
	}

Parameters:
lastRequest the lastRequest to set
	public void setLastRequest(String lastRequest) {
		this. = lastRequest;
	}

Returns:
the lastResponse
	public String getLastResponse() {
		return ;
	}

Parameters:
lastResponse the lastResponse to set
	public void setLastResponse(String lastResponse) {
		this. = lastResponse;
	}

Initialize from sdk_config.properties
	protected void initializeToDefault() {
		 = SDKUtil.combineDefaultMap(ConfigManager
	}

Overloaded static method used to load the configuration file.

Deprecated:
Parameters:
is
	protected static void initConfig(InputStream isthrows IOException {
		try {
			ConfigManager.getInstance().load(is);
catch (IOException ioe) {
			.debug(ioe.getMessage(), ioe);
			throw ioe;
		}
	}

Overloaded static method used to load the configuration file

Deprecated:
Parameters:
file
	protected static void initConfig(File filethrows IOException {
		try {
			if (!file.exists()) {
				throw new FileNotFoundException("File doesn't exist: "
file.getAbsolutePath());
			}
			FileInputStream fis = new FileInputStream(file);
catch (IOException ioe) {
			.debug(ioe.getMessage(), ioe);
			throw ioe;
		}
	}

Overloaded static method used to load the configuration file

Deprecated:
Parameters:
filepath
	protected static void initConfig(String filepaththrows IOException {
		try {
			File file = new File(filepath);
catch (IOException ioe) {
			.debug(ioe.getMessage(), ioe);
			throw ioe;
		}
	}

Initializes ConfigManager with the passed java.util.Properties instance

Deprecated:
Parameters:
properties java.util.Properties instance
	protected static void initConfig(Properties properties) {
		ConfigManager.getInstance().load(properties);
	}

	protected String call(APICallPreHandler apiCallPrehandler)
		if (this. == null || this..size() <= 0) {
					"Configuration not loaded..");
		}
		APIService apiService = new APIService();
		 = apiCallPrehandler.getPayLoad();
		String response = apiService.makeRequestUsing(apiCallPrehandler);
		 = response;
		return response;
	}
New to GrepCode? Check out our FAQ X