Java Doc for AttachmentManager.java in  » Wiki-Engine » JSPWiki » com » ecyrd » jspwiki » attachment » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Wiki Engine » JSPWiki » com.ecyrd.jspwiki.attachment 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.ecyrd.jspwiki.attachment.AttachmentManager

AttachmentManager
public class AttachmentManager (Code)
Provides facilities for handling attachments. All attachment handling goes through this class.

The AttachmentManager provides a facade towards the current WikiAttachmentProvider that is in use. It is created by the WikiEngine as a singleton object, and can be requested through the WikiEngine.
author:
   Janne Jalkanen
since:
   1.9.28



Field Summary
final public static  StringPROP_ALLOWEDEXTENSIONS
    
final public static  StringPROP_FORDBIDDENEXTENSIONS
    
final public static  StringPROP_MAXSIZE
     The maximum size of attachments that can be uploaded.
final public static  StringPROP_PROVIDER
     The property name for defining the attachment provider class name.
static  Loggerlog
    

Constructor Summary
public  AttachmentManager(WikiEngine engine, Properties props)
     Creates a new AttachmentManager.

Method Summary
public  booleanattachmentsEnabled()
     Returns true, if attachments are enabled and running.
public  voiddeleteAttachment(Attachment att)
     Deletes all versions of the given attachment.
public  voiddeleteVersion(Attachment att)
     Deletes the given attachment version.
public  CollectiongetAllAttachments()
     Returns a collection of Attachments, containing each and every attachment that is in this Wiki. A collection of attachments.
public  AttachmentgetAttachmentInfo(String name)
     Gets info on a particular attachment, latest version.
Parameters:
  name - A full attachment name.
public  AttachmentgetAttachmentInfo(String name, int version)
     Gets info on a particular attachment with the given version.
Parameters:
  name - A full attachment name.
Parameters:
  version - A version number.
public  AttachmentgetAttachmentInfo(WikiContext context, String attachmentname)
     Figures out the full attachment name from the context and attachment name.
Parameters:
  context - The current WikiContext
Parameters:
  attachmentname - The file name of the attachment.
public  AttachmentgetAttachmentInfo(WikiContext context, String attachmentname, int version)
     Figures out the full attachment name from the context and attachment name.
Parameters:
  context - The current WikiContext
Parameters:
  attachmentname - The file name of the attachment.
Parameters:
  version - A particular version.
public  InputStreamgetAttachmentStream(Attachment att)
     Finds a (real) attachment from the repository as a stream.
Parameters:
  att - Attachment An InputStream to read from.
public  InputStreamgetAttachmentStream(WikiContext ctx, Attachment att)
     Returns an attachment stream using the particular WikiContext.
public  WikiAttachmentProvidergetCurrentProvider()
     Returns the current attachment provider. The current provider.
public  DynamicAttachmentgetDynamicAttachment(String name)
     Finds a DynamicAttachment.
public  ListgetVersionHistory(String attachmentName)
     Returns a list of versions of the attachment.
Parameters:
  attachmentName - A fully qualified name of the attachment.
public  booleanhasAttachments(WikiPage wikipage)
     Returns true, if the page has any attachments at all.
public  CollectionlistAttachments(WikiPage wikipage)
     Returns the list of attachments associated with a given wiki page. If there are no attachments, returns an empty Collection.
Parameters:
  wikipage - The wiki page from which you are seeking attachments for.
public  voidstoreAttachment(Attachment att, File source)
     Stores an attachment that lives in the given file. If the attachment did not exist previously, this method will create it.
public  voidstoreAttachment(Attachment att, InputStream in)
     Stores an attachment directly from a stream. If the attachment did not exist previously, this method will create it.
public  voidstoreDynamicAttachment(WikiContext ctx, DynamicAttachment att)
     Stores a dynamic attachment.

Field Detail
PROP_ALLOWEDEXTENSIONS
final public static String PROP_ALLOWEDEXTENSIONS(Code)
A space-separated list of attachment types which can be uploaded



PROP_FORDBIDDENEXTENSIONS
final public static String PROP_FORDBIDDENEXTENSIONS(Code)
A space-separated list of attachment types which cannot be uploaded



PROP_MAXSIZE
final public static String PROP_MAXSIZE(Code)
The maximum size of attachments that can be uploaded.



PROP_PROVIDER
final public static String PROP_PROVIDER(Code)
The property name for defining the attachment provider class name.



log
static Logger log(Code)




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

DO NOT CREATE an AttachmentManager on your own, unless you really know what you're doing. Just use WikiEngine.getAttachmentManager() if you're making a module for JSPWiki.
Parameters:
  engine - The wikiengine that owns this attachment manager.
Parameters:
  props - A list of properties from which the AttachmentManager will seekits configuration. Typically this is the "jspwiki.properties".





Method Detail
attachmentsEnabled
public boolean attachmentsEnabled()(Code)
Returns true, if attachments are enabled and running. A boolean value indicating whether attachment functionality is enabled.



deleteAttachment
public void deleteAttachment(Attachment att) throws ProviderException(Code)
Deletes all versions of the given attachment.
Parameters:
  att - The Attachment to delete.
throws:
  ProviderException - if something goes wrong with the backend.



deleteVersion
public void deleteVersion(Attachment att) throws ProviderException(Code)
Deletes the given attachment version.
Parameters:
  att - The attachment to delete
