com.sun.xml.internal.ws.developer.JAXBContextFactory Java Examples

The following examples show how to use com.sun.xml.internal.ws.developer.JAXBContextFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JAXBRIContextFactory.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public BindingContext newContext(BindingInfo bi) {
    Class[] classes = bi.contentClasses().toArray(new Class[bi.contentClasses().size()]);
    for (int i = 0; i < classes.length; i++) {
        if (WrapperComposite.class.equals(classes[i])) {
            classes[i] = CompositeStructure.class;
        }
    }
    Map<TypeInfo, TypeReference> typeInfoMappings = typeInfoMappings(bi.typeInfos());
    Map<Class, Class> subclassReplacements = bi.subclassReplacements();
    String defaultNamespaceRemap = bi.getDefaultNamespace();
    Boolean c14nSupport = (Boolean) bi.properties().get("c14nSupport");
    RuntimeAnnotationReader ar = (RuntimeAnnotationReader) bi.properties().get("com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader");
    JAXBContextFactory jaxbContextFactory = (JAXBContextFactory) bi.properties().get(JAXBContextFactory.class.getName());
    try {
        JAXBRIContext context = (jaxbContextFactory != null)
                ? jaxbContextFactory.createJAXBContext(
                bi.getSEIModel(),
                toList(classes),
                toList(typeInfoMappings.values()))
                : ContextFactory.createContext(
                classes, typeInfoMappings.values(),
                subclassReplacements, defaultNamespaceRemap,
                (c14nSupport != null) ? c14nSupport : false,
                ar, false, false, false);
        return new JAXBRIContextWrapper(context, typeInfoMappings);
    } catch (Exception e) {
        throw new DatabindingException(e);
    }
}
 
Example #2
Source File: JAXBRIContextFactory.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public BindingContext newContext(BindingInfo bi) {
    Class[] classes = bi.contentClasses().toArray(new Class[bi.contentClasses().size()]);
    for (int i = 0; i < classes.length; i++) {
        if (WrapperComposite.class.equals(classes[i])) {
            classes[i] = CompositeStructure.class;
        }
    }
    Map<TypeInfo, TypeReference> typeInfoMappings = typeInfoMappings(bi.typeInfos());
    Map<Class, Class> subclassReplacements = bi.subclassReplacements();
    String defaultNamespaceRemap = bi.getDefaultNamespace();
    Boolean c14nSupport = (Boolean) bi.properties().get("c14nSupport");
    RuntimeAnnotationReader ar = (RuntimeAnnotationReader) bi.properties().get("com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader");
    JAXBContextFactory jaxbContextFactory = (JAXBContextFactory) bi.properties().get(JAXBContextFactory.class.getName());
    try {
        JAXBRIContext context = (jaxbContextFactory != null)
                ? jaxbContextFactory.createJAXBContext(
                bi.getSEIModel(),
                toList(classes),
                toList(typeInfoMappings.values()))
                : ContextFactory.createContext(
                classes, typeInfoMappings.values(),
                subclassReplacements, defaultNamespaceRemap,
                (c14nSupport != null) ? c14nSupport : false,
                ar, false, false, false);
        return new JAXBRIContextWrapper(context, typeInfoMappings);
    } catch (Exception e) {
        throw new DatabindingException(e);
    }
}
 
Example #3
Source File: JAXBRIContextFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public BindingContext newContext(BindingInfo bi) {
    Class[] classes = bi.contentClasses().toArray(new Class[bi.contentClasses().size()]);
    for (int i = 0; i < classes.length; i++) {
        if (WrapperComposite.class.equals(classes[i])) {
            classes[i] = CompositeStructure.class;
        }
    }
    Map<TypeInfo, TypeReference> typeInfoMappings = typeInfoMappings(bi.typeInfos());
    Map<Class, Class> subclassReplacements = bi.subclassReplacements();
    String defaultNamespaceRemap = bi.getDefaultNamespace();
    Boolean c14nSupport = (Boolean) bi.properties().get("c14nSupport");
    RuntimeAnnotationReader ar = (RuntimeAnnotationReader) bi.properties().get("com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader");
    JAXBContextFactory jaxbContextFactory = (JAXBContextFactory) bi.properties().get(JAXBContextFactory.class.getName());
    try {
        JAXBRIContext context = (jaxbContextFactory != null)
                ? jaxbContextFactory.createJAXBContext(
                bi.getSEIModel(),
                toList(classes),
                toList(typeInfoMappings.values()))
                : ContextFactory.createContext(
                classes, typeInfoMappings.values(),
                subclassReplacements, defaultNamespaceRemap,
                (c14nSupport != null) ? c14nSupport : false,
                ar, false, false, false);
        return new JAXBRIContextWrapper(context, typeInfoMappings);
    } catch (Exception e) {
        throw new DatabindingException(e);
    }
}
 
