类 ScriptingController


  • public class ScriptingController
    extends java.lang.Object
    The wrapper class to access the scripting APIs of the hive node.
    • 方法概要

      所有方法 静态方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      <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.
      static <T> T downloadFileByHiveUrl​(java.lang.String hiveUrl, java.lang.Class<T> resultType, AppContext context)  
      java.util.List<ScriptContent> getScripts​(java.lang.String name, int skip, int limit)
      Get the registered scripts.
      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.
      • 从类继承的方法 java.lang.Object

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

      • ScriptingController

        public ScriptingController​(NodeRPCConnection connection,
                                   boolean anonymous)
        Create by the RPC connection.
        参数:
        connection - The RPC connection.
        anonymous - whether access anonymously.
    • 方法详细资料

      • registerScript

        public void registerScript​(java.lang.String name,
                                   Condition condition,
                                   Executable executable,
                                   boolean allowAnonymousUser,
                                   boolean allowAnonymousApp)
                            throws HiveException
        Register a script on the hive node.
        参数:
        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.
      • getScripts

        public java.util.List<ScriptContent> getScripts​(java.lang.String name,
                                                        int skip,
                                                        int limit)
                                                 throws HiveException
        Get the registered scripts.
        参数:
        name - the specific script name
        skip - skip, default 0
        limit - limit, default 0
        返回:
        the list of the scripts.
        抛出:
        HiveException - The error comes from the hive node.
      • callScript

        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
        Run the registered script. The runner is not the owner of the script normally.
        类型参数:
        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.
        返回:
        The instance of the result type.
        抛出:
        HiveException - See HiveException
      • callScriptUrl

        public <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
        Call the script by the URL parameters. Same as 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.
        返回:
        The instance of the result type.
        抛出:
        HiveException - See HiveException
      • uploadFile

        public <T> T uploadFile​(java.lang.String transactionId,
                                java.lang.Class<T> resultType)
                         throws HiveException
        Upload file really by transaction ID.
        类型参数:
        T - The result type.
        参数:
        transactionId - The transaction ID got by calling script.
        resultType - Supported type: OutputStream, OutputStreamWriter
        返回:
        The instance of the result type.
        抛出:
        HiveException - See HiveException
      • downloadFile

        public <T> T downloadFile​(java.lang.String transactionId,
                                  java.lang.Class<T> resultType)
                           throws HiveException
        Download file really by transaction ID.
        类型参数:
        T - The result type.
        参数:
        transactionId - The transaction ID got by calling script.
        resultType - Supported type: InputStream, InputStreamReader
        返回:
        The instance of the result type.
        抛出:
        HiveException - See HiveException
      • downloadFileByHiveUrl

        public static <T> T downloadFileByHiveUrl​(java.lang.String hiveUrl,
                                                  java.lang.Class<T> resultType,
                                                  AppContext context)
                                           throws HiveException
        抛出:
        HiveException
      • unregisterScript

        public void unregisterScript​(java.lang.String name)
                              throws HiveException
        Unregister the script.
        参数:
        name - The name of the script.
        抛出:
        HiveException - See HiveException