org.springframework.extensions.webscripts
Class WebApplicationStore

java.lang.Object
  extended by org.springframework.extensions.webscripts.AbstractStore
      extended by org.springframework.extensions.webscripts.LocalFileSystemStore
          extended by org.springframework.extensions.webscripts.WebApplicationStore
All Implemented Interfaces:
Store, org.springframework.web.context.ServletContextAware

public class WebApplicationStore
extends LocalFileSystemStore

Store implementation which points to web application root

Author:
muzquiano

Nested Class Summary
 
Nested classes/interfaces inherited from class org.springframework.extensions.webscripts.LocalFileSystemStore
LocalFileSystemStore.LocalFileSystemStoreScriptLoader
 
Constructor Summary
WebApplicationStore()
           
 
Method Summary
 void createDocument(String documentPath, String content)
          Creates a document.
 String[] getAllDocumentPaths()
          Gets the paths of all documents in this store
 String getBasePath()
          Gets the base path of the store
 InputStream getDocument(String documentPath)
          Gets a document
protected  String[] getDocumentPathsByRegEx(String path, String regexPattern, boolean traverseChildren)
          Performs a pattern filter look up using a regex and starting from a given path.
 boolean hasDocument(String documentPath)
          Determines if the document exists.
 boolean isSecure()
          Returns true if this store is considered secure - i.e.
 long lastModified(String documentPath)
          Gets the last modified timestamp for the document.
 boolean removeDocument(String documentPath)
          Removes an existing document.
 void updateDocument(String documentPath, String content)
          Updates an existing document.
 
Methods inherited from class org.springframework.extensions.webscripts.LocalFileSystemStore
exists, gatherAbsolutePaths, getDescriptionDocumentPaths, getDocumentPaths, getPath, getRealPath, getRoot, getRootDir, getScriptDocumentPaths, getScriptLoader, getServletContext, getTemplateLoader, init, setPath, setRoot, setServletContext, toAbsolutePath
 
Methods inherited from class org.springframework.extensions.webscripts.AbstractStore
getDocumentPaths, getPreviewContext, setPreviewContextProvider
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebApplicationStore

public WebApplicationStore()
Method Detail

isSecure

public boolean isSecure()
Description copied from interface: Store
Returns true if this store is considered secure - i.e. on the app-server classpath. Scripts in secure stores can be run under the identity of a declared user (via the runas attribute) rather than the authenticated user.

Specified by:
isSecure in interface Store
Overrides:
isSecure in class LocalFileSystemStore
Returns:
true if this store is considered secure

hasDocument

public boolean hasDocument(String documentPath)
Description copied from interface: Store
Determines if the document exists.

Specified by:
hasDocument in interface Store
Overrides:
hasDocument in class LocalFileSystemStore
Parameters:
documentPath - document path
Returns:
true => exists, false => does not exist

lastModified

public long lastModified(String documentPath)
                  throws IOException
Description copied from interface: Store
Gets the last modified timestamp for the document.

Specified by:
lastModified in interface Store
Overrides:
lastModified in class LocalFileSystemStore
Parameters:
documentPath - document path to an existing document
Returns:
last modified timestamp
Throws:
IOException - if the document does not exist in the store

updateDocument

public void updateDocument(String documentPath,
                           String content)
                    throws IOException
Description copied from interface: Store
Updates an existing document.

Specified by:
updateDocument in interface Store
Overrides:
updateDocument in class LocalFileSystemStore
Parameters:
documentPath - document path
content - content to update the document with
Throws:
IOException - if the document does not exist or the update fails

removeDocument

public boolean removeDocument(String documentPath)
                       throws IOException
Description copied from interface: Store
Removes an existing document.

Specified by:
removeDocument in interface Store
Overrides:
removeDocument in class LocalFileSystemStore
Parameters:
documentPath - document path
Returns:
whether the operation succeeded
Throws:
IOException - if the document does not exist or the remove fails

createDocument

public void createDocument(String documentPath,
                           String content)
                    throws IOException
Description copied from interface: Store
Creates a document.

Specified by:
createDocument in interface Store
Overrides:
createDocument in class LocalFileSystemStore
Parameters:
documentPath - document path
content - content of the document to write
Throws:
IOException - if the document already exists or the create fails

getDocument

public InputStream getDocument(String documentPath)
                        throws IOException
Description copied from interface: Store
Gets a document

Specified by:
getDocument in interface Store
Overrides:
getDocument in class LocalFileSystemStore
Parameters:
documentPath - document path
Returns:
input stream onto document
Throws:
IOException - if the document does not exist in the store

getAllDocumentPaths

public String[] getAllDocumentPaths()
Description copied from interface: Store
Gets the paths of all documents in this store

Specified by:
getAllDocumentPaths in interface Store
Overrides:
getAllDocumentPaths in class LocalFileSystemStore
Returns:
array of all document paths

getDocumentPathsByRegEx

protected String[] getDocumentPathsByRegEx(String path,
                                           String regexPattern,
                                           boolean traverseChildren)
Description copied from class: LocalFileSystemStore
Performs a pattern filter look up using a regex and starting from a given path. Returns an array of valid document paths

Overrides:
getDocumentPathsByRegEx in class LocalFileSystemStore
Returns:
document paths

getBasePath

public String getBasePath()
Description copied from interface: Store
Gets the base path of the store

Specified by:
getBasePath in interface Store
Overrides:
getBasePath in class LocalFileSystemStore
Returns:
base path


Copyright © 2009 SpringSource, Inc. All Rights Reserved.