Examples of AegisContext


Examples of org.apache.cxf.aegis.AegisContext

        addNamespace("xsi", SOAPConstants.XSI_NS);

    }

    private void defaultContext() {
        context = new AegisContext();
        context.initialize();
        mapping = context.getTypeMapping();
    }
View Full Code Here

Examples of org.apache.cxf.aegis.AegisContext

        assertTrue(int2ok);
    }
   
    @Test
    public void testNillableAnnotation() throws Exception {
        context = new AegisContext();
        TypeCreationOptions config = new TypeCreationOptions();
        config.setDefaultNillable(false);
        config.setDefaultMinOccurs(1);
        context.setTypeCreationOptions(config);
        context.initialize();
View Full Code Here

Examples of org.apache.cxf.aegis.AegisContext

    }
   
   
    @Test
    public void testNillableIntMinOccurs1() throws Exception {
        context = new AegisContext();
        TypeCreationOptions config = new TypeCreationOptions();
        config.setDefaultMinOccurs(1);
        config.setDefaultNillable(false);
        context.setTypeCreationOptions(config);
        context.initialize();
View Full Code Here

Examples of org.apache.cxf.aegis.AegisContext

     * be usable even if that API is never called.
     */
    private void ensureInitialized() {
        if (!isInitialized) {
            if (aegisContext == null) {
                aegisContext = new AegisContext();
                if (overrideTypes != null) {
                    aegisContext.setRootClassNames(overrideTypes);
                }
                if (configuration != null) {
                    aegisContext.setTypeCreationOptions(configuration);
View Full Code Here

Examples of org.apache.cxf.aegis.AegisContext

     */
    public void initialize(Service s) {

        // We want to support some compatibility configuration properties.
        if (aegisContext == null) {
            aegisContext = new AegisContext();

            Object val = s.get(READ_XSI_TYPE_KEY);
            if ("false".equals(val) || Boolean.FALSE.equals(val)) {
                aegisContext.setReadXsiTypes(false);
            }
View Full Code Here

Examples of org.apache.cxf.aegis.AegisContext

    }

    protected AegisContext getAegisContext(Class<?> type, Type genericType) {
       
        if (resolver != null) {
            AegisContext context = resolver.getContext(type);
            // it's up to the resolver to keep its contexts in a map
            if (context != null) {
                return context;
            }
        }
View Full Code Here

Examples of org.apache.cxf.aegis.AegisContext

            rootClasses.add(ct);
        }
    }
    private AegisContext getClassContext(Class<?> type, Type reflectionType) {
        synchronized (classContexts) {
            AegisContext context = classContexts.get(type);
            if (context == null) {
                context = new AegisContext();
                context.setWriteXsiTypes(writeXsiType);
                context.setReadXsiTypes(readXsiType);
                Set<Class<?>> rootClasses = new HashSet<Class<?>>();
                /* we do not want raw collection types in here.
                 * so we only add the 'type' to the root classes if the
                 * un-erased (reflection) type is non-generic.
                 * Now, perhaps we should tolerate non-collection
                 * generic types. 
                 */
                if (reflectionType == null || reflectionType instanceof Class) {
                    rootClasses.add(type);
                } else {
                    addType(rootClasses, reflectionType, true);
                }
                context.setRootClasses(rootClasses);
                context.initialize();
                /* It's not enough, in the presence of generic types, to just add it as a root.
                    a mapping is also needed */
                if (reflectionType != null) {
                    org.apache.cxf.aegis.type.Type aegisType;
                    aegisType = context.getTypeMapping().getTypeCreator().createType(reflectionType);
                    context.getTypeMapping().register(aegisType);
                }
                classContexts.put(type, context);
            }
            return context;
        }
View Full Code Here

Examples of org.apache.cxf.aegis.AegisContext

public class AegisElementProvider extends AbstractAegisProvider  {
   
    public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType m,
        MultivaluedMap<String, String> headers, InputStream is)
        throws IOException {
        AegisContext context = getAegisContext(type, genericType);
        AegisReader<XMLStreamReader> aegisReader = context.createXMLStreamReader();
        try {
            XMLStreamReader xmlStreamReader = createStreamReader(type, genericType, is);
            return aegisReader.read(xmlStreamReader);
        } catch (Exception e) {
            throw new WebApplicationException(e);
View Full Code Here

Examples of org.apache.cxf.aegis.AegisContext

        MediaType m, MultivaluedMap<String, Object> headers, OutputStream os)
        throws IOException {
        if (type == null) {
            type = obj.getClass();
        }
        AegisContext context = getAegisContext(type, genericType);
        // we need special cases for collection types.
       
        org.apache.cxf.aegis.type.Type aegisType = TypeUtil.getWriteTypeStandalone(context, obj, genericType);
        AegisWriter<XMLStreamWriter> aegisWriter = context.createXMLStreamWriter();
        try {
            XMLStreamWriter xmlStreamWriter = createStreamWriter(aegisType.getSchemaType(), os);
            // use type qname as element qname?
            xmlStreamWriter.writeStartDocument();
            aegisWriter.write(obj, aegisType.getSchemaType(), false, xmlStreamWriter, aegisType);
View Full Code Here

Examples of org.apache.cxf.aegis.AegisContext

     * be usable even if that API is never called.
     */
    private void ensureInitialized() {
        if (!isInitialized) {
            if (aegisContext == null) {
                aegisContext = new AegisContext();
                if (overrideTypes != null) {
                    aegisContext.setRootClassNames(overrideTypes);
                }
                if (configuration != null) {
                    aegisContext.setTypeCreationOptions(configuration);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.