com.google.api.ads.dfa.lib.client
Class DfaSession

java.lang.Object
  extended by com.google.api.ads.dfa.lib.client.DfaSession
All Implemented Interfaces:
AdsSession

public class DfaSession
extends Object
implements AdsSession

A DfaSession represents a single session of DFA use.

Author:
Adam Rogal

Nested Class Summary
static class DfaSession.Builder
          Builder for DfaSession.
static class DfaSession.Environment
          Enum representing the endpoint server, aka environment.
 
Method Summary
 String getApplicationName()
          Gets the application name.
 String getEndpoint()
          Returns the server endpoint to make requests against.
 String getImpersonatedToken()
          Gets the token necessary to impersonate.
 Long getNetworkToImpersonate()
          Gets the network to impersonate.
 String getPassword()
          Gets the password.
 String getToken()
          Gets the token used for authentication.
 String getUsername()
          Gets the user name.
 String getUsernameToImpersonate()
          Gets the username to impersonate.
 boolean isEnvironment(Endpoint environment)
          Determines if the session is for the supplied DfaSession.Environment.
 boolean isImpersonating()
          Indicates whether clients of this session will impersonate.
 void setImpersonatedToken(String impersonatedToken)
          Sets the token necessary to impersonate.
 void setNetworkToImpersonate(Long networkToImpersonate)
          Sets the network to impersonate.
 void setToken(String token)
          Sets the token associated with this session.
 void setUsernameToImpersonate(String usernameToImpersonate)
          Sets the username to impersonate.
 void stopImpersonating()
          Resets all settings related to impersonating in this session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setUsernameToImpersonate

public void setUsernameToImpersonate(String usernameToImpersonate)
Sets the username to impersonate. Only superusers may impersonate. Only a username to impersonate or a network to impersonate should ever be specified at the same time.


getUsernameToImpersonate

public String getUsernameToImpersonate()
Gets the username to impersonate. Only superusers may impersonate.


setNetworkToImpersonate

public void setNetworkToImpersonate(Long networkToImpersonate)
Sets the network to impersonate. Only superusers may impersonate. Only a username to impersonate or a network to impersonate should ever be specified at the same time.


getNetworkToImpersonate

public Long getNetworkToImpersonate()
Gets the network to impersonate. Only superusers may impersonate.


setImpersonatedToken

public void setImpersonatedToken(String impersonatedToken)
Sets the token necessary to impersonate. Only superusers may impersonate.


getImpersonatedToken

public String getImpersonatedToken()
Gets the token necessary to impersonate. Only superusers may impersonate.


isImpersonating

public boolean isImpersonating()
Indicates whether clients of this session will impersonate. A username or network ID is required to impersonate; just an impersonated token is not enough.


stopImpersonating

public void stopImpersonating()
Resets all settings related to impersonating in this session. You should call this method when switching between impersonating one username/network and another to ensure that the old impersonation token has been cleared.


setToken

public void setToken(String token)
Sets the token associated with this session.


getUsername

public String getUsername()
Gets the user name.


getPassword

public String getPassword()
Gets the password.


getToken

public String getToken()
Gets the token used for authentication.


getApplicationName

public String getApplicationName()
Gets the application name.


getEndpoint

public String getEndpoint()
Description copied from interface: AdsSession
Returns the server endpoint to make requests against.

Specified by:
getEndpoint in interface AdsSession
Returns:
the endpoint

isEnvironment

public boolean isEnvironment(Endpoint environment)
Determines if the session is for the supplied DfaSession.Environment.

Specified by:
isEnvironment in interface AdsSession
Parameters:
environment - the environment to check


Copyright © 2012. All Rights Reserved.