本文整理了Java中xdi2.core.features.nodetypes.XdiPeerRoot.createPeerRootXDIArc()
方法的一些代码示例,展示了XdiPeerRoot.createPeerRootXDIArc()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XdiPeerRoot.createPeerRootXDIArc()
方法的具体详情如下:
包路径:xdi2.core.features.nodetypes.XdiPeerRoot
类名称:XdiPeerRoot
方法名:createPeerRootXDIArc
[英]Returns the peer root arc of an address.
[中]返回地址的对等根弧。
代码示例来源:origin: projectdanube/xdi2
@Override
public XDIArc map(XDIAddress XDIaddress) {
return XdiPeerRoot.createPeerRootXDIArc(XDIaddress);
}
}
代码示例来源:origin: projectdanube/xdi2
public void setOwnerXDIAddress(XDIAddress ownerXDIAddress) {
this.ownerPeerRootXDIArc = XdiPeerRoot.createPeerRootXDIArc(ownerXDIAddress);
}
代码示例来源:origin: projectdanube/xdi2
/**
* Set the TO address of the message (template).
*/
public void setToXDIAddress(XDIAddress toXDIAddress) {
XDIArc toPeerRootXDIArc = XdiPeerRoot.createPeerRootXDIArc(toXDIAddress);
this.setToPeerRootXDIArc(toPeerRootXDIArc);
}
代码示例来源:origin: projectdanube/xdi2
/**
* Set the FROM address of the message (template).
*/
public void setFromXDIAddress(XDIAddress fromXDIAddress) {
XDIArc fromPeerRootXDIArc = XdiPeerRoot.createPeerRootXDIArc(fromXDIAddress);
this.setFromPeerRootXDIArc(fromPeerRootXDIArc);
}
代码示例来源:origin: projectdanube/xdi2
public static CloudName createRandom(Character cs, String prefix) {
StringBuffer buffer = new StringBuffer();
buffer.append(cs);
if (prefix != null) buffer.append(prefix);
buffer.append(UUID.randomUUID().toString().toLowerCase().replace('-', '.'));
XDIAddress XDIaddress = XDIAddress.create(buffer.toString());
XDIArc peerRootXDIArc = XdiPeerRoot.createPeerRootXDIArc(XDIaddress);
return new CloudName(XDIaddress, peerRootXDIArc);
}
代码示例来源:origin: projectdanube/xdi2
public static CloudNumber fromXDIAddress(XDIAddress XDIaddress) {
if (! isValid(XDIaddress)) return null;
XDIArc peerRootXDIArc = XdiPeerRoot.createPeerRootXDIArc(XDIaddress);
return new CloudNumber(XDIaddress, peerRootXDIArc);
}
代码示例来源:origin: projectdanube/xdi2
public static DID fromXDIAddress(XDIAddress XDIaddress) {
if (! isValid(XDIaddress)) return null;
XDIArc peerRootXDIArc = XdiPeerRoot.createPeerRootXDIArc(XDIaddress);
return new DID(XDIaddress, peerRootXDIArc);
}
代码示例来源:origin: projectdanube/xdi2
@Override
public XDIClientRoute<?> route(XDIAddress XDIaddress) throws Xdi2AgentException, Xdi2ClientException {
// let's find out the TO peer root of the address
XDIAddress peerRootXDIAddress = XDIAddressUtil.extractXDIAddress(XDIaddress, XdiPeerRoot.class, false, false, true, false, false);
XDIArc peerRootFirstXDIArc = peerRootXDIAddress == null ? null : peerRootXDIAddress.getFirstXDIArc();
XDIArc firstXDIArc = XDIaddress.getFirstXDIArc();
if (log.isDebugEnabled()) log.debug("Peer root first arc: " + peerRootFirstXDIArc + ", First arc: " + firstXDIArc);
XDIArc toPeerRootXDIArc = null;
if (toPeerRootXDIArc == null && peerRootFirstXDIArc != null) toPeerRootXDIArc = peerRootFirstXDIArc;
if (toPeerRootXDIArc == null && firstXDIArc != null) toPeerRootXDIArc = XdiPeerRoot.createPeerRootXDIArc(XDIAddress.fromComponent(firstXDIArc));
if (log.isDebugEnabled()) log.debug("Determined TO peer root: " + toPeerRootXDIArc);
if (toPeerRootXDIArc == null) {
if (log.isDebugEnabled()) log.debug("Unable to determine TO peer root for address " + XDIaddress);
return null;
}
// let's find a route
return route(toPeerRootXDIArc);
}
代码示例来源:origin: projectdanube/xdi2
@Override
public XdiPeerRoot getPeerRoot(XDIAddress XDIaddress, boolean create) {
if (log.isTraceEnabled()) log.trace("getPeerRoot(" + XDIaddress + "," + create + ")");
XDIArc peerRootXDIArc = XdiPeerRoot.createPeerRootXDIArc(XDIaddress);
ContextNode peerRootContextNode = create ? this.getContextNode().setContextNode(peerRootXDIArc) : this.getContextNode().getContextNode(peerRootXDIArc, false);
if (peerRootContextNode == null) return null;
return new XdiPeerRoot(peerRootContextNode);
}
代码示例来源:origin: projectdanube/xdi2
public static CloudName fromXDIAddress(XDIAddress XDIaddress) {
if (! isValid(XDIaddress)) return null;
XDIaddress = XDIAddress.create(XDIaddress.toString().toLowerCase());
XDIArc peerRootXDIArc = XdiPeerRoot.createPeerRootXDIArc(XDIaddress);
return new CloudName(XDIaddress, peerRootXDIArc);
}
代码示例来源:origin: projectdanube/xdi2
@Override
public GraphMessagingContainer instanceFor(PrototypingContext prototypingContext) throws Xdi2MessagingException {
// create new messaging container
MessagingContainer messagingContainer = new GraphMessagingContainer();
// instantiate new graph
Graph graph;
try {
String identifier = XdiPeerRoot.createPeerRootXDIArc(prototypingContext.getOwnerXDIAddress()).toString();
graph = this.getGraph().getGraphFactory().openGraph(identifier);
if (log.isDebugEnabled()) log.debug("Opened graph " + graph.getClass().getCanonicalName() + " for " + identifier);
} catch (IOException ex) {
throw new Xdi2MessagingException("Cannot open graph: " + ex.getMessage(), ex, null);
}
((GraphMessagingContainer) messagingContainer).setGraph(graph);
// done
return (GraphMessagingContainer) messagingContainer;
}
代码示例来源:origin: projectdanube/xdi2
public static DID createRandom(Character cs) {
XDIArc XDIarc = XdiEntitySingleton.createXDIArc(cs, true, false, XDIArc.literalFromRandomUuid(), null);
XDIAddress XDIaddress = XDIAddress.fromComponent(XDIarc);
XDIArc peerRootXDIArc = XdiPeerRoot.createPeerRootXDIArc(XDIaddress);
return new DID(XDIaddress, peerRootXDIArc);
}
代码示例来源:origin: projectdanube/xdi2
public static CloudNumber createRandom(Character cs) {
XDIArc XDIarc = XdiEntitySingleton.createXDIArc(cs, true, false, XDIArc.literalFromRandomUuid(), null);
XDIAddress XDIaddress = XDIAddress.fromComponent(XDIarc);
XDIArc peerRootXDIArc = XdiPeerRoot.createPeerRootXDIArc(XDIaddress);
return new CloudNumber(XDIaddress, peerRootXDIArc);
}
代码示例来源:origin: projectdanube/xdi2
@Override
public RSAPrivateKey getPrivateKey(XDIAddress signerXDIAddress) throws GeneralSecurityException {
if (signerXDIAddress == null) throw new NullPointerException();
// graph
MessagingContainerMount messagingContainerMount;
try {
messagingContainerMount = this.getMessagingContainerRegistry().lookup(XdiPeerRoot.createPeerRootXDIArc(signerXDIAddress));
} catch (Exception ex) {
throw new GeneralSecurityException("Messaging target not found for " + signerXDIAddress + ": " + ex.getMessage(), ex);
}
if (log.isDebugEnabled()) log.debug("Messaging target mount: " + messagingContainerMount);
if (messagingContainerMount == null) return null;
MessagingContainer messagingContainer = messagingContainerMount.getMessagingContainer();
Graph graph = ((GraphMessagingContainer) messagingContainer).getGraph(); // TODO: what if this is another messaging container?
// signer entity
XdiEntity signerXdiEntity = XdiCommonRoot.findCommonRoot(graph).getXdiEntity(signerXDIAddress, false);
signerXdiEntity = signerXdiEntity == null ? null : signerXdiEntity.dereference();
if (log.isDebugEnabled()) log.debug("Signer entity: " + signerXdiEntity + " in graph " + GraphUtil.getOwnerPeerRootXDIArc(graph));
if (signerXdiEntity == null) return null;
// find private key
RSAPrivateKey privateKey = rsaPrivateKeyFromPrivateKeyString(Keys.getSignaturePrivateKey(signerXdiEntity));
// done
return privateKey;
}
代码示例来源:origin: projectdanube/xdi2
if (variableValues.containsKey(peerKey)) continue;
XDIArc peerValue = XdiPeerRoot.createPeerRootXDIArc((XDIAddress) value);
代码示例来源:origin: projectdanube/xdi2
if (variableValues.containsKey(peerKey)) continue;
XDIArc peerValue = XdiPeerRoot.createPeerRootXDIArc((XDIAddress) value);
代码示例来源:origin: projectdanube/xdi2
XDIArc toPeerRootXDIArc = XdiPeerRoot.createPeerRootXDIArc(message.getSenderXDIAddress());
this.registerSession(request.getWebSocketMessageHandler().getSession(), toPeerRootXDIArc);
代码示例来源:origin: projectdanube/xdi2
registryMessage.createGetOperation(XDIAddress.fromComponent(XdiPeerRoot.createPeerRootXDIArc(query)));
registryMessage.createGetOperation(XDIAddressUtil.concatXDIAddresses(query, XDISecurityConstants.XDI_ADD_MSG_SIG_KEYPAIR_PUBLIC_KEY));
registryMessage.createGetOperation(XDIAddressUtil.concatXDIAddresses(query, XDISecurityConstants.XDI_ADD_MSG_ENCRYPT_KEYPAIR_PUBLIC_KEY));
代码示例来源:origin: projectdanube/xdi2
public void testPeerRootXDIArces() throws Exception {
assertFalse(XdiPeerRoot.isValidXDIArc(XDIArc.create("")));
assertTrue(XdiPeerRoot.isValidXDIArc(XDIArc.create("(=!1111)")));
assertFalse(XdiPeerRoot.isValidXDIArc(XDIArc.create("(=a*b/+c*d)")));
assertFalse(XdiPeerRoot.isValidXDIArc(XDIArc.create("[<+c>]")));
assertFalse(XdiPeerRoot.isValidXDIArc(XDIArc.create("{*1}")));
assertFalse(XdiPeerRoot.isValidXDIArc(XDIArc.create("{[<+(name)>]}")));
assertFalse(XdiPeerRoot.isValidXDIArc(XDIArc.create("<+(name)>")));
assertFalse(XdiPeerRoot.isValidXDIArc(XDIArc.create("[+(name)]")));
assertFalse(XdiPeerRoot.isValidXDIArc(XDIArc.create("+(name)")));
assertEquals(XdiPeerRoot.createPeerRootXDIArc(XDIAddress.create("=!1111")), XDIArc.create("(=!1111)"));
assertEquals(XdiPeerRoot.getXDIAddressOfPeerRootXDIArc(XDIArc.create("(=!1111)")), XDIAddress.create("=!1111"));
}
内容来源于网络,如有侵权,请联系作者删除!