|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.xpn.xwiki.plugin.webdav.utils.XWikiDavContext
public class XWikiDavContext
Holds context information about a webdav request. TODO: Get rid of this class (Move to components).
| Constructor Summary | |
|---|---|
XWikiDavContext(org.apache.jackrabbit.webdav.DavServletRequest request,
org.apache.jackrabbit.webdav.DavServletResponse response,
javax.servlet.ServletContext servletContext,
org.apache.jackrabbit.webdav.DavResourceFactory resourceFactory,
org.apache.jackrabbit.webdav.DavSession davSession,
org.apache.jackrabbit.webdav.lock.LockManager lockManager)
Creates a new xwiki webdav context. |
|
| Method Summary | |
|---|---|
void |
addAttachment(com.xpn.xwiki.doc.XWikiDocument doc,
byte[] data,
java.lang.String attachmentName)
Adds an attachment to the XWikiDocument represented by this resource. |
void |
checkAccess(java.lang.String right,
java.lang.String fullDocName)
Validates if the user (in the context) has the given access level on the document in question, if not, throws a DavException. |
void |
cleanUp()
Release any resources acquired. |
void |
deleteAttachment(com.xpn.xwiki.doc.XWikiAttachment attachment)
Deletes the given attachment from it's document. |
void |
deleteDocument(com.xpn.xwiki.doc.XWikiDocument document)
Deletes the specified xwiki document from the current xwiki. |
boolean |
exists(java.lang.String fullDocName)
Checks whether the specified xwiki document exists or not. |
byte[] |
getContent(com.xpn.xwiki.doc.XWikiAttachment attachment)
Returns the content of the attachment. |
org.apache.jackrabbit.webdav.DavSession |
getDavSession()
|
com.xpn.xwiki.doc.XWikiDocument |
getDocument(java.lang.String fullDocName)
Finds the xwiki document matching the given document name. |
byte[] |
getFileContentAsBytes(java.io.InputStream in)
Utility method for reading a given input stream into a byte array. |
org.apache.jackrabbit.webdav.lock.LockManager |
getLockManager()
|
java.lang.String |
getMethod()
|
java.lang.String |
getMimeType(com.xpn.xwiki.doc.XWikiAttachment attachment)
Returns the mime type of the given attachment. |
org.apache.jackrabbit.webdav.DavResourceFactory |
getResourceFactory()
|
java.util.List<java.lang.String> |
getSpaces()
|
java.lang.String |
getUser()
|
XWikiDavUserStorage |
getUserStorage()
Returns the session storage allocated for the current user. |
com.xpn.xwiki.XWikiContext |
getXwikiContext()
|
boolean |
hasAccess(java.lang.String right,
java.lang.String fullDocName)
Returns if the user (in the context) has the given access level on the document in question. |
boolean |
isCreateCollectionRequest()
|
boolean |
isCreateFileRequest()
|
boolean |
isCreateOrMoveRequest()
|
boolean |
isCreateResourceRequest()
|
boolean |
isDeleteResourceRequest()
|
boolean |
isMoveAttachmentRequest(com.xpn.xwiki.doc.XWikiDocument doc)
Utility method for checking whether the current webdav request is trying to move / rename an attachment. |
boolean |
isMoveResourceRequest()
|
void |
moveAttachment(com.xpn.xwiki.doc.XWikiAttachment attachment,
com.xpn.xwiki.doc.XWikiDocument destinationDoc,
java.lang.String newAttachmentName)
Moves the given attachment under the target document. |
void |
renameDocument(com.xpn.xwiki.doc.XWikiDocument document,
java.lang.String newDocumentName)
Renames the given xwiki document into the new document name provided. |
void |
saveDocument(com.xpn.xwiki.doc.XWikiDocument document)
Saves the given xwiki document into current xwiki. |
java.util.List<java.lang.Object> |
search(java.lang.String sql)
A shortcut to XWikiStoreInterface.search(String, int, int, XWikiContext). |
java.util.List<java.lang.String> |
searchDocumentsNames(java.lang.String sql)
A shortcut to , returns all the results found. |
java.util.List<java.lang.String> |
searchDocumentsNames(java.lang.String sql,
int nb,
int start)
A shortcut to . |
java.lang.String |
toXML(com.xpn.xwiki.doc.XWikiDocument document)
Converts the given xwiki document into an xml representation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XWikiDavContext(org.apache.jackrabbit.webdav.DavServletRequest request,
org.apache.jackrabbit.webdav.DavServletResponse response,
javax.servlet.ServletContext servletContext,
org.apache.jackrabbit.webdav.DavResourceFactory resourceFactory,
org.apache.jackrabbit.webdav.DavSession davSession,
org.apache.jackrabbit.webdav.lock.LockManager lockManager)
throws org.apache.jackrabbit.webdav.DavException
request - dav request.response - dav response.servletContext - servlet context.resourceFactory - dav resource factory.davSession - dav session.lockManager - lock manager.
org.apache.jackrabbit.webdav.DavException - if an error occurs while initializing the xwiki context.| Method Detail |
|---|
public XWikiDavUserStorage getUserStorage()
public boolean hasAccess(java.lang.String right,
java.lang.String fullDocName)
right - Access level.fullDocName - Name of the document.
public void checkAccess(java.lang.String right,
java.lang.String fullDocName)
throws org.apache.jackrabbit.webdav.DavException
DavException.
right - Access level.fullDocName - Name of the document.
org.apache.jackrabbit.webdav.DavException - If the user doesn't have enough access rights on the given document or if the access
verification code fails.public java.lang.String getMimeType(com.xpn.xwiki.doc.XWikiAttachment attachment)
attachment - xwiki attachment.
public byte[] getContent(com.xpn.xwiki.doc.XWikiAttachment attachment)
throws org.apache.jackrabbit.webdav.DavException
attachment - xwiki attachment.
org.apache.jackrabbit.webdav.DavException - if an error occurs while reading the attachment.
public byte[] getFileContentAsBytes(java.io.InputStream in)
throws org.apache.jackrabbit.webdav.DavException
in - input stream.
org.apache.jackrabbit.webdav.DavException - if an error occurs while reading the input stream.
public void addAttachment(com.xpn.xwiki.doc.XWikiDocument doc,
byte[] data,
java.lang.String attachmentName)
throws org.apache.jackrabbit.webdav.DavException
XWikiDocument represented by this resource.
attachmentName - Name of this attachment.data - Data to be put into the attachment (file content).doc - The document to which the attachment is made.
org.apache.jackrabbit.webdav.DavException - Indicates an internal error.
public void moveAttachment(com.xpn.xwiki.doc.XWikiAttachment attachment,
com.xpn.xwiki.doc.XWikiDocument destinationDoc,
java.lang.String newAttachmentName)
throws org.apache.jackrabbit.webdav.DavException
attachment - xwiki attachment.destinationDoc - target document.newAttachmentName - new attachment name.
org.apache.jackrabbit.webdav.DavException - if an error occurs while accessing the wiki.
public void deleteAttachment(com.xpn.xwiki.doc.XWikiAttachment attachment)
throws org.apache.jackrabbit.webdav.DavException
attachment - xwiki attachment.
org.apache.jackrabbit.webdav.DavException - if an error occurs while accessing the wiki.public boolean exists(java.lang.String fullDocName)
fullDocName - name of the document.
public com.xpn.xwiki.doc.XWikiDocument getDocument(java.lang.String fullDocName)
throws org.apache.jackrabbit.webdav.DavException
fullDocName - name of the xwiki document.
org.apache.jackrabbit.webdav.DavException - if an error occurs while accessing the wiki.
public java.lang.String toXML(com.xpn.xwiki.doc.XWikiDocument document)
throws org.apache.jackrabbit.webdav.DavException
document - xwiki document.
org.apache.jackrabbit.webdav.DavException - if an error occurs while accessing the wiki.
public void renameDocument(com.xpn.xwiki.doc.XWikiDocument document,
java.lang.String newDocumentName)
throws org.apache.jackrabbit.webdav.DavException
document - xwiki document to be renamed.newDocumentName - new document name.
org.apache.jackrabbit.webdav.DavException - if an error occurs while accessing the wiki.
public java.util.List<java.lang.String> searchDocumentsNames(java.lang.String sql)
throws org.apache.jackrabbit.webdav.DavException
sql - the HQL query string.
org.apache.jackrabbit.webdav.DavException - if an error occurs while accessing the wiki.
public java.util.List<java.lang.String> searchDocumentsNames(java.lang.String sql,
int nb,
int start)
throws org.apache.jackrabbit.webdav.DavException
sql - the HQL where clause.nb - number of results expected.start - offset.
org.apache.jackrabbit.webdav.DavException - if an error occurs while accessing the wiki.
public java.util.List<java.lang.Object> search(java.lang.String sql)
throws org.apache.jackrabbit.webdav.DavException
XWikiStoreInterface.search(String, int, int, XWikiContext).
sql - the HQL query.
org.apache.jackrabbit.webdav.DavException - if an error occurs while accessing the wiki.
public void saveDocument(com.xpn.xwiki.doc.XWikiDocument document)
throws org.apache.jackrabbit.webdav.DavException
document - xwiki document to be saved.
org.apache.jackrabbit.webdav.DavException - if an error occurs while accessing the wiki.
public void deleteDocument(com.xpn.xwiki.doc.XWikiDocument document)
throws org.apache.jackrabbit.webdav.DavException
document - the xwiki document.
org.apache.jackrabbit.webdav.DavException - if an error occurs while accessing the wiki.
public java.util.List<java.lang.String> getSpaces()
throws org.apache.jackrabbit.webdav.DavException
org.apache.jackrabbit.webdav.DavException - if an error occurs while accessing the wiki.public boolean isCreateCollectionRequest()
public boolean isCreateFileRequest()
public boolean isCreateResourceRequest()
public boolean isMoveResourceRequest()
public boolean isCreateOrMoveRequest()
public boolean isMoveAttachmentRequest(com.xpn.xwiki.doc.XWikiDocument doc)
doc - the xwiki document to which the attachment belongs to.
public boolean isDeleteResourceRequest()
public java.lang.String getMethod()
public java.lang.String getUser()
public org.apache.jackrabbit.webdav.DavResourceFactory getResourceFactory()
public org.apache.jackrabbit.webdav.DavSession getDavSession()
public org.apache.jackrabbit.webdav.lock.LockManager getLockManager()
public com.xpn.xwiki.XWikiContext getXwikiContext()
public void cleanUp()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||