Example #4
Source File: JAXBRIContextFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public BindingContext newContext(BindingInfo bi) {
    Class[] classes = bi.contentClasses().toArray(new Class[bi.contentClasses().size()]);
    for (int i = 0; i < classes.length; i++) {
        if (WrapperComposite.class.equals(classes[i])) {
            classes[i] = CompositeStructure.class;
        }
    }
    Map<TypeInfo, TypeReference> typeInfoMappings = typeInfoMappings(bi.typeInfos());
    Map<Class, Class> subclassReplacements = bi.subclassReplacements();
    String defaultNamespaceRemap = bi.getDefaultNamespace();
    Boolean c14nSupport = (Boolean) bi.properties().get("c14nSupport");
    RuntimeAnnotationReader ar = (RuntimeAnnotationReader) bi.properties().get("com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader");
    JAXBContextFactory jaxbContextFactory = (JAXBContextFactory) bi.properties().get(JAXBContextFactory.class.getName());
    try {
        JAXBRIContext context = (jaxbContextFactory != null)
                ? jaxbContextFactory.createJAXBContext(
                bi.getSEIModel(),
                toList(classes),
                toList(typeInfoMappings.values()))
                : ContextFactory.createContext(
                classes, typeInfoMappings.values(),
                subclassReplacements, defaultNamespaceRemap,
                (c14nSupport != null) ? c14nSupport : false,
                ar, false, false, false);
        return new JAXBRIContextWrapper(context, typeInfoMappings);
    } catch (Exception e) {
        throw new DatabindingException(e);
    }
}
 
Example #5
Source File: JAXBRIContextFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public BindingContext newContext(BindingInfo bi) {
    Class[] classes = bi.contentClasses().toArray(new Class[bi.contentClasses().size()]);
    for (int i = 0; i < classes.length; i++) {
        if (WrapperComposite.class.equals(classes[i])) {
            classes[i] = CompositeStructure.class;
        }
    }
    Map<TypeInfo, TypeReference> typeInfoMappings = typeInfoMappings(bi.typeInfos());
    Map<Class, Class> subclassReplacements = bi.subclassReplacements();
    String defaultNamespaceRemap = bi.getDefaultNamespace();
    Boolean c14nSupport = (Boolean) bi.properties().get("c14nSupport");
    RuntimeAnnotationReader ar = (RuntimeAnnotationReader) bi.properties().get("com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader");
    JAXBContextFactory jaxbContextFactory = (JAXBContextFactory) bi.properties().get(JAXBContextFactory.class.getName());
    try {
        JAXBRIContext context = (jaxbContextFactory != null)
                ? jaxbContextFactory.createJAXBContext(
                bi.getSEIModel(),
                toList(classes),
                toList(typeInfoMappings.values()))
                : ContextFactory.createContext(
                classes, typeInfoMappings.values(),
                subclassReplacements, defaultNamespaceRemap,
                (c14nSupport != null) ? c14nSupport : false,
                ar, false, false, false);
        return new JAXBRIContextWrapper(context, typeInfoMappings);
    } catch (Exception e) {
        throw new DatabindingException(e);
    }
}
 
Example #6
Source File: JAXBRIContextFactory.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public BindingContext newContext(BindingInfo bi) {
    Class[] classes = bi.contentClasses().toArray(new Class[bi.contentClasses().size()]);
    for (int i = 0; i < classes.length; i++) {
        if (WrapperComposite.class.equals(classes[i])) {
            classes[i] = CompositeStructure.class;
        }
    }
    Map<TypeInfo, TypeReference> typeInfoMappings = typeInfoMappings(bi.typeInfos());
    Map<Class, Class> subclassReplacements = bi.subclassReplacements();
    String defaultNamespaceRemap = bi.getDefaultNamespace();
    Boolean c14nSupport = (Boolean) bi.properties().get("c14nSupport");
    RuntimeAnnotationReader ar = (RuntimeAnnotationReader) bi.properties().get("com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader");
    JAXBContextFactory jaxbContextFactory = (JAXBContextFactory) bi.properties().get(JAXBContextFactory.class.getName());
    try {
        JAXBRIContext context = (jaxbContextFactory != null)
                ? jaxbContextFactory.createJAXBContext(
                bi.getSEIModel(),
                toList(classes),
                toList(typeInfoMappings.values()))
                : ContextFactory.createContext(
                classes, typeInfoMappings.values(),
                subclassReplacements, defaultNamespaceRemap,
                (c14nSupport != null) ? c14nSupport : false,
                ar, false, false, false);
        return new JAXBRIContextWrapper(context, typeInfoMappings);
    } catch (Exception e) {
        throw new DatabindingException(e);
    }
}
 
