/** * Checks if an address is a valid XDI $false condition. * @param XDIaddress The address to check. * @return True if the address is a valid XDI $false condition. */ public static boolean isValid(XDIAddress XDIaddress) { if (! XDIConstants.XDI_ADD_FALSE.equals(XDIaddress)) return false; return true; }
/** * Checks if an address is a valid XDI $true condition. * @param XDIaddress The address to check. * @return True if the address is a valid XDI $true condition. */ public static boolean isValid(XDIAddress XDIaddress) { if (! XDIConstants.XDI_ADD_TRUE.equals(XDIaddress)) return false; return true; }
/** * Checks if a context node is a valid XDI common definition. * @param contextNode The context node to check. * @return True if the context node is a valid XDI common definition. */ public static boolean isValid(ContextNode contextNode) { if (contextNode == null) throw new NullPointerException(); return XDIConstants.XDI_ADD_COMMON_DEFINITION.equals(contextNode.getXDIArc()); }
@Override public boolean select(Relation relation) { return relation.getTargetXDIAddress().equals(targetXDIAddress); } };
/** * Checks if a context node is a valid XDI common variable. * @param contextNode The context node to check. * @return True if the context node is a valid XDI common variable. */ public static boolean isValid(ContextNode contextNode) { if (contextNode == null) throw new NullPointerException(); return XDIConstants.XDI_ADD_COMMON_VARIABLE.equals(contextNode.getXDIArc()); }
@Override public boolean select(Relation relation) { return relation.getXDIAddress().equals(XDIDictionaryConstants.XDI_ADD_HAS); } };
@Override public boolean select(Relation relation) { return relation.getXDIAddress().equals(XDIDictionaryConstants.XDI_ADD_REP); } };
@Override public boolean select(Relation relation) { return relation.getXDIAddress().equals(XDIaddress); } };
@Override public boolean select(Relation relation) { return relation.getXDIAddress().equals(XDIDictionaryConstants.XDI_ADD_IS); } };
@Override public boolean select(Relation relation) { return relation.getXDIAddress().equals(XDIDictionaryConstants.XDI_ADD_REF); } };
@Override public boolean equals(Object object) { if (! (object instanceof DID)) return false; if (object == this) return true; return this.getXDIAddress().equals(((DID) object).getXDIAddress()); }
@Override public boolean equals(Object object) { if (! (object instanceof CloudName)) return false; if (object == this) return true; return this.getXDIAddress().equals(((CloudName) object).getXDIAddress()); }
/** * Checks if a statement is a valid XDI $lesser condition. * @param XDIstatement The statement to check. * @return True if the statement is a valid XDI $lesser condition. */ public static boolean isValid(XDIStatement XDIstatement) { if (! XDIstatement.isRelationStatement()) return false; if (! XDIPolicyConstants.XDI_ADD_LESSER.equals(XDIstatement.getRelationXDIAddress())) return false; return true; }
@Override public boolean equals(Object object) { if (! (object instanceof CloudNumber)) return false; if (object == this) return true; return this.getXDIAddress().equals(((CloudNumber) object).getXDIAddress()); }
/** * Checks if a statement is a valid XDI $greater condition. * @param XDIstatement The statement to check. * @return True if the statement is a valid XDI $greater condition. */ public static boolean isValid(XDIStatement XDIstatement) { if (! XDIstatement.isRelationStatement()) return false; if (! XDIPolicyConstants.XDI_ADD_GREATER.equals(XDIstatement.getRelationXDIAddress())) return false; return true; }
/** * Checks if a statement is a valid XDI $is condition. * @param XDIstatement The statement to check. * @return True if the statement is a valid XDI $is condition. */ public static boolean isValid(XDIStatement XDIstatement) { if (! XDIstatement.isRelationStatement()) return false; if (! XDIPolicyConstants.XDI_ADD_IS.equals(XDIstatement.getRelationXDIAddress())) return false; return true; }
@Override public boolean equals(Object object) { if (object == null || ! (object instanceof Statement)) return false; if (object == this) return true; Statement other = (Statement) object; // two statements are equal if their components are equals if (! this.getSubject().equals(other.getSubject())) return false; if (! this.getPredicate().equals(other.getPredicate())) return false; if (! this.getObject().equals(other.getObject())) return false; return true; }
private void writeContextNodeXDIArc(BufferedWriter bufferedWriter, XDIAddress contextNodeXDIAddress, XDIArc contextNodeXDIArc) throws IOException { ContextNode contextNode = MemoryGraphFactory.getInstance().openGraph().getRootContextNode(false); if (! XDIConstants.XDI_ADD_ROOT.equals(contextNodeXDIAddress)) { contextNode = contextNode.setDeepContextNode(contextNodeXDIAddress); } this.writeContextNodeXDIArc(bufferedWriter, contextNode, contextNodeXDIArc); }
/** * When a relation is deleted, its inner root has to be deleted too. */ protected void delRelationDelInnerRoot(XDIAddress XDIaddress, XDIAddress targetXDIAddress) { XdiContext<?> xdiContext = XdiAbstractContext.fromContextNode(this); XdiInnerRoot xdiInnerRoot = xdiContext.getXdiInnerRoot(XDIaddress, false); if (xdiInnerRoot == null) return; if (xdiInnerRoot.getXDIAddress().equals(targetXDIAddress)) { this.getGraph().getDeepNode(targetXDIAddress, false).delete(); } }
@Override public boolean evaluateInternal(PolicyEvaluationContext policyEvaluationContext) { // check if subject address and object address are the same XDIAddress subject = policyEvaluationContext.resolveXDIAddress(this.getXDIStatement().getSubject()); XDIAddress object = policyEvaluationContext.resolveXDIAddress((XDIAddress) this.getXDIStatement().getObject()); if (subject == null || object == null) return false; if (subject.equals(object)) return true; // done return false; } }