src/share/jaxws_classes/com/sun/xml/internal/ws/db/glassfish/JAXBRIContextWrapper.java

changeset 368
0989ad8c0860
parent 286
f50545b5e2f1
child 637
9c07ef4934dd
     1.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/db/glassfish/JAXBRIContextWrapper.java	Thu Apr 04 19:05:24 2013 -0700
     1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/db/glassfish/JAXBRIContextWrapper.java	Tue Apr 09 14:51:13 2013 +0100
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -29,129 +29,152 @@
    1.11  import java.util.List;
    1.12  import java.util.Map;
    1.13  
    1.14 -import javax.xml.bind.Binder;
    1.15  import javax.xml.bind.JAXBContext;
    1.16  import javax.xml.bind.JAXBException;
    1.17 -import javax.xml.bind.JAXBIntrospector;
    1.18  import javax.xml.bind.Marshaller;
    1.19  import javax.xml.bind.SchemaOutputResolver;
    1.20  import javax.xml.bind.Unmarshaller;
    1.21  import javax.xml.namespace.QName;
    1.22 -import javax.xml.transform.Result;
    1.23 -
    1.24 -import org.w3c.dom.Node;
    1.25 -
    1.26 -import com.sun.xml.internal.bind.api.BridgeContext;
    1.27 -import com.sun.xml.internal.bind.api.CompositeStructure;
    1.28  import com.sun.xml.internal.bind.api.JAXBRIContext;
    1.29  import com.sun.xml.internal.bind.api.TypeReference;
    1.30  import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeInfoSet;
    1.31 -import com.sun.xml.internal.bind.api.Bridge;
    1.32  import com.sun.xml.internal.ws.spi.db.BindingContext;
    1.33  import com.sun.xml.internal.ws.spi.db.XMLBridge;
    1.34 -import com.sun.xml.internal.ws.spi.db.PropertyAccessor;
    1.35  import com.sun.xml.internal.ws.spi.db.TypeInfo;
    1.36  import com.sun.xml.internal.ws.spi.db.WrapperComposite;
    1.37  
    1.38  class JAXBRIContextWrapper implements BindingContext {
    1.39  
    1.40 -        private Map<TypeInfo, TypeReference> typeRefs;
    1.41 -        private Map<TypeReference, TypeInfo> typeInfos;
    1.42 -        private JAXBRIContext context;
    1.43 +    private Map<TypeInfo, TypeReference> typeRefs;
    1.44 +    private Map<TypeReference, TypeInfo> typeInfos;
    1.45 +    private JAXBRIContext context;
    1.46  
    1.47 -        JAXBRIContextWrapper(JAXBRIContext cxt, Map<TypeInfo, TypeReference> refs) {
    1.48 -                context = cxt;
    1.49 -                typeRefs = refs;
    1.50 -                if (refs != null) {
    1.51 -                        typeInfos = new java.util.HashMap<TypeReference, TypeInfo>();
    1.52 -                        for (TypeInfo ti : refs.keySet()) typeInfos.put(typeRefs.get(ti), ti);
    1.53 -                }
    1.54 +    JAXBRIContextWrapper(JAXBRIContext cxt, Map<TypeInfo, TypeReference> refs) {
    1.55 +        context = cxt;
    1.56 +        typeRefs = refs;
    1.57 +        if (refs != null) {
    1.58 +            typeInfos = new java.util.HashMap<TypeReference, TypeInfo>();
    1.59 +            for (TypeInfo ti : refs.keySet()) {
    1.60 +                typeInfos.put(typeRefs.get(ti), ti);
    1.61 +            }
    1.62          }
    1.63 +    }
    1.64  
    1.65 -        TypeReference typeReference(TypeInfo ti) {
    1.66 -                return (typeRefs != null)? typeRefs.get(ti) : null;
    1.67 +    TypeReference typeReference(TypeInfo ti) {
    1.68 +        return (typeRefs != null) ? typeRefs.get(ti) : null;
    1.69 +    }
    1.70 +
    1.71 +    TypeInfo typeInfo(TypeReference tr) {
    1.72 +        return (typeInfos != null) ? typeInfos.get(tr) : null;
    1.73 +    }
    1.74 +
    1.75 +    @Override
    1.76 +    public Marshaller createMarshaller() throws JAXBException {
    1.77 +        return context.createMarshaller();
    1.78 +    }
    1.79 +
    1.80 +    @Override
    1.81 +    public Unmarshaller createUnmarshaller() throws JAXBException {
    1.82 +        return context.createUnmarshaller();
    1.83 +    }
    1.84 +
    1.85 +    @Override
    1.86 +    public void generateSchema(SchemaOutputResolver outputResolver)
    1.87 +            throws IOException {
    1.88 +        context.generateSchema(outputResolver);
    1.89 +    }
    1.90 +
    1.91 +    @Override
    1.92 +    public String getBuildId() {
    1.93 +        return context.getBuildId();
    1.94 +    }
    1.95 +
    1.96 +    @Override
    1.97 +    public QName getElementName(Class o) throws JAXBException {
    1.98 +        return context.getElementName(o);
    1.99 +    }
   1.100 +
   1.101 +    @Override
   1.102 +    public QName getElementName(Object o) throws JAXBException {
   1.103 +        return context.getElementName(o);
   1.104 +    }
   1.105 +
   1.106 +    @Override
   1.107 +    public <B, V> com.sun.xml.internal.ws.spi.db.PropertyAccessor<B, V> getElementPropertyAccessor(
   1.108 +            Class<B> wrapperBean, String nsUri, String localName)
   1.109 +            throws JAXBException {
   1.110 +        return new RawAccessorWrapper(context.getElementPropertyAccessor(wrapperBean, nsUri, localName));
   1.111 +    }
   1.112 +
   1.113 +    @Override
   1.114 +    public List<String> getKnownNamespaceURIs() {
   1.115 +        return context.getKnownNamespaceURIs();
   1.116 +    }
   1.117 +
   1.118 +    public RuntimeTypeInfoSet getRuntimeTypeInfoSet() {
   1.119 +        return context.getRuntimeTypeInfoSet();
   1.120 +    }
   1.121 +
   1.122 +    public QName getTypeName(com.sun.xml.internal.bind.api.TypeReference tr) {
   1.123 +        return context.getTypeName(tr);
   1.124 +    }
   1.125 +
   1.126 +    @Override
   1.127 +    public int hashCode() {
   1.128 +        return context.hashCode();
   1.129 +    }
   1.130 +
   1.131 +    @Override
   1.132 +    public boolean equals(Object obj) {
   1.133 +        if (obj == null) {
   1.134 +            return false;
   1.135          }
   1.136 +        if (getClass() != obj.getClass()) {
   1.137 +            return false;
   1.138 +        }
   1.139 +        final JAXBRIContextWrapper other = (JAXBRIContextWrapper) obj;
   1.140 +        if (this.context != other.context && (this.context == null || !this.context.equals(other.context))) {
   1.141 +            return false;
   1.142 +        }
   1.143 +        return true;
   1.144 +    }
   1.145  
   1.146 -        TypeInfo typeInfo(TypeReference tr) {
   1.147 -                return (typeInfos != null)? typeInfos.get(tr) : null;
   1.148 -        }
   1.149 +    @Override
   1.150 +    public boolean hasSwaRef() {
   1.151 +        return context.hasSwaRef();
   1.152 +    }
   1.153  
   1.154 -        public Marshaller createMarshaller() throws JAXBException {
   1.155 -                return context.createMarshaller();
   1.156 -        }
   1.157 +    @Override
   1.158 +    public String toString() {
   1.159 +        return JAXBRIContextWrapper.class.getName() + " : " + context.toString();
   1.160 +    }
   1.161  
   1.162 -        public Unmarshaller createUnmarshaller() throws JAXBException {
   1.163 -                return context.createUnmarshaller();
   1.164 -        }
   1.165 +    @Override
   1.166 +    public XMLBridge createBridge(TypeInfo ti) {
   1.167 +        TypeReference tr = typeRefs.get(ti);
   1.168 +        com.sun.xml.internal.bind.api.Bridge b = context.createBridge(tr);
   1.169 +        return WrapperComposite.class.equals(ti.type)
   1.170 +                ? new WrapperBridge(this, b)
   1.171 +                : new BridgeWrapper(this, b);
   1.172 +    }
   1.173  
   1.174 -        public void generateSchema(SchemaOutputResolver outputResolver)
   1.175 -                        throws IOException {
   1.176 -                context.generateSchema(outputResolver);
   1.177 -        }
   1.178 +    @Override
   1.179 +    public JAXBContext getJAXBContext() {
   1.180 +        return context;
   1.181 +    }
   1.182  
   1.183 -        public String getBuildId() {
   1.184 -                return context.getBuildId();
   1.185 -        }
   1.186 +    @Override
   1.187 +    public QName getTypeName(TypeInfo ti) {
   1.188 +        TypeReference tr = typeRefs.get(ti);
   1.189 +        return context.getTypeName(tr);
   1.190 +    }
   1.191  
   1.192 -        public QName getElementName(Class o) throws JAXBException {
   1.193 -                return context.getElementName(o);
   1.194 -        }
   1.195 +    @Override
   1.196 +    public XMLBridge createFragmentBridge() {
   1.197 +        return new MarshallerBridge((com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl) context);
   1.198 +    }
   1.199  
   1.200 -        public QName getElementName(Object o) throws JAXBException {
   1.201 -                return context.getElementName(o);
   1.202 -        }
   1.203 -
   1.204 -        public <B, V> com.sun.xml.internal.ws.spi.db.PropertyAccessor<B, V> getElementPropertyAccessor(
   1.205 -                        Class<B> wrapperBean, String nsUri, String localName)
   1.206 -                        throws JAXBException {
   1.207 -                return new RawAccessorWrapper(context.getElementPropertyAccessor(wrapperBean, nsUri, localName));
   1.208 -        }
   1.209 -
   1.210 -        public List<String> getKnownNamespaceURIs() {
   1.211 -                return context.getKnownNamespaceURIs();
   1.212 -        }
   1.213 -
   1.214 -        public RuntimeTypeInfoSet getRuntimeTypeInfoSet() {
   1.215 -                return context.getRuntimeTypeInfoSet();
   1.216 -        }
   1.217 -
   1.218 -        public QName getTypeName(com.sun.xml.internal.bind.api.TypeReference tr) {
   1.219 -                return context.getTypeName(tr);
   1.220 -        }
   1.221 -
   1.222 -        public int hashCode() {
   1.223 -                return context.hashCode();
   1.224 -        }
   1.225 -
   1.226 -        public boolean hasSwaRef() {
   1.227 -                return context.hasSwaRef();
   1.228 -        }
   1.229 -
   1.230 -        public String toString() {
   1.231 -                return JAXBRIContextWrapper.class.getName() + " : " + context.toString();
   1.232 -        }
   1.233 -
   1.234 -        public XMLBridge createBridge(TypeInfo ti) {
   1.235 -                TypeReference tr = typeRefs.get(ti);
   1.236 -                com.sun.xml.internal.bind.api.Bridge b = context.createBridge(tr);
   1.237 -                return WrapperComposite.class.equals(ti.type) ?
   1.238 -                                new WrapperBridge(this, b) :
   1.239 -                                new BridgeWrapper(this, b);
   1.240 -        }
   1.241 -
   1.242 -        public JAXBContext getJAXBContext() {
   1.243 -                return context;
   1.244 -        }
   1.245 -
   1.246 -        public QName getTypeName(TypeInfo ti) {
   1.247 -                TypeReference tr = typeRefs.get(ti);
   1.248 -                return context.getTypeName(tr);
   1.249 -        }
   1.250 -
   1.251 -        public XMLBridge createFragmentBridge() {
   1.252 -                return new MarshallerBridge((com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl)context);
   1.253 -        }
   1.254 -
   1.255 +    @Override
   1.256      public Object newWrapperInstace(Class<?> wrapperType)
   1.257              throws InstantiationException, IllegalAccessException {
   1.258          return wrapperType.newInstance();

mercurial