gpt4 book ai didi

xdi2.core.features.nodetypes.XdiEntity类的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 19:42:40 30 4
gpt4 key购买 nike

本文整理了Java中xdi2.core.features.nodetypes.XdiEntity类的一些代码示例,展示了XdiEntity类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XdiEntity类的具体详情如下:
包路径:xdi2.core.features.nodetypes.XdiEntity
类名称:XdiEntity

XdiEntity介绍

暂无

代码示例

代码示例来源:origin: projectdanube/xdi2

/**
 * Checks if an XDI entity is a valid DDO.
 * @param xdiEntity The XDI entity to check.
 * @return True if the XDI entity is a valid DDO.
 */
public static boolean isValid(XdiEntity xdiEntity) {
  if (xdiEntity == null) return false;
  if (! DID.isValid(xdiEntity.getXDIAddress())) return false;
  return true;
}

代码示例来源:origin: projectdanube/xdi2

/**
 * Returns the underlying XDI entity to which this DDO is bound.
 * @return An XDI entity that represents the DDO.
 */
public ContextNode getContextNode() {
  return this.getXdiEntity().getContextNode();
}

代码示例来源:origin: projectdanube/xdi2

public XdiInnerRoot getXdiInnerRoot() {
  XdiRoot xdiRoot = this.getXdiEntity().findRoot();
  if (! (xdiRoot instanceof XdiInnerRoot)) return null;
  return (XdiInnerRoot) xdiRoot;
}

代码示例来源:origin: projectdanube/xdi2

/**
 * Checks if an XDI entity is a valid XDI message.
 * @param xdiEntity The XDI entity to check.
 * @return True if the XDI entity is a valid XDI message.
 */
public static boolean isValid(XdiEntity xdiEntity) {
  if (xdiEntity instanceof XdiEntitySingleton) {
    if (! xdiEntity.getXDIArc().equals(XDIMessagingConstants.XDI_ADD_MSG)) return false;
  } else if (xdiEntity instanceof XdiEntityInstance) {
    XdiEntityCollection xdiCollection = ((XdiEntityInstance) xdiEntity).getXdiCollection();
    if (! xdiCollection.getXDIArc().equals(XDIMessagingConstants.XDI_ADD_EC_MSG)) return false;
  } else {
    return false;
  }
  if (xdiEntity.getXdiEntitySingleton(XDIMessagingConstants.XDI_ARC_DO, false) == null) return false;
  return true;
}

代码示例来源:origin: projectdanube/xdi2

/**
 * Returns the XDI entity with XDI permissions.
 * @return A XDI entity with XDI permissions.
 */
public XdiEntity getPermissionsXdiEntity() {
  return this.getXdiEntity().getXdiEntitySingleton(XDILinkContractConstants.XDI_ARC_DO, true);
}

代码示例来源:origin: projectdanube/xdi2

public XdiInnerRoot getMessageDeferredPushResult() {
  XdiInnerRoot xdiInnerRoot = this.getXdiSubGraph().getXdiInnerRoot(XDIMessagingConstants.XDI_ADD_DEFER_PUSH, false);
  if (xdiInnerRoot == null) return null;
  return xdiInnerRoot;
}

代码示例来源:origin: projectdanube/xdi2

/**
 * Creates an XDI $not policy.
 */
public PolicyNot createNotPolicy(boolean singleton) {
  XdiEntity policyNotXdiEntity; 
  if (singleton)
    policyNotXdiEntity = this.getXdiEntity().getXdiEntitySingleton(XdiEntitySingleton.createXDIArc(XDIPolicyConstants.XDI_ARC_NOT), true);
  else
    policyNotXdiEntity = this.getXdiEntity().getXdiEntityCollection(XdiEntityCollection.createXDIArc(XDIPolicyConstants.XDI_ARC_NOT), true).setXdiInstanceUnordered(true, false);
  return PolicyNot.fromXdiEntity(policyNotXdiEntity);
}

代码示例来源: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

