com.ecyrd.jspwiki.attachment
Class AttachmentManager

java.lang.Object
  |
  +--com.ecyrd.jspwiki.attachment.AttachmentManager

public class AttachmentManager
extends java.lang.Object

Provides facilities for handling attachments.

Since:
1.9.28
Author:
Janne Jalkanen

Field Summary
static java.lang.String PROP_PROVIDER
           
 
Constructor Summary
AttachmentManager(WikiEngine engine, java.util.Properties props)
          Creates a new AttachmentManager.
 
Method Summary
 boolean attachmentsEnabled()
          Returns true, if attachments are enabled and running.
 java.util.Collection getAllAttachments()
          Returns a collection of Attachments, containing each and every attachment that is in this Wiki.
 Attachment getAttachmentInfo(java.lang.String name)
           
 Attachment getAttachmentInfo(java.lang.String name, int version)
           
 Attachment getAttachmentInfo(WikiContext context, java.lang.String attachmentname)
           
 Attachment getAttachmentInfo(WikiContext context, java.lang.String attachmentname, int version)
          Checks for a compound name, and attempts to get attachment information.
 java.io.InputStream getAttachmentStream(Attachment att)
           
 WikiAttachmentProvider getCurrentProvider()
           
 java.util.List getVersionHistory(java.lang.String attachmentName)
           
 boolean hasAttachments(WikiPage wikipage)
          Returns true, if the page has attachments.
 java.util.Collection listAttachments(WikiPage wikipage)
          Returns the list of attachments associated with a given wiki page.
 void storeAttachment(Attachment att, java.io.File source)
          Stores an attachment that lives in the given file.
 void storeAttachment(Attachment att, java.io.InputStream in)
          Stores an attachment directly from a stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_PROVIDER

public static final java.lang.String PROP_PROVIDER
See Also:
Constant Field Values
Constructor Detail

AttachmentManager

public AttachmentManager(WikiEngine engine,
                         java.util.Properties props)
Creates a new AttachmentManager. Note that creation will never fail, but it's quite likely that attachments do not function.

Method Detail

attachmentsEnabled

public boolean attachmentsEnabled()
Returns true, if attachments are enabled and running.


getAttachmentInfo

public Attachment getAttachmentInfo(java.lang.String name)
                             throws ProviderException
ProviderException

getAttachmentInfo

public Attachment getAttachmentInfo(java.lang.String name,
                                    int version)
                             throws ProviderException
ProviderException

getAttachmentInfo

public Attachment getAttachmentInfo(WikiContext context,
                                    java.lang.String attachmentname)
                             throws ProviderException
ProviderException

getAttachmentInfo

public Attachment getAttachmentInfo(WikiContext context,
                                    java.lang.String attachmentname,
                                    int version)
                             throws ProviderException
Checks for a compound name, and attempts to get attachment information.

ProviderException

listAttachments

public java.util.Collection listAttachments(WikiPage wikipage)
                                     throws ProviderException
Returns the list of attachments associated with a given wiki page.

ProviderException

hasAttachments

public boolean hasAttachments(WikiPage wikipage)
Returns true, if the page has attachments.


getAttachmentStream

public java.io.InputStream getAttachmentStream(Attachment att)
                                        throws java.io.IOException,
                                               ProviderException
java.io.IOException
ProviderException

storeAttachment

public void storeAttachment(Attachment att,
                            java.io.File source)
                     throws java.io.IOException,
                            ProviderException
Stores an attachment that lives in the given file.

java.io.IOException
ProviderException

storeAttachment

public void storeAttachment(Attachment att,
                            java.io.InputStream in)
                     throws java.io.IOException,
                            ProviderException
Stores an attachment directly from a stream.

java.io.IOException
ProviderException

getVersionHistory

public java.util.List getVersionHistory(java.lang.String attachmentName)
                                 throws ProviderException
ProviderException

getAllAttachments

public java.util.Collection getAllAttachments()
                                       throws ProviderException
Returns a collection of Attachments, containing each and every attachment that is in this Wiki.

Returns:
A collection of attachments. If attachments are disabled, will return an empty collection.
ProviderException

getCurrentProvider

public WikiAttachmentProvider getCurrentProvider()