org.mule.security.oauth
Class BaseOAuthClientFactory

java.lang.Object
  extended by org.mule.security.oauth.BaseOAuthClientFactory
All Implemented Interfaces:
org.apache.commons.pool.KeyedPoolableObjectFactory<String,OAuth2Adapter>

public abstract class BaseOAuthClientFactory
extends Object
implements org.apache.commons.pool.KeyedPoolableObjectFactory<String,OAuth2Adapter>


Constructor Summary
BaseOAuthClientFactory(OAuth2Manager<OAuth2Adapter> oauthManager, ObjectStore<Serializable> objectStore)
           
 
Method Summary
 void activateObject(String key, OAuth2Adapter obj)
          This default implementation does nothing
 void destroyObject(String key, OAuth2Adapter obj)
          If obj implements Stoppable or Disposable, the object is destroyed by invoking the corresponding methods
protected abstract  Class<? extends OAuth2Adapter> getAdapterClass()
          Returns the class of the concrete implementation of OAuth2Adapter that this factory is supposed to generate
 OAuth2Adapter makeObject(String key)
          This method creates an instance of OAuth2Adapter which concrete type depends on the return of org.mule.security.oauth.BaseOAuthClientFactory.getAdapterClass The adapter is fully initialized and interfaces such as Initialisable, MuleContextAware and Startable are respected by invoking the corresponding methods in case the adapter implements them.
 void passivateObject(String key, OAuth2Adapter obj)
          Passivates the object by updating the state of the persisted object with the one of the given one.
protected abstract  void setCustomAdapterProperties(OAuth2Adapter adapter, org.mule.common.security.oauth.OAuthState state)
          Implementors can levarage this method to move custom property values from the state to the adapter You can leave this method blank if not needed in your case.
protected abstract  void setCustomStateProperties(OAuth2Adapter adapter, org.mule.common.security.oauth.OAuthState state)
          Implementos can leverage this method to move custom property values from the adapter to the state.
 boolean validateObject(String key, OAuth2Adapter obj)
          Validates the object by checking that it exists at the object store and that the state of the given object is consisten with the persisted state
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseOAuthClientFactory

public BaseOAuthClientFactory(OAuth2Manager<OAuth2Adapter> oauthManager,
                              ObjectStore<Serializable> objectStore)
Method Detail

getAdapterClass

protected abstract Class<? extends OAuth2Adapter> getAdapterClass()
Returns the class of the concrete implementation of OAuth2Adapter that this factory is supposed to generate


setCustomAdapterProperties

protected abstract void setCustomAdapterProperties(OAuth2Adapter adapter,
                                                   org.mule.common.security.oauth.OAuthState state)
Implementors can levarage this method to move custom property values from the state to the adapter You can leave this method blank if not needed in your case.

Parameters:
adapter - a OAuth2Adapter which supports custom properties
state - a OAuth2Adapter which is carrying custom properties.

setCustomStateProperties

protected abstract void setCustomStateProperties(OAuth2Adapter adapter,
                                                 org.mule.common.security.oauth.OAuthState state)
Implementos can leverage this method to move custom property values from the adapter to the state. You can leave this method blank if not needed in your case.

Parameters:
adapter - a OAuth2Adapter which is carrying custom properties
state - a OAuth2Adapter

makeObject

public final OAuth2Adapter makeObject(String key)
                               throws Exception
This method creates an instance of OAuth2Adapter which concrete type depends on the return of org.mule.security.oauth.BaseOAuthClientFactory.getAdapterClass The adapter is fully initialized and interfaces such as Initialisable, MuleContextAware and Startable are respected by invoking the corresponding methods in case the adapter implements them. Finally, the org.mule.security.oauth.OAuth2Connector.postAuth() method is invoked.

Specified by:
makeObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory<String,OAuth2Adapter>
Parameters:
the - key of the object at the object store
Throws:
Exception

destroyObject

public final void destroyObject(String key,
                                OAuth2Adapter obj)
                         throws Exception
If obj implements Stoppable or Disposable, the object is destroyed by invoking the corresponding methods

Specified by:
destroyObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory<String,OAuth2Adapter>
Parameters:
key - the key of the object at the object store
obj - an instance of OAuth2Adapter
Throws:
IllegalArgumetException - if obj is not an instance of the type returned by org.mule.security.oauth.BaseOAuthClientFactory.getAdapterClass()
Exception

validateObject

public final boolean validateObject(String key,
                                    OAuth2Adapter obj)
Validates the object by checking that it exists at the object store and that the state of the given object is consisten with the persisted state

Specified by:
validateObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory<String,OAuth2Adapter>
Parameters:
key - the key of the object at the object store
obj - an instance of OAuth2Adapter
Throws:
IllegalArgumetException - if obj is not an instance of the type returned by org.mule.security.oauth.BaseOAuthClientFactory.getAdapterClass()

activateObject

public void activateObject(String key,
                           OAuth2Adapter obj)
                    throws Exception
This default implementation does nothing

Specified by:
activateObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory<String,OAuth2Adapter>
Throws:
Exception

passivateObject

public final void passivateObject(String key,
                                  OAuth2Adapter obj)
                           throws Exception
Passivates the object by updating the state of the persisted object with the one of the given one. If the object doesn't exist in the object store then it is created

Specified by:
passivateObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory<String,OAuth2Adapter>
Parameters:
key - the key of the object at the object store
obj - an instance of OAuth2Adapter
Throws:
IllegalArgumetException - if obj is not an instance of the type returned by org.mule.security.oauth.BaseOAuthClientFactory.getAdapterClass()
Exception


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.