com.baidu.driver4j.bns
类 BNSQueryProxy

java.lang.Object
  继承者 com.baidu.driver4j.bns.BNSQueryProxy
所有已实现的接口:
InstanceQuery
直接已知子类:
BNSProxy

public class BNSQueryProxy
extends Object
implements InstanceQuery

BNS query access proxy class.
This is the main entry class for all operation access for BNS.

从以下版本开始:
1.0.0
作者:
xiemalin

字段摘要
protected  String bnsServerUrl
           
protected  int connectTimeout
           
protected static String DEFAULT_BNS_SERVER
           
protected static String GROUP_OPER
          Service group operation path
protected  String groupOperUrl
           
protected static String INSTANCE_OPER
          instance operation path
protected  String instanceOperUrl
           
protected static String PARAM_JOINER
           
protected static String PARAM_MARK
           
protected  int readTimeout
           
protected  String serivceOperUrl
           
protected static String SERVICE_OPER
          service operation path
protected  SimpleHttpRequestExecutor simpleHttpRequestExecutor
           
 
构造方法摘要
protected BNSQueryProxy(String bnsServerUrl)
           
 
方法摘要
 BNSResponse getBNSResponseByServiceName(String serviceName, String command)
          服务名称查询返回数据流
protected  String getBnsServerUrl()
           
protected  int getConnectTimeout()
           
protected  String getGroupOperUrl()
           
 Instance getInstance(String serviceName, String hostName)
          服务(组)实例信息查询
protected  String getInstanceOperUrl()
           
 List<Instance> getInstances(String serviceName)
          服务(组)实例信息查询
 List<Instance> getInstances(String serviceName, boolean enabledOnly)
          服务(组)实例信息查询
 List<Instance> getInstances(String serviceName, int... status)
          服务(组)实例信息查询,
 List<Instance> getInstancesByServiceGroup(String name)
          根据名称查询服务组下的实例信息
protected  int getReadTimeout()
           
protected  String getSerivceOperUrl()
           
 Service getService(String serviceName)
          服务名称查询服务信息
 Group getServiceGroup(String name)
          根据名称查询服务组信息
 List<String> getServiceGroupListByNodePath(String nodePath)
          获取某节点路径下的服务组列表
 boolean isServiceExist(String serviceName)
          check service name exist.
protected  void logHTTPRequestInfo(String serviceUrl, String method)
          输出日志信息
static BNSQueryProxy proxy()
           
static BNSQueryProxy proxy(String bnsServerUrl)
           
 List<Instance> queryInstances(String serviceName)
          服务(组)实例信息查询
 List<String> queryServiceGroupName(String serviceName)
          服务组搜索
 List<String> queryServiceName(String serviceName)
          服务搜索
 void setConnectTimeout(int connectTimeout)
           
 void setReadTimeout(int readTimeout)
           
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

DEFAULT_BNS_SERVER

protected static final String DEFAULT_BNS_SERVER
另请参见:
常量字段值

SERVICE_OPER

protected static final String SERVICE_OPER
service operation path

另请参见:
常量字段值

INSTANCE_OPER

protected static final String INSTANCE_OPER
instance operation path

另请参见:
常量字段值

GROUP_OPER

protected static final String GROUP_OPER
Service group operation path

另请参见:
常量字段值

PARAM_MARK

protected static final String PARAM_MARK
另请参见:
常量字段值

PARAM_JOINER

protected static final String PARAM_JOINER
另请参见:
常量字段值

bnsServerUrl

protected String bnsServerUrl

serivceOperUrl

protected String serivceOperUrl

instanceOperUrl

protected String instanceOperUrl

groupOperUrl

protected String groupOperUrl

connectTimeout

protected int connectTimeout

readTimeout

protected int readTimeout

simpleHttpRequestExecutor

protected SimpleHttpRequestExecutor simpleHttpRequestExecutor
构造方法详细信息

BNSQueryProxy

protected BNSQueryProxy(String bnsServerUrl)
方法详细信息

proxy

public static BNSQueryProxy proxy(String bnsServerUrl)

proxy

public static BNSQueryProxy proxy()

getService

public Service getService(String serviceName)
                   throws BNSException
