facebook4j.conf
Class ConfigurationBase

java.lang.Object
  extended by facebook4j.conf.ConfigurationBase
All Implemented Interfaces:
AuthorizationConfiguration, Configuration, HttpClientConfiguration, HttpClientWrapperConfiguration, java.io.Serializable
Direct Known Subclasses:
PropertyConfiguration

public class ConfigurationBase
extends java.lang.Object
implements Configuration, java.io.Serializable

Configuration base class with default settings.

Author:
Yusuke Yamamoto - yusuke at mac.com, Ryuji Yamashita - roundrop at gmail.com
See Also:
Serialized Form

Field Summary
private  java.lang.String clientURL
           
private  java.lang.String clientVersion
           
static java.lang.String DALVIK
           
(package private) static java.lang.String dalvikDetected
           
private  boolean debug
           
private static java.lang.String DEFAULT_OAUTH_ACCESS_TOKEN_URL
           
private static java.lang.String DEFAULT_OAUTH_AUTHORIZATION_URL
           
private static java.lang.String DEFAULT_REST_BASE_URL
           
private static java.lang.String DEFAULT_VIDEO_BASE_URL
           
private  int defaultMaxPerRoute
           
static java.lang.String GAE
           
(package private) static java.lang.String gaeDetected
           
private  boolean gzipEnabled
           
private  int httpConnectionTimeout
           
private  java.lang.String httpProxyHost
           
private  java.lang.String httpProxyPassword
           
private  int httpProxyPort
           
private  java.lang.String httpProxyUser
           
private  int httpReadTimeout
           
private  int httpRetryCount
           
private  int httpRetryIntervalSeconds
           
private  int httpStreamingReadTimeout
           
private static java.util.List<ConfigurationBase> instances
           
private  boolean IS_DALVIK
           
private  boolean IS_GAE
           
private  boolean jsonStoreEnabled
           
private  int maxTotalConnections
           
private  boolean mbeanEnabled
           
private  java.lang.String oAuthAccessToken
           
private  java.lang.String oAuthAccessTokenURL
           
private  java.lang.String oAuthAppId
           
private  java.lang.String oAuthAppSecret
           
private  java.lang.String oAuthAuthorizationURL
           
private  java.lang.String oAuthPermissions
           
private  boolean prettyDebug
           
(package private)  java.util.Map<java.lang.String,java.lang.String> requestHeaders
           
private  java.lang.String restBaseURL
           
private static long serialVersionUID
           
private  java.lang.String userAgent
           
private  boolean useSSL
           
private  java.lang.String videoBaseURL
           
 
Constructor Summary
protected ConfigurationBase()
           
 
Method Summary
protected  void cacheInstance()
           
private static void cacheInstance(ConfigurationBase conf)
           
 boolean equals(java.lang.Object o)
           
private  void fixRestBaseURL()
           
(package private) static java.lang.String fixURL(boolean useSSL, java.lang.String url)
           
private  void fixVideoBaseURL()
           
 java.lang.String getClientURL()
           
 java.lang.String getClientVersion()
           
 int getHttpConnectionTimeout()
           
 int getHttpDefaultMaxPerRoute()
           
 int getHttpMaxTotalConnections()
           
 java.lang.String getHttpProxyHost()
           
 java.lang.String getHttpProxyPassword()
           
 int getHttpProxyPort()
           
 java.lang.String getHttpProxyUser()
           
 int getHttpReadTimeout()
           
 int getHttpRetryCount()
           
 int getHttpRetryIntervalSeconds()
           
 int getHttpStreamingReadTimeout()
           
private static ConfigurationBase getInstance(ConfigurationBase configurationBase)
           
 java.lang.String getOAuthAccessToken()
           
 java.lang.String getOAuthAccessTokenURL()
           
 java.lang.String getOAuthAppId()
           
 java.lang.String getOAuthAppSecret()
           
 java.lang.String getOAuthAuthorizationURL()
           
 java.lang.String getOAuthPermissions()
           
 java.util.Map<java.lang.String,java.lang.String> getRequestHeaders()
           
 java.lang.String getRestBaseURL()
           
 java.lang.String getUserAgent()
           
 java.lang.String getVideoBaseURL()
           
 int hashCode()
           