Example #7
Source File: JAXBRIContextFactory.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public BindingContext newContext(BindingInfo bi) {
    Class[] classes = bi.contentClasses().toArray(new Class[bi.contentClasses().size()]);
    for (int i = 0; i < classes.length; i++) {
        if (WrapperComposite.class.equals(classes[i])) {
            classes[i] = CompositeStructure.class;
        }
    }
    Map<TypeInfo, TypeReference> typeInfoMappings = typeInfoMappings(bi.typeInfos());
    Map<Class, Class> subclassReplacements = bi.subclassReplacements();
    String defaultNamespaceRemap = bi.getDefaultNamespace();
    Boolean c14nSupport = (Boolean) bi.properties().get("c14nSupport");
    RuntimeAnnotationReader ar = (RuntimeAnnotationReader) bi.properties().get("com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader");
    JAXBContextFactory jaxbContextFactory = (JAXBContextFactory) bi.properties().get(JAXBContextFactory.class.getName());
    try {
        JAXBRIContext context = (jaxbContextFactory != null)
                ? jaxbContextFactory.createJAXBContext(
                bi.getSEIModel(),
                toList(classes),
                toList(typeInfoMappings.values()))
                : ContextFactory.createContext(
                classes, typeInfoMappings.values(),
                subclassReplacements, defaultNamespaceRemap,
                (c14nSupport != null) ? c14nSupport : false,
                ar, false, false, false);
        return new JAXBRIContextWrapper(context, typeInfoMappings);
    } catch (Exception e) {
        throw new DatabindingException(e);
    }
}
 
Example #8
Source File: JAXBRIContextFactory.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public BindingContext newContext(BindingInfo bi) {
    Class[] classes = bi.contentClasses().toArray(new Class[bi.contentClasses().size()]);
    for (int i = 0; i < classes.length; i++) {
        if (WrapperComposite.class.equals(classes[i])) {
            classes[i] = CompositeStructure.class;
        }
    }
    Map<TypeInfo, TypeReference> typeInfoMappings = typeInfoMappings(bi.typeInfos());
    Map<Class, Class> subclassReplacements = bi.subclassReplacements();
    String defaultNamespaceRemap = bi.getDefaultNamespace();
    Boolean c14nSupport = (Boolean) bi.properties().get("c14nSupport");
    RuntimeAnnotationReader ar = (RuntimeAnnotationReader) bi.properties().get("com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader");
    JAXBContextFactory jaxbContextFactory = (JAXBContextFactory) bi.properties().get(JAXBContextFactory.class.getName());
    try {
        JAXBRIContext context = (jaxbContextFactory != null)
                ? jaxbContextFactory.createJAXBContext(
                bi.getSEIModel(),
                toList(classes),
                toList(typeInfoMappings.values()))
                : ContextFactory.createContext(
                classes, typeInfoMappings.values(),
                subclassReplacements, defaultNamespaceRemap,
                (c14nSupport != null) ? c14nSupport : false,
                ar, false, false, false);
        return new JAXBRIContextWrapper(context, typeInfoMappings);
    } catch (Exception e) {
        throw new DatabindingException(e);
    }
}
 
Example #9
Source File: AbstractSEIModelImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private void /*JAXBRIContext*/ createJAXBContext() {
        final List<TypeInfo> types = getAllTypeInfos();
        final List<Class> cls = new ArrayList<Class>(types.size() + additionalClasses.size());

        cls.addAll(additionalClasses);
        for (TypeInfo type : types) {
            cls.add((Class) type.type);
        }

        try {
            //jaxbContext = JAXBRIContext.newInstance(cls, types, targetNamespace, false);
            // Need to avoid doPriv block once JAXB is fixed. Afterwards, use the above
            bindingContext = AccessController.doPrivileged(new PrivilegedExceptionAction<BindingContext>() {
                public BindingContext run() throws Exception {
                    if(LOGGER.isLoggable(Level.FINEST)) {
                        LOGGER.log(Level.FINEST, "Creating JAXBContext with classes={0} and types={1}", new Object[]{cls, types});
                    }
                    UsesJAXBContextFeature f = features.get(UsesJAXBContextFeature.class);
                    com.oracle.webservices.internal.api.databinding.DatabindingModeFeature dmf =
                            features.get(com.oracle.webservices.internal.api.databinding.DatabindingModeFeature.class);
                    JAXBContextFactory factory = f!=null ? f.getFactory() : null;
                    if(factory==null)   factory=JAXBContextFactory.DEFAULT;

//                    return factory.createJAXBContext(AbstractSEIModelImpl.this,cls,types);

                    databindingInfo.properties().put(JAXBContextFactory.class.getName(), factory);
                    if (dmf != null) {
                        if (LOGGER.isLoggable(Level.FINE))
                            LOGGER.log(Level.FINE, "DatabindingModeFeature in SEI specifies mode: {0}", dmf.getMode());
                        databindingInfo.setDatabindingMode(dmf
                                .getMode());
                    }

                        if (f!=null) databindingInfo.setDatabindingMode(BindingContextFactory.DefaultDatabindingMode);
                        databindingInfo.setClassLoader(classLoader);
                        databindingInfo.contentClasses().addAll(cls);
                        databindingInfo.typeInfos().addAll(types);
                        databindingInfo.properties().put("c14nSupport", Boolean.FALSE);
                        databindingInfo.setDefaultNamespace(AbstractSEIModelImpl.this.getDefaultSchemaNamespace());
                        BindingContext bc =  BindingContextFactory.create(databindingInfo);
                            if (LOGGER.isLoggable(Level.FINE))
                                LOGGER.log(Level.FINE,
                                        "Created binding context: "
                                                + bc.getClass().getName());
//                      System.out.println("---------------------- databinding " + bc);
                        return bc;
                }
            });
//          createBridgeMap(types);
            createBondMap(types);
        } catch (PrivilegedActionException e) {
            throw new WebServiceException(ModelerMessages.UNABLE_TO_CREATE_JAXB_CONTEXT(), e);
        }
        knownNamespaceURIs = new ArrayList<String>();
        for (String namespace : bindingContext.getKnownNamespaceURIs()) {
            if (namespace.length() > 0) {
                if (!namespace.equals(SOAPNamespaceConstants.XSD) && !namespace.equals(SOAPNamespaceConstants.XMLNS))
                    knownNamespaceURIs.add(namespace);
            }
        }

        marshallers = new Pool.Marshaller(jaxbContext);

        //return getJAXBContext();
    }
 
