com.baidu.driver4j.bns
类 BNSProxy

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

public class BNSProxy
extends BNSQueryProxy

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

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

字段摘要
protected  String authKey
           
protected  SimpleHttpRequestExecutor simpleHttpRequestExecutor
           
 
从类 com.baidu.driver4j.bns.BNSQueryProxy 继承的字段
bnsServerUrl, connectTimeout, DEFAULT_BNS_SERVER, GROUP_OPER, groupOperUrl, INSTANCE_OPER, instanceOperUrl, PARAM_JOINER, PARAM_MARK, readTimeout, serivceOperUrl, SERVICE_OPER
 
构造方法摘要
protected BNSProxy(String bnsServerUrl, String authKey)
           
 
方法摘要
 void addInstance(String serviceName, Instance instance)
          add instance under target service name
 void addInstances(String serviceName, List<Instance> intances)
          批量增加实例
 void addMachineNames(String serviceName, List<String> machinenames, boolean disable)
          批量增加机器
 boolean checkAuthorize(String nodePath)
          验证token对节点路径是否有操作权限
 void createService(Service service)
          创建服务
 void createService(Service service, boolean dummyExist)
          创建服务
 void createServiceGroup(Group group)
          新建服务组
 void createServiceGroup(Group group, boolean dummyExist)
          新建服务组
protected  String getAuthKey()
           
static BNSProxy proxy()
           
static BNSProxy proxy(String authKey)
           
static BNSProxy proxy(String bnsServerUrl, String authKey)
           
 void removeAllInstances(String serviceName)
          删除服务下所有实例
 void removeInstance(String serviceName, String hostName)
          删除实例
 void removeInstance(String serviceName, String hostName, int instanceId)
          删除实例
 void removeService(String serviceName)
          删除服务
 void removeServiceGroup(String name)
          删除服务组
 void setMaxBatchAddSize(int maxBatchAddSize)
           
 void updateInstance(String serviceName, Instance instance)
          修改实例的各种信息
 void updateInstance(String serviceName, Instance instance, boolean ignoreNull)
          修改实例的各种信息
 void updateService(Service service)
          更新服务详情
 
从类 com.baidu.driver4j.bns.BNSQueryProxy 继承的方法
getBNSResponseByServiceName, getBnsServerUrl, getConnectTimeout, getGroupOperUrl, getInstance, getInstanceOperUrl, getInstances, getInstances, getInstances, getInstancesByServiceGroup, getReadTimeout, getSerivceOperUrl, getService, getServiceGroup, getServiceGroupListByNodePath, isServiceExist, logHTTPRequestInfo, queryInstances, queryServiceGroupName, queryServiceName, setConnectTimeout, setReadTimeout
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

authKey

protected String authKey

simpleHttpRequestExecutor

protected SimpleHttpRequestExecutor simpleHttpRequestExecutor
构造方法详细信息

BNSProxy

protected BNSProxy(String bnsServerUrl,
                   String authKey)
方法详细信息

proxy

public static BNSProxy proxy(String bnsServerUrl,
                             String authKey)

proxy

public static BNSProxy proxy(String authKey)

proxy

public static BNSProxy proxy()

createService

public void createService(Service service)
                   throws BNSException
创建服务

参数:
service - Service instance
抛出:
BNSException - in case of access BNS service failed

createService

public void createService(Service service,
                          boolean dummyExist)
                   throws BNSException
创建服务

参数:
service - Service instance
dummyExist - if true will not check service name exist
抛出:
BNSException - in case of access BNS service failed

removeService

public void removeService(String serviceName)
                   throws BNSException
删除服务

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

updateService

public void updateService(Service service)
                   throws BNSException
更新服务详情

参数:
service - service instance must specified service name
抛出:
BNSException - in case of access BNS service failed

addInstance

public void addInstance(String serviceName,
                        Instance instance)
                 throws BNSException
add instance under target service name

参数:
serviceName - service name
instance - instance info
抛出:
BNSException - in case of access BNS service failed

addInstances

public void addInstances(String serviceName,
                         List<Instance> intances)
                  throws BNSException
批量增加实例

参数:
serviceName - 服务名
intances - 批量新增实现列表
抛出:
BNSException - in case of access BNS service failed

updateInstance

public void updateInstance(String serviceName,
                           Instance instance)
                    throws BNSException
修改实例的各种信息

参数:
serviceName - 服务名
instance - 实例信息
抛出:
BNSException - in case of access BNS service failed

updateInstance

public void updateInstance(String serviceName,
                           Instance instance,
                           boolean ignoreNull)
                    throws BNSException
修改实例的各种信息

参数:
serviceName - 服务名
instance - 实例信息
ignoreNull - set true will ignore null value
抛出:
BNSException - in case of access BNS service failed

removeAllInstances

public void removeAllInstances(String serviceName)
                        throws BNSException
删除服务下所有实例

参数:
serviceName - the name of service
抛出:
BNSException - in case of access BNS service failed

removeInstance

public void removeInstance(String serviceName,
                           String hostName,
                           int instanceId)
                    throws BNSException
删除实例

参数:
serviceName - name of service
hostName - the host name of target machine
instanceId - 实例id(可选) ,若不指定,则删除 机器上 此服务的所有实例
抛出:
BNSException - in case of access BNS service failed

removeInstance

public void removeInstance(String serviceName,
                           String hostName)
                    throws BNSException
删除实例

参数:
serviceName - name of service
hostName - the host name of target machine
抛出:
BNSException - in case of access BNS service failed

addMachineNames

public void addMachineNames(String serviceName,
                            List<String> machinenames,
                            boolean disable)
                     throws BNSException
批量增加机器

参数:
serviceName - service name
machinenames - machine names
disable - disable for add machine name
抛出:
BNSException - in case of access BNS service failed

checkAuthorize

public boolean checkAuthorize(String nodePath)
                       throws BNSException
验证token对节点路径是否有操作权限

参数:
nodePath - 节点路径
返回:
true 表示有权限
抛出:
BNSException - in case of access BNS service failed

createServiceGroup

public void createServiceGroup(Group group)
                        throws BNSException
新建服务组

参数:
group - group instance
抛出:
BNSException - in case of access BNS service failed

createServiceGroup

public void createServiceGroup(Group group,
                               boolean dummyExist)
                        throws BNSException
新建服务组

参数:
group - group instance
dummyExist - if true will not check group name exist
抛出:
BNSException - in case of access BNS service failed

removeServiceGroup

public void removeServiceGroup(String name)
                        throws BNSException
删除服务组

参数:
name - group name
抛出:
BNSException - in case of access BNS service failed

getAuthKey

protected String getAuthKey()

setMaxBatchAddSize

public void setMaxBatchAddSize(int maxBatchAddSize)


Copyright © 2016. All rights reserved.