1 /*
   2  * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.xml.internal.bind.v2.runtime;
  27 
  28 import java.io.IOException;
  29 import java.lang.reflect.InvocationTargetException;
  30 
  31 import javax.xml.bind.ValidationEvent;
  32 import javax.xml.bind.helpers.ValidationEventImpl;
  33 import javax.xml.stream.XMLStreamException;
  34 
  35 import com.sun.xml.internal.bind.api.CompositeStructure;
  36 import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader;
  37 import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext;
  38 
  39 import org.xml.sax.SAXException;
  40 
  41 /**
  42  * @author Kohsuke Kawaguchi
  43  */
  44 public class CompositeStructureBeanInfo extends JaxBeanInfo<CompositeStructure> {
  45     public CompositeStructureBeanInfo(JAXBContextImpl context) {
  46         super(context,null, CompositeStructure.class,false,true,false);
  47     }
  48 
  49     public String getElementNamespaceURI(CompositeStructure o) {
  50         throw new UnsupportedOperationException();
  51     }
  52 
  53     public String getElementLocalName(CompositeStructure o) {
  54         throw new UnsupportedOperationException();
  55     }
  56 
  57     public CompositeStructure createInstance(UnmarshallingContext context) throws IllegalAccessException, InvocationTargetException, InstantiationException, SAXException {
  58         throw new UnsupportedOperationException();
  59     }
  60 
  61     public boolean reset(CompositeStructure o, UnmarshallingContext context) throws SAXException {
  62         throw new UnsupportedOperationException();
  63     }
  64 
  65     public String getId(CompositeStructure o, XMLSerializer target) throws SAXException {
  66         return null;
  67     }
  68 
  69     public Loader getLoader(JAXBContextImpl context, boolean typeSubstitutionCapable) {
  70         // no unmarshaller support for this.
  71         throw new UnsupportedOperationException();
  72     }
  73 
  74     public void serializeRoot(CompositeStructure o, XMLSerializer target) throws SAXException, IOException, XMLStreamException {
  75         target.reportError(
  76                 new ValidationEventImpl(
  77                         ValidationEvent.ERROR,
  78                         Messages.UNABLE_TO_MARSHAL_NON_ELEMENT.format(o.getClass().getName()),
  79                         null,
  80                         null));
  81     }
  82 
  83     public void serializeURIs(CompositeStructure o, XMLSerializer target) throws SAXException {
  84         // noop
  85     }
  86 
  87     public void serializeAttributes(CompositeStructure o, XMLSerializer target) throws SAXException, IOException, XMLStreamException {
  88         // noop
  89     }
  90 
  91     public void serializeBody(CompositeStructure o, XMLSerializer target) throws SAXException, IOException, XMLStreamException {
  92         int len = o.bridges.length;
  93         for( int i=0; i<len; i++ ) {
  94             Object value = o.values[i];
  95             InternalBridge bi = (InternalBridge)o.bridges[i];
  96             bi.marshal( value, target );
  97         }
  98     }
  99 
 100     public Transducer<CompositeStructure> getTransducer() {
 101         return null;
 102     }
 103 }