public class ScriptingController
extends java.lang.Object
| Constructor and Description |
|---|
ScriptingController(NodeRPCConnection connection)
Create by the RPC connection.
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
callScript(java.lang.String name,
com.fasterxml.jackson.databind.JsonNode params,
java.lang.String targetDid,
java.lang.String targetAppDid,
java.lang.Class<T> resultType)
Run the registered script.
|
<T> T |
callScriptUrl(java.lang.String name,
java.lang.String params,
java.lang.String targetDid,
java.lang.String targetAppDid,
java.lang.Class<T> resultType)
Call the script by the URL parameters.
|
<T> T |
downloadFile(java.lang.String transactionId,
java.lang.Class<T> resultType)
Download file really by transaction ID.
|
void |
registerScript(java.lang.String name,
Condition condition,
Executable executable,
boolean allowAnonymousUser,
boolean allowAnonymousApp)
Register a script on the hive node.
|
void |
unregisterScript(java.lang.String name)
Unregister the script.
|
<T> T |
uploadFile(java.lang.String transactionId,
java.lang.Class<T> resultType)
Upload file really by transaction ID.
|
public ScriptingController(NodeRPCConnection connection)
connection - The RPC connection.public void registerScript(java.lang.String name,
Condition condition,
Executable executable,
boolean allowAnonymousUser,
boolean allowAnonymousApp)
throws HiveException
name - The name of the script.condition - The condition of the script. To run the script normally, the condition must be matched.executable - The executable represents an executed action.allowAnonymousUser - If allow the anonymous user to run the script.allowAnonymousApp - If allow the anonymous application to run the script.HiveException - The error comes from the hive node.public <T> T callScript(java.lang.String name,
com.fasterxml.jackson.databind.JsonNode params,
java.lang.String targetDid,
java.lang.String targetAppDid,
java.lang.Class<T> resultType)
throws HiveException
T - Same as result type.name - The name of the script.params - The parameters to run the script.targetDid - The owner of the script.targetAppDid - The application DID owns the script.resultType - Supported type: String, byte[], JsonNode, Reader, other Json relating types.HiveException - See HiveExceptionpublic <T> T callScriptUrl(java.lang.String name,
java.lang.String params,
java.lang.String targetDid,
java.lang.String targetAppDid,
java.lang.Class<T> resultType)
throws HiveException
callScript(String, JsonNode, String, String, Class).T - Same as resultType.name - The name of the script.params - The parameters to run the script.targetDid - The owner of the script.targetAppDid - The application DID owns the script.resultType - Supported type: String, byte[], JsonNode, Reader, other Json relating types.HiveException - See HiveExceptionpublic <T> T uploadFile(java.lang.String transactionId,
java.lang.Class<T> resultType)
throws HiveException
T - The result type.transactionId - The transaction ID got by calling script.resultType - Supported type: OutputStream, OutputStreamWriterHiveException - See HiveExceptionpublic <T> T downloadFile(java.lang.String transactionId,
java.lang.Class<T> resultType)
throws HiveException
T - The result type.transactionId - The transaction ID got by calling script.resultType - Supported type: InputStream, InputStreamReaderHiveException - See HiveExceptionpublic void unregisterScript(java.lang.String name)
throws HiveException
name - The name of the script.HiveException - See HiveException