Search in sources :

Example 1 with ObjectFactory

use of org.xipki.ca.certprofile.x509.jaxb.ObjectFactory in project xipki by xipki.

the class ProfileConfCreatorDemo method marshall.

// method main
private static void marshall(Marshaller marshaller, X509ProfileType profile, String filename) throws Exception {
    File file = new File("tmp", filename);
    file.getParentFile().mkdirs();
    JAXBElement<X509ProfileType> root = new ObjectFactory().createX509Profile(profile);
    FileOutputStream out = new FileOutputStream(file);
    try {
        marshaller.marshal(root, out);
    } catch (JAXBException ex) {
        throw XmlUtil.convert(ex);
    } finally {
        out.close();
    }
    System.out.println("Generated certprofile in " + filename);
}
Also used : ObjectFactory(org.xipki.ca.certprofile.x509.jaxb.ObjectFactory) FileOutputStream(java.io.FileOutputStream) JAXBException(javax.xml.bind.JAXBException) X509ProfileType(org.xipki.ca.certprofile.x509.jaxb.X509ProfileType) File(java.io.File)

Aggregations

File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 JAXBException (javax.xml.bind.JAXBException)1 ObjectFactory (org.xipki.ca.certprofile.x509.jaxb.ObjectFactory)1 X509ProfileType (org.xipki.ca.certprofile.x509.jaxb.X509ProfileType)1