private LiteralNode getParameterLiteral(XDIAddress parameterXDIAddress) {
  XdiAttributeSingleton parameterXdiAttribute = this.getXdiSubGraph().getXdiAttributeSingleton(parameterXDIAddress, false);
  if (parameterXdiAttribute == null) return null;
  LiteralNode parameterLiteralNode = parameterXdiAttribute.getLiteralNode();
  if (parameterLiteralNode == null) return null;
  return parameterLiteralNode;
}

代码示例来源:origin: projectdanube/xdi2

/**
 * Returns the XDI entity with XDI operations.
 * @return A XDI entity with XDI operations.
 */
public XdiEntity getOperationsXdiEntity() {
  return this.getXdiSubGraph().getXdiEntitySingleton(XDIMessagingConstants.XDI_ARC_DO, true);
}

代码示例来源:origin: projectdanube/xdi2

public void delPermissionTargetXDIStatements(XDIAddress permissionXDIAddress) {
  if (permissionXDIAddress == null) throw new NullPointerException();
  // delete the permission statements
  XdiInnerRoot xdiInnerRoot = this.getPermissionsXdiEntity().getXdiInnerRoot(permissionXDIAddress, false);
  if (xdiInnerRoot == null) return;
  xdiInnerRoot.getContextNode().delete();
}

代码示例来源:origin: projectdanube/xdi2

/**
 * Creates an XDI $or policy.
 */
public PolicyOr createOrPolicy(boolean singleton) {
  XdiEntity policyOrXdiEntity; 
  if (singleton)
    policyOrXdiEntity = this.getXdiEntity().getXdiEntitySingleton(XdiEntitySingleton.createXDIArc(XDIPolicyConstants.XDI_ARC_OR), true);
  else
    policyOrXdiEntity = this.getXdiEntity().getXdiEntityCollection(XdiEntityCollection.createXDIArc(XDIPolicyConstants.XDI_ARC_OR), true).setXdiInstanceUnordered(true, false);
  return PolicyOr.fromXdiEntity(policyOrXdiEntity);
}

代码示例来源:origin: projectdanube/xdi2

@Override
public SecretKey getSecretKey(XDIAddress signerXDIAddress) throws GeneralSecurityException {
  // signer address
  if (signerXDIAddress == null) {
    signerXDIAddress = GraphUtil.getOwnerXDIAddress(this.getSecretKeyGraph());
  }
  // signer entity
  XdiEntity signerXdiEntity = XdiCommonRoot.findCommonRoot(this.getSecretKeyGraph()).getXdiEntity(signerXDIAddress, false);
  signerXdiEntity = signerXdiEntity == null ? null : signerXdiEntity.dereference();
  if (log.isDebugEnabled()) log.debug("Signer entity: " + signerXdiEntity + " in graph " + GraphUtil.getOwnerPeerRootXDIArc(this.getSecretKeyGraph()));
  if (signerXdiEntity == null) return null;
  // find secret key
  SecretKey secretKey = aesSecretKeyFromSecretKeyString(Keys.getSecretKey(signerXdiEntity));
  // done
  return secretKey;
}

代码示例来源:origin: projectdanube/xdi2

/**
 * Sets a parameter value of this message (template).
 * @param parameterXDIAddress The parameter identifier.
 * @param parameterValue The parameter value.
 */
public void setParameter(XDIAddress parameterXDIAddress, Object parameterValue) {
  XdiAttributeSingleton parameterXdiAttribute = this.getXdiSubGraph().getXdiAttributeSingleton(parameterXDIAddress, true);
  parameterXdiAttribute.setLiteralData(parameterValue);
}

代码示例来源:origin: projectdanube/xdi2

/**
 * Checks if an XDI entity is a valid XDI root link contract.
 * @param xdiEntity The XDI entity to check.
 * @return True if the XDI entity is a valid XDI root link contract.
 */
