public class ResourceLazyLoadingScript extends Object implements LazyLoadingScript, Externalizable
classpath:
prefix support).
When the scipt is constructed, the actual script contents is not loaded. Only if needed
the script contents will be loaded. See LazyLoadingRemoteInvocationAspect
.
Constructor and Description |
---|
ResourceLazyLoadingScript() |
ResourceLazyLoadingScript(String name,
String type,
String resoruceLocation)
Constructs a new lazy loading sctipt.
|
Modifier and Type | Method and Description |
---|---|
<T,Y> ResourceLazyLoadingScript |
broadcast(RemoteResultReducer<T,Y> reducer)
Broadcast the execution of this script over all active partitions.
|
ResourceLazyLoadingScript |
cache(boolean shouldCache)
Should this script be cached or not.
|
Object[] |
getMetaArguments()
Returns a set of meta arguments that are used for remote invocation.
|
String |
getName()
Returns the name of the script.
|
Map<String,Object> |
getParameters()
Returns the set of parameters that will be passes to the script execution.
|
RemoteResultReducer |
getReducer()
Returns the reducer that will be used in case broadcasting is enabled or not.
|
Object |
getRouting()
Returns the routing index (which partition it will "hit").
|
String |
getScriptAsString()
Returns the scirpt string only if it was already loaded using
loadScript() . |
String |
getType()
Returns the type of a script.
|
boolean |
hasScript()
Returns
true if the script has been loaded. |
void |
loadScript()
Loads the scirpt into memory from the resource location.
|
ResourceLazyLoadingScript |
metaArguments(Object... metaArguments)
Adds another meta argument to the script
|
ResourceLazyLoadingScript |
name(String name)
Sets the name of the script.
|
ResourceLazyLoadingScript |
parameter(String name,
Object value)
Puts a parameter that can be used during script execution.
|
void |
readExternal(ObjectInput in) |
ResourceLazyLoadingScript |
routing(Object routing)
Sets the routing index (which partition this will "hit") for the script.
|
ResourceLazyLoadingScript |
script(String resourceLocation)
Sets the actual script source.
|
Boolean |
shouldBroadcast()
Return
true if broadcast should be enabled or not. |
boolean |
shouldCache()
Returns if this script should be cached or not.
|
String |
toString() |
ResourceLazyLoadingScript |
type(String type)
Sets the type of the script.
|
void |
writeExternal(ObjectOutput out) |
public ResourceLazyLoadingScript()
public ResourceLazyLoadingScript(String name, String type, String resoruceLocation)
name
- The script name (used as a unique identifier for cachable scripts).type
- The type of the script executedresoruceLocation
- The resource location (similar to URL syntax, with additional support for classpath:
prefix).public String getScriptAsString()
loadScript()
.getScriptAsString
in interface Script
public boolean hasScript()
true
if the script has been loaded.hasScript
in interface LazyLoadingScript
public void loadScript()
loadScript
in interface LazyLoadingScript
public String getName()
public String getType()
groovy
.public Map<String,Object> getParameters()
getParameters
in interface Script
public boolean shouldCache()
shouldCache
in interface Script
public Object getRouting()
getRouting
in interface Script
public RemoteResultReducer getReducer()
BroadcastIndicator
getReducer
in interface BroadcastIndicator
public Boolean shouldBroadcast()
BroadcastIndicator
true
if broadcast should be enabled or not. Return null
if should not affect it in any manner.
shouldBroadcast
in interface BroadcastIndicator
public Object[] getMetaArguments()
Script
getMetaArguments
in interface Script
SpaceRemotingInvocation.getMetaArguments()
public ResourceLazyLoadingScript name(String name)
public ResourceLazyLoadingScript script(String resourceLocation)
public ResourceLazyLoadingScript type(String type)
groovy
.public ResourceLazyLoadingScript cache(boolean shouldCache)
true
.public ResourceLazyLoadingScript parameter(String name, Object value)
name
- The name of the parameter.value
- The value of the parameter.public ResourceLazyLoadingScript routing(Object routing)
public <T,Y> ResourceLazyLoadingScript broadcast(RemoteResultReducer<T,Y> reducer)
public ResourceLazyLoadingScript metaArguments(Object... metaArguments)
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
Copyright © GigaSpaces.