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


Java RpcResultBuilder类代码示例

本文整理汇总了Java中org.opendaylight.yangtools.yang.common.RpcResultBuilder的典型用法代码示例。如果您正苦于以下问题:Java RpcResultBuilder类的具体用法?Java RpcResultBuilder怎么用?Java RpcResultBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RpcResultBuilder类属于org.opendaylight.yangtools.yang.common包,在下文中一共展示了RpcResultBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNatTranslationsOnRouter

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入依赖的package包/类
@Override
public Future<RpcResult<GetNatTranslationsOnRouterOutput>> getNatTranslationsOnRouter(
        GetNatTranslationsOnRouterInput input) {
    RpcResultBuilder<GetNatTranslationsOnRouterOutput> rpcResultBuilder = null;
    long routerId = NatUtil.getVpnId(dataBroker, input.getRouterUuid().getValue());
    if (routerId == NatConstants.INVALID_ID) {
        String errMsg = String.format("404 Not Found - No Router found with UUID {%s}",
                input.getRouterUuid().getValue());
        rpcResultBuilder = RpcResultBuilder.<GetNatTranslationsOnRouterOutput>failed()
                .withError(RpcError.ErrorType.APPLICATION, errMsg);
        return Futures.immediateFuture(rpcResultBuilder.build());
    }

    List<RouterNat> routerNatList = constructNatInformation(input.getRouterUuid(), routerId);

    GetNatTranslationsOnRouterOutputBuilder output = new GetNatTranslationsOnRouterOutputBuilder()
            .setRouterNat(routerNatList);
    rpcResultBuilder = RpcResultBuilder.success();
    rpcResultBuilder.withResult(output.build());
    return Futures.immediateFuture(rpcResultBuilder.build());
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:22,代码来源:NatRpcServiceImpl.java

示例2: deregisterClient

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入依赖的package包/类
@Override
public Future<RpcResult<DeregisterClientOutput>> deregisterClient(DeregisterClientInput input) {
     try {
         if (connections.remove(input.getClientId().toString()) != null) {
             TenantManager.deregisterClient(input.getClientId());
             FpcagentDispatcher.removeStrategy(input.getClientId());
             clientIdList.remove(input.getClientId());
             LOG.info("Connection Removed for Client {}", input.getClientId());
             checkPoint();
         }
         return Futures.immediateFuture(RpcResultBuilder.<DeregisterClientOutput>success().build());
     } catch (Exception exc) {
        ErrorLog.logError("Error in new Connection Binding" + exc.getMessage(), exc.getStackTrace());
        return Futures.immediateFuture(RpcResultBuilder.<DeregisterClientOutput>failed()
                .withError(RpcError.ErrorType.APPLICATION,
                        "Error Occurred During Client Binding",
                        exc)
                .build());
    }
}
 
开发者ID:opendaylight,项目名称:fpc,代码行数:21,代码来源:FpcServiceImpl.java

示例3: subscribeDtcl

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入依赖的package包/类
@Override
public Future<RpcResult<Void>> subscribeDtcl() {

    if (dtclReg != null) {
        final RpcError error = RpcResultBuilder.newError(ErrorType.RPC, "Registration present.",
                "There is already dataTreeChangeListener registered on id-ints list.");
        return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(error).build());
    }

    idIntsListener = new IdIntsListener();

    dtclReg = domDataTreeChangeService
            .registerDataTreeChangeListener(
                    new org.opendaylight.controller.md.sal.dom.api.DOMDataTreeIdentifier(
                            CONTROLLER_CONFIG, WriteTransactionsHandler.ID_INT_YID),
                    idIntsListener);

    return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:MdsalLowLevelTestProvider.java

示例4: subscribeYnl

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入依赖的package包/类
@Override
public Future<RpcResult<Void>> subscribeYnl(final SubscribeYnlInput input) {

    LOG.debug("subscribe-ynl, input: {}", input);

    if (ynlRegistrations.containsKey(input.getId())) {
        final RpcError error = RpcResultBuilder.newError(ErrorType.RPC, "Registration present.",
                "There is already ynl listener registered for this id: " + input.getId());
        return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(error).build());
    }

    ynlRegistrations.put(input.getId(),
            notificationService.registerNotificationListener(new YnlListener(input.getId())));

    return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:MdsalLowLevelTestProvider.java

示例5: unregisterBoundConstant

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入依赖的package包/类
@Override
public Future<RpcResult<Void>> unregisterBoundConstant(final UnregisterBoundConstantInput input) {
    LOG.debug("unregister-bound-constant, {}", input);

    final DOMRpcImplementationRegistration<RoutedGetConstantService> registration =
            routedRegistrations.remove(input.getContext());

    if (registration == null) {
        LOG.debug("No get-contexted-constant registration for context: {}", input.getContext());
        final RpcError rpcError = RpcResultBuilder
                .newError(ErrorType.APPLICATION, "missing-registration", "No get-constant rpc registration present.");
        final RpcResult<Void> result = RpcResultBuilder.<Void>failed().withRpcError(rpcError).build();
        return Futures.immediateFuture(result);
    }

    registration.close();
    return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:MdsalLowLevelTestProvider.java

示例6: registerSingletonConstant

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入依赖的package包/类
@Override
public Future<RpcResult<Void>> registerSingletonConstant(final RegisterSingletonConstantInput input) {

    LOG.debug("Received register-singleton-constant rpc, input: {}", input);

    if (input.getConstant() == null) {
        final RpcError error = RpcResultBuilder.newError(
                ErrorType.RPC, "Invalid input.", "Constant value is null");
        return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(error).build());
    }

    getSingletonConstantRegistration =
            SingletonGetConstantService.registerNew(singletonService, domRpcService, input.getConstant());

    return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:MdsalLowLevelTestProvider.java

示例7: unregisterFlappingSingleton

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入依赖的package包/类
@Override
public Future<RpcResult<UnregisterFlappingSingletonOutput>> unregisterFlappingSingleton() {
    LOG.debug("unregister-flapping-singleton received.");

    if (flappingSingletonService == null) {
        final RpcError rpcError = RpcResultBuilder
                .newError(ErrorType.APPLICATION, "missing-registration", "No flapping-singleton registration present.");
        final RpcResult<UnregisterFlappingSingletonOutput> result =
                RpcResultBuilder.<UnregisterFlappingSingletonOutput>failed().withRpcError(rpcError).build();
        return Futures.immediateFuture(result);
    }

    final long flapCount = flappingSingletonService.setInactive();
    flappingSingletonService = null;

    final UnregisterFlappingSingletonOutput output =
            new UnregisterFlappingSingletonOutputBuilder().setFlapCount(flapCount).build();

    return Futures.immediateFuture(RpcResultBuilder.success(output).build());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:21,代码来源:MdsalLowLevelTestProvider.java

示例8: subscribeDdtl

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入依赖的package包/类
@Override
public Future<RpcResult<Void>> subscribeDdtl() {

    if (ddtlReg != null) {
        final RpcError error = RpcResultBuilder.newError(ErrorType.RPC, "Registration present.",
                "There is already dataTreeChangeListener registered on id-ints list.");
        return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(error).build());
    }

    idIntsDdtl = new IdIntsDOMDataTreeLIstener();

    try {
        ddtlReg =
                domDataTreeService.registerListener(idIntsDdtl,
                        Collections.singleton(new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION,
                                ProduceTransactionsHandler.ID_INT_YID))
                        , true, Collections.emptyList());
    } catch (DOMDataTreeLoopException e) {
        LOG.error("Failed to register DOMDataTreeListener.", e);

    }

    return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:25,代码来源:MdsalLowLevelTestProvider.java

示例9: unsubscribeYnl

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入依赖的package包/类
@Override
public Future<RpcResult<UnsubscribeYnlOutput>> unsubscribeYnl(final UnsubscribeYnlInput input) {
    LOG.debug("Received unsubscribe-ynl, input: {}", input);

    if (!ynlRegistrations.containsKey(input.getId())) {
        final RpcError rpcError = RpcResultBuilder
                .newError(ErrorType.APPLICATION, "missing-registration", "No ynl listener with this id registered.");
        final RpcResult<UnsubscribeYnlOutput> result =
                RpcResultBuilder.<UnsubscribeYnlOutput>failed().withRpcError(rpcError).build();
        return Futures.immediateFuture(result);
    }

    final ListenerRegistration<YnlListener> registration = ynlRegistrations.remove(input.getId());
    final UnsubscribeYnlOutput output = registration.getInstance().getOutput();

    registration.close();

    return Futures.immediateFuture(RpcResultBuilder.<UnsubscribeYnlOutput>success().withResult(output).build());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:MdsalLowLevelTestProvider.java

示例10: checkPublishNotifications

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入依赖的package包/类
@Override
public Future<RpcResult<CheckPublishNotificationsOutput>> checkPublishNotifications(
        final CheckPublishNotificationsInput input) {

    final PublishNotificationsTask task = publishNotificationsTasks.get(input.getId());

    if (task == null) {
        return Futures.immediateFuture(RpcResultBuilder.success(
                new CheckPublishNotificationsOutputBuilder().setActive(false)).build());
    }

    final CheckPublishNotificationsOutputBuilder checkPublishNotificationsOutputBuilder =
            new CheckPublishNotificationsOutputBuilder().setActive(!task.isFinished());

    if (task.getLastError() != null) {
        final StringWriter sw = new StringWriter();
        final PrintWriter pw = new PrintWriter(sw);
        task.getLastError().printStackTrace(pw);
        checkPublishNotificationsOutputBuilder.setLastError(task.getLastError().toString() + sw.toString());
    }

    final CheckPublishNotificationsOutput output =
            checkPublishNotificationsOutputBuilder.setPublishCount(task.getCurrentNotif()).build();

    return Futures.immediateFuture(RpcResultBuilder.success(output).build());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:27,代码来源:MdsalLowLevelTestProvider.java

示例11: shutdownPrefixShardReplica

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入依赖的package包/类
@Override
public Future<RpcResult<Void>> shutdownPrefixShardReplica(final ShutdownPrefixShardReplicaInput input) {
    LOG.debug("Received shutdown-prefix-shard-replica rpc, input: {}", input);

    final InstanceIdentifier<?> shardPrefix = input.getPrefix();

    if (shardPrefix == null) {
        final RpcError rpcError = RpcResultBuilder.newError(ErrorType.APPLICATION, "bad-element",
                "A valid shard prefix must be specified");
        return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(rpcError).build());
    }

    final YangInstanceIdentifier shardPath = bindingNormalizedNodeSerializer.toYangInstanceIdentifier(shardPrefix);
    final String cleanPrefixShardName = ClusterUtils.getCleanShardName(shardPath);

    return shutdownShardGracefully(cleanPrefixShardName);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:MdsalLowLevelTestProvider.java

示例12: stopStressTest

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入依赖的package包/类
@Override
public Future<RpcResult<StopStressTestOutput>> stopStressTest() {
    stopThread();
    StopStressTestOutputBuilder stopStressTestOutput;
    stopStressTestOutput = new StopStressTestOutputBuilder()
            .setSuccessCount(succcessCounter.longValue())
            .setFailureCount(failureCounter.longValue());

    StopStressTestOutput result = stopStressTestOutput.build();
    LOG_PURCHASE_CAR.info("Executed Stop Stress test; No. of cars created {}; " +
            "No. of cars failed {}; ", succcessCounter, failureCounter);
    // clear counters
    succcessCounter.set(0);
    failureCounter.set(0);
    return Futures.immediateFuture(RpcResultBuilder.<StopStressTestOutput>success(result).build());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:CarProvider.java

示例13: registerOwnership

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入依赖的package包/类
@Override
public Future<RpcResult<Void>> registerOwnership(final RegisterOwnershipInput input) {
    if(registeredListener.compareAndSet(false, true)) {
        ownershipService.registerListener(ENTITY_TYPE, ownershipListener);
    }

    Entity entity = new Entity(ENTITY_TYPE, input.getCarId());
    try {
        ownershipService.registerCandidate(entity);
    } catch (CandidateAlreadyRegisteredException e) {
        return RpcResultBuilder.<Void>failed().withError(ErrorType.APPLICATION,
                "Could not register for car " + input.getCarId(), e).buildFuture();
    }

    return RpcResultBuilder.<Void>success().buildFuture();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:CarProvider.java

示例14: unregisterCommitCohort

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入依赖的package包/类
@Override
@SuppressWarnings("checkstyle:IllegalCatch")
public Future<RpcResult<Void>> unregisterCommitCohort() {
    final DOMDataTreeCommitCohortRegistration<CarEntryDataTreeCommitCohort> reg = commitCohortReg.getAndSet(null);
    if (reg != null) {
        try {
            reg.close();
            LOG_CAR_PROVIDER.info("Unregistered commit cohort");
        } catch (Exception e) {
            return RpcResultBuilder.<Void>failed().withError(ErrorType.APPLICATION,
                    "Error closing commit cohort registration", e).buildFuture();
        }
    }

    return RpcResultBuilder.<Void>success().buildFuture();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:CarProvider.java

示例15: getAclPortStatistics

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入依赖的package包/类
@Override
public Future<RpcResult<GetAclPortStatisticsOutput>> getAclPortStatistics(GetAclPortStatisticsInput input) {
    LOG.trace("Get ACL port statistics for input: {}", input);
    RpcResultBuilder<GetAclPortStatisticsOutput> rpcResultBuilder;

    if (this.securityGroupMode != SecurityGroupMode.Stateful) {
        rpcResultBuilder = RpcResultBuilder.failed();
        rpcResultBuilder.withError(ErrorType.APPLICATION, "operation-not-supported",
                "Operation not supported for ACL " + this.securityGroupMode + " mode");
        return Futures.immediateFuture(rpcResultBuilder.build());
    }
    // Default direction is Both
    Direction direction = input.getDirection() == null ? Direction.Both : input.getDirection();

    List<AclPortStats> lstAclInterfaceStats = AclLiveStatisticsHelper.getAclPortStats(direction,
            input.getInterfaceNames(), this.odlDirectStatsService, this.dataBroker);

    GetAclPortStatisticsOutputBuilder output =
            new GetAclPortStatisticsOutputBuilder().setAclPortStats(lstAclInterfaceStats);
    rpcResultBuilder = RpcResultBuilder.success();
    rpcResultBuilder.withResult(output.build());
    return Futures.immediateFuture(rpcResultBuilder.build());
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:24,代码来源:AclLiveStatisticsRpcServiceImpl.java


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