Package org.apache.axis.encoding

Examples of org.apache.axis.encoding.Serializer


            return true;
        }

        // look up the serializer in the TypeMappingRegistry
        Serializer ser = null;
        SerializerFactory factory = null;

        if (tm != null) {
            factory = (SerializerFactory) tm.getSerializer(type, qName);
        } else {
            factory = (SerializerFactory) defaultTM.getSerializer(type, qName);
        }

        // If no factory is found, use the BeanSerializerFactory
        // if applicable, otherwise issue errors and treat as an anyType
        if (factory == null) {
            if (isEnumClass(type)) {
                factory = new EnumSerializerFactory(type, qName);
            } else if (isBeanCompatible(type, true)) {
                factory = new BeanSerializerFactory(type, qName);
            } else {
                return false;
            }
        }

        if (factory != null) {
            ser = (Serializer) factory.getSerializerAs(Constants.AXIS_SAX);
        }

        // if we can't get a serializer, that is bad.
        if (ser == null) {
            throw new AxisFault(Messages.getMessage("NoSerializer00",
                    type.getName()));
        }

        Element typeEl;

        try {
            typeEl = ser.writeSchema(type, this);
        } catch (Exception e) {
            throw AxisFault.makeFault(e);
        }

        // If this is an anonymous type, just make the type element a child
View Full Code Here


                containingElement.setAttribute("type", getQNameString(qName));
            return;
        }

        // look up the serializer in the TypeMappingRegistry
        Serializer ser = null;
        SerializerFactory factory = null;
        if (tm != null) {
            factory = (SerializerFactory)tm.getSerializer(type);
        } else {
            factory = (SerializerFactory)defaultTM.getSerializer(type);
        }

        // If no factory is found, use the BeanSerializerFactory
        // if applicable, otherwise issue errors and treat as an anyType
        if (factory == null) {
            if (isEnumClass(type)) {
                factory = new EnumSerializerFactory(type, qName);
            } else if (isBeanCompatible(type, true)) {
                factory = new BeanSerializerFactory(type, qName);
            } else {
                return;
            }
        }

        if (factory != null) {
            ser = (Serializer)factory.getSerializerAs(Constants.AXIS_SAX);
        }

        // if we can't get a serializer, that is bad.
        if (ser == null) {
            throw new AxisFault(
                    Messages.getMessage("NoSerializer00", type.getName()));
        }

        Element typeEl;
        try {
            typeEl = ser.writeSchema(type, this);
        } catch (Exception e) {
            throw AxisFault.makeFault(e);
        }

        // If this is an anonymous type, just make the type element a child
View Full Code Here

    }
   
    protected Serializer getSerializerAsInternal(String mechanismType)
        throws JAXRPCException {
        // Try getting a specialized Serializer
        Serializer serializer = getSpecialized(mechanismType);
       
        // Try getting a general purpose Serializer via constructor
        // invocation
        if (serializer == null) {
            serializer = getGeneralPurpose(mechanismType);
View Full Code Here

                return false;
            }
        }

        // factory is not null
        Serializer ser = (Serializer) factory.getSerializerAs(Constants.AXIS_SAX);

        // if we can't get a serializer, that is bad.
        if (ser == null) {
            throw new AxisFault(Messages.getMessage("NoSerializer00",
                    type.getName()));
        }

        Element typeEl;

        try {
            typeEl = ser.writeSchema(type, this);
        } catch (Exception e) {
            throw AxisFault.makeFault(e);
        }

        // If this is an anonymous type, just make the type element a child