private  void initRequestHeaders()
           
 boolean isDalvik()
           
 boolean isDebugEnabled()
           
 boolean isGAE()
           
 boolean isGZIPEnabled()
           
 boolean isJSONStoreEnabled()
           
 boolean isMBeanEnabled()
           
 boolean isPrettyDebugEnabled()
           
protected  java.lang.Object readResolve()
           
protected  void setClientURL(java.lang.String clientURL)
           
protected  void setClientVersion(java.lang.String clientVersion)
           
protected  void setDebug(boolean debug)
           
protected  void setGZIPEnabled(boolean gzipEnabled)
           
protected  void setHttpConnectionTimeout(int connectionTimeout)
           
protected  void setHttpDefaultMaxPerRoute(int defaultMaxPerRoute)
           
protected  void setHttpMaxTotalConnections(int maxTotalConnections)
           
protected  void setHttpProxyHost(java.lang.String proxyHost)
           
protected  void setHttpProxyPassword(java.lang.String proxyPassword)
           
protected  void setHttpProxyPort(int proxyPort)
           
protected  void setHttpProxyUser(java.lang.String proxyUser)
           
protected  void setHttpReadTimeout(int readTimeout)
           
protected  void setHttpRetryCount(int retryCount)
           
protected  void setHttpRetryIntervalSeconds(int retryIntervalSeconds)
           
protected  void setHttpStreamingReadTimeout(int httpStreamingReadTimeout)
           
protected  void setJSONStoreEnabled(boolean enabled)
           
protected  void setMBeanEnabled(boolean enabled)
           
protected  void setOAuthAccessToken(java.lang.String oAuthAccessToken)
           
protected  void setOAuthAccessTokenURL(java.lang.String oAuthAccessTokenURL)
           
protected  void setOAuthAppId(java.lang.String oAuthAppId)
           
protected  void setOAuthAppSecret(java.lang.String oAuthAppSecret)
           
protected  void setOAuthAuthorizationURL(java.lang.String oAuthAuthorizationURL)
           
protected  void setOAuthPermissions(java.lang.String oAuthPermissions)
           
protected  void setPrettyDebugEnabled(boolean prettyDebug)
           
protected  void setRestBaseURL(java.lang.String restBaseURL)
           
protected  void setUserAgent(java.lang.String userAgent)
           
protected  void setUseSSL(boolean useSSL)
           
protected  void setVideoBaseURL(java.lang.String videoBaseURL)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

debug

private boolean debug

userAgent

private java.lang.String userAgent

useSSL

private boolean useSSL

prettyDebug

private boolean prettyDebug

gzipEnabled

private boolean gzipEnabled

httpProxyHost

private java.lang.String httpProxyHost

httpProxyUser

private java.lang.String httpProxyUser

httpProxyPassword

private java.lang.String httpProxyPassword

httpProxyPort

private int httpProxyPort

httpConnectionTimeout

private int httpConnectionTimeout

httpReadTimeout

private int httpReadTimeout

httpStreamingReadTimeout

private int httpStreamingReadTimeout

httpRetryCount

private int httpRetryCount

httpRetryIntervalSeconds

private int httpRetryIntervalSeconds

maxTotalConnections

private int maxTotalConnections

defaultMaxPerRoute

private int defaultMaxPerRoute

oAuthAppId

private java.lang.String oAuthAppId

oAuthAppSecret

private java.lang.String oAuthAppSecret

oAuthPermissions

private java.lang.String oAuthPermissions

oAuthAccessToken

private java.lang.String oAuthAccessToken

oAuthAuthorizationURL

private java.lang.String oAuthAuthorizationURL

oAuthAccessTokenURL

private java.lang.String oAuthAccessTokenURL

restBaseURL

private java.lang.String restBaseURL

videoBaseURL

private java.lang.String videoBaseURL

jsonStoreEnabled

private boolean jsonStoreEnabled

mbeanEnabled

private boolean mbeanEnabled

clientVersion

private java.lang.String clientVersion

clientURL

private java.lang.String clientURL

DALVIK

public static final java.lang.String DALVIK
See Also:
Constant Field Values

GAE

public static final java.lang.String GAE
See Also:
Constant Field Values

DEFAULT_OAUTH_AUTHORIZATION_URL

