Class StaticScript
java.lang.Object
org.openspaces.remoting.scripting.StaticScript
- All Implemented Interfaces:
SmartExternalizable,Externalizable,Serializable,BroadcastIndicator,Script
- Direct Known Subclasses:
StaticResourceScript
A script that holds the actual script as a String. The name, type, and script must be provided.
- Author:
- kimchy
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new static script.StaticScript(String name, String type, String script) Constructs a new static script. -
Method Summary
Modifier and TypeMethodDescription<T,Y> StaticScript broadcast(RemoteResultReducer<T, Y> reducer) Broadcast the execution of this script over all active partitions.cache(boolean shouldCache) Should this script be cached or not.Object[]Returns a set of meta arguments that are used for remote invocation.getName()Returns the name of the script.Returns the set of parameters that will be passes to the script execution.Returns the reducer that will be used in case broadcasting is enabled or not.Returns the routing index.Returns the script as a String.getType()Returns the type of a script.metaArguments(Object... metaArguments) Adds another meta argument to the scriptSets the name of the script.Puts a parameter that can be used during script execution.voidSets the routing index (which partition it will "hit") for the scirpt.Sets the actual script source.Returntrueif broadcast should be enabled or not.booleanReturns if this script should be cached or not.toString()Sets the type of the script.voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.gigaspaces.serialization.SmartExternalizable
enabledSmartExternalizableWithReference
-
Constructor Details
-
StaticScript
public StaticScript()Constructs a new static script. Note, the name, type, and script must be provided. -
StaticScript
Constructs a new static script.- Parameters:
name- The name of the script.type- The type of the script (for example,groovy).script- The actual script as a String.
-
-
Method Details
-
getScriptAsString
Returns the script as a String.- Specified by:
getScriptAsStringin interfaceScript
-
getName
Returns the name of the script. Must uniquely identify a script. -
getType
Returns the type of a script. For example:groovy. -
getParameters
Returns the set of parameters that will be passes to the script execution.- Specified by:
getParametersin interfaceScript
-
shouldCache
public boolean shouldCache()Returns if this script should be cached or not.- Specified by:
shouldCachein interfaceScript
-
getRouting
Returns the routing index.- Specified by:
getRoutingin interfaceScript
-
getReducer
Description copied from interface:BroadcastIndicatorReturns the reducer that will be used in case broadcasting is enabled or not.- Specified by:
getReducerin interfaceBroadcastIndicator
-
shouldBroadcast
Description copied from interface:BroadcastIndicatorReturntrueif broadcast should be enabled or not. Returnnullif should not affect it in any manner.- Specified by:
shouldBroadcastin interfaceBroadcastIndicator
-
getMetaArguments
Description copied from interface:ScriptReturns a set of meta arguments that are used for remote invocation.- Specified by:
getMetaArgumentsin interfaceScript- See Also:
-
name
Sets the name of the script. -
script
Sets the actual script source. -
type
Sets the type of the script. For example:groovy. -
cache
Should this script be cached or not. Deaults totrue. -
parameter
Puts a parameter that can be used during script execution.- Parameters:
name- The name of the parameter.value- The value of the parameter.
-
routing
Sets the routing index (which partition it will "hit") for the scirpt. -
metaArguments
Adds another meta argument to the script -
broadcast
Broadcast the execution of this script over all active partitions. Optionally use a reducer to reduce the results. -
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
toString
-