public static boolean isValid(XdiEntity xdiEntity) {
  if (! RelationshipLinkContract.isValid(xdiEntity)) return false;
  if (xdiEntity instanceof XdiEntitySingleton) {
    if (RelationshipLinkContract.getAuthorizingAuthority(xdiEntity.getXDIAddress()) == null) return false;
    if (RelationshipLinkContract.getRequestingAuthority(xdiEntity.getXDIAddress()) == null) return false;
    if (RelationshipLinkContract.getTemplateAuthorityAndId(xdiEntity.getXDIAddress()) != null) return false;
    if (! RelationshipLinkContract.getAuthorizingAuthority(xdiEntity.getXDIAddress()).equals(RelationshipLinkContract.getRequestingAuthority(xdiEntity.getXDIAddress()))) return false;
    return true;
  } else if (xdiEntity instanceof XdiEntityInstance) {
    return false;
  } else {
    return false;
  }
}

代码示例来源:origin: projectdanube/xdi2

/**
 * Returns the underlying context node to which this XDI link contract (template) is bound.
 * @return A context node that represents the XDI link contract (template).
 */
public ContextNode getContextNode() {
  return this.getXdiEntity().getContextNode();
}

代码示例来源:origin: projectdanube/xdi2

/**
 * Returns an existing XDI defer push policy root in this XDI link contract (template), or creates a new one.
 * @param create Whether to create an XDI defer push policy root if it does not exist.
 * @return The existing or newly created XDI defer push policy root.
 */
public PolicyRoot getDeferPushPolicyRoot(boolean create) {
  XdiEntitySingleton xdiEntitySingleton = this.getXdiEntity().getXdiEntitySingleton(XDIPolicyConstants.XDI_ADD_DEFER_PUSH, create);
  if (xdiEntitySingleton == null) return null;
  xdiEntitySingleton = xdiEntitySingleton.getXdiEntitySingleton(XDIPolicyConstants.XDI_ARC_IF, create);
  if (xdiEntitySingleton == null) return null;
  return PolicyRoot.fromXdiEntity(xdiEntitySingleton);
}

代码示例来源:origin: projectdanube/xdi2

public boolean hasPermissionTargetXDIStatement(XDIAddress permissionXDIAddress, XDIStatement targetXDIStatement) {
  if (permissionXDIAddress == null || targetXDIStatement == null) throw new NullPointerException();
  // find the inner root
  XdiInnerRoot xdiInnerRoot = this.getPermissionsXdiEntity().getXdiInnerRoot(permissionXDIAddress, false);
  if (xdiInnerRoot == null) return false;
  // check if the target statement exists
  return xdiInnerRoot.getContextNode().containsStatement(targetXDIStatement);
}

代码示例来源:origin: projectdanube/xdi2

/**
 * Creates an XDI $and policy.
 */
public PolicyAnd createAndPolicy(boolean singleton) {
  XdiEntity policyAndXdiEntity; 
  if (singleton)
    policyAndXdiEntity = this.getXdiEntity().getXdiEntitySingleton(XdiEntitySingleton.createXDIArc(XDIPolicyConstants.XDI_ARC_AND), true);
  else
    policyAndXdiEntity = this.getXdiEntity().getXdiEntityCollection(XdiEntityCollection.createXDIArc(XDIPolicyConstants.XDI_ARC_AND), true).setXdiInstanceUnordered(true, false);
  return PolicyAnd.fromXdiEntity(policyAndXdiEntity);
}

代码示例来源:origin: projectdanube/xdi2

@Override
public SecretKey getSecretKey(XDIAddress signerXDIAddress) throws GeneralSecurityException {
  // signer address
  if (signerXDIAddress == null) {
    signerXDIAddress = GraphUtil.getOwnerXDIAddress(this.getSecretKeyGraph());
  }
  // signer entity
  XdiEntity signerXdiEntity = XdiCommonRoot.findCommonRoot(this.getSecretKeyGraph()).getXdiEntity(signerXDIAddress, false);
  signerXdiEntity = signerXdiEntity == null ? null : signerXdiEntity.dereference();
  if (log.isDebugEnabled()) log.debug("Signer entity: " + signerXdiEntity + " in graph " + GraphUtil.getOwnerPeerRootXDIArc(this.getSecretKeyGraph()));
  if (signerXdiEntity == null) return null;
  // find secret key
  SecretKey secretKey = aesSecretKeyFromSecretKeyString(Keys.getSecretKey(signerXdiEntity));
  // done
  return secretKey;
}

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com