public abstract class BaseOAuthClientFactory extends Object implements org.apache.commons.pool.KeyedPoolableObjectFactory<String,OAuth2Adapter>
| Constructor and Description |
|---|
BaseOAuthClientFactory(OAuth2Manager<OAuth2Adapter> oauthManager,
ObjectStore<Serializable> objectStore) |
| Modifier and Type | Method and Description |
|---|---|
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
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 connector)
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
|
public BaseOAuthClientFactory(OAuth2Manager<OAuth2Adapter> oauthManager, ObjectStore<Serializable> objectStore)
protected abstract Class<? extends OAuth2Adapter> getAdapterClass()
OAuth2Adapter that this factory is supposed to
generateprotected abstract void setCustomAdapterProperties(OAuth2Adapter adapter, org.mule.common.security.oauth.OAuthState state)
adapter - a OAuth2Adapter which supports
custom propertiesstate - a OAuth2Adapter which is carrying
custom properties.protected abstract void setCustomStateProperties(OAuth2Adapter adapter, org.mule.common.security.oauth.OAuthState state)
adapter - a OAuth2Adapter which is
carrying custom propertiesstate - a OAuth2Adapterpublic final OAuth2Adapter makeObject(String key) throws Exception
OAuth2Adapter which concrete type depends on
the return of
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
OAuth2Connector.postAuth() method is invoked.makeObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory<String,OAuth2Adapter>key - the of the object at the object storeExceptionpublic final void destroyObject(String key, OAuth2Adapter obj) throws Exception
Stoppable or
Disposable, the object is destroyed by invoking
the corresponding methodsdestroyObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory<String,OAuth2Adapter>key - the key of the object at the object storeobj - an instance of OAuth2AdapterIllegalArgumentException - if obj is not an instance of the type returned
by getAdapterClass()Exceptionpublic final boolean validateObject(String key, OAuth2Adapter obj)
validateObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory<String,OAuth2Adapter>key - the key of the object at the object storeobj - an instance of OAuth2AdapterIllegalArgumentException - if obj is not an instance of the type returned
by getAdapterClass()public void activateObject(String key, OAuth2Adapter obj) throws Exception
activateObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory<String,OAuth2Adapter>Exceptionpublic final void passivateObject(String key, OAuth2Adapter connector) throws Exception
passivateObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory<String,OAuth2Adapter>key - the key of the object at the object storeconnector - an instance of OAuth2AdapterIllegalArgumentException - if obj is not an instance of the type returned by getAdapterClass()ExceptionCopyright © 2003–2018 MuleSoft, Inc.. All rights reserved.