View Full Code Here

    }
   
    protected Serializer getSerializerAsInternal(String mechanismType)
        throws JAXRPCException {
        // Try getting a specialized Serializer
        Serializer serializer = getSpecialized(mechanismType);
       
        // Try getting a general purpose Serializer via constructor
        // invocation
        if (serializer == null) {
            serializer = getGeneralPurpose(mechanismType);
View Full Code Here

                containingElement.setAttribute("type", getQNameString(qName));
            return true;
        }

        // look up the serializer in the TypeMappingRegistry
        Serializer ser = null;
        SerializerFactory factory = null;
        if (tm != null) {
            factory = (SerializerFactory)tm.getSerializer(type);
        } else {
            factory = (SerializerFactory)defaultTM.getSerializer(type);
        }

        // If no factory is found, use the BeanSerializerFactory
        // if applicable, otherwise issue errors and treat as an anyType
        if (factory == null) {
            if (isEnumClass(type)) {
                factory = new EnumSerializerFactory(type, qName);
            } else if (isBeanCompatible(type, true)) {
                factory = new BeanSerializerFactory(type, qName);
            } else {
                return false;
            }
        }

        if (factory != null) {
            ser = (Serializer)factory.getSerializerAs(Constants.AXIS_SAX);
        }

        // if we can't get a serializer, that is bad.
        if (ser == null) {
            throw new AxisFault(
                    Messages.getMessage("NoSerializer00", type.getName()));
        }

        Element typeEl;
        try {
            typeEl = ser.writeSchema(type, this);
        } catch (Exception e) {
            throw AxisFault.makeFault(e);
        }

        // If this is an anonymous type, just make the type element a child
View Full Code Here

    }
   
    protected Serializer getSerializerAsInternal(String mechanismType)
        throws JAXRPCException {
        // Try getting a specialized Serializer
        Serializer serializer = getSpecialized(mechanismType);
       
        // Try getting a general purpose Serializer via constructor
        // invocation
        if (serializer == null) {
            serializer = getGeneralPurpose(mechanismType);
View Full Code Here

            return true;
        }

        // look up the serializer in the TypeMappingRegistry
        Serializer ser = null;
        SerializerFactory factory = null;

        if (tm != null) {
            factory = (SerializerFactory) tm.getSerializer(type);
        } else {
            factory = (SerializerFactory) defaultTM.getSerializer(type);
        }

        // If no factory is found, use the BeanSerializerFactory
        // if applicable, otherwise issue errors and treat as an anyType
        if (factory == null) {
            if (isEnumClass(type)) {
                factory = new EnumSerializerFactory(type, qName);
            } else if (isBeanCompatible(type, true)) {
                factory = new BeanSerializerFactory(type, qName);
            } else {
                return false;
            }
        }

        if (factory != null) {
            ser = (Serializer) factory.getSerializerAs(Constants.AXIS_SAX);
        }

        // if we can't get a serializer, that is bad.
        if (ser == null) {
            throw new AxisFault(Messages.getMessage("NoSerializer00",
                    type.getName()));
        }

        Element typeEl;

        try {
            typeEl = ser.writeSchema(type, this);
        } catch (Exception e) {
            throw AxisFault.makeFault(e);
        }

        // If this is an anonymous type, just make the type element a child
View Full Code Here

    }
   
    protected Serializer getSerializerAsInternal(String mechanismType)
        throws JAXRPCException {
        // Try getting a specialized Serializer
        Serializer serializer = getSpecialized(mechanismType);
       
        // Try getting a general purpose Serializer via constructor
        // invocation
        if (serializer == null) {
            serializer = getGeneralPurpose(mechanismType);
View Full Code Here

   * @throws SerializationException if we cannot serialize the object.
   */
  public String serialize(T reportDefinition) {
    try {
      QName xmlType = getXmlType();
      Serializer serializer = getSerializer(xmlType);
      StringWriter writer = new StringWriter();
      SerializationContext context = new SerializationContext(writer);
      serializer.serialize(
          xmlType, null, reportDefinition, context);
      return sanitize(writer.toString());
    } catch (IllegalArgumentException e) {
      throw new SerializationException("Could not serialize report.", e);
    } catch (SecurityException e) {
View Full Code Here

TOP

Related Classes of org.apache.axis.encoding.Serializer

Copyright © 2018 www.massapicom. 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.