Example #10
Source File: AbstractSEIModelImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private void /*JAXBRIContext*/ createJAXBContext() {
        final List<TypeInfo> types = getAllTypeInfos();
        final List<Class> cls = new ArrayList<Class>(types.size() + additionalClasses.size());

        cls.addAll(additionalClasses);
        for (TypeInfo type : types) {
            cls.add((Class) type.type);
        }

        try {
            //jaxbContext = JAXBRIContext.newInstance(cls, types, targetNamespace, false);
            // Need to avoid doPriv block once JAXB is fixed. Afterwards, use the above
            bindingContext = AccessController.doPrivileged(new PrivilegedExceptionAction<BindingContext>() {
                public BindingContext run() throws Exception {
                    if(LOGGER.isLoggable(Level.FINEST)) {
                        LOGGER.log(Level.FINEST, "Creating JAXBContext with classes={0} and types={1}", new Object[]{cls, types});
                    }
                    UsesJAXBContextFeature f = features.get(UsesJAXBContextFeature.class);
                    com.oracle.webservices.internal.api.databinding.DatabindingModeFeature dmf =
                            features.get(com.oracle.webservices.internal.api.databinding.DatabindingModeFeature.class);
                    JAXBContextFactory factory = f!=null ? f.getFactory() : null;
                    if(factory==null)   factory=JAXBContextFactory.DEFAULT;

//                    return factory.createJAXBContext(AbstractSEIModelImpl.this,cls,types);

                    databindingInfo.properties().put(JAXBContextFactory.class.getName(), factory);
                    if (dmf != null) {
                        if (LOGGER.isLoggable(Level.FINE))
                            LOGGER.log(Level.FINE, "DatabindingModeFeature in SEI specifies mode: {0}", dmf.getMode());
                        databindingInfo.setDatabindingMode(dmf
                                .getMode());
                    }

                        if (f!=null) databindingInfo.setDatabindingMode(BindingContextFactory.DefaultDatabindingMode);
                        databindingInfo.setClassLoader(classLoader);
                        databindingInfo.contentClasses().addAll(cls);
                        databindingInfo.typeInfos().addAll(types);
                        databindingInfo.properties().put("c14nSupport", Boolean.FALSE);
                        databindingInfo.setDefaultNamespace(AbstractSEIModelImpl.this.getDefaultSchemaNamespace());
                        BindingContext bc =  BindingContextFactory.create(databindingInfo);
                            if (LOGGER.isLoggable(Level.FINE))
                                LOGGER.log(Level.FINE,
                                        "Created binding context: "
                                                + bc.getClass().getName());
//                      System.out.println("---------------------- databinding " + bc);
                        return bc;
                }
            });
//          createBridgeMap(types);
            createBondMap(types);
        } catch (PrivilegedActionException e) {
            throw new WebServiceException(ModelerMessages.UNABLE_TO_CREATE_JAXB_CONTEXT(), e);
        }
        knownNamespaceURIs = new ArrayList<String>();
        for (String namespace : bindingContext.getKnownNamespaceURIs()) {
            if (namespace.length() > 0) {
                if (!namespace.equals(SOAPNamespaceConstants.XSD) && !namespace.equals(SOAPNamespaceConstants.XMLNS))
                    knownNamespaceURIs.add(namespace);
            }
        }

        marshallers = new Pool.Marshaller(jaxbContext);

        //return getJAXBContext();
    }
 