private static final java.lang.String DEFAULT_OAUTH_AUTHORIZATION_URL
See Also:
Constant Field Values

DEFAULT_OAUTH_ACCESS_TOKEN_URL

private static final java.lang.String DEFAULT_OAUTH_ACCESS_TOKEN_URL
See Also:
Constant Field Values

DEFAULT_REST_BASE_URL

private static final java.lang.String DEFAULT_REST_BASE_URL
See Also:
Constant Field Values

DEFAULT_VIDEO_BASE_URL

private static final java.lang.String DEFAULT_VIDEO_BASE_URL
See Also:
Constant Field Values

IS_DALVIK

private boolean IS_DALVIK

IS_GAE

private boolean IS_GAE

dalvikDetected

static java.lang.String dalvikDetected

gaeDetected

static java.lang.String gaeDetected

requestHeaders

java.util.Map<java.lang.String,java.lang.String> requestHeaders

instances

private static final java.util.List<ConfigurationBase> instances
Constructor Detail

ConfigurationBase

protected ConfigurationBase()
Method Detail

isDalvik

public final boolean isDalvik()
Specified by:
isDalvik in interface Configuration

isGAE

public boolean isGAE()
Specified by:
isGAE in interface Configuration

isDebugEnabled

public final boolean isDebugEnabled()
Specified by:
isDebugEnabled in interface Configuration

setDebug

protected final void setDebug(boolean debug)

getUserAgent

public final java.lang.String getUserAgent()
Specified by:
getUserAgent in interface Configuration

setUserAgent

protected final void setUserAgent(java.lang.String userAgent)

isPrettyDebugEnabled

public boolean isPrettyDebugEnabled()
Specified by:
isPrettyDebugEnabled in interface HttpClientConfiguration

setUseSSL

protected final void setUseSSL(boolean useSSL)

setPrettyDebugEnabled

protected final void setPrettyDebugEnabled(boolean prettyDebug)

setGZIPEnabled

protected final void setGZIPEnabled(boolean gzipEnabled)

isGZIPEnabled

public boolean isGZIPEnabled()
Specified by:
isGZIPEnabled in interface HttpClientConfiguration

initRequestHeaders

private void initRequestHeaders()

getRequestHeaders

public java.util.Map<java.lang.String,java.lang.String> getRequestHeaders()
Specified by:
getRequestHeaders in interface HttpClientWrapperConfiguration
Returns:
request headers

getHttpProxyHost

public final java.lang.String getHttpProxyHost()
Specified by:
getHttpProxyHost in interface HttpClientConfiguration

setHttpProxyHost

protected final void setHttpProxyHost(java.lang.String proxyHost)

getHttpProxyUser

public final java.lang.String getHttpProxyUser()
Specified by:
getHttpProxyUser in interface HttpClientConfiguration

setHttpProxyUser

protected final void setHttpProxyUser(java.lang.String proxyUser)

getHttpProxyPassword

public final java.lang.String getHttpProxyPassword()
Specified by:
getHttpProxyPassword in interface HttpClientConfiguration

setHttpProxyPassword

protected final void setHttpProxyPassword(java.lang.String proxyPassword)

getHttpProxyPort

public final int getHttpProxyPort()
Specified by:
getHttpProxyPort in interface HttpClientConfiguration

setHttpProxyPort

protected final void setHttpProxyPort(int proxyPort)

getHttpConnectionTimeout

public final int getHttpConnectionTimeout()
Specified by:
getHttpConnectionTimeout in interface HttpClientConfiguration

setHttpConnectionTimeout

protected final void setHttpConnectionTimeout(int connectionTimeout)

getHttpReadTimeout

public final int getHttpReadTimeout()
Specified by:
getHttpReadTimeout in interface HttpClientConfiguration

setHttpReadTimeout

protected final void setHttpReadTimeout(int readTimeout)

getHttpStreamingReadTimeout

public int getHttpStreamingReadTimeout()

setHttpStreamingReadTimeout

protected final void setHttpStreamingReadTimeout(int httpStreamingReadTimeout)

getHttpRetryCount

public final int getHttpRetryCount()
Specified by:
getHttpRetryCount in interface HttpClientConfiguration

setHttpRetryCount

protected final void setHttpRetryCount(int retryCount)

