X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-monitoring%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fmonitoring%2Fxml%2FJaxBSerializer.java;fp=opendaylight%2Fnetconf%2Fnetconf-monitoring%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fmonitoring%2Fxml%2FJaxBSerializer.java;h=0000000000000000000000000000000000000000;hb=9ba2b4eca79bcc0e78099b133296801c8d45a6c4;hp=e80e3f82b1f6c0650bfc4619ab3e17ad5660186e;hpb=b2e81149739c87f0ecc2ce7f06448d7a5d3162b8;p=controller.git diff --git a/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/xml/JaxBSerializer.java b/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/xml/JaxBSerializer.java deleted file mode 100644 index e80e3f82b1..0000000000 --- a/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/xml/JaxBSerializer.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.netconf.monitoring.xml; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.transform.dom.DOMResult; -import org.opendaylight.controller.netconf.monitoring.xml.model.NetconfState; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class JaxBSerializer { - private static final JAXBContext JAXB_CONTEXT; - - static { - try { - JAXB_CONTEXT = JAXBContext.newInstance(NetconfState.class); - } catch (JAXBException e) { - throw new ExceptionInInitializerError(e); - } - } - - public Element toXml(final NetconfState monitoringModel) { - final DOMResult res; - try { - final Marshaller marshaller = JAXB_CONTEXT.createMarshaller(); - - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - - res = new DOMResult(); - marshaller.marshal(monitoringModel, res); - } catch (final JAXBException e) { - throw new RuntimeException("Unable to serialize netconf state " + monitoringModel, e); - } - return ((Document)res.getNode()).getDocumentElement(); - } -}