本文整理汇总了Java中org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder方法的典型用法代码示例。如果您正苦于以下问题:Java InstanceIdentifier.InstanceIdentifierBuilder方法的具体用法?Java InstanceIdentifier.InstanceIdentifierBuilder怎么用?Java InstanceIdentifier.InstanceIdentifierBuilder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opendaylight.yangtools.yang.binding.InstanceIdentifier
的用法示例。
在下文中一共展示了InstanceIdentifier.InstanceIdentifierBuilder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addPerson
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; //导入方法依赖的package包/类
@Override
public Future<RpcResult<Void>> addPerson(final AddPersonInput input) {
LOG.info("RPC addPerson : adding person [{}]", input);
PersonBuilder builder = new PersonBuilder(input);
final Person person = builder.build();
final SettableFuture<RpcResult<Void>> futureResult = SettableFuture.create();
// Each entry will be identifiable by a unique key, we have to create that identifier
final InstanceIdentifier.InstanceIdentifierBuilder<Person> personIdBuilder =
InstanceIdentifier.<People>builder(People.class)
.child(Person.class, person.getKey());
final InstanceIdentifier<Person> personId = personIdBuilder.build();
// Place entry in data store tree
WriteTransaction tx = dataProvider.newWriteOnlyTransaction();
tx.put(LogicalDatastoreType.CONFIGURATION, personId, person, true);
Futures.addCallback(tx.submit(), new FutureCallback<Void>() {
@Override
public void onSuccess(final Void result) {
LOG.info("RPC addPerson : person added successfully [{}]", person);
rpcRegistration.registerPath(PersonContext.class, personId);
LOG.info("RPC addPerson : routed rpc registered for instance ID [{}]", personId);
futureResult.set(RpcResultBuilder.<Void>success().build());
}
@Override
public void onFailure(final Throwable t) {
LOG.error(String.format("RPC addPerson : person addition failed [%s]", person), t);
futureResult.set(RpcResultBuilder.<Void>failed()
.withError(RpcError.ErrorType.APPLICATION, t.getMessage()).build());
}
});
return futureResult;
}