001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common Development
008: * and Distribution License("CDDL") (collectively, the "License"). You
009: * may not use this file except in compliance with the License. You can obtain
010: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
011: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
012: * language governing permissions and limitations under the License.
013: *
014: * When distributing the software, include this License Header Notice in each
015: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
016: * Sun designates this particular file as subject to the "Classpath" exception
017: * as provided by Sun in the GPL Version 2 section of the License file that
018: * accompanied this code. If applicable, add the following below the License
019: * Header, with the fields enclosed by brackets [] replaced by your own
020: * identifying information: "Portions Copyrighted [year]
021: * [name of copyright owner]"
022: *
023: * Contributor(s):
024: *
025: * If you wish your version of this file to be governed by only the CDDL or
026: * only the GPL Version 2, indicate your decision by adding "[Contributor]
027: * elects to include this software in this distribution under the [CDDL or GPL
028: * Version 2] license." If you don't indicate a single choice of license, a
029: * recipient has the option to distribute your version of this file under
030: * either the CDDL, the GPL Version 2 or to extend the choice of license to
031: * its licensees as provided above. However, if you add GPL Version 2 code
032: * and therefore, elected the GPL Version 2 license, then the option applies
033: * only if the new code is made subject to such option by the copyright
034: * holder.
035: */
036:
037: package com.sun.xml.bind.v2.runtime;
038:
039: import java.io.IOException;
040: import java.lang.reflect.InvocationTargetException;
041:
042: import javax.xml.bind.ValidationEvent;
043: import javax.xml.bind.helpers.ValidationEventImpl;
044: import javax.xml.stream.XMLStreamException;
045:
046: import com.sun.xml.bind.api.CompositeStructure;
047: import com.sun.xml.bind.v2.runtime.unmarshaller.Loader;
048: import com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext;
049:
050: import org.xml.sax.SAXException;
051:
052: /**
053: * @author Kohsuke Kawaguchi
054: */
055: public class CompositeStructureBeanInfo extends
056: JaxBeanInfo<CompositeStructure> {
057: public CompositeStructureBeanInfo(JAXBContextImpl context) {
058: super (context, null, CompositeStructure.class, false, true,
059: false);
060: }
061:
062: public String getElementNamespaceURI(CompositeStructure o) {
063: throw new UnsupportedOperationException();
064: }
065:
066: public String getElementLocalName(CompositeStructure o) {
067: throw new UnsupportedOperationException();
068: }
069:
070: public CompositeStructure createInstance(
071: UnmarshallingContext context)
072: throws IllegalAccessException, InvocationTargetException,
073: InstantiationException, SAXException {
074: throw new UnsupportedOperationException();
075: }
076:
077: public boolean reset(CompositeStructure o,
078: UnmarshallingContext context) throws SAXException {
079: throw new UnsupportedOperationException();
080: }
081:
082: public String getId(CompositeStructure o, XMLSerializer target)
083: throws SAXException {
084: return null;
085: }
086:
087: public Loader getLoader(JAXBContextImpl context,
088: boolean typeSubstitutionCapable) {
089: // no unmarshaller support for this.
090: throw new UnsupportedOperationException();
091: }
092:
093: public void serializeRoot(CompositeStructure o, XMLSerializer target)
094: throws SAXException, IOException, XMLStreamException {
095: target.reportError(new ValidationEventImpl(
096: ValidationEvent.ERROR,
097: Messages.UNABLE_TO_MARSHAL_NON_ELEMENT.format(o
098: .getClass().getName()), null, null));
099: }
100:
101: public void serializeURIs(CompositeStructure o, XMLSerializer target)
102: throws SAXException {
103: // noop
104: }
105:
106: public void serializeAttributes(CompositeStructure o,
107: XMLSerializer target) throws SAXException, IOException,
108: XMLStreamException {
109: // noop
110: }
111:
112: public void serializeBody(CompositeStructure o, XMLSerializer target)
113: throws SAXException, IOException, XMLStreamException {
114: int len = o.bridges.length;
115: for (int i = 0; i < len; i++) {
116: Object value = o.values[i];
117: InternalBridge bi = (InternalBridge) o.bridges[i];
118: bi.marshal(value, target);
119: }
120: }
121:
122: public Transducer<CompositeStructure> getTransducer() {
123: return null;
124: }
125: }
|