This project has retired. For details please refer to its
Attic page.
JAXBContextUtil xref
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 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 private static Log log = LogFactory.getLog(JAXBContextUtil.class);
17 private static final Map<String, JAXBContext> JAXBContexts = new HashMap<String, JAXBContext>();
18
19 static {
20 try {
21 JAXBContexts.put(UDDI_V2_VERSION, JAXBContext.newInstance(new Class[] {org.apache.ws.scout.model.uddi.v2.ObjectFactory.class}));
22 JAXBContexts.put(UDDI_V3_VERSION, JAXBContext.newInstance(new Class[] {org.uddi.api_v3.ObjectFactory.class}));
23 } catch (JAXBException e) {
24 log.error("Initialization of JAXBMarshaller failed:" + e, e);
25 throw new ExceptionInInitializerError(e);
26 }
27 }
28
29 public static JAXBContext getContext(String uddiVersion) {
30 return JAXBContexts.get(uddiVersion);
31 }
32
33 }