Example #11
Source File: AbstractSEIModelImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private void /*JAXBRIContext*/ createJAXBContext() {
        final List<TypeInfo> types = getAllTypeInfos();
        final List<Class> cls = new ArrayList<Class>(types.size() + additionalClasses.size());

        cls.addAll(additionalClasses);
        for (TypeInfo type : types) {
            cls.add((Class) type.type);
        }

        try {
            //jaxbContext = JAXBRIContext.newInstance(cls, types, targetNamespace, false);
            // Need to avoid doPriv block once JAXB is fixed. Afterwards, use the above
            bindingContext = AccessController.doPrivileged(new PrivilegedExceptionAction<BindingContext>() {
                public BindingContext run() throws Exception {
                    if(LOGGER.isLoggable(Level.FINEST)) {
                        LOGGER.log(Level.FINEST, "Creating JAXBContext with classes={0} and types={1}", new Object[]{cls, types});
                    }
                    UsesJAXBContextFeature f = features.get(UsesJAXBContextFeature.class);
                    com.oracle.webservices.internal.api.databinding.DatabindingModeFeature dmf =
                            features.get(com.oracle.webservices.internal.api.databinding.DatabindingModeFeature.class);
                    JAXBContextFactory factory = f!=null ? f.getFactory() : null;
                    if(factory==null)   factory=JAXBContextFactory.DEFAULT;

//                    return factory.createJAXBContext(AbstractSEIModelImpl.this,cls,types);

                    databindingInfo.properties().put(JAXBContextFactory.class.getName(), factory);
                    if (dmf != null) {
                        if (LOGGER.isLoggable(Level.FINE))
                            LOGGER.log(Level.FINE, "DatabindingModeFeature in SEI specifies mode: {0}", dmf.getMode());
                        databindingInfo.setDatabindingMode(dmf
                                .getMode());
                    }

                        if (f!=null) databindingInfo.setDatabindingMode(BindingContextFactory.DefaultDatabindingMode);
                        databindingInfo.setClassLoader(classLoader);
                        databindingInfo.contentClasses().addAll(cls);
                        databindingInfo.typeInfos().addAll(types);
                        databindingInfo.properties().put("c14nSupport", Boolean.FALSE);
                        databindingInfo.setDefaultNamespace(AbstractSEIModelImpl.this.getDefaultSchemaNamespace());
                        BindingContext bc =  BindingContextFactory.create(databindingInfo);
                            if (LOGGER.isLoggable(Level.FINE))
                                LOGGER.log(Level.FINE,
                                        "Created binding context: "
                                                + bc.getClass().getName());
//                      System.out.println("---------------------- databinding " + bc);
                        return bc;
                }
            });
//          createBridgeMap(types);
            createBondMap(types);
        } catch (PrivilegedActionException e) {
            throw new WebServiceException(ModelerMessages.UNABLE_TO_CREATE_JAXB_CONTEXT(), e);
        }
        knownNamespaceURIs = new ArrayList<String>();
        for (String namespace : bindingContext.getKnownNamespaceURIs()) {
            if (namespace.length() > 0) {
                if (!namespace.equals(SOAPNamespaceConstants.XSD) && !namespace.equals(SOAPNamespaceConstants.XMLNS))
                    knownNamespaceURIs.add(namespace);
            }
        }

        marshallers = new Pool.Marshaller(jaxbContext);

        //return getJAXBContext();
    }
 
Example #12
Source File: AbstractSEIModelImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private void /*JAXBRIContext*/ createJAXBContext() {
        final List<TypeInfo> types = getAllTypeInfos();
        final List<Class> cls = new ArrayList<Class>(types.size() + additionalClasses.size());

        cls.addAll(additionalClasses);
        for (TypeInfo type : types) {
            cls.add((Class) type.type);
        }

        try {
            //jaxbContext = JAXBRIContext.newInstance(cls, types, targetNamespace, false);
            // Need to avoid doPriv block once JAXB is fixed. Afterwards, use the above
            bindingContext = AccessController.doPrivileged(new PrivilegedExceptionAction<BindingContext>() {
                public BindingContext run() throws Exception {
                    if(LOGGER.isLoggable(Level.FINEST)) {
                        LOGGER.log(Level.FINEST, "Creating JAXBContext with classes={0} and types={1}", new Object[]{cls, types});
                    }
                    UsesJAXBContextFeature f = features.get(UsesJAXBContextFeature.class);
                    com.oracle.webservices.internal.api.databinding.DatabindingModeFeature dmf =
                            features.get(com.oracle.webservices.internal.api.databinding.DatabindingModeFeature.class);
                    JAXBContextFactory factory = f!=null ? f.getFactory() : null;
                    if(factory==null)   factory=JAXBContextFactory.DEFAULT;

//                    return factory.createJAXBContext(AbstractSEIModelImpl.this,cls,types);

                    databindingInfo.properties().put(JAXBContextFactory.class.getName(), factory);
                    if (dmf != null) {
                        if (LOGGER.isLoggable(Level.FINE))
                            LOGGER.log(Level.FINE, "DatabindingModeFeature in SEI specifies mode: {0}", dmf.getMode());
                        databindingInfo.setDatabindingMode(dmf
                                .getMode());
                    }

                        if (f!=null) databindingInfo.setDatabindingMode(BindingContextFactory.DefaultDatabindingMode);
                        databindingInfo.setClassLoader(classLoader);
                        databindingInfo.contentClasses().addAll(cls);
                        databindingInfo.typeInfos().addAll(types);
                        databindingInfo.properties().put("c14nSupport", Boolean.FALSE);
                        databindingInfo.setDefaultNamespace(AbstractSEIModelImpl.this.getDefaultSchemaNamespace());
                        BindingContext bc =  BindingContextFactory.create(databindingInfo);
                            if (LOGGER.isLoggable(Level.FINE))
                                LOGGER.log(Level.FINE,
                                        "Created binding context: "
                                                + bc.getClass().getName());
//                      System.out.println("---------------------- databinding " + bc);
                        return bc;
                }
            });
//          createBridgeMap(types);
            createBondMap(types);
        } catch (PrivilegedActionException e) {
            throw new WebServiceException(ModelerMessages.UNABLE_TO_CREATE_JAXB_CONTEXT(), e);
        }
        knownNamespaceURIs = new ArrayList<String>();
        for (String namespace : bindingContext.getKnownNamespaceURIs()) {
            if (namespace.length() > 0) {
                if (!namespace.equals(SOAPNamespaceConstants.XSD) && !namespace.equals(SOAPNamespaceConstants.XMLNS))
                    knownNamespaceURIs.add(namespace);
            }
        }

        marshallers = new Pool.Marshaller(jaxbContext);

        //return getJAXBContext();
    }
 
