facebook4j
Class FacebookBaseImpl

java.lang.Object
  extended by facebook4j.FacebookBaseImpl
All Implemented Interfaces:
OAuthSupport, java.io.Serializable
Direct Known Subclasses:
FacebookImpl

abstract class FacebookBaseImpl
extends java.lang.Object
implements java.io.Serializable, OAuthSupport

Base class of Facebook supports OAuth.

Author:
Ryuji Yamashita - roundrop at gmail.com

Field Summary
protected  Authorization auth
           
protected  Configuration conf
           
protected  z_F4JInternalFactory factory
           
protected  HttpClientWrapper http
           
protected  java.lang.String id
           
protected  java.lang.String name
           
private static long serialVersionUID
           
 
Constructor Summary
FacebookBaseImpl(Configuration conf, Authorization auth)
           
 
Method Summary
protected  void ensureAuthorizationEnabled()
           
 boolean equals(java.lang.Object obj)
           
protected  void fillInIDAndName()
           
 Authorization getAuthorization()
          
 Configuration getConfiguration()
          
 java.lang.String getId()
          
 java.lang.String getName()
          
private  OAuthSupport getOAuth()
           
 AccessToken getOAuthAccessToken()
          Returns an access token associated with this instance.
 AccessToken getOAuthAccessToken(java.lang.String oauthCode)
          Exchange the code for a User Access Token.
 AccessToken getOAuthAppAccessToken()
          Returns an App Access Token.
 java.lang.String getOAuthAuthorizationURL(java.lang.String callbackURL)
          
 java.lang.String getOAuthAuthorizationURL(java.lang.String callbackURL, java.lang.String state)
          
 int hashCode()
           
private  void init()
           
private  void readObject(java.io.ObjectInputStream stream)
           
protected  void setFactory()
           
protected  void setHttp()
           
 void setOAuthAccessToken(AccessToken accessToken)
          Sets the access token
 void setOAuthAppId(java.lang.String appId, java.lang.String appSecret)
          sets the OAuth AppID and App secret
 void setOAuthPermissions(java.lang.String permissions)
          sets the permissions
 void shutdown()
          
 java.lang.String toString()
           
private  void writeObject(java.io.ObjectOutputStream out)
           
 
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

http

protected transient HttpClientWrapper http

factory

protected z_F4JInternalFactory factory

conf

protected Configuration conf

auth

protected Authorization auth

id

protected transient java.lang.String id

name

protected transient java.lang.String name
Constructor Detail

FacebookBaseImpl

FacebookBaseImpl(Configuration conf,
                 Authorization auth)
Method Detail

init

private void init()

setHttp

protected void setHttp()

setFactory

protected void setFactory()

getId

public java.lang.String getId()
                       throws FacebookException,
                              java.lang.IllegalStateException

Throws:
FacebookException
java.lang.IllegalStateException

getName

public java.lang.String getName()
                         throws FacebookException,
                                java.lang.IllegalStateException

Throws:
FacebookException
java.lang.IllegalStateException

fillInIDAndName

protected void fillInIDAndName()
                        throws FacebookException
Throws:
FacebookException

getAuthorization

public final Authorization getAuthorization()


getConfiguration

public Configuration getConfiguration()


shutdown

public void shutdown()


ensureAuthorizationEnabled

protected final void ensureAuthorizationEnabled()

writeObject

private void writeObject(java.io.ObjectOutputStream out)
                  throws java.io.IOException
Throws:
java.io.IOException

readObject

private void readObject(java.io.ObjectInputStream stream)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

setOAuthAppId

public void setOAuthAppId(java.lang.String appId,
                          java.lang.String appSecret)
sets the OAuth AppID and App secret

Specified by:
setOAuthAppId in interface OAuthSupport
Parameters:
appId - OAuth AppID
appSecret - OAuth App secret

setOAuthPermissions

public void setOAuthPermissions(java.lang.String permissions)
sets the permissions

Specified by:
setOAuthPermissions in interface OAuthSupport
Parameters:
permissions - comma-separated permission names
See Also:
Permissions Reference

getOAuthAuthorizationURL

public java.lang.String getOAuthAuthorizationURL(java.lang.String callbackURL)

Specified by:
getOAuthAuthorizationURL in interface OAuthSupport

getOAuthAuthorizationURL

public java.lang.String getOAuthAuthorizationURL(java.lang.String callbackURL,
                                                 java.lang.String state)

Specified by:
getOAuthAuthorizationURL in interface OAuthSupport

getOAuthAccessToken

public AccessToken getOAuthAccessToken()
Returns an access token associated with this instance.

Specified by:
getOAuthAccessToken in interface OAuthSupport
Returns:
access token
See Also:
Server-Side Authentication

getOAuthAccessToken

public AccessToken getOAuthAccessToken(java.lang.String oauthCode)
                                throws FacebookException
Exchange the code for a User Access Token.

Specified by:
getOAuthAccessToken in interface OAuthSupport
Parameters:
oauthCode - OAuth code.
Returns:
User Access Token
Throws:
FacebookException - when Facebook service or network is unavailable, or the user has not authorized
See Also:
Server-Side Authentication

getOAuthAppAccessToken

public AccessToken getOAuthAppAccessToken()
                                   throws FacebookException
Returns an App Access Token.

Specified by:
getOAuthAppAccessToken in interface OAuthSupport
Returns:
App Access Token
Throws:
FacebookException - when Facebook service or network is unavailable, or the user has not authorized
See Also:
Server-Side Authentication

setOAuthAccessToken

public void setOAuthAccessToken(AccessToken accessToken)
Sets the access token

Specified by:
setOAuthAccessToken in interface OAuthSupport
Parameters:
accessToken - accessToken

getOAuth

private OAuthSupport getOAuth()

equals

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

hashCode

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

toString

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