src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/BridgeAdapter.java

Print this page




  71     }
  72 
  73     public void marshal(Marshaller m, InMemory inMemory, OutputStream output, NamespaceContext nsc) throws JAXBException {
  74         core.marshal(m,adaptM(m,inMemory),output,nsc);
  75     }
  76 
  77     public void marshal(Marshaller m, InMemory inMemory, Node output) throws JAXBException {
  78         core.marshal(m,adaptM(m,inMemory),output);
  79     }
  80 
  81     public void marshal(Marshaller context, InMemory inMemory, ContentHandler contentHandler) throws JAXBException {
  82         core.marshal(context,adaptM(context,inMemory),contentHandler);
  83     }
  84 
  85     public void marshal(Marshaller context, InMemory inMemory, Result result) throws JAXBException {
  86         core.marshal(context,adaptM(context,inMemory),result);
  87     }
  88 
  89     private OnWire adaptM(Marshaller m,InMemory v) throws JAXBException {
  90         XMLSerializer serializer = ((MarshallerImpl)m).serializer;
  91         serializer.setThreadAffinity();
  92         serializer.pushCoordinator();
  93         try {
  94             return _adaptM(serializer, v);
  95         } finally {
  96             serializer.popCoordinator();
  97             serializer.resetThreadAffinity();
  98         }
  99     }
 100 
 101     private OnWire _adaptM(XMLSerializer serializer, InMemory v) throws MarshalException {
 102         XmlAdapter<OnWire,InMemory> a = serializer.getAdapter(adapter);
 103         try {
 104             return a.marshal(v);
 105         } catch (Exception e) {
 106             serializer.handleError(e,v,null);
 107             throw new MarshalException(e);
 108         }
 109     }
 110 
 111 
 112     public @NotNull InMemory unmarshal(Unmarshaller u, XMLStreamReader in) throws JAXBException {
 113         return adaptU(u, core.unmarshal(u,in));
 114     }
 115 
 116     public @NotNull InMemory unmarshal(Unmarshaller u, Source in) throws JAXBException {
 117         return adaptU(u, core.unmarshal(u,in));
 118     }
 119 
 120     public @NotNull InMemory unmarshal(Unmarshaller u, InputStream in) throws JAXBException {
 121         return adaptU(u, core.unmarshal(u,in));
 122     }
 123 
 124     public @NotNull InMemory unmarshal(Unmarshaller u, Node n) throws JAXBException {
 125         return adaptU(u, core.unmarshal(u,n));
 126     }
 127 
 128     public TypeReference getTypeReference() {
 129         return core.getTypeReference();
 130     }
 131 
 132     private @NotNull InMemory adaptU(Unmarshaller _u, OnWire v) throws JAXBException {
 133         UnmarshallerImpl u = (UnmarshallerImpl) _u;
 134         XmlAdapter<OnWire,InMemory> a = u.coordinator.getAdapter(adapter);
 135         u.coordinator.setThreadAffinity();
 136         u.coordinator.pushCoordinator();
 137         try {
 138             return a.unmarshal(v);
 139         } catch (Exception e) {
 140             throw new UnmarshalException(e);
 141         } finally {
 142             u.coordinator.popCoordinator();
 143             u.coordinator.resetThreadAffinity();
 144         }
 145     }
 146 
 147     void marshal(InMemory o, XMLSerializer out) throws IOException, SAXException, XMLStreamException {
 148         try {
 149             core.marshal(_adaptM( XMLSerializer.getInstance(), o ), out );
 150         } catch (MarshalException e) {
 151             // recover from error by not marshalling this element.
 152         }
 153     }
 154 }


  71     }
  72 
  73     public void marshal(Marshaller m, InMemory inMemory, OutputStream output, NamespaceContext nsc) throws JAXBException {
  74         core.marshal(m,adaptM(m,inMemory),output,nsc);
  75     }
  76 
  77     public void marshal(Marshaller m, InMemory inMemory, Node output) throws JAXBException {
  78         core.marshal(m,adaptM(m,inMemory),output);
  79     }
  80 
  81     public void marshal(Marshaller context, InMemory inMemory, ContentHandler contentHandler) throws JAXBException {
  82         core.marshal(context,adaptM(context,inMemory),contentHandler);
  83     }
  84 
  85     public void marshal(Marshaller context, InMemory inMemory, Result result) throws JAXBException {
  86         core.marshal(context,adaptM(context,inMemory),result);
  87     }
  88 
  89     private OnWire adaptM(Marshaller m,InMemory v) throws JAXBException {
  90         XMLSerializer serializer = ((MarshallerImpl)m).serializer;

  91         serializer.pushCoordinator();
  92         try {
  93             return _adaptM(serializer, v);
  94         } finally {
  95             serializer.popCoordinator();

  96         }
  97     }
  98 
  99     private OnWire _adaptM(XMLSerializer serializer, InMemory v) throws MarshalException {
 100         XmlAdapter<OnWire,InMemory> a = serializer.getAdapter(adapter);
 101         try {
 102             return a.marshal(v);
 103         } catch (Exception e) {
 104             serializer.handleError(e,v,null);
 105             throw new MarshalException(e);
 106         }
 107     }
 108 
 109 
 110     public @NotNull InMemory unmarshal(Unmarshaller u, XMLStreamReader in) throws JAXBException {
 111         return adaptU(u, core.unmarshal(u,in));
 112     }
 113 
 114     public @NotNull InMemory unmarshal(Unmarshaller u, Source in) throws JAXBException {
 115         return adaptU(u, core.unmarshal(u,in));
 116     }
 117 
 118     public @NotNull InMemory unmarshal(Unmarshaller u, InputStream in) throws JAXBException {
 119         return adaptU(u, core.unmarshal(u,in));
 120     }
 121 
 122     public @NotNull InMemory unmarshal(Unmarshaller u, Node n) throws JAXBException {
 123         return adaptU(u, core.unmarshal(u,n));
 124     }
 125 
 126     public TypeReference getTypeReference() {
 127         return core.getTypeReference();
 128     }
 129 
 130     private @NotNull InMemory adaptU(Unmarshaller _u, OnWire v) throws JAXBException {
 131         UnmarshallerImpl u = (UnmarshallerImpl) _u;
 132         XmlAdapter<OnWire,InMemory> a = u.coordinator.getAdapter(adapter);

 133         u.coordinator.pushCoordinator();
 134         try {
 135             return a.unmarshal(v);
 136         } catch (Exception e) {
 137             throw new UnmarshalException(e);
 138         } finally {
 139             u.coordinator.popCoordinator();

 140         }
 141     }
 142 
 143     void marshal(InMemory o, XMLSerializer out) throws IOException, SAXException, XMLStreamException {
 144         try {
 145             core.marshal(_adaptM( XMLSerializer.getInstance(), o ), out );
 146         } catch (MarshalException e) {
 147             // recover from error by not marshalling this element.
 148         }
 149     }
 150 }