Package com.xpn.xwiki.doc
Class XWikiAttachmentArchive
- java.lang.Object
-
- com.xpn.xwiki.doc.XWikiAttachmentArchive
-
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
VoidAttachmentVersioningStore.VoidAttachmentArchive
public class XWikiAttachmentArchive extends Object implements Cloneable
JRCS based implementation of an archive for XWikiAttachment.- Version:
- $Id: a523d2563124aebb68450c72a5e4522f0a946550 $
-
-
Constructor Summary
Constructors Constructor Description XWikiAttachmentArchive()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Object
clone()
XWikiAttachmentArchive
clone(XWikiAttachment attachment, XWikiContext context)
Clone the attachment archive while replacing the name and the document of the revisions to the one of the attachment passed in parameter.byte[]
getArchive()
Get the archive if it is currently stored in RAM.byte[]
getArchive(XWikiContext context)
Get the archive, loading it from the database if necessary.String
getArchiveAsString()
Get the archive if it is currently stored in RAM.String
getArchiveAsString(XWikiContext context)
Get the archive, loading it from the database if necessary.XWikiAttachment
getAttachment()
long
getId()
org.suigeneris.jrcs.rcs.Archive
getRCSArchive()
Deprecated.since 2.6M1 please do not use this, it is bound to a jrcs based implementation.XWikiAttachment
getRevision(XWikiAttachment attachment, String rev, XWikiContext context)
Get an old revision of the attachment which this is an archive of.org.suigeneris.jrcs.rcs.Version[]
getVersions()
void
setArchive(byte[] data)
Set the archive from a byte array representation of a JRCS archive.void
setArchive(String data)
Set the archive from a byte array representation of a JRCS archive.void
setAttachment(XWikiAttachment attachment)
Set the attachment to associate with this archive.void
setId(long id)
This does nothing and is only here to satisfy Hibernate.void
setRCSArchive(org.suigeneris.jrcs.rcs.Archive archive)
Deprecated.since 2.6M1 please do not use this, it is bound to a jrcs based implementation.void
updateArchive(byte[] data, XWikiContext context)
Deprecated.since 7.1M1, useupdateArchive(XWikiContext)
insteadvoid
updateArchive(XWikiContext context)
Update the archive.
-
-
-
Method Detail
-
getId
public long getId()
- Returns:
- the id of the attachment which this archive is associated with.
-
setId
public void setId(long id)
This does nothing and is only here to satisfy Hibernate.- Parameters:
id
- the id of the attachment which this archive is associated with, unused.
-
clone
@Unstable public XWikiAttachmentArchive clone(XWikiAttachment attachment, XWikiContext context)
Clone the attachment archive while replacing the name and the document of the revisions to the one of the attachment passed in parameter.- Parameters:
attachment
- the attachment to use for the new name and location ofcontext
- the current context- Returns:
- the cloned attachment archive
- Since:
- 14.2RC1
-
getRCSArchive
@Deprecated public org.suigeneris.jrcs.rcs.Archive getRCSArchive()
Deprecated.since 2.6M1 please do not use this, it is bound to a jrcs based implementation.- Returns:
- a JRCS archive.
-
setRCSArchive
@Deprecated public void setRCSArchive(org.suigeneris.jrcs.rcs.Archive archive)
Deprecated.since 2.6M1 please do not use this, it is bound to a jrcs based implementation.- Parameters:
archive
- a JRCS archive.
-
getArchiveAsString
public String getArchiveAsString() throws XWikiException
Get the archive if it is currently stored in RAM.- Returns:
- a String representation of a JRCS archive.
- Throws:
XWikiException
- if anything goes wrong.- Since:
- 7.1M1
-
getArchiveAsString
public String getArchiveAsString(XWikiContext context) throws XWikiException
Get the archive, loading it from the database if necessary.- Parameters:
context
- the XWikiContext for the request used to load the correct attachment archive from the database.- Returns:
- a String representation of a JRCS archive.
- Throws:
XWikiException
- if anything goes wrong.- Since:
- 7.1M1
-
getArchive
public byte[] getArchive() throws XWikiException
Get the archive if it is currently stored in RAM.- Returns:
- a byte array representation of a JRCS archive or an empty array if the archive is not available on the heap.
- Throws:
XWikiException
- if anything goes wrong.
-
getArchive
public byte[] getArchive(XWikiContext context) throws XWikiException
Get the archive, loading it from the database if necessary.- Parameters:
context
- the XWikiContext for the request used to load the correct attachment archive from the database.- Returns:
- a byte array representation of a JRCS archive.
- Throws:
XWikiException
- if anything goes wrong.
-
setArchive
public void setArchive(byte[] data) throws XWikiException
Set the archive from a byte array representation of a JRCS archive.- Parameters:
data
- a byte array representation of a JRCS archive.- Throws:
XWikiException
- if anything goes wrong.
-
setArchive
public void setArchive(String data) throws XWikiException
Set the archive from a byte array representation of a JRCS archive.- Parameters:
data
- a String representation of a JRCS archive.- Throws:
XWikiException
- if anything goes wrong.- Since:
- 7.1M1
-
updateArchive
@Deprecated public void updateArchive(byte[] data, XWikiContext context) throws XWikiException
Deprecated.since 7.1M1, useupdateArchive(XWikiContext)
insteadUpdate the archive.- Parameters:
data
- not used for anything, the data is loaded from the attachment included with this archive.context
- the XWikiContext for the request used to load the correct attachment content from the database.- Throws:
XWikiException
- if anything goes wrong.
-
updateArchive
public void updateArchive(XWikiContext context) throws XWikiException
Update the archive.- Parameters:
context
- the XWikiContext for the request used to load the correct attachment content from the database.- Throws:
XWikiException
- if anything goes wrong.- Since:
- 7.1M1
-
getAttachment
public XWikiAttachment getAttachment()
- Returns:
- the attachment which this is an archive for.
-
setAttachment
public void setAttachment(XWikiAttachment attachment)
Set the attachment to associate with this archive. This is a dangerous function because it will not change the archive. Using this may cause an attachment to be associated with the wrong history.- Parameters:
attachment
- the attachment to set for this archive.
-
getVersions
public org.suigeneris.jrcs.rcs.Version[] getVersions()
- Returns:
- an array of versions which are available for this attachment, ordered by version number descending.
-
getRevision
public XWikiAttachment getRevision(XWikiAttachment attachment, String rev, XWikiContext context) throws XWikiException
Get an old revision of the attachment which this is an archive of.- Parameters:
attachment
- This attachment will be used to get the document to associate the attachment revision with.rev
- a String representation of the version to load.context
- the context for the request which needed this revision.- Returns:
- an XWikiAttachment for the given revision.
- Throws:
XWikiException
- if any Exception is thrown while getting the revision.
-
-