public class AbstractGemFireAsLastResourceAspectSupport extends Object implements Ordered
AbstractGemFireAsLastResourceAspectSupport is an abstract base class encapsulating functionality common
to all AOP Aspect extensions/implementations involving the GemFire JCA ResourceAdapter object registered in
the JNDI context of a managed environment.| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractGemFireAsLastResourceAspectSupport.GemFireConnectionHolder |
| Modifier and Type | Field and Description |
|---|---|
protected static String |
DEFAULT_GEMFIRE_JCA_RESOURCE_ADAPTER_JNDI_NAME |
protected static int |
DEFAULT_ORDER |
protected static boolean |
DEFAULT_THROW_ON_ERROR |
protected static org.springframework.data.gemfire.config.annotation.support.AbstractGemFireAsLastResourceAspectSupport.Consumer<String> |
NO_OP_LOGGER |
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE| Constructor and Description |
|---|
AbstractGemFireAsLastResourceAspectSupport() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
atTransactionalMethod()
Defines an AOP Pointcut identifying Join Points during the execution of the application's components
on which this Aspect should be applied.
|
protected void |
atTransactionalType()
Defines an AOP Pointcut identifying Join Points during the execution of the application's components
on which this Aspect should be applied.
|
protected String |
format(String message,
Object... args)
|
protected Context |
getContext()
Returns a reference to the naming
Context. |
protected Integer |
getDefaultOrder()
Returns the default order used by this AOP Aspect in the chain of Aspects configured
in Spring's Transaction Management.
|
protected <T extends com.gemstone.gemfire.cache.GemFireCache> |
getGemFireCache()
Returns a reference to the
GemFireCache used to interact with GemFire. |
String |
getGemFireJcaResourceAdapterJndiName()
Returns the configured reference to GemFire's JCA ResourceAdapter registered in the managed environment's
JNDI context.
|
String |
getInitialContextFactory()
Returns the configured, fully-qualified classname of the
InitialContextFactory
used to construct the InitialContext that is then used to lookup managed objects registered
in the JNDI context of the managed environment. |
protected org.slf4j.Logger |
getLogger()
Returns a reference to the
Logger used to record debug, info, warning and error messages
logged by the application. |
int |
getOrder()
Returns the order of this AOP Aspect relative to other Aspects in the chain of Aspects configured
in Spring's Transaction Management.
|
String |
getProviderUrl()
Returns the URL of the Naming Context Provider as a
String. |
boolean |
isThrowOnError()
Determines whether an Exception should be thrown when this Aspect is unable to perform its function.
|
protected <T extends AbstractGemFireAsLastResourceAspectSupport> |
logDebugInfo(String message,
Object... args)
|
protected <T extends AbstractGemFireAsLastResourceAspectSupport> |
logError(String message,
Object... args)
|
protected <T extends AbstractGemFireAsLastResourceAspectSupport> |
logInfo(String message,
Object... args)
|
protected <T extends AbstractGemFireAsLastResourceAspectSupport> |
logTraceInfo(org.springframework.data.gemfire.config.annotation.support.AbstractGemFireAsLastResourceAspectSupport.Supplier<String> logMessage)
Logs the given
log message at Level.TRACE level when tracing is enabled. |
protected <T extends AbstractGemFireAsLastResourceAspectSupport> |
logTraceInfo(String message,
Object... args)
|
protected <T extends AbstractGemFireAsLastResourceAspectSupport> |
logWarning(String message,
Object... args)
|
protected InitialContext |
newInitialContext(Hashtable<?,?> environment)
Constructs a new instance of the
InitialContext configured with the given environment. |
protected org.slf4j.Logger |
newLogger()
Constructs a new instance of
Logger used by this application to log messages. |
protected Context |
resolveContext()
Resolves the
Context used to perform lookups of registered, managed objects in a management environment. |
protected Hashtable<?,?> |
resolveEnvironment()
Resolves the
environment used by the application to configure the InitialContext. |
protected com.gemstone.gemfire.cache.GemFireCache |
resolveGemFireCache()
Resolves a reference to the
GemFireCache required by this Aspect to perform its function. |
protected String |
resolveGemFireJcaResourceAdapterJndiName()
Resolves the configured JNDI name used to lookup and resolve the GemFire JCA ResourceAdapter object
from the JNDI context in the managed environment.
|
void |
setOrder(int order)
Sets the order of this AOP Aspect relative to other Aspects in the chain of Aspects configured
in Spring's Transaction Management.
|
<T extends AbstractGemFireAsLastResourceAspectSupport> |
withThrowOnError(boolean throwOnError)
Builder method used to set the
throwOnError property. |
protected static final boolean DEFAULT_THROW_ON_ERROR
protected static final int DEFAULT_ORDER
protected static final org.springframework.data.gemfire.config.annotation.support.AbstractGemFireAsLastResourceAspectSupport.Consumer<String> NO_OP_LOGGER
protected static final String DEFAULT_GEMFIRE_JCA_RESOURCE_ADAPTER_JNDI_NAME
public AbstractGemFireAsLastResourceAspectSupport()
protected <T extends com.gemstone.gemfire.cache.GemFireCache> T getGemFireCache()
GemFireCache used to interact with GemFire.T - Class sub-type of the GemFireCache in use.GemFireCache.GemFireCachepublic String getGemFireJcaResourceAdapterJndiName()
String containing the configured reference to GemFire's JCA ResourceAdapter
registered in the managed environment's JNDI context.public String getInitialContextFactory()
InitialContextFactory
used to construct the InitialContext that is then used to lookup managed objects registered
in the JNDI context of the managed environment.InitialContextFactory
used to construct the InitialContext.protected org.slf4j.Logger getLogger()
Logger used to record debug, info, warning and error messages
logged by the application.Logger used by the application for logging purposes.Loggerpublic void setOrder(int order)
order - int value specifying the relative order of this Aspect.Orderedpublic int getOrder()
protected Integer getDefaultOrder()
public String getProviderUrl()
String.public boolean isThrowOnError()
protected void atTransactionalType()
Transactional annotated
application service types. That is, the Transactional
annotation is used at the class level.Pointcutprotected void atTransactionalMethod()
Transactional annotated
application service methods. That is, the
Transactional annotation is used at the service class,
service method level.Pointcutprotected String format(String message, Object... args)
message - String containing the message to format.args - array of arguments used to format the message.message formatted with the provided array of arguments.String.format(String, Object...)protected <T extends AbstractGemFireAsLastResourceAspectSupport> T logDebugInfo(String message, Object... args)
message formatted with the given array of arguments
at Level.DEBUG level when debugging is enabled.T - Class type extension of AbstractGemFireAsLastResourceAspectSupport.message - String containing the message to log.args - array of arguments used to format the message.Logger.isDebugEnabled(),
Logger.debug(String, Object...),
format(String, Object...)protected <T extends AbstractGemFireAsLastResourceAspectSupport> T logInfo(String message, Object... args)
message formatted with the given array of arguments
at Level.INFO level when info logging is enabled.T - Class type extension of AbstractGemFireAsLastResourceAspectSupport.message - String containing the message to log.args - array of arguments used to format the message.Logger.isInfoEnabled(),
Logger.info(String, Object...),
format(String, Object...)protected <T extends AbstractGemFireAsLastResourceAspectSupport> T logTraceInfo(String message, Object... args)
message formatted with the given array of arguments
at Level.TRACE level when tracing is enabled.T - Class type extension of AbstractGemFireAsLastResourceAspectSupport.message - String containing the message to log.args - array of arguments used to format the message.logTraceInfo(Supplier)protected <T extends AbstractGemFireAsLastResourceAspectSupport> T logTraceInfo(org.springframework.data.gemfire.config.annotation.support.AbstractGemFireAsLastResourceAspectSupport.Supplier<String> logMessage)
log message at Level.TRACE level when tracing is enabled.T - Class type extension of AbstractGemFireAsLastResourceAspectSupport.logMessage - Supplier of the message to log.Logger.isTraceEnabled(),
Logger.trace(String)protected <T extends AbstractGemFireAsLastResourceAspectSupport> T logWarning(String message, Object... args)
message formatted with the given array of arguments
at Level.WARN level when warnings are enabled.T - Class type extension of AbstractGemFireAsLastResourceAspectSupport.message - String containing the message to log.args - array of arguments used to format the message.Logger.isWarnEnabled(),
Logger.warn(String, Object...),
format(String, Object...)protected <T extends AbstractGemFireAsLastResourceAspectSupport> T logError(String message, Object... args)
message formatted with the given array of arguments
at Level.ERROR level when error logging is enabled.T - Class type extension of AbstractGemFireAsLastResourceAspectSupport.message - String containing the message to log.args - array of arguments used to format the message.Logger.isErrorEnabled(),
Logger.error(String, Object...),
format(String, Object...)protected InitialContext newInitialContext(Hashtable<?,?> environment) throws NamingException
InitialContext configured with the given environment.environment - Hashtable containing environment configuration meta-data used to access
the JNDI context in a managed environment.InitialContext configured with the given environment.NamingException - if the InitialContext could not be initialized with
the provided environment.InitialContext,
Hashtableprotected org.slf4j.Logger newLogger()
Logger used by this application to log messages.Logger.protected Context resolveContext()
Context used to perform lookups of registered, managed objects in a management environment.Context used to perform lookups of registered, managed objects in a managed environment.IllegalStateException - if the Context could not be resolved.GemFireCache.getJNDIContext(),
newInitialContext(Hashtable),
resolveEnvironment(),
resolveGemFireCache(),
getContext(),
Contextprotected Hashtable<?,?> resolveEnvironment()
environment used by the application to configure the InitialContext.environment used to configure the InitialContext.getInitialContextFactory(),
getProviderUrl(),
Hashtableprotected com.gemstone.gemfire.cache.GemFireCache resolveGemFireCache()
GemFireCache required by this Aspect to perform its function.
This method either returns the configured GemFireCache instance or looks up
the GemFireCache instance using GemFire's API.GemFireCache instance.CacheUtils.resolveGemFireCache(),
GemFireCache,
getGemFireCache()protected String resolveGemFireJcaResourceAdapterJndiName()
String containing the JNDI name used to lookup and resolve the GemFire JCA ResourceAdapter
object from the JNDI context in the managed environment.getGemFireJcaResourceAdapterJndiName()public <T extends AbstractGemFireAsLastResourceAspectSupport> T withThrowOnError(boolean throwOnError)
throwOnError property.
The throwOnError property is used to indicate whether an Exception should be thrown
when an error occurs during the normal operation and function of this Aspect. By default, the error condition
is simply logged.T - sub-type of this Aspect.throwOnError - boolean value used to set the throwOnError property.isThrowOnError()Copyright © 2011–2017 Pivotal Software, Inc.. All rights reserved.