01: /**
02: * $Id: ProducerJAXB.java,v 1.3 2005/04/08 10:11:01 rt130506 Exp $
03: * Copyright 2003 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.wsrp.producer;
14:
15: import javax.xml.bind.JAXBContext;
16: import javax.xml.bind.JAXBException;
17: import javax.xml.bind.Marshaller;
18: import javax.xml.bind.Unmarshaller;
19:
20: import com.sun.portal.wsrp.common.jaxb.producer.ObjectFactory;
21:
22: public class ProducerJAXB {
23: private Marshaller marshaller = null;
24: private Unmarshaller unmarshaller = null;
25: private JAXBContext jaxbContext = null;
26: private ObjectFactory objectFactory = new ObjectFactory();
27:
28: public ProducerJAXB() throws ProducerException {
29: try {
30: //jaxbContext = JAXBContext.newInstance();
31: jaxbContext = JAXBContext.newInstance(
32: "com.sun.portal.wsrp.common.jaxb.producer", this
33: .getClass().getClassLoader());
34: marshaller = jaxbContext.createMarshaller();
35: marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
36: Boolean.TRUE);
37: unmarshaller = jaxbContext.createUnmarshaller();
38: } catch (JAXBException je) {
39: throw new ProducerException(
40: "could not initialize producer jaxb", je);
41: }
42: }
43:
44: public JAXBContext getJAXBContext() throws ProducerException {
45: return jaxbContext;
46: }
47:
48: public Marshaller getMarshaller() throws ProducerException {
49: return marshaller;
50: }
51:
52: public Unmarshaller getUnmarshaller() throws ProducerException {
53: return unmarshaller;
54: }
55:
56: public ObjectFactory getObjectFactory() throws ProducerException {
57: return objectFactory;
58: }
59: }
|