org.apache.axiom.attachments.impl
Class PartFactory

java.lang.Object
  extended by org.apache.axiom.attachments.impl.PartFactory

public class PartFactory
extends java.lang.Object

The PartFactory creates an object that represents a Part (implements the Part interface). There are different ways to represent a part (backing file or backing array etc.). These different implementations should not be exposed to the other layers of the code. The PartFactory helps maintain this abstraction, and makes it easier to add new implementations.


Nested Class Summary
(package private) static class PartFactory.BAOS
          A normal ByteArrayOutputStream, except that it returns the buffer directly instead of returning a copy of the buffer.
 
Field Summary
private static org.apache.commons.logging.Log log
           
 
Constructor Summary
PartFactory()
           
 
Method Summary
static Part createPart(LifecycleManager manager, MIMEBodyPartInputStream in, boolean isSOAPPart, int threshholdSize, java.lang.String attachmentDir, int messageContentLength)
          Creates a part from the input stream.
private static void readHeader(java.lang.StringBuffer header, java.util.Map headers)
          Parse the header into a name and value pair.
private static java.io.InputStream readHeaders(java.io.InputStream in, java.util.Map headers)
          The implementing class must call initHeaders prior to using any of the Part methods.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.commons.logging.Log log
Constructor Detail

PartFactory

public PartFactory()
Method Detail

createPart

public static Part createPart(LifecycleManager manager,
                              MIMEBodyPartInputStream in,
                              boolean isSOAPPart,
                              int threshholdSize,
                              java.lang.String attachmentDir,
                              int messageContentLength)
                       throws OMException
Creates a part from the input stream. The remaining parameters are used to determine if the part should be represented in memory (byte buffers) or backed by a file.

Parameters:
in - MIMEBodyPartInputStream
isSOAPPart -
threshholdSize -
attachmentDir -
messageContentLength -
Returns:
Part
Throws:
OMException - if any exception is encountered while processing.

readHeaders

private static java.io.InputStream readHeaders(java.io.InputStream in,
                                               java.util.Map headers)
                                        throws java.io.IOException
The implementing class must call initHeaders prior to using any of the Part methods.

Parameters:
is -
headers -
Throws:
java.io.IOException

readHeader

private static void readHeader(java.lang.StringBuffer header,
                               java.util.Map headers)
Parse the header into a name and value pair. Add the name value pair to the map.

Parameters:
header - StringBuffer
headers - Map