org.jvnet.jax_ws_commons.dime.attachment
Class DimeRecord

java.lang.Object
  extended by org.jvnet.jax_ws_commons.dime.attachment.DimeRecord
All Implemented Interfaces:
com.sun.xml.ws.api.message.Attachment

public class DimeRecord
extends java.lang.Object
implements com.sun.xml.ws.api.message.Attachment

DIME encoded web service attachment.

Author:
Oliver Treichel

Nested Class Summary
static class DimeRecord.TypeNameFormat
          Enumeration of known DIME type name formats.
 
Constructor Summary
DimeRecord()
           
 
Method Summary
 byte[] asByteArray()
          Not implemented.
 javax.activation.DataHandler asDataHandler()
          Get this attachment as a DataHandler
 java.io.InputStream asInputStream()
          Get this attachment as an InputStream.
 javax.xml.transform.Source asSource()
          Not implemented.
 int getChunkSize()
          Gets the size of the internal buffer for reading and writing data from the network to a file or vice versa.
 java.lang.String getContentId()
          Gets the id of this attachment.
 java.lang.String getContentType()
          Return the mime type of the attachment if it is known (i.e if the DIME type format is DimeRecord.TypeNameFormat.MEDIA_TYPE.
 byte[] getOptions()
          Get the DIME options.
 DimeRecord.TypeNameFormat getTypeNameFormat()
          Get the DIME type name format.
 boolean isChunked()
          Is the data of the attachment chunked (i.e. is the content spread over multiple DIME records)?
 boolean isFirst()
          Is this the first record in the DIME message?
 boolean isLast()
          Is this the last record in the DIME message?
 void setChunkSize(int chunkSize)
          Sets the size of the internal buffer for reading and writing data from the network to a file or vice versa.
 void setContentId(java.lang.String id)
          Set the content id of the record.
 void setContentType(java.lang.String type)
          Sets the content type of the record.
 void setData(javax.activation.DataHandler data)
          Sets the content of the attachment.
 void setFirst(boolean first)
          Mark this record as the fist record in the DIME message.
 void setLast(boolean last)
          Mark this record as the last record in the DIME message.
 void setOptions(byte[] options)
          Set options to be send to the client.
 void setTypeNameFormat(DimeRecord.TypeNameFormat typeFormat)
          Set the type name format (i.e. the format of the content type).
 void writeTo(java.io.OutputStream os)
          Write this DimeRecord to an OutputStream.
 void writeTo(javax.xml.soap.SOAPMessage saaj)
          Not implemented.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DimeRecord

public DimeRecord()
Method Detail

asByteArray

public byte[] asByteArray()
Not implemented.

Specified by:
asByteArray in interface com.sun.xml.ws.api.message.Attachment
Throws:
java.lang.UnsupportedOperationException
See Also:
Attachment.asByteArray()

asDataHandler

public javax.activation.DataHandler asDataHandler()
Get this attachment as a DataHandler

Specified by:
asDataHandler in interface com.sun.xml.ws.api.message.Attachment
See Also:
Attachment.asDataHandler()

asInputStream

public java.io.InputStream asInputStream()
Get this attachment as an InputStream.

Specified by:
asInputStream in interface com.sun.xml.ws.api.message.Attachment
See Also:
Attachment.asInputStream()

asSource

public javax.xml.transform.Source asSource()
Not implemented.

Specified by:
asSource in interface com.sun.xml.ws.api.message.Attachment
Throws:
java.lang.UnsupportedOperationException
See Also:
Attachment.asSource()

getChunkSize

public int getChunkSize()
Gets the size of the internal buffer for reading and writing data from the network to a file or vice versa. Defaults to 8 kByte.

Returns:
The size of the internal buffer in bytes.

getContentId

public java.lang.String getContentId()
Gets the id of this attachment. The id is used as the value of the href attribute in the SOAP message.

Specified by:
getContentId in interface com.sun.xml.ws.api.message.Attachment
Returns:
The content id.
See Also:
Attachment.getContentId()

getContentType

public java.lang.String getContentType()
Return the mime type of the attachment if it is known (i.e if the DIME type format is DimeRecord.TypeNameFormat.MEDIA_TYPE.

Specified by:
getContentType in interface com.sun.xml.ws.api.message.Attachment
Returns:
The mime type or null if unknown.
See Also:
Attachment.getContentType()

getOptions

public byte[] getOptions()
Get the DIME options. This value is ignored by the implementation.

Returns:
The options.

getTypeNameFormat

public DimeRecord.TypeNameFormat getTypeNameFormat()
Get the DIME type name format.

Returns:
The type name format.

isChunked

public boolean isChunked()
Is the data of the attachment chunked (i.e. is the content spread over multiple DIME records)? If the record is chunked, there must be more records in the message (i.e. isLast() must be false).

Returns:
true if there is more data in the next record(s).

isFirst

public boolean isFirst()
Is this the first record in the DIME message? The first part of the DIME message is always the SOAP message.

Returns:
true if this is the first record (i.e. the SOAP message), false if this record is an binary attachment.

isLast

public boolean isLast()
Is this the last record in the DIME message?

Returns:
true if this is the last record in the DIME message.

setChunkSize

public void setChunkSize(int chunkSize)
Sets the size of the internal buffer for reading and writing data from the network to a file or vice versa. Defaults to 8 kByte.

Parameters:
chunkSize -

setContentId

public void setContentId(java.lang.String id)
Set the content id of the record. The id is used as the value of the href attribute in the SOAP message.

Parameters:
id -

setContentType

public void setContentType(java.lang.String type)
Sets the content type of the record. The type name format should be set accordingly.

Parameters:
type -
See Also:
setTypeNameFormat(DimeRecord.TypeNameFormat)

setData

public void setData(javax.activation.DataHandler data)
Sets the content of the attachment.

Parameters:
data -

setFirst

public void setFirst(boolean first)
Mark this record as the fist record in the DIME message.

Parameters:
first -

setLast

public void setLast(boolean last)
Mark this record as the last record in the DIME message.

Parameters:
last -

setOptions

public void setOptions(byte[] options)
Set options to be send to the client.

Parameters:
options -

setTypeNameFormat

public void setTypeNameFormat(DimeRecord.TypeNameFormat typeFormat)
Set the type name format (i.e. the format of the content type).

Parameters:
typeFormat -

writeTo

public void writeTo(java.io.OutputStream os)
             throws java.io.IOException
Write this DimeRecord to an OutputStream.

Specified by:
writeTo in interface com.sun.xml.ws.api.message.Attachment
Parameters:
os -
Throws:
java.io.IOException

writeTo

public void writeTo(javax.xml.soap.SOAPMessage saaj)
             throws javax.xml.soap.SOAPException
Not implemented.

Specified by:
writeTo in interface com.sun.xml.ws.api.message.Attachment
Throws:
java.lang.UnsupportedOperationException
javax.xml.soap.SOAPException
See Also:
Attachment.writeTo(SOAPMessage)


Copyright © 2008. All Rights Reserved.