throws:
  ProviderException - If something goes wrong with the backend.



getAllAttachments
public Collection getAllAttachments() throws ProviderException(Code)
Returns a collection of Attachments, containing each and every attachment that is in this Wiki. A collection of attachments. If attachments are disabled, willreturn an empty collection.
throws:
  ProviderException - If something went wrong with the backend



getAttachmentInfo
public Attachment getAttachmentInfo(String name) throws ProviderException(Code)
Gets info on a particular attachment, latest version.
Parameters:
  name - A full attachment name. Attachment, or null, if no such attachment exists.
throws:
  ProviderException - If something goes wrong.



getAttachmentInfo
public Attachment getAttachmentInfo(String name, int version) throws ProviderException(Code)
Gets info on a particular attachment with the given version.
Parameters:
  name - A full attachment name.
Parameters:
  version - A version number. Attachment, or null, if no such attachment or version exists.
throws:
  ProviderException - If something goes wrong.



getAttachmentInfo
public Attachment getAttachmentInfo(WikiContext context, String attachmentname) throws ProviderException(Code)
Figures out the full attachment name from the context and attachment name.
Parameters:
  context - The current WikiContext
Parameters:
  attachmentname - The file name of the attachment. Attachment, or null, if no such attachment exists.
throws:
  ProviderException - If something goes wrong.



getAttachmentInfo
public Attachment getAttachmentInfo(WikiContext context, String attachmentname, int version) throws ProviderException(Code)
Figures out the full attachment name from the context and attachment name.
Parameters:
  context - The current WikiContext
Parameters:
  attachmentname - The file name of the attachment.
Parameters:
  version - A particular version. Attachment, or null, if no such attachment or version exists.
throws:
  ProviderException - If something goes wrong.



getAttachmentStream
public InputStream getAttachmentStream(Attachment att) throws IOException, ProviderException(Code)
Finds a (real) attachment from the repository as a stream.
Parameters:
  att - Attachment An InputStream to read from. May return null, ifattachments are disabled.
throws:
  IOException - If the stream cannot be opened
throws:
  ProviderException - If the backend fails due to some other reason.



getAttachmentStream
public InputStream getAttachmentStream(WikiContext ctx, Attachment att) throws ProviderException, IOException(Code)
Returns an attachment stream using the particular WikiContext. This method should be used instead of getAttachmentStream(Attachment), since it also allows the DynamicAttachments to function.
Parameters:
  ctx - The Wiki Context
Parameters:
  att - The Attachment to find An InputStream. May return null, if attachments are disabled. You musttake care of closing it.
throws:
  ProviderException - If the backend fails due to some reason
throws:
  IOException - If the stream cannot be opened



getCurrentProvider
public WikiAttachmentProvider getCurrentProvider()(Code)
Returns the current attachment provider. The current provider. May be null, if attachments are disabled.



getDynamicAttachment
public DynamicAttachment getDynamicAttachment(String name)(Code)
Finds a DynamicAttachment. Normally, you should just use getAttachmentInfo(), since that will find also DynamicAttachments.
Parameters:
  name - The name of the attachment to look for An Attachment, or null.
See Also:   AttachmentManager.getAttachmentInfo(String)



getVersionHistory
public List getVersionHistory(String attachmentName) throws ProviderException(Code)
Returns a list of versions of the attachment.
Parameters:
  attachmentName - A fully qualified name of the attachment. A list of Attachments. May return null, if attachments aredisabled.
throws:
  ProviderException - If the provider fails for some reason.



hasAttachments
public boolean hasAttachments(WikiPage wikipage)(Code)
Returns true, if the page has any attachments at all. This is a convinience method.
Parameters:
  wikipage - The wiki page from which you are seeking attachments for. True, if the page has attachments, else false.



listAttachments
public Collection listAttachments(WikiPage wikipage) throws ProviderException(Code)
Returns the list of attachments associated with a given wiki page. If there are no attachments, returns an empty Collection.
Parameters:
  wikipage - The wiki page from which you are seeking attachments for. a valid collection of attachments.
throws:
  ProviderException - If there was something wrong in the backend.



storeAttachment
public void storeAttachment(Attachment att, File source) throws IOException, ProviderException(Code)
Stores an attachment that lives in the given file. If the attachment did not exist previously, this method will create it. If it did exist, it stores a new version.
Parameters:
  att - Attachment to store this under.
Parameters:
  source - A file to read from.
throws:
  IOException - If writing the attachment failed.
throws:
  ProviderException - If something else went wrong.



storeAttachment
public void storeAttachment(Attachment att, InputStream in) throws IOException, ProviderException(Code)
Stores an attachment directly from a stream. If the attachment did not exist previously, this method will create it. If it did exist, it stores a new version.
Parameters:
  att - Attachment to store this under.
Parameters:
  in - InputStream from which the attachment contents will be read.
throws:
  IOException - If writing the attachment failed.
throws:
  ProviderException - If something else went wrong.



storeDynamicAttachment
public void storeDynamicAttachment(WikiContext ctx, DynamicAttachment att)(Code)
Stores a dynamic attachment. Unlike storeAttachment(), this just stores the attachment in the memory.
Parameters:
  ctx - A WikiContext
Parameters:
  att - An attachment to store



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.