程序包 org.elastos.hive

类 ScriptRunner

  • 所有已实现的接口:
    ScriptingInvocationService

    public class ScriptRunner
    extends ServiceEndpoint
    implements ScriptingInvocationService
    The script runner is used on the script calling side.

    To call the script, the script owner need register the script first.

                    Vault vault = new Vault(appContext, providerAddress);
                    ScriptingService scriptingService = vault.getScriptingService();
                    scriptingService.registerScript(...);
     

    Then the script caller can use this class to execute the script.

                    ScriptRunner scriptRunner = new ScriptRunner(callerAppContext, providerAddress);
                    scriptRunner.callScript(...).get();
     
    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      <T> java.util.concurrent.CompletableFuture<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)
      Invoke the execution of a specified script registered previously by the vault owner, where the script is defined with certain preset routines.
      <T> java.util.concurrent.CompletableFuture<T> callScriptUrl​(java.lang.String name, java.lang.String params, java.lang.String targetDid, java.lang.String targetAppDid, java.lang.Class<T> resultType)
      Executes a previously registered server side script with a direct URL where the values can be passed as part of the query.
      <T> java.util.concurrent.CompletableFuture<T> downloadFile​(java.lang.String transactionId, java.lang.Class<T> resultType)
      Invoke the execution of the script to download a file in the streaming mode.
      <T> java.util.concurrent.CompletableFuture<T> downloadFileByHiveUrl​(java.lang.String hiveUrl, java.lang.Class<T> resultType)
      This is the compatible implementation for downloading file by the hive url which comes from v1 version SDK.
      <T> java.util.concurrent.CompletableFuture<T> uploadFile​(java.lang.String transactionId, java.lang.Class<T> resultType)
      Invoke the execution of the script to upload a file in the streaming mode.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • ScriptRunner

        public ScriptRunner​(AppContext context,
                            java.lang.String providerAddress)
      • ScriptRunner

        public ScriptRunner​(AppContext context)
    • 方法详细资料

      • callScript

        public <T> java.util.concurrent.CompletableFuture<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)
        从接口复制的说明: ScriptingInvocationService
        Invoke the execution of a specified script registered previously by the vault owner, where the script is defined with certain preset routines. It's the general invocation method for external users to call.
        指定者:
        callScript 在接口中 ScriptingInvocationService
        类型参数:
        T - String, byte[], JsonNode, Reader
        参数:
        name - The name of script to invoke.
        params - The parameters as input to the invocation.
        targetDid - The script owner's user did. Skipped when owner calls.
        targetAppDid - The script owner's application did. Skipped when owner calls.
        resultType - String, byte[], JsonNode, Reader
        返回:
        String, byte[], JsonNode, Reader
      • callScriptUrl

        public <T> java.util.concurrent.CompletableFuture<T> callScriptUrl​(java.lang.String name,
                                                                           java.lang.String params,
                                                                           java.lang.String targetDid,
                                                                           java.lang.String targetAppDid,
                                                                           java.lang.Class<T> resultType)
        Executes a previously registered server side script with a direct URL where the values can be passed as part of the query. Vault owner or external users are allowed to call scripts on someone's vault.
        类型参数:
        T - String, byte[], JsonNode, Reader, Write, OutputStream, Reader, InputStream
        参数:
        name - The call's script name
        params - The parameters for the script.
        targetDid - The script owner's user did.
        targetAppDid - The script owner's application did.
        resultType - String, byte[], JsonNode, Reader, Write, OutputStream, Reader, InputStream
        返回:
        Result for specific script type
      • uploadFile

        public <T> java.util.concurrent.CompletableFuture<T> uploadFile​(java.lang.String transactionId,
                                                                        java.lang.Class<T> resultType)
        从接口复制的说明: ScriptingInvocationService
        Invoke the execution of the script to upload a file in the streaming mode. The upload works a bit differently from other executable queries because there are two steps to this executable. First, register a script on the vault, then you call this API actually to upload the file
        指定者:
        uploadFile 在接口中 ScriptingInvocationService
        类型参数:
        T - Reader or InputStream class
        参数:
        transactionId - The streaming identifier to the upload process
        resultType - Reader or InputStream class
        返回:
        Reader or InputStream class
      • downloadFile

        public <T> java.util.concurrent.CompletableFuture<T> downloadFile​(java.lang.String transactionId,
                                                                          java.lang.Class<T> resultType)
        从接口复制的说明: ScriptingInvocationService
        Invoke the execution of the script to download a file in the streaming mode. The upload works a bit differently from other executable queries because there are two steps to this executable. First, register a script on the vault, then you call this API actually to download the file
        指定者:
        downloadFile 在接口中 ScriptingInvocationService
        类型参数:
        T - Reader or InputStream class
        参数:
        transactionId - The streaming identifier to the upload process
        resultType - Reader or InputStream class
        返回:
        Reader or InputStream class
      • downloadFileByHiveUrl

        public <T> java.util.concurrent.CompletableFuture<T> downloadFileByHiveUrl​(java.lang.String hiveUrl,
                                                                                   java.lang.Class<T> resultType)
        从接口复制的说明: ScriptingInvocationService
        This is the compatible implementation for downloading file by the hive url which comes from v1 version SDK. The hive url definition is as this format:
        hive://<targetDid>@<targetAppDid>/<scriptName>?params=<paramJsonStr>
        指定者:
        downloadFileByHiveUrl 在接口中 ScriptingInvocationService
        类型参数:
        T - Reader or InputStream class
        参数:
        hiveUrl - The hive url.
        resultType - Reader or InputStream class
        返回:
        Reader or InputStream instance