Example #13
Source File: AbstractSEIModelImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private void /*JAXBRIContext*/ createJAXBContext() {
        final List<TypeInfo> types = getAllTypeInfos();
        final List<Class> cls = new ArrayList<Class>(types.size() + additionalClasses.size());

        cls.addAll(additionalClasses);
        for (TypeInfo type : types) {
            cls.add((Class) type.type);
        }

        try {
            //jaxbContext = JAXBRIContext.newInstance(cls, types, targetNamespace, false);
            // Need to avoid doPriv block once JAXB is fixed. Afterwards, use the above
            bindingContext = AccessController.doPrivileged(new PrivilegedExceptionAction<BindingContext>() {
                public BindingContext run() throws Exception {
                    if(LOGGER.isLoggable(Level.FINEST)) {
                        LOGGER.log(Level.FINEST, "Creating JAXBContext with classes={0} and types={1}", new Object[]{cls, types});
                    }
                    UsesJAXBContextFeature f = features.get(UsesJAXBContextFeature.class);
                    com.oracle.webservices.internal.api.databinding.DatabindingModeFeature dmf =
                            features.get(com.oracle.webservices.internal.api.databinding.DatabindingModeFeature.class);
                    JAXBContextFactory factory = f!=null ? f.getFactory() : null;
                    if(factory==null)   factory=JAXBContextFactory.DEFAULT;

//                    return factory.createJAXBContext(AbstractSEIModelImpl.this,cls,types);

                    databindingInfo.properties().put(JAXBContextFactory.class.getName(), factory);
                    if (dmf != null) {
                        if (LOGGER.isLoggable(Level.FINE))
                            LOGGER.log(Level.FINE, "DatabindingModeFeature in SEI specifies mode: {0}", dmf.getMode());
                        databindingInfo.setDatabindingMode(dmf
                                .getMode());
                    }

                        if (f!=null) databindingInfo.setDatabindingMode(BindingContextFactory.DefaultDatabindingMode);
                        databindingInfo.setClassLoader(classLoader);
                        databindingInfo.contentClasses().addAll(cls);
                        databindingInfo.typeInfos().addAll(types);
                        databindingInfo.properties().put("c14nSupport", Boolean.FALSE);
                        databindingInfo.setDefaultNamespace(AbstractSEIModelImpl.this.getDefaultSchemaNamespace());
                        BindingContext bc =  BindingContextFactory.create(databindingInfo);
                            if (LOGGER.isLoggable(Level.FINE))
                                LOGGER.log(Level.FINE,
                                        "Created binding context: "
                                                + bc.getClass().getName());
//                      System.out.println("---------------------- databinding " + bc);
                        return bc;
                }
            });
//          createBridgeMap(types);
            createBondMap(types);
        } catch (PrivilegedActionException e) {
            throw new WebServiceException(ModelerMessages.UNABLE_TO_CREATE_JAXB_CONTEXT(), e);
        }
        knownNamespaceURIs = new ArrayList<String>();
        for (String namespace : bindingContext.getKnownNamespaceURIs()) {
            if (namespace.length() > 0) {
                if (!namespace.equals(SOAPNamespaceConstants.XSD) && !namespace.equals(SOAPNamespaceConstants.XMLNS))
                    knownNamespaceURIs.add(namespace);
            }
        }

        marshallers = new Pool.Marshaller(jaxbContext);

        //return getJAXBContext();
    }
 