服务名称查询服务信息

参数:
serviceName - service name
返回:
服务单元信息. null if not exist
抛出:
BNSException - in case of access BNS service failed

isServiceExist

public boolean isServiceExist(String serviceName)
                       throws BNSException
check service name exist.

参数:
serviceName - service name
返回:
true if service name exist
抛出:
BNSException - in case of access BNS service failed

getBNSResponseByServiceName

public BNSResponse getBNSResponseByServiceName(String serviceName,
                                               String command)
                                        throws BNSException
服务名称查询返回数据流

参数:
serviceName - service name
返回:
BNSResponse. null if not exist
抛出:
BNSException - in case of access BNS service failed

getInstance

public Instance getInstance(String serviceName,
                            String hostName)
                     throws BNSException
服务(组)实例信息查询

参数:
serviceName - 服务(组名称
hostName - 实例名称
返回:
实例对象
抛出:
BNSException - in case of access BNS service failed

getInstances

public List<Instance> getInstances(String serviceName)
                            throws BNSException
服务(组)实例信息查询

参数:
serviceName - 服务(组名称
返回:
实例对象
抛出:
BNSException - in case of access BNS service failed

getInstances

public List<Instance> getInstances(String serviceName,
                                   boolean enabledOnly)
                            throws BNSException
服务(组)实例信息查询

参数:
serviceName - 服务(组名称
enabledOnly - if true only get enabled instance
返回:
实例对象
抛出:
BNSException - in case of access BNS service failed

getInstances

public List<Instance> getInstances(String serviceName,
                                   int... status)
                            throws BNSException
服务(组)实例信息查询,

参数:
serviceName - 服务(组名称
status - filter by status properties
返回:
实例对象
抛出:
BNSException - in case of access BNS service failed

queryServiceName

public List<String> queryServiceName(String serviceName)
                              throws BNSException
服务搜索

参数:
serviceName - service name
返回:
searched name list
抛出:
BNSException - in case of access BNS service failed

queryServiceGroupName

public List<String> queryServiceGroupName(String serviceName)
                                   throws BNSException
服务组搜索

参数:
serviceName - service name
返回:
searched name list
抛出:
BNSException - in case of access BNS service failed

getServiceGroup

public Group getServiceGroup(String name)
                      throws BNSException
根据名称查询服务组信息

参数:
name - group name
返回:
instance of Group or null if not exist
抛出:
BNSException - in case of access BNS service failed

getInstancesByServiceGroup

public List<Instance> getInstancesByServiceGroup(String name)
                                          throws BNSException
根据名称查询服务组下的实例信息

参数:
name - group name
返回:
list of Group or empty if group not exist or no service under the group
抛出:
BNSException - in case of access BNS service failed

getServiceGroupListByNodePath

public List<String> getServiceGroupListByNodePath(String nodePath)
                                           throws BNSException
获取某节点路径下的服务组列表

参数:
nodePath - nodePath 节点路径,如BAIDU_OP_OPED_NOAH
返回:
服务组列表
抛出:
BNSException - in case of access BNS service failed

logHTTPRequestInfo

protected void logHTTPRequestInfo(String serviceUrl,
                                  String method)
输出日志信息

参数:
serviceUrl - target HTTP service URL to log
method - method name

getConnectTimeout

protected int getConnectTimeout()

getReadTimeout

protected int getReadTimeout()

getSerivceOperUrl

protected String getSerivceOperUrl()

getInstanceOperUrl

protected String getInstanceOperUrl()

getGroupOperUrl

protected String getGroupOperUrl()

getBnsServerUrl

protected String getBnsServerUrl()

setConnectTimeout

public void setConnectTimeout(int connectTimeout)

setReadTimeout

public void setReadTimeout(int readTimeout)

queryInstances

public List<Instance> queryInstances(String serviceName)
                              throws BNSException
从接口 InstanceQuery 复制的描述
服务(组)实例信息查询

指定者:
接口 InstanceQuery 中的 queryInstances
参数:
serviceName - 服务(组名称
返回:
实例对象
抛出:
BNSException - in case of access BNS service failed


Copyright © 2016. All rights reserved.