package org.jgrades.lic.api.service;

import org.jgrades.lic.api.model.Licence;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.helpers.DefaultValidationEventHandler;

public final class LicenceMarshallingFactory {
    private static JAXBContext jaxbContext;

    static {
        try {
            jaxbContext = JAXBContext.newInstance(Licence.class);
        } catch (JAXBException e) {
            e.printStackTrace();//TODO: use logger in future
        }
    }

    private LicenceMarshallingFactory() {
    }

    public static Marshaller getMarshaller() {
        Marshaller jaxbMarshaller = null;
        try {
            jaxbMarshaller = jaxbContext.createMarshaller();
            jaxbMarshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
            jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
        } catch (JAXBException e) {
            e.printStackTrace();//TODO: use logger in future
        }
        return jaxbMarshaller;
    }

    public static Unmarshaller getUnmarshaller() {
        Unmarshaller jaxbUnmarshaller = null;
        try {
            jaxbUnmarshaller = jaxbContext.createUnmarshaller();
            jaxbUnmarshaller.setEventHandler(new DefaultValidationEventHandler());
        } catch (JAXBException e) {
            e.printStackTrace();//TODO: use logger in future
        }
        return jaxbUnmarshaller;
    }
}

@@ -72,16 +72,117 @@
 Licence;
+%0Aimport org.jgrades.logging.logger.JGLoggingFactory;%0Aimport org.jgrades.logging.logger.JGradesLogger;
 %0A%0Aimport
@@ -470,17 +470,119 @@
 ontext;%0A
+    private static JGradesLogger logger = JGLoggingFactory.getLogger(LicenceMarshallingFactory.class);
 %0A
-
     stat
@@ -910,32 +910,32 @@
 shaller = null;%0A
-
         try %7B%0A  
@@ -924,32 +924,72 @@
 ;%0A        try %7B%0A
+            logger.info(%22LOG LOG LOG%22);%0A
             jaxb

Test comit