Example #14
Source File: AbstractSEIModelImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private void /*JAXBRIContext*/ createJAXBContext() {
        final List<TypeInfo> types = getAllTypeInfos();
        final List<Class> cls = new ArrayList<Class>(types.size() + additionalClasses.size());

        cls.addAll(additionalClasses);
        for (TypeInfo type : types) {
            cls.add((Class) type.type);
        }

        try {
            //jaxbContext = JAXBRIContext.newInstance(cls, types, targetNamespace, false);
            // Need to avoid doPriv block once JAXB is fixed. Afterwards, use the above
            bindingContext = AccessController.doPrivileged(new PrivilegedExceptionAction<BindingContext>() {
                public BindingContext run() throws Exception {
                    if(LOGGER.isLoggable(Level.FINEST)) {
                        LOGGER.log(Level.FINEST, "Creating JAXBContext with classes={0} and types={1}", new Object[]{cls, types});
                    }
                    UsesJAXBContextFeature f = features.get(UsesJAXBContextFeature.class);
                    com.oracle.webservices.internal.api.databinding.DatabindingModeFeature dmf =
                            features.get(com.oracle.webservices.internal.api.databinding.DatabindingModeFeature.class);
                    JAXBContextFactory factory = f!=null ? f.getFactory() : null;
                    if(factory==null)   factory=JAXBContextFactory.DEFAULT;

//                    return factory.createJAXBContext(AbstractSEIModelImpl.this,cls,types);

                    databindingInfo.properties().put(JAXBContextFactory.class.getName(), factory);
                    if (dmf != null) {
                        if (LOGGER.isLoggable(Level.FINE))
                            LOGGER.log(Level.FINE, "DatabindingModeFeature in SEI specifies mode: {0}", dmf.getMode());
                        databindingInfo.setDatabindingMode(dmf
                                .getMode());
                    }

                        if (f!=null) databindingInfo.setDatabindingMode(BindingContextFactory.DefaultDatabindingMode);
                        databindingInfo.setClassLoader(classLoader);
                        databindingInfo.contentClasses().addAll(cls);
                        databindingInfo.typeInfos().addAll(types);
                        databindingInfo.properties().put("c14nSupport", Boolean.FALSE);
                        databindingInfo.setDefaultNamespace(AbstractSEIModelImpl.this.getDefaultSchemaNamespace());
                        BindingContext bc =  BindingContextFactory.create(databindingInfo);
                            if (LOGGER.isLoggable(Level.FINE))
                                LOGGER.log(Level.FINE,
                                        "Created binding context: "
                                                + bc.getClass().getName());
//                      System.out.println("---------------------- databinding " + bc);
                        return bc;
                }
            });
//          createBridgeMap(types);
            createBondMap(types);
        } catch (PrivilegedActionException e) {
            throw new WebServiceException(ModelerMessages.UNABLE_TO_CREATE_JAXB_CONTEXT(), e);
        }
        knownNamespaceURIs = new ArrayList<String>();
        for (String namespace : bindingContext.getKnownNamespaceURIs()) {
            if (namespace.length() > 0) {
                if (!namespace.equals(SOAPNamespaceConstants.XSD) && !namespace.equals(SOAPNamespaceConstants.XMLNS))
                    knownNamespaceURIs.add(namespace);
            }
        }

        marshallers = new Pool.Marshaller(jaxbContext);

        //return getJAXBContext();
    }
 
Example #15
Source File: AbstractSEIModelImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private void /*JAXBRIContext*/ createJAXBContext() {
        final List<TypeInfo> types = getAllTypeInfos();
        final List<Class> cls = new ArrayList<Class>(types.size() + additionalClasses.size());

        cls.addAll(additionalClasses);
        for (TypeInfo type : types) {
            cls.add((Class) type.type);
        }

        try {
            //jaxbContext = JAXBRIContext.newInstance(cls, types, targetNamespace, false);
            // Need to avoid doPriv block once JAXB is fixed. Afterwards, use the above
            bindingContext = AccessController.doPrivileged(new PrivilegedExceptionAction<BindingContext>() {
                public BindingContext run() throws Exception {
                    if(LOGGER.isLoggable(Level.FINEST)) {
                        LOGGER.log(Level.FINEST, "Creating JAXBContext with classes={0} and types={1}", new Object[]{cls, types});
                    }
                    UsesJAXBContextFeature f = features.get(UsesJAXBContextFeature.class);
                    com.oracle.webservices.internal.api.databinding.DatabindingModeFeature dmf =
                            features.get(com.oracle.webservices.internal.api.databinding.DatabindingModeFeature.class);
                    JAXBContextFactory factory = f!=null ? f.getFactory() : null;
                    if(factory==null)   factory=JAXBContextFactory.DEFAULT;

//                    return factory.createJAXBContext(AbstractSEIModelImpl.this,cls,types);

                    databindingInfo.properties().put(JAXBContextFactory.class.getName(), factory);
                    if (dmf != null) {
                        if (LOGGER.isLoggable(Level.FINE))
                            LOGGER.log(Level.FINE, "DatabindingModeFeature in SEI specifies mode: {0}", dmf.getMode());
                        databindingInfo.setDatabindingMode(dmf
                                .getMode());
                    }

                        if (f!=null) databindingInfo.setDatabindingMode(BindingContextFactory.DefaultDatabindingMode);
                        databindingInfo.setClassLoader(classLoader);
                        databindingInfo.contentClasses().addAll(cls);
                        databindingInfo.typeInfos().addAll(types);
                        databindingInfo.properties().put("c14nSupport", Boolean.FALSE);
                        databindingInfo.setDefaultNamespace(AbstractSEIModelImpl.this.getDefaultSchemaNamespace());
                        BindingContext bc =  BindingContextFactory.create(databindingInfo);
                            if (LOGGER.isLoggable(Level.FINE))
                                LOGGER.log(Level.FINE,
                                        "Created binding context: "
                                                + bc.getClass().getName());
//                      System.out.println("---------------------- databinding " + bc);
                        return bc;
                }
            });
//          createBridgeMap(types);
            createBondMap(types);
        } catch (PrivilegedActionException e) {
            throw new WebServiceException(ModelerMessages.UNABLE_TO_CREATE_JAXB_CONTEXT(), e);
        }
        knownNamespaceURIs = new ArrayList<String>();
        for (String namespace : bindingContext.getKnownNamespaceURIs()) {
            if (namespace.length() > 0) {
                if (!namespace.equals(SOAPNamespaceConstants.XSD) && !namespace.equals(SOAPNamespaceConstants.XMLNS))
                    knownNamespaceURIs.add(namespace);
            }
        }

        marshallers = new Pool.Marshaller(jaxbContext);

        //return getJAXBContext();
    }
 
