public class ScriptableInterceptor<SERVICE_TYPE> extends Object implements org.aopalliance.intercept.MethodInterceptor
MethodInterceptor
; that will allow any existing Service to also have a Script version (using AdapterService
)
AdapterService
directly also; however this provides a one size fits all way of directly script-a-lizing existing services without
need for additional code (for the Lazy man who loves it short!) :)MethodInterceptor
intended to be used in org.springframework.aop.framework.ProxyFactoryBean
. This allows multiple other interceptors to be configured,
and provides additional configuration level flexibility.Constructor and Description |
---|
ScriptableInterceptor() |
Modifier and Type | Method and Description |
---|---|
String |
getAdapterAlias()
The
Adapter alias to fetch the real adapter from the {@link #adapterService |
AdapterService |
getAdapterService()
The
AdapterService to invoke the script. |
SERVICE_TYPE |
getDefaultService()
The default target service if Scripting not available
|
Object |
invoke(org.aopalliance.intercept.MethodInvocation invocation) |
boolean |
isProoceedToOriginalInFailure()
If there is a failure in the adapter then only proceed to Original service
If true, will require defaultService to exist (not null) |
void |
setAdapterAlias(String adapterAlias)
The
Adapter alias to fetch the real adapter from the {@link #adapterService |
void |
setAdapterService(AdapterService adapterService)
The
AdapterService to invoke the script. |
void |
setDefaultService(SERVICE_TYPE defaultService)
The default target service if Scripting not available
|
void |
setProoceedToOriginalInFailure(boolean prooceedToOriginalInFailure)
If there is a failure in the adapter then only proceed to Original service
If true, will require defaultService to exist (not null) |
public Object invoke(org.aopalliance.intercept.MethodInvocation invocation) throws Throwable
invoke
in interface org.aopalliance.intercept.MethodInterceptor
Throwable
public boolean isProoceedToOriginalInFailure()
defaultService
to exist (not null)public void setProoceedToOriginalInFailure(boolean prooceedToOriginalInFailure)
defaultService
to exist (not null)public SERVICE_TYPE getDefaultService()
Exception
. Useful if we do not want to risk alternate strategy and want to focus only on the primary
strategy provided by the script.public void setDefaultService(SERVICE_TYPE defaultService)
Exception
. Useful if we do not want to risk alternate strategy and want to focus only on the primary
strategy provided by the script.public AdapterService getAdapterService()
AdapterService
to invoke the script. This class will intercept the original call to pass it to the Adapter.public void setAdapterService(AdapterService adapterService)
AdapterService
to invoke the script. This class will intercept the original call to pass it to the Adapter.public String getAdapterAlias()
Adapter
alias to fetch the real adapter from the {@link #adapterServiceCopyright © 2018. All rights reserved.