| 1 | |
package org.apache.ws.scout.registry; |
| 2 | |
|
| 3 | |
import javax.xml.bind.JAXBContext; |
| 4 | |
import javax.xml.bind.JAXBException; |
| 5 | |
import java.util.HashMap; |
| 6 | |
import java.util.Map; |
| 7 | |
|
| 8 | |
import org.apache.commons.logging.Log; |
| 9 | |
import org.apache.commons.logging.LogFactory; |
| 10 | |
|
| 11 | 0 | public class JAXBContextUtil { |
| 12 | |
|
| 13 | |
public static final String UDDI_V2_VERSION = "2.0"; |
| 14 | |
public static final String UDDI_V3_VERSION = "3.0"; |
| 15 | |
|
| 16 | 2 | private static Log log = LogFactory.getLog(JAXBContextUtil.class); |
| 17 | 2 | private static final Map<String, JAXBContext> JAXBContexts = new HashMap<String, JAXBContext>(); |
| 18 | |
|
| 19 | |
static { |
| 20 | |
try { |
| 21 | 2 | JAXBContexts.put(UDDI_V2_VERSION, JAXBContext.newInstance(new Class[] {org.apache.ws.scout.model.uddi.v2.ObjectFactory.class})); |
| 22 | 2 | JAXBContexts.put(UDDI_V3_VERSION, JAXBContext.newInstance(new Class[] {org.uddi.api_v3.ObjectFactory.class})); |
| 23 | 0 | } catch (JAXBException e) { |
| 24 | 0 | log.error("Initialization of JAXBMarshaller failed:" + e, e); |
| 25 | 0 | throw new ExceptionInInitializerError(e); |
| 26 | 2 | } |
| 27 | 2 | } |
| 28 | |
|
| 29 | |
public static JAXBContext getContext(String uddiVersion) { |
| 30 | 116 | return JAXBContexts.get(uddiVersion); |
| 31 | |
} |
| 32 | |
|
| 33 | |
} |