01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */package org.apache.cxf.jaxb;
19:
20: import java.util.Collection;
21:
22: import javax.xml.bind.JAXBContext;
23: import javax.xml.bind.attachment.AttachmentMarshaller;
24: import javax.xml.bind.attachment.AttachmentUnmarshaller;
25: import javax.xml.validation.Schema;
26:
27: import org.apache.cxf.jaxb.attachment.JAXBAttachmentMarshaller;
28: import org.apache.cxf.jaxb.attachment.JAXBAttachmentUnmarshaller;
29: import org.apache.cxf.message.Attachment;
30:
31: /**
32: *
33: */
34: public abstract class JAXBDataBase {
35:
36: protected JAXBContext context;
37: protected Schema schema;
38: protected Collection<Attachment> attachments;
39: protected boolean attachmentProcessingEnabled;
40: protected boolean unwrapJAXBElement = true;
41:
42: protected JAXBDataBase(JAXBContext ctx) {
43: context = ctx;
44: }
45:
46: public void setSchema(Schema s) {
47: this .schema = s;
48: }
49:
50: public void setJAXBContext(JAXBContext jc) {
51: this .context = jc;
52: }
53:
54: public Schema getSchema() {
55: return schema;
56: }
57:
58: public JAXBContext getJAXBContext() {
59: return context;
60: }
61:
62: public Collection<Attachment> getAttachments() {
63: return attachments;
64: }
65:
66: public void setAttachments(Collection<Attachment> attachments) {
67: this .attachments = attachments;
68: }
69:
70: protected AttachmentUnmarshaller getAttachmentUnmarshaller() {
71: return new JAXBAttachmentUnmarshaller(attachments);
72: }
73:
74: protected AttachmentMarshaller getAttachmentMarrshaller() {
75: return new JAXBAttachmentMarshaller(attachments);
76: }
77:
78: public void setProperty(String prop, Object value) {
79: if (prop.equals(JAXBDataBinding.UNWRAP_JAXB_ELEMENT)) {
80: unwrapJAXBElement = Boolean.TRUE.equals(value);
81: }
82: }
83: }
|