/** * Helper static class that does the work to write a policy set to an output stream. * * @author pameladragosh * */ public static void writePolicyFile(OutputStream os, PolicySetType policySet) { JAXBElement<PolicySetType> policySetElement = new ObjectFactory().createPolicySet(policySet); try { JAXBContext context = JAXBContext.newInstance(PolicySetType.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); m.marshal(policySetElement, os); } catch (JAXBException e) { logger.error("writePolicyFile failed: " + e.getLocalizedMessage()); } }
/** * Helper static class that does the work to write a policy set to an output stream. * * @author pameladragosh * */ public static void writePolicyFile(OutputStream os, PolicyType policy) { JAXBElement<PolicyType> policySetElement = new ObjectFactory().createPolicy(policy); try { JAXBContext context = JAXBContext.newInstance(PolicyType.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); m.marshal(policySetElement, os); } catch (JAXBException e) { logger.error("writePolicyFile failed: " + e.getLocalizedMessage()); } }
? Xacml3JaxbHelper.XACML_3_0_OBJECT_FACTORY.createPolicyIdReference(jaxbIdRef) : Xacml3JaxbHelper.XACML_3_0_OBJECT_FACTORY.createPolicySetIdReference(jaxbIdRef); jaxbPolicyIdRefs.add(jaxbPolicyIdRef);
private static void addStatusMessageForEachCause(final Throwable cause, final int currentCauseDepth, final int maxIncludedCauseDepth, final List<Element> statusDetailElements, final Marshaller xacml3Marshaller) throws JAXBException { if (cause == null) { return; } assert statusDetailElements != null; // create JAXBElement: StatusMessage(cause.getMessage) and convert it to DOM Element final DOMResult domResult = new DOMResult(); xacml3Marshaller.marshal(Xacml3JaxbHelper.XACML_3_0_OBJECT_FACTORY.createStatusMessage(cause.getMessage()), domResult); statusDetailElements.add(((Document) domResult.getNode()).getDocumentElement()); if (currentCauseDepth == maxIncludedCauseDepth) { return; } addStatusMessageForEachCause(cause.getCause(), currentCauseDepth + 1, maxIncludedCauseDepth, statusDetailElements, xacml3Marshaller); }
/** * Helper static class that does the work to write a policy set to an output stream. * * @author pameladragosh * */ public static void writePolicyFile(OutputStream os, PolicySetType policySet) { JAXBElement<PolicySetType> policySetElement = new ObjectFactory().createPolicySet(policySet); try { JAXBContext context = JAXBContext.newInstance(PolicySetType.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); m.marshal(policySetElement, os); } catch (JAXBException e) { logger.error("writePolicyFile failed: " + e.getLocalizedMessage()); } }
/** * Helper static class that does the work to write a policy set to an output stream. * * @author pameladragosh * */ public static void writePolicyFile(OutputStream os, PolicyType policy) { JAXBElement<PolicyType> policySetElement = new ObjectFactory().createPolicy(policy); try { JAXBContext context = JAXBContext.newInstance(PolicyType.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); m.marshal(policySetElement, os); } catch (JAXBException e) { logger.error("writePolicyFile failed: " + e.getLocalizedMessage()); } }
/** * Helper static class that does the work to write a policy set to a file on disk. * * @author pameladragosh * */ public static Path writePolicyFile(Path filename, PolicySetType policySet) { JAXBElement<PolicySetType> policySetElement = new ObjectFactory().createPolicySet(policySet); try { JAXBContext context = JAXBContext.newInstance(PolicySetType.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); m.marshal(policySetElement, filename.toFile()); if (Files.exists(filename)) { return filename; } else { logger.error("File does not exist after marshalling."); return null; } } catch (JAXBException e) { logger.error("writePolicyFile failed: " + e.getLocalizedMessage()); return null; } }
/** * Helper static class that does the work to write a policy to a file on disk. * * @author pameladragosh * */ public static Path writePolicyFile(Path filename, PolicyType policy) { JAXBElement<PolicyType> policyElement = new ObjectFactory().createPolicy(policy); try { JAXBContext context = JAXBContext.newInstance(PolicyType.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); m.marshal(policyElement, filename.toFile()); if (Files.exists(filename)) { return filename; } else { logger.error("File does not exist after marshalling."); return null; } } catch (JAXBException e) { logger.error("writePolicyFile failed: " + e.getLocalizedMessage()); return null; } } /**
/** * Helper static class that does the work to write a policy set to a file on disk. * * @author pameladragosh * */ public static Path writePolicyFile(Path filename, PolicySetType policySet) { JAXBElement<PolicySetType> policySetElement = new ObjectFactory().createPolicySet(policySet); try { JAXBContext context = JAXBContext.newInstance(PolicySetType.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); m.marshal(policySetElement, filename.toFile()); if (Files.exists(filename)) { return filename; } else { logger.error("File does not exist after marshalling."); return null; } } catch (JAXBException e) { logger.error("writePolicyFile failed: " + e.getLocalizedMessage()); return null; } }
/** * Helper static class that does the work to write a policy to a file on disk. * * @author pameladragosh * */ public static Path writePolicyFile(Path filename, PolicyType policy) { JAXBElement<PolicyType> policyElement = new ObjectFactory().createPolicy(policy); try { JAXBContext context = JAXBContext.newInstance(PolicyType.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); m.marshal(policyElement, filename.toFile()); if (Files.exists(filename)) { return filename; } else { logger.error("File does not exist after marshalling."); return null; } } catch (JAXBException e) { logger.error("writePolicyFile failed: " + e.getLocalizedMessage()); return null; } } /**