类 NodeRPCConnection

  • 直接已知子类:
    ServiceEndpoint

    public abstract class NodeRPCConnection
    extends java.lang.Object
    Network connection for accessing hive node with restful APIs.

    The access token management is required for the sub-class implicitly.

    For file uploading, direct connection need be created for uploading stream.

                    HttpURLConnection urlConnection = connection.openConnection(FilesAPI.API_UPLOAD + path);
                    OutputStream outputStream = new UploadOutputStream(urlConnection, urlConnection.getOutputStream());
     

    For other APIs, please directly create the relating service.

                    FilesAPI filesAPI = connection.createService(FilesAPI.class, true);
                    String hashCode = filesAPI.getHash(path).execute().body().getHash();
     
    • 方法概要

      所有方法 实例方法 抽象方法 具体方法 
      修饰符和类型 方法 说明
      <S> S createService​(java.lang.Class<S> serviceClass, boolean requiredAuthorization)
      Create a retrofit API service which can map Java call to Http request.
      protected abstract AccessToken getAccessToken()  
      protected abstract java.lang.String getProviderAddress()  
      java.net.HttpURLConnection openConnection​(java.lang.String urlPath)
      Open a HTTP connection to communicate with hive node.
      • 从类继承的方法 java.lang.Object

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

      • NodeRPCConnection

        public NodeRPCConnection()
    • 方法详细资料

      • getProviderAddress

        protected abstract java.lang.String getProviderAddress()
      • getAccessToken

        protected abstract AccessToken getAccessToken()
      • openConnection

        public java.net.HttpURLConnection openConnection​(java.lang.String urlPath)
                                                  throws java.io.IOException
        Open a HTTP connection to communicate with hive node.
        参数:
        urlPath - Relative URL path of the node API.
        返回:
        The connection.
        抛出:
        java.io.IOException - exception such as timeout, network error, etc.
      • createService

        public <S> S createService​(java.lang.Class<S> serviceClass,
                                   boolean requiredAuthorization)
        Create a retrofit API service which can map Java call to Http request.
        类型参数:
        S - The service class.
        参数:
        serviceClass - The service class is the base class for the service.
        requiredAuthorization - If this service need authorization. Normally if true, the service need token when send request.
        返回:
        The service instance based on the service class.