com.google.code.linkedinapi.client
Class LinkedInApiClientFactory

java.lang.Object
  extended by com.google.code.linkedinapi.client.LinkedInApiClientFactory

public class LinkedInApiClientFactory
extends java.lang.Object

A factory for creating LinkedInApiClient objects.

Author:
Nabeel Mukhtar

Field Summary
private  LinkedInApiConsumer apiConsumer
          The api consumer.
private  java.lang.reflect.Constructor<? extends LinkedInApiClient> defaultClientImpl
          The default client impl.
private static java.util.Map<LinkedInApiConsumer,LinkedInApiClientFactory> factoriesMap
          The Constant factoriesMap.
private  java.util.concurrent.ExecutorService taskExecutor
          The task executor.
 
Constructor Summary
private LinkedInApiClientFactory(LinkedInApiConsumer apiConsumer)
          Instantiates a new linked in api client factory.
 
Method Summary
 AsyncLinkedInApiClient createAsyncLinkedInApiClient(LinkedInAccessToken accessToken)
          Creates a new LinkedInApiClient object.
 AsyncLinkedInApiClient createAsyncLinkedInApiClient(java.lang.String token, java.lang.String tokenSecret)
          Creates a new LinkedInApiClient object.
 LinkedInApiClient createLinkedInApiClient(java.lang.Class<? extends LinkedInApiClient> implClass, LinkedInAccessToken accessToken)
          Creates a new LinkedInApiClient object.
 LinkedInApiClient createLinkedInApiClient(LinkedInAccessToken accessToken)
          Creates a new LinkedInApiClient object.
 LinkedInApiClient createLinkedInApiClient(java.lang.String token, java.lang.String tokenSecret)
          Creates a new LinkedInApiClient object.
static LinkedInApiClientFactory newInstance(LinkedInApiConsumer apiConsumer)
          New instance.
static LinkedInApiClientFactory newInstance(java.lang.String consumerKey, java.lang.String consumerSecret)
          New instance.
 void setTaskExecutor(java.util.concurrent.ExecutorService taskExecutor)
          Sets the task executor to be used for asynchronous API calls.
private  void validateAccessToken(LinkedInAccessToken accessToken)
           
private static void validateConsumerKey(LinkedInApiConsumer apiConsumer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factoriesMap

private static final java.util.Map<LinkedInApiConsumer,LinkedInApiClientFactory> factoriesMap
The Constant factoriesMap.


taskExecutor

private java.util.concurrent.ExecutorService taskExecutor
The task executor.


apiConsumer

private LinkedInApiConsumer apiConsumer
The api consumer.


defaultClientImpl

private java.lang.reflect.Constructor<? extends LinkedInApiClient> defaultClientImpl
The default client impl.

Constructor Detail

LinkedInApiClientFactory

private LinkedInApiClientFactory(LinkedInApiConsumer apiConsumer)
Instantiates a new linked in api client factory.

Parameters:
apiConsumer - the api consumer
Method Detail

setTaskExecutor

public void setTaskExecutor(java.util.concurrent.ExecutorService taskExecutor)
Sets the task executor to be used for asynchronous API calls.

Parameters:
taskExecutor - the task executor

newInstance

public static LinkedInApiClientFactory newInstance(java.lang.String consumerKey,
                                                   java.lang.String consumerSecret)
New instance.

Parameters:
consumerKey - the consumer key
consumerSecret - the consumer secret
Returns:
the linked in api client factory

newInstance

public static LinkedInApiClientFactory newInstance(LinkedInApiConsumer apiConsumer)
New instance.

Parameters:
apiConsumer - the api consumer
Returns:
the linked in api client factory

createLinkedInApiClient

public LinkedInApiClient createLinkedInApiClient(LinkedInAccessToken accessToken)
Creates a new LinkedInApiClient object.

Parameters:
accessToken - the access token
Returns:
the linked in api client

createLinkedInApiClient

public LinkedInApiClient createLinkedInApiClient(java.lang.Class<? extends LinkedInApiClient> implClass,
                                                 LinkedInAccessToken accessToken)
Creates a new LinkedInApiClient object.

Parameters:
accessToken - the access token
Returns:
the linked in api client

createAsyncLinkedInApiClient

public AsyncLinkedInApiClient createAsyncLinkedInApiClient(LinkedInAccessToken accessToken)
Creates a new LinkedInApiClient object.

Parameters:
accessToken - the access token
Returns:
the async linked in api client

createLinkedInApiClient

public LinkedInApiClient createLinkedInApiClient(java.lang.String token,
                                                 java.lang.String tokenSecret)
Creates a new LinkedInApiClient object.

Parameters:
token - the token
tokenSecret - the token secret
Returns:
the linked in api client

createAsyncLinkedInApiClient

public AsyncLinkedInApiClient createAsyncLinkedInApiClient(java.lang.String token,
                                                           java.lang.String tokenSecret)
Creates a new LinkedInApiClient object.

Parameters:
token - the token
tokenSecret - the token secret
Returns:
the async linked in api client

validateConsumerKey

private static void validateConsumerKey(LinkedInApiConsumer apiConsumer)

validateAccessToken

private void validateAccessToken(LinkedInAccessToken accessToken)