org.springframework.extensions.webscripts
Interface Store

All Known Implementing Classes:
AbstractStore, ClassPathStore, JarStore, LocalFileSystemStore, RemoteStore, WebApplicationStore

public interface Store

Store for holding Web Script Definitions and Implementations

Author:
davidc

Method Summary
 void createDocument(String documentPath, String content)
          Creates a document.
 boolean exists()
          Determines whether the store actually exists
 String[] getAllDocumentPaths()
          Gets the paths of all documents in this store
 String getBasePath()
          Gets the base path of the store
 String[] getDescriptionDocumentPaths()
          Gets the paths of all Web Script description documents in this store
 InputStream getDocument(String documentPath)
          Gets a document
 String[] getDocumentPaths(String path, boolean includeSubPaths, String documentPattern)
          Gets the paths of given document pattern within given path/sub-paths in this store
 String[] getDocumentPaths(String path, String filePathPattern)
          Gets the paths matching a given file path pattern in this store.
 String[] getScriptDocumentPaths(WebScript script)
          Gets the paths of all implementation files for a given Web Script
 ScriptLoader getScriptLoader()
          Gets the script loader for this store
 freemarker.cache.TemplateLoader getTemplateLoader()
          Gets the template loader for this store
 boolean hasDocument(String documentPath)
          Determines if the document exists.
 void init()
          Initialise Store (called once)
 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.
 

Method Detail

init

void init()
Initialise Store (called once)


exists

boolean exists()
Determines whether the store actually exists

Returns:
true => it does exist

getBasePath

String getBasePath()
Gets the base path of the store

Returns:
base path

isSecure

boolean isSecure()
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.

Returns:
true if this store is considered secure

getDocumentPaths

String[] getDocumentPaths(String path,
                          boolean includeSubPaths,
                          String documentPattern)
                          throws IOException
Gets the paths of given document pattern within given path/sub-paths in this store

Parameters:
path - start path
includeSubPaths - if true, include sub-paths
documentPattern - document name, allows wildcards, eg. *.ftl or my*.ftl
Returns:
array of document paths
Throws:
IOException

getDocumentPaths

String[] getDocumentPaths(String path,
                          String filePathPattern)
                          throws IOException
Gets the paths matching a given file path pattern in this store.

Parameters:
path - start path
filePathPattern - file path pattern string, allows wildcards, eg. *.ftl or my*.ftl or *\/a\/*.xml
Returns:
array of document paths
Throws:
IOException

getDescriptionDocumentPaths

String[] getDescriptionDocumentPaths()
                                     throws IOException
Gets the paths of all Web Script description documents in this store

Returns:
array of description document paths
Throws:
IOException

getScriptDocumentPaths

String[] getScriptDocumentPaths(WebScript script)
                                throws IOException
Gets the paths of all implementation files for a given Web Script

Parameters:
script - web script
Returns:
array of implementation document paths
Throws:
IOException

getAllDocumentPaths

String[] getAllDocumentPaths()
Gets the paths of all documents in this store

Returns:
array of all document paths

lastModified

long lastModified(String documentPath)
                  throws IOException
Gets the last modified timestamp for the document.

Parameters:
documentPath - document path to an existing document
Returns:
last modified timestamp
Throws:
IOException - if the document does not exist in the store

hasDocument

boolean hasDocument(String documentPath)
                    throws IOException
Determines if the document exists.

Parameters:
documentPath - document path
Returns:
true => exists, false => does not exist
Throws:
IOException - Signals that an I/O exception has occurred.

getDocument

InputStream getDocument(String documentPath)
                        throws IOException
Gets a document

Parameters:
documentPath - document path
Returns:
input stream onto document
Throws:
IOException - if the document does not exist in the store

createDocument

void createDocument(String documentPath,
                    String content)
                    throws IOException
Creates a document.

Parameters:
documentPath - document path
content - content of the document to write
Throws:
IOException - if the document already exists or the create fails

updateDocument

void updateDocument(String documentPath,
                    String content)
                    throws IOException
Updates an existing document.

Parameters:
documentPath - document path
content - content to update the document with
Throws:
IOException - if the document does not exist or the update fails

removeDocument

boolean removeDocument(String documentPath)
                       throws IOException
Removes an existing document.

Parameters:
documentPath - document path
Returns:
whether the operation succeeded
Throws:
IOException - if the document does not exist or the remove fails

getTemplateLoader

freemarker.cache.TemplateLoader getTemplateLoader()
Gets the template loader for this store

Returns:
template loader

getScriptLoader

ScriptLoader getScriptLoader()
Gets the script loader for this store

Returns:
script loader


Copyright © 2009 SpringSource, Inc. All Rights Reserved.