package eu.osci.messageparts;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;

import eu.osci.ws._2008._05.transport.ObjectFactory;


/**
 * Class to get JAXB context in the OSCI environment.<br>
 * Copyright © 2010 Freie Hansestadt Bremen. <br>
 * Created by bremen online services Entwicklungs- und Betriebsgesellschaft mbH & Co. KG. <br>
 * This library (Starter Kit) can be used by anybody according to the Bremer Lizenz für freie
 * Softwarebibliotheken. The license terms can be viewed at www.osci.de or can be ordered at the
 * OSCI-Leitstelle (Die Senatorin für Finanzen, Freie Hansestadt Bremen, Postfach 10 15 40, 28015 Bremen).
 * 
 * @author R. Lindemann
 */
public class JaxbContextHolder
{

  private static javax.xml.bind.JAXBContext xkmsContext = null;

  private static javax.xml.bind.JAXBContext osciContext = null;

  private static javax.xml.bind.JAXBContext addressingContext = null;

  private static javax.xml.bind.JAXBContext letterContext = null;

  private static javax.xml.bind.JAXBContext wsTrustContext = null;

  /**
   * Internal method to get the JAXB context to marshal and unmarshal WS-Trust objects.
   * 
   * @return The created JAXB context.
   * @throws JAXBException In case of errors creating the JAXB context.
   */
  public static javax.xml.bind.JAXBContext getTrustJaxBContext() throws JAXBException
  {
    if (wsTrustContext == null)
    {
      wsTrustContext = JAXBContext.newInstance(org.oasis_open.docs.ws_sx.ws_trust._200512.ObjectFactory.class);
    }
    return wsTrustContext;
  }

  /**
   * Internal method to get the JAXB context to marshal and unmarshal OSCI objects.
   * 
   * @return The created JAXB context.
   * @throws JAXBException In case of errors creating the JAXB context.
   */
  public static javax.xml.bind.JAXBContext getOSCIJaxBContext() throws JAXBException
  {
    if (osciContext == null)
    {
      osciContext = JAXBContext.newInstance(ObjectFactory.class);
    }
    return osciContext;
  }

  /**
   * Internal method to get the JAXBContext to marshal and unmarshal XKMS objects.
   * 
   * @return The created JAXB context.
   * @throws JAXBException In case of errors creating the JAXB context.
   */
  public static javax.xml.bind.JAXBContext getXKMSJaxBContext() throws JAXBException
  {
    if (xkmsContext == null)
    {
      xkmsContext = JAXBContext.newInstance(org.w3._2002._03.xkms.ObjectFactory.class);
    }
    return xkmsContext;
  }

  /**
   * Internal method to get the JAXB context to marshal and unmarshal addressing objects.
   * 
   * @return The created JAXB context.
   * @throws JAXBException In case of errors creating the JAXB context.
   */
  public static javax.xml.bind.JAXBContext getAddressingJaxBContext() throws JAXBException
  {
    if (addressingContext == null)
    {
      addressingContext = JAXBContext.newInstance(org.w3._2005._08.addressing.ObjectFactory.class);
    }
    return addressingContext;
  }

  /**
   * Internal method to get the JAXB context to marshal and unmarshal LetterStyle objects.
   * 
   * @return The created JAXB context.
   * @throws JAXBException In case of errors creating the JAXB context.
   */
  public static javax.xml.bind.JAXBContext getLetterStyleJaxBContext() throws JAXBException
  {
    if (letterContext == null)
    {
      letterContext = JAXBContext.newInstance(eu.osci._2008._05.common.urn.messagetypes.letterstyle.ObjectFactory.class);
    }
    return letterContext;
  }

}
