SCRIPT_OBJECT
- as the core Scripting Type Object; the implementation of this must ideally, also support the Adapter
interfacepublic abstract class AdapterService<SCRIPT_OBJECT> extends Object
Modifier and Type | Class and Description |
---|---|
static class |
AdapterService.AdapterWrapper<SCRIPT_OBJECT> |
Constructor and Description |
---|
AdapterService() |
Modifier and Type | Method and Description |
---|---|
Object |
execute(String key,
Object... args)
Execute native scripts by given
Adapter definition |
abstract Object |
executeMethod(String key,
String methodName,
Object... args)
Execute Native script by default given method Name
|
boolean |
flushAdapter(String key)
Flush/Remove/Dispose the adapter instance
|
abstract AdapterService.AdapterWrapper |
get(String key) |
protected abstract AdapterService.AdapterWrapper |
getAdapterWrapper(String resourceLocationName,
org.springframework.scripting.ScriptSource scriptSource,
org.springframework.core.io.Resource scriptResourceRef) |
org.apache.commons.collections.Transformer |
getAliasToPathTransformer()
For a given key/alias return the actual path to the Resource.
|
abstract Collection<String> |
getKeys() |
Adapter |
getRegisteredAdapter(String key)
Get an
Adapter from this service. |
org.springframework.core.io.Resource |
getResource(String scriptLocation)
Resolve the script source for URL or Files.
|
AdapterService.AdapterWrapper |
registerAdapter(String key,
org.springframework.core.io.Resource resource)
For a given Alias/Key register a Resource identified by its path aka resourceLocationName
|
AdapterService.AdapterWrapper |
registerAdapter(String key,
String resourceLocationName)
For a given Alias/Key register a Resource identified by its path aka resourceLocationName
|
void |
registerMultiple(Map<String,Object> resourceMap)
If Adapters preset in
#adapters Map then initialize all the Adapters automatically
The map can have the path to the Reource or the Resource object itself. |
List<String> |
reload(Collection<String> keys) |
String |
reload(String keysStr)
Reload Scripts by name (in a comma separated String list)
|
boolean |
reloadAdapter(String key)
Flush & Re-Load the adapter instance.
|
abstract void |
remove(String key) |
abstract AdapterService.AdapterWrapper |
set(String key,
AdapterService.AdapterWrapper adapter) |
void |
setAliasToPathTransformer(org.apache.commons.collections.Transformer aliasToPathTransformer)
For a given key/alias return the actual path to the Resource.
|
void |
verify(org.springframework.core.io.Resource resource)
Allows to compile and check the script for compile time mistakes
|
public org.springframework.core.io.Resource getResource(String scriptLocation) throws Exception
scriptLocation
- Exception
public abstract AdapterService.AdapterWrapper get(String key)
public abstract AdapterService.AdapterWrapper set(String key, AdapterService.AdapterWrapper adapter)
public abstract void remove(String key)
public abstract Collection<String> getKeys()
public void verify(org.springframework.core.io.Resource resource) throws Exception
Exception
protected abstract AdapterService.AdapterWrapper getAdapterWrapper(String resourceLocationName, org.springframework.scripting.ScriptSource scriptSource, org.springframework.core.io.Resource scriptResourceRef) throws Exception
Exception
public AdapterService.AdapterWrapper registerAdapter(String key, String resourceLocationName) throws Exception
key
- as the Key Name to refer to the AdapterresourceLocationName
- AdapterService.AdapterWrapper
Exception
public AdapterService.AdapterWrapper registerAdapter(String key, org.springframework.core.io.Resource resource) throws Exception
key
- as the Key Name to refer to the Adapterresource
- as Resource
AdapterService.AdapterWrapper
Exception
public void registerMultiple(Map<String,Object> resourceMap) throws Exception
#adapters
Map
then initialize all the Adapters automatically
Resource
object itself.Exception
public boolean flushAdapter(String key)
key
- as the Key Name to refer to the Adapterpublic boolean reloadAdapter(String key)
key
- as the Key Name to refer to the Adapterpublic Adapter getRegisteredAdapter(String key) throws Exception
Adapter
from this service. If No adapter is defined for the key, then null will return.
public abstract Object executeMethod(String key, String methodName, Object... args) throws Exception
key
- to derive Script ObjectmethodName
- as Stringargs
- as Object[]Exception
public Object execute(String key, Object... args) throws Exception
Adapter
definitionkey
- methodName
- as Stringargs
- as Object[]Exception
public org.apache.commons.collections.Transformer getAliasToPathTransformer()
DefaultAliasToPathTransformer
public void setAliasToPathTransformer(org.apache.commons.collections.Transformer aliasToPathTransformer)
DefaultAliasToPathTransformer
public String reload(String keysStr) throws Exception
keysStr
- as String (comma separated)Exception
Copyright © 2018. All rights reserved.