org.deegree.commons.xml.jaxb
Class JAXBUtils

java.lang.Object
  extended by org.deegree.commons.xml.jaxb.JAXBUtils

public class JAXBUtils
extends java.lang.Object

Version:
$Revision: 27762 $, $Date: 2010-11-03 23:41:48 +0100 (Mi, 03. Nov 2010) $
Author:
Andreas Schmitz, last edited by: $Author: mschneider $

Constructor Summary
JAXBUtils()
           
 
Method Summary
static void fixThreadLocalLeaks()
          Call this once you're done in the thread that uses jaxb (un-)marshalling.
static javax.xml.validation.Schema getSchemaForUrl(java.lang.String schemaFile)
          Tries to load a schema file from the given location, which might be useful for the validation of configuration files with JAXB.
static javax.xml.bind.Unmarshaller getUnmarshaller(java.lang.String jaxbPackage, java.lang.String schemaLocation)
          Creates a JAXB Unmarshaller which is instantiated with the given classpath (as well as the common configuration classpath).
static java.lang.Object unmarshall(java.lang.String jaxbPackage, java.lang.String schemaLocation, java.net.URL url)
           
static java.lang.Object unmarshall(java.lang.String jaxbPackage, java.lang.String schemaLocation, XMLAdapter xmlAdapter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JAXBUtils

public JAXBUtils()
Method Detail

fixThreadLocalLeaks

public static void fixThreadLocalLeaks()
Call this once you're done in the thread that uses jaxb (un-)marshalling.


unmarshall

public static java.lang.Object unmarshall(java.lang.String jaxbPackage,
                                          java.lang.String schemaLocation,
                                          java.net.URL url)
                                   throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

unmarshall

public static java.lang.Object unmarshall(java.lang.String jaxbPackage,
                                          java.lang.String schemaLocation,
                                          XMLAdapter xmlAdapter)
                                   throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

getUnmarshaller

public static javax.xml.bind.Unmarshaller getUnmarshaller(java.lang.String jaxbPackage,
                                                          java.lang.String schemaLocation)
                                                   throws javax.xml.bind.JAXBException
Creates a JAXB Unmarshaller which is instantiated with the given classpath (as well as the common configuration classpath). If the given schemalocation is not null, the unmarshaller will validate against the schema file loaded from the given location.

Parameters:
jaxbPackage - used for instantiating the unmarshaller
schemaLocation - if not null this method will try to load the schema from location and set the validation in the unmarshaller. This location could be: "/META-INF/schemas/[SERVICE_NAME]/[VERSION]/[SERVICE_NAME]_service_configuration.xsd"
Returns:
an unmarshaller which can be used to unmarshall a document with jaxb
Throws:
javax.xml.bind.JAXBException - if the Unmarshaller could not be created.

getSchemaForUrl

public static javax.xml.validation.Schema getSchemaForUrl(java.lang.String schemaFile)
Tries to load a schema file from the given location, which might be useful for the validation of configuration files with JAXB.

Parameters:
schemaFile - location like: "/META-INF/schemas/[SERVICE_NAME]/[VERSION]/[SERVICE_NAME]_service_configuration.xsd"
Returns:
the schema for the given url or null if no schema could be loaded from the given url.


Copyright © 2011. All Rights Reserved.