本文整理汇总了Java中xdi2.client.XDIClient类的典型用法代码示例。如果您正苦于以下问题:Java XDIClient类的具体用法?Java XDIClient怎么用?Java XDIClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XDIClient类属于xdi2.client包,在下文中一共展示了XDIClient类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getXdiClient
import xdi2.client.XDIClient; //导入依赖的package包/类
public XDIClient getXdiClient() {
return new XDIHttpClient(this.xdiEndpointUri);
}
开发者ID:projectdanube,项目名称:xdi2-manager,代码行数:4,代码来源:CloudUser.java
示例2: discoverManual
import xdi2.client.XDIClient; //导入依赖的package包/类
public static void discoverManual(CloudNumber cloudNumber) throws Exception {
XDIDiscoveryResult resultFromRegistry = xdiDiscoveryClient.discoverFromRegistry(cloudNumber.getXDIAddress());
URI xdiEndpointUri = resultFromRegistry.getXdiEndpointUri();
MessageEnvelope messageEnvelope = new MessageEnvelope();
Message message = messageEnvelope.createMessage(cloudNumber.getXDIAddress());
message.setToPeerRootXDIArc(cloudNumber.getPeerRootXDIArc());
message.createGetOperation(XDIStatement.fromComponents(cloudNumber.getXDIAddress(), XDIDictionaryConstants.XDI_ADD_IS_REF, XDIConstants.XDI_ADD_COMMON_VARIABLE));
message.setLinkContractClass(PublicLinkContract.class);
XDIClient xdiClient = new XDIHttpClient(xdiEndpointUri);
MessagingResponse messagingResponse = xdiClient.send(messageEnvelope);
ContextNode contextNode = messagingResponse.getGraph().getDeepContextNode(cloudNumber.getXDIAddress());
ReadOnlyIterator<Relation> relations = contextNode.getRelations(XDIDictionaryConstants.XDI_ADD_IS_REF);
for (Relation relation : relations) System.out.println("Manually discovered: " + relation.follow().getXDIAddress());
}
开发者ID:projectdanube,项目名称:xdi2-example-client,代码行数:22,代码来源:CloudNameDiscovery.java
示例3: main
import xdi2.client.XDIClient; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
LogManager.getLogger("xdi2").setLevel(Level.OFF);
XDIWriter writer = XDIWriterRegistry.forFormat("XDI DISPLAY", null);
// discovery
XDIDiscoveryClient xdiDiscoveryClient = XDIDiscoveryClient.DEFAULT_DISCOVERY_CLIENT;
XDIDiscoveryResult xdiDiscoveryResult = xdiDiscoveryClient.discoverFromRegistry(XDIAddress.create("=markus"));
// construct message
MessageEnvelope messageEnvelope = new MessageEnvelope();
Message message = messageEnvelope.createMessage(XDIAddress.create("=sender"));
message.createGetOperation(XDIAddress.create("=markus<#email>"));
message.setToPeerRootXDIArc(xdiDiscoveryResult.getCloudNumber().getPeerRootXDIArc());
message.setLinkContractClass(PublicLinkContract.class);
// construct client, send message, read result
XDIClient client = new XDIHttpClient(xdiDiscoveryResult.getXdiEndpointUri());
MessagingResponse messagingResponse = client.send(messageEnvelope);
// print results
System.out.println("Discovery result: ");
writer.write(xdiDiscoveryResult.getMessagingResponse().getGraph(), System.out);
System.out.println();
System.out.println("Message envelope: ");
writer.write(messageEnvelope.getGraph(), System.out);
System.out.println();
System.out.println("Messaging response: ");
writer.write(messagingResponse.getGraph(), System.out);
}
开发者ID:projectdanube,项目名称:xdi2-example-client,代码行数:39,代码来源:SimpleClient.java
注:本文中的xdi2.client.XDIClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论