当前位置: 首页>>代码示例>>Java>>正文


Java PoolMember.getName方法代码示例

本文整理汇总了Java中org.opendaylight.controller.samples.loadbalancer.entities.PoolMember.getName方法的典型用法代码示例。如果您正苦于以下问题:Java PoolMember.getName方法的具体用法?Java PoolMember.getName怎么用?Java PoolMember.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opendaylight.controller.samples.loadbalancer.entities.PoolMember的用法示例。


在下文中一共展示了PoolMember.getName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addPoolMember

import org.opendaylight.controller.samples.loadbalancer.entities.PoolMember; //导入方法依赖的package包/类
@Path("/{containerName}/create/poolmember")
@POST
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@StatusCodes( {
    @ResponseCode(code = 201, condition = "Pool member created successfully"),
    @ResponseCode(code = 404, condition = "The containerName not found"),
    @ResponseCode(code = 503, condition = "Load balancer service is unavailable"),
    @ResponseCode(code = 404, condition = "Pool not found"),
    @ResponseCode(code = 409, condition = "Pool member already exist"),
    @ResponseCode(code = 415, condition = "Invalid input data")})
public Response addPoolMember(@PathParam("containerName") String containerName,
        @TypeHint(PoolMember.class) JAXBElement<PoolMember> inPoolMember){

    PoolMember pmInput = inPoolMember.getValue();
    String name = pmInput.getName();
    String memberIP = pmInput.getIp();
    String poolName = pmInput.getPoolName();

    if(name.isEmpty() ||
            memberIP.isEmpty()||
            poolName.isEmpty()){
        throw new UnsupportedMediaTypeException(RestMessages.INVALIDDATA.toString());
    }

    IConfigManager configManager = getConfigManagerService(containerName);
    if (configManager == null) {
        throw new ServiceUnavailableException("Load Balancer "
                                    + RestMessages.SERVICEUNAVAILABLE.toString());
    }

    if(!configManager.poolExists(poolName))
        throw new ResourceNotFoundException(NBConst.RES_POOL_NOT_FOUND);

    if(!configManager.memberExists(name, memberIP, poolName)){

        PoolMember poolMember = configManager.addPoolMember(name, memberIP, poolName);
        if ( poolMember != null){
            return Response.status(Response.Status.CREATED).build();
        }
    }else{
        throw new ResourceConflictException(NBConst.RES_POOLMEMBER_ALREADY_EXIST);
    }
    throw new InternalServerErrorException(NBConst.RES_POOLMEMBER_CREATION_FAILED);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:45,代码来源:LoadBalancerNorthbound.java


注:本文中的org.opendaylight.controller.samples.loadbalancer.entities.PoolMember.getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。