org.ws4d.java.attachment
Class AttachmentStore

java.lang.Object
  extended by org.ws4d.java.attachment.AttachmentStore
Direct Known Subclasses:
DefaultAttachmentStore

public abstract class AttachmentStore
extends java.lang.Object

This class allows to store the attachments. Depending on the platform the attachments are stored into files, or stay in memory.


Field Summary
static int POLICY_EXT_STORAGE
          This attachment store policy indicates that attachments should be stored on external media (file system, database, etc.) rather than kept in memory.
static int POLICY_MEM_BUFFER
          This attachment store policy indicates that attachments should be kept within memory rather than stored on external media (file system, database, etc.).
 
Constructor Summary
AttachmentStore()
           
 
Method Summary
static boolean addStreamingMediaType(InternetMediaType type)
           
abstract  void cleanup()
           
static boolean exists()
           
static AttachmentStore getInstance()
           
static int getStorePolicy()
          Returns the policy for storing attachment raw data used within this current runtime.
static Iterator getStreamingMediaTypes()
           
abstract  boolean isAvailable(ContextID context, java.lang.String cid)
           
static boolean isStreamingMediaType(InternetMediaType type)
           
static boolean removeStreamingMediaType(InternetMediaType type)
           
static void resetStreamingMediaTypes()
           
abstract  IncomingAttachment resolve(ContextID context, java.lang.String cid)
           
static void setStorePolicy(int newStorePolicy)
           
abstract  void store(ContextID context, java.lang.String cid, java.lang.String contentType, java.lang.String transferEncoding, java.io.InputStream from)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POLICY_MEM_BUFFER

public static final int POLICY_MEM_BUFFER
This attachment store policy indicates that attachments should be kept within memory rather than stored on external media (file system, database, etc.).

See Also:
Constant Field Values

POLICY_EXT_STORAGE

public static final int POLICY_EXT_STORAGE
This attachment store policy indicates that attachments should be stored on external media (file system, database, etc.) rather than kept in memory.

See Also:
Constant Field Values
Constructor Detail

AttachmentStore

public AttachmentStore()
Method Detail

getInstance

public static AttachmentStore getInstance()
                                   throws AttachmentException
Throws:
AttachmentException

exists

public static boolean exists()

getStorePolicy

public static int getStorePolicy()
Returns the policy for storing attachment raw data used within this current runtime.

Returns:
the attachment store policy of the current runtime/platform
See Also:
POLICY_MEM_BUFFER, POLICY_EXT_STORAGE

setStorePolicy

public static void setStorePolicy(int newStorePolicy)

addStreamingMediaType

public static boolean addStreamingMediaType(InternetMediaType type)

removeStreamingMediaType

public static boolean removeStreamingMediaType(InternetMediaType type)

isStreamingMediaType

public static boolean isStreamingMediaType(InternetMediaType type)

getStreamingMediaTypes

public static Iterator getStreamingMediaTypes()

resetStreamingMediaTypes

public static void resetStreamingMediaTypes()

resolve

public abstract IncomingAttachment resolve(ContextID context,
                                           java.lang.String cid)
                                    throws AttachmentException
Throws:
AttachmentException

store

public abstract void store(ContextID context,
                           java.lang.String cid,
                           java.lang.String contentType,
                           java.lang.String transferEncoding,
                           java.io.InputStream from)

isAvailable

public abstract boolean isAvailable(ContextID context,
                                    java.lang.String cid)

cleanup

public abstract void cleanup()