private static PolicySet toPolicySet(List<AbstractPolicy> policies, PolicyCombiningAlgorithm alg) { return new PolicySet(EMPTY_URI, alg, null /* * no general target beyond those of * multiplexed individual policies */, policies); } }
/** * Creates an instance of a <code>PolicySet</code> object based on a * DOM node. The node must be the root of PolicySetType XML object, * otherwise an exception is thrown. This <code>PolicySet</code> will * not support references because it has no <code>PolicyFinder</code>. * * @param root the DOM root of a PolicySetType XML type * * @throws ParsingException if the PolicySetType is invalid */ public static PolicySet getInstance(Node root) throws ParsingException { return getInstance(root, null); }
/** * Encodes this <code>PolicySet</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)); }
String indent = indenter.makeString(); out.println(indent + "<PolicySet PolicySetId=\"" + getId().toString() + "\" PolicyCombiningAlgId=\"" + getCombiningAlg().getIdentifier().toString() + "\">"); String nextIndent = indenter.makeString(); String description = getDescription(); if (description != null) out.println(nextIndent + "<Description>" + description + "</Description>"); String version = getDefaultVersion(); if (version != null) out.println("<PolicySetDefaults><XPathVersion>" + version + "</XPathVersion></PolicySetDefaults>"); getTarget().encode(output, indenter); encodeCommonElements(output, indenter);
HashMap policyParameters = new HashMap(); HashMap policySetParameters = new HashMap(); PolicyMetaData metaData = getMetaData(); policies.add(PolicySet.getInstance(child, finder)); } else if (name.equals("Policy")) { policies.add(Policy.getInstance(child)); metaData)); } else if (name.equals("PolicyCombinerParameters")) { paramaterHelper(policyParameters, child, "Policy"); } else if (name.equals("PolicySetCombinerParameters")) { paramaterHelper(policySetParameters, child, "PolicySet"); setChildren(elements);
@Override public String toString() { return "PolicySet [getId()=" + getId() + "]"; } }
/** * A private method that handles reading the policy and creates the correct * kind of AbstractPolicy. * Because this makes use of the policyFinder, it cannot be reused between finders. * Consider moving to policyManager, which is not intended to be reused outside * of a policyFinderModule, which is not intended to be reused amongst PolicyFinder instances. */ protected AbstractPolicy handleDocument(Document doc, PolicyFinder policyFinder) throws ParsingException { // handle the policy, if it's a known type Element root = doc.getDocumentElement(); String name = root.getTagName(); // see what type of policy this is if (name.equals("Policy")) { return Policy.getInstance(root); } else if (name.equals("PolicySet")) { return PolicySet.getInstance(root, policyFinder); } else { // this isn't a root type that we know how to handle throw new ParsingException("Unknown root document type: " + name); } }
private static PolicySet toPolicySet(List<AbstractPolicy> policies, PolicyCombiningAlgorithm alg) { return new PolicySet(EMPTY_URI, alg, null /* * no general target beyond those of * multiplexed individual policies */, policies); } }
/** * A private method that handles reading the policy and creates the * correct kind of AbstractPolicy. */ private AbstractPolicy handleDocument(Document doc) throws ParsingException { // handle the policy, if it's a known type Element root = doc.getDocumentElement(); String name = root.getTagName(); // see what type of policy this is if (name.equals("Policy")) { return Policy.getInstance(root); } else if (name.equals("PolicySet")) { return PolicySet.getInstance(root, finder); } else { // this isn't a root type that we know how to handle throw new ParsingException("Unknown root document type: " + name); } }
/** * Creates an instance of a <code>PolicySet</code> object based on a * DOM node. The node must be the root of PolicySetType XML object, * otherwise an exception is thrown. The finder is used to handle * policy references. * * @param root the DOM root of a PolicySetType XML type * @param finder the <code>PolicyFinder</code> used to handle references * * @throws ParsingException if the PolicySetType is invalid */ public static PolicySet getInstance(Node root, PolicyFinder finder) throws ParsingException { // first off, check that it's the right kind of node if (! SunxacmlUtil.getNodeName(root).equals("PolicySet")) { throw new ParsingException("Cannot create PolicySet from root of" + " type " + SunxacmlUtil.getNodeName(root)); } return new PolicySet(root, finder); }
return Policy.getInstance(root); } else if (name.equals("PolicySet")) { return PolicySet.getInstance(root, finder); } else {
return p; default: return new PolicySet(parentPolicyId, m_combiningAlg, m_target,
return Policy.getInstance(root); } else if (rootName.equals("PolicySet")) { return PolicySet.getInstance(root); } else { throw new ValidationException("Policy invalid; root element is "
return ((AbstractPolicy) (list.get(0))); default : return new PolicySet(parentId, combiningAlg, target, list);
return Policy.getInstance(root); } else if (rootName.equals("PolicySet")) { return PolicySet.getInstance(root); } else { throw new ValidationException("Policy invalid; root element is "