getHttpRetryIntervalSeconds

public final int getHttpRetryIntervalSeconds()
Specified by:
getHttpRetryIntervalSeconds in interface HttpClientConfiguration

setHttpRetryIntervalSeconds

protected final void setHttpRetryIntervalSeconds(int retryIntervalSeconds)

getHttpMaxTotalConnections

public final int getHttpMaxTotalConnections()
Specified by:
getHttpMaxTotalConnections in interface HttpClientConfiguration

setHttpMaxTotalConnections

protected final void setHttpMaxTotalConnections(int maxTotalConnections)

getHttpDefaultMaxPerRoute

public final int getHttpDefaultMaxPerRoute()
Specified by:
getHttpDefaultMaxPerRoute in interface HttpClientConfiguration

setHttpDefaultMaxPerRoute

protected final void setHttpDefaultMaxPerRoute(int defaultMaxPerRoute)

getOAuthAppId

public final java.lang.String getOAuthAppId()
Specified by:
getOAuthAppId in interface AuthorizationConfiguration

setOAuthAppId

protected final void setOAuthAppId(java.lang.String oAuthAppId)

getOAuthAppSecret

public final java.lang.String getOAuthAppSecret()
Specified by:
getOAuthAppSecret in interface AuthorizationConfiguration

setOAuthAppSecret

protected final void setOAuthAppSecret(java.lang.String oAuthAppSecret)

getOAuthAccessToken

public java.lang.String getOAuthAccessToken()
Specified by:
getOAuthAccessToken in interface AuthorizationConfiguration

setOAuthAccessToken

protected final void setOAuthAccessToken(java.lang.String oAuthAccessToken)

getClientVersion

public final java.lang.String getClientVersion()
Specified by:
getClientVersion in interface Configuration

setClientVersion

protected final void setClientVersion(java.lang.String clientVersion)

getClientURL

public final java.lang.String getClientURL()
Specified by:
getClientURL in interface Configuration

setClientURL

protected final void setClientURL(java.lang.String clientURL)

getRestBaseURL

public java.lang.String getRestBaseURL()
Specified by:
getRestBaseURL in interface Configuration

getVideoBaseURL

public java.lang.String getVideoBaseURL()
Specified by:
getVideoBaseURL in interface Configuration

setRestBaseURL

protected final void setRestBaseURL(java.lang.String restBaseURL)

fixRestBaseURL

private void fixRestBaseURL()

setVideoBaseURL

protected final void setVideoBaseURL(java.lang.String videoBaseURL)

fixVideoBaseURL

private void fixVideoBaseURL()

getOAuthAuthorizationURL

public java.lang.String getOAuthAuthorizationURL()
Specified by:
getOAuthAuthorizationURL in interface Configuration

setOAuthAuthorizationURL

protected final void setOAuthAuthorizationURL(java.lang.String oAuthAuthorizationURL)

getOAuthAccessTokenURL

public java.lang.String getOAuthAccessTokenURL()
Specified by:
getOAuthAccessTokenURL in interface Configuration

setOAuthAccessTokenURL

protected final void setOAuthAccessTokenURL(java.lang.String oAuthAccessTokenURL)

isJSONStoreEnabled

public boolean isJSONStoreEnabled()
Specified by:
isJSONStoreEnabled in interface Configuration

setJSONStoreEnabled

protected final void setJSONStoreEnabled(boolean enabled)

isMBeanEnabled

public boolean isMBeanEnabled()
Specified by:
isMBeanEnabled in interface Configuration

setMBeanEnabled

protected final void setMBeanEnabled(boolean enabled)

getOAuthPermissions

public java.lang.String getOAuthPermissions()
Specified by:
getOAuthPermissions in interface AuthorizationConfiguration

setOAuthPermissions

protected void setOAuthPermissions(java.lang.String oAuthPermissions)

fixURL

static java.lang.String fixURL(boolean useSSL,
                               java.lang.String url)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

cacheInstance

private static void cacheInstance(ConfigurationBase conf)

cacheInstance

protected void cacheInstance()

getInstance

private static ConfigurationBase getInstance(ConfigurationBase configurationBase)

readResolve

protected java.lang.Object readResolve()
                                throws java.io.ObjectStreamException
Throws:
java.io.ObjectStreamException