/** * Encodes this <code>TargetMatch</code> into its XML representation and * writes this encoding to the given <code>OutputStream</code> with no * indentation. * * @param output a stream into which the XML-encoded data is written */ public void encode(OutputStream output) { encode(output, new Indenter(0)); }
throw new IllegalArgumentException("Unknown TargetMatch type"); return getInstance(root, i, new PolicyMetaData( PolicyMetaData.XACML_1_0_IDENTIFIER,
/** * Determines whether this <code>TargetMatchGroup</code> matches * the input request (whether it is applicable). * * @param context the representation of the request * * @return the result of trying to match the group with the context */ public MatchResult match(EvaluationCtx context) { Iterator it = matches.iterator(); MatchResult result = null; while (it.hasNext()) { TargetMatch tm = (TargetMatch)(it.next()); result = tm.match(context); if (result.getResult() != MatchResult.MATCH) break; } return result; }
function.checkInputsNoBag(inputs); return new TargetMatch(matchType, function, eval, attrValue);
MatchResult match = evaluateMatch(inputs, context);
/** * Encodes this <code>TargetMatchGroup</code> into its XML representation * and writes this encoding to the given <code>OutputStream</code> with * indentation. * * @param output a stream into which the XML-encoded data is written * @param indenter an object that creates indentation strings */ public void encode(OutputStream output, Indenter indenter) { PrintStream out = new PrintStream(output); String indent = indenter.makeString(); Iterator it = matches.iterator(); String name = TargetMatch.NAMES[matchType]; out.println(indent + "<" + name + ">"); indenter.in(); while (it.hasNext()) { TargetMatch tm = (TargetMatch)(it.next()); tm.encode(output, indenter); } out.println(indent + "</" + name + ">"); indenter.out(); }
/** * Creates a <code>Target</code> based on its DOM node. * * @param root the node to parse for the target group * @param matchType the type of the match * @param metaData meta-date associated with the policy * * @return a new <code>TargetMatchGroup</code> constructed by parsing * * @throws ParsingException if the DOM node is invalid */ public static TargetMatchGroup getInstance(Node root, int matchType, PolicyMetaData metaData) throws ParsingException { List matches = new ArrayList(); NodeList children = root.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); String name = SunxacmlUtil.getNodeName(child); if (name.equals(TargetMatch.NAMES[matchType] + "Match")) { matches.add(TargetMatch.getInstance(child, matchType, metaData)); } } return new TargetMatchGroup(matches, matchType); }