Example #16
Source File: AbstractSEIModelImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private void /*JAXBRIContext*/ createJAXBContext() {
        final List<TypeInfo> types = getAllTypeInfos();
        final List<Class> cls = new ArrayList<Class>(types.size() + additionalClasses.size());

        cls.addAll(additionalClasses);
        for (TypeInfo type : types) {
            cls.add((Class) type.type);
        }

        try {
            //jaxbContext = JAXBRIContext.newInstance(cls, types, targetNamespace, false);
            // Need to avoid doPriv block once JAXB is fixed. Afterwards, use the above
            bindingContext = AccessController.doPrivileged(new PrivilegedExceptionAction<BindingContext>() {
                public BindingContext run() throws Exception {
                    if(LOGGER.isLoggable(Level.FINEST)) {
                        LOGGER.log(Level.FINEST, "Creating JAXBContext with classes={0} and types={1}", new Object[]{cls, types});
                    }
                    UsesJAXBContextFeature f = features.get(UsesJAXBContextFeature.class);
                    com.oracle.webservices.internal.api.databinding.DatabindingModeFeature dmf =
                            features.get(com.oracle.webservices.internal.api.databinding.DatabindingModeFeature.class);
                    JAXBContextFactory factory = f!=null ? f.getFactory() : null;
                    if(factory==null)   factory=JAXBContextFactory.DEFAULT;

//                    return factory.createJAXBContext(AbstractSEIModelImpl.this,cls,types);

                    databindingInfo.properties().put(JAXBContextFactory.class.getName(), factory);
                    if (dmf != null) {
                        if (LOGGER.isLoggable(Level.FINE))
                            LOGGER.log(Level.FINE, "DatabindingModeFeature in SEI specifies mode: {0}", dmf.getMode());
                        databindingInfo.setDatabindingMode(dmf
                                .getMode());
                    }

                        if (f!=null) databindingInfo.setDatabindingMode(BindingContextFactory.DefaultDatabindingMode);
                        databindingInfo.setClassLoader(classLoader);
                        databindingInfo.contentClasses().addAll(cls);
                        databindingInfo.typeInfos().addAll(types);
                        databindingInfo.properties().put("c14nSupport", Boolean.FALSE);
                        databindingInfo.setDefaultNamespace(AbstractSEIModelImpl.this.getDefaultSchemaNamespace());
                        BindingContext bc =  BindingContextFactory.create(databindingInfo);
                            if (LOGGER.isLoggable(Level.FINE))
                                LOGGER.log(Level.FINE,
                                        "Created binding context: "
                                                + bc.getClass().getName());
//                      System.out.println("---------------------- databinding " + bc);
                        return bc;
                }
            });
//          createBridgeMap(types);
            createBondMap(types);
        } catch (PrivilegedActionException e) {
            throw new WebServiceException(ModelerMessages.UNABLE_TO_CREATE_JAXB_CONTEXT(), e);
        }
        knownNamespaceURIs = new ArrayList<String>();
        for (String namespace : bindingContext.getKnownNamespaceURIs()) {
            if (namespace.length() > 0) {
                if (!namespace.equals(SOAPNamespaceConstants.XSD) && !namespace.equals(SOAPNamespaceConstants.XMLNS))
                    knownNamespaceURIs.add(namespace);
            }
        }

        marshallers = new Pool.Marshaller(jaxbContext);

        //return getJAXBContext();
    }