/** * 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); }
/** * 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); } }
/** * 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); } }
return Policy.getInstance(root); } else if (name.equals("PolicySet")) { return PolicySet.getInstance(root, finder); } else {
policies.add(PolicySet.getInstance(child, finder)); } else if (name.equals("Policy")) { policies.add(Policy.getInstance(child));
return Policy.getInstance(root); } else if (rootName.equals("PolicySet")) { return PolicySet.getInstance(root); } else { throw new ValidationException("Policy invalid; root element is "
return Policy.getInstance(root); } else if (rootName.equals("PolicySet")) { return PolicySet.getInstance(root); } else { throw new ValidationException("Policy invalid; root element is "