Package org.apache.cxf.aegis.type.mtom
Class AbstractXOPType
- java.lang.Object
-
- org.apache.cxf.aegis.type.AegisType
-
- org.apache.cxf.aegis.type.mtom.AbstractXOPType
-
- Direct Known Subclasses:
ByteArrayType,DataHandlerType,DataSourceType
public abstract class AbstractXOPType extends AegisType
Base class for MtoM types.
-
-
Field Summary
Fields Modifier and Type Field Description static StringXML_MIME_ATTR_LOCAL_NAMEstatic QNameXML_MIME_BASE64static QNameXML_MIME_CONTENT_TYPEstatic StringXML_MIME_NSstatic QNameXOP_HREFstatic QNameXOP_INCLUDEstatic StringXOP_NS
-
Constructor Summary
Constructors Constructor Description AbstractXOPType(boolean useXmimeBinaryType, String expectedContentTypes)Create an XOP type.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddToSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement schemaElement)If the type object merely wants to contribute attributes to the xsd:element element, it can implement this.protected abstract org.apache.cxf.message.AttachmentcreateAttachment(Object object, String id)protected abstract byte[]getBytes(Object object)if MtoM is not enabled, we need bytes to turn into base64.protected abstract StringgetContentType(Object object, Context context)protected abstract ObjectreadAttachment(org.apache.cxf.message.Attachment att, Context context)ObjectreadMtoM(MessageReader reader, Context context)This is called from base64Type when it recognizes an XOP attachment.ObjectreadObject(MessageReader reader, Context context)This defers to the plain base64 type, which calls back into here above for XOP.booleanusesXmime()protected abstract ObjectwrapBytes(byte[] bareBytes, String contentType)If one of these types arrives unoptimized, we need to convert it to the desired return type.voidwriteObject(Object object, MessageWriter writer, Context context)Writes the object to the MessageWriter.-
Methods inherited from class org.apache.cxf.aegis.type.AegisType
equals, getDependencies, getMaxOccurs, getMinOccurs, getSchemaType, getType, getTypeClass, getTypeMapping, hashCode, hasMaxOccurs, hasMinOccurs, isAbstract, isComplex, isFlatArray, isNillable, isWriteOuter, setAbstract, setFlatArray, setNillable, setSchemaType, setTypeClass, setTypeMapping, setWriteOuter, toString, usesUtilityTypes, writeSchema
-
-
-
-
Field Detail
-
XOP_NS
public static final String XOP_NS
- See Also:
- Constant Field Values
-
XML_MIME_NS
public static final String XML_MIME_NS
- See Also:
- Constant Field Values
-
XML_MIME_ATTR_LOCAL_NAME
public static final String XML_MIME_ATTR_LOCAL_NAME
- See Also:
- Constant Field Values
-
XOP_INCLUDE
public static final QName XOP_INCLUDE
-
XML_MIME_CONTENT_TYPE
public static final QName XML_MIME_CONTENT_TYPE
-
XOP_HREF
public static final QName XOP_HREF
-
XML_MIME_BASE64
public static final QName XML_MIME_BASE64
-
-
Constructor Detail
-
AbstractXOPType
public AbstractXOPType(boolean useXmimeBinaryType, String expectedContentTypes)Create an XOP type. This type will use xmime to publish and receive the content type via xmime:base64Binary if useXmimeBinaryType is true. If expectedContentTypes != null, then it will use xmime to advertise expected content types.- Parameters:
useXmimeBinaryType- whether to use xmime:base64Binary.expectedContentTypes- whether to public xmime:expectedContentTypes.
-
-
Method Detail
-
readMtoM
public Object readMtoM(MessageReader reader, Context context) throws DatabindingException
This is called from base64Type when it recognizes an XOP attachment.- Parameters:
reader-context-- Returns:
- Throws:
DatabindingException
-
readObject
public Object readObject(MessageReader reader, Context context) throws DatabindingException
This defers to the plain base64 type, which calls back into here above for XOP. Read in the XML fragment and create an object.- Specified by:
readObjectin classAegisType- Returns:
- Throws:
DatabindingException
-
readAttachment
protected abstract Object readAttachment(org.apache.cxf.message.Attachment att, Context context) throws IOException
- Throws:
IOException
-
writeObject
public void writeObject(Object object, MessageWriter writer, Context context) throws DatabindingException
Description copied from class:AegisTypeWrites the object to the MessageWriter.- Specified by:
writeObjectin classAegisType- Throws:
DatabindingException
-
createAttachment
protected abstract org.apache.cxf.message.Attachment createAttachment(Object object, String id)
-
wrapBytes
protected abstract Object wrapBytes(byte[] bareBytes, String contentType)
If one of these types arrives unoptimized, we need to convert it to the desired return type.- Parameters:
bareBytes- the bytes pulled out of the base64.contentType- when we support xmime:contentType, this will be passed along.- Returns:
-
getBytes
protected abstract byte[] getBytes(Object object)
if MtoM is not enabled, we need bytes to turn into base64.- Returns:
-
addToSchemaElement
public void addToSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement schemaElement)
Description copied from class:AegisTypeIf the type object merely wants to contribute attributes to the xsd:element element, it can implement this.- Overrides:
addToSchemaElementin classAegisType
-
-