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


Java RpcResultBuilder.newError方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: DataValidationFailedException

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
public <P extends Path<P>> DataValidationFailedException(final Class<P> pathType,final P path,
                                                         final String message, final Throwable cause) {
    super(message, cause, RpcResultBuilder.newError(ErrorType.APPLICATION, "invalid-value", message, null,
                                                    path != null ? path.toString() : null, cause));
    this.pathType = Preconditions.checkNotNull(pathType, "path type must not be null");
    this.path = Preconditions.checkNotNull(path,"path must not be null.");
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:8,代码来源:DataValidationFailedException.java

示例10: getRpcErrors

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
public Collection<RpcError> getRpcErrors() {
    final Collection<RpcError> rpcErrors = new ArrayList<>();
    for (final RpcErrorData ed: rpcErrorDataList) {
        final RpcError rpcError = ed.severity == ErrorSeverity.ERROR
                ? RpcResultBuilder.newError(ed.errorType, ed.tag, ed.message, ed.applicationTag,
                        ed.info, ed.cause) :
                  RpcResultBuilder.newWarning(ed.errorType, ed.tag, ed.message, ed.applicationTag,
                        ed.info, ed.cause);
        rpcErrors.add(rpcError);
    }

    return rpcErrors;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:14,代码来源:RpcErrorsException.java

示例11: setUp

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    final RpcError rpcError = RpcResultBuilder.newError(
            RpcError.ErrorType.RPC, "error", "error message");
    final RpcError rpcWarning = RpcResultBuilder.newWarning(
            RpcError.ErrorType.RPC, "warning", "warning message");

    rpcErrors = new ArrayList<>();
    rpcErrors.add(rpcError);
    rpcErrors.add(rpcWarning);

    exception = new RpcErrorsException(ERROR_MESSAGE, rpcErrors);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:14,代码来源:RpcErrorsExceptionTest.java

示例12: unregisterConstant

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

    if (globalGetConstantRegistration == null) {
        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);
    }

    globalGetConstantRegistration.close();
    globalGetConstantRegistration = null;

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

示例13: registerFlappingSingleton

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
@Override
public Future<RpcResult<Void>> registerFlappingSingleton() {
    LOG.debug("Received register-flapping-singleton.");

    if (flappingSingletonService != null) {
        final RpcError error = RpcResultBuilder.newError(
                ErrorType.RPC, "Registration present.", "flapping-singleton already registered");
        return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(error).build());
    }

    flappingSingletonService = new FlappingSingletonService(singletonService);

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

示例14: shutdownShardReplica

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

    final String shardName = input.getShardName();
    if (Strings.isNullOrEmpty(shardName)) {
        final RpcError rpcError = RpcResultBuilder.newError(ErrorType.APPLICATION, "bad-element",
                "A valid shard name must be specified");
        return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(rpcError).build());
    }

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

示例15: OptimisticLockFailedException

import org.opendaylight.yangtools.yang.common.RpcResultBuilder; //导入方法依赖的package包/类
public OptimisticLockFailedException(final String message, final Throwable cause) {
    super(message, cause, RpcResultBuilder.newError(ErrorType.APPLICATION, "resource-denied",
                                                    message, null, null, cause));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:5,代码来源:OptimisticLockFailedException.java


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