Interface Store
- All Known Implementing Classes:
AbstractStore,ClassPathStore,RemoteStore
public interface Store
Store for holding Web Script Definitions and Implementations
- Author:
- davidc
-
Method Summary
Modifier and TypeMethodDescriptionvoidcreateDocument(String documentPath, String content) Creates a document.voidcreateDocuments(List<org.springframework.extensions.surf.util.Pair<String, org.dom4j.Document>> paths) Creates multiple XML documents at the specified paths.booleanexists()Determines whether the store actually existsString[]Gets the paths of all documents in this storeGets the base path of the storeString[]Gets the paths of all Web Script description documents in this storegetDocument(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 storeString[]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 ScriptGets the script loader for this storefreemarker.cache.TemplateLoaderGets the template loader for this storebooleanhasDocument(String documentPath) Determines if the document exists.voidinit()Initialise Store (called once)booleanIndicates whether or not this store can be written to.booleanisSecure()Returns true if this store is considered secure - i.e.longlastModified(String documentPath) Gets the last modified timestamp for the document.booleanremoveDocument(String documentPath) Removes an existing document.voidupdateDocument(String documentPath, String content) Updates an existing document.
-
Method Details
-
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 pathincludeSubPaths- if true, include sub-pathsdocumentPattern- document name, allows wildcards, eg. *.ftl or my*.ftl- Returns:
- array of document paths
- Throws:
IOException
-
getDocumentPaths
Gets the paths matching a given file path pattern in this store.- Parameters:
path- start pathfilePathPattern- file path pattern string, allows wildcards, eg. *.ftl or my*.ftl or *\/a\/*.xml- Returns:
- array of document paths
- Throws:
IOException
-
getDescriptionDocumentPaths
Gets the paths of all Web Script description documents in this store- Returns:
- array of description document paths
- Throws:
IOException
-
getScriptDocumentPaths
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
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
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
Gets a document. Note a raw InputStream to the content is returned and must be closed by the accessing method.- Parameters:
documentPath- document path- Returns:
- input stream onto document
- Throws:
IOException- if the document does not exist in the store
-
createDocument
Creates a document.- Parameters:
documentPath- document pathcontent- content of the document to write- Throws:
IOException- if the document already exists or the create fails
-
createDocuments
void createDocuments(List<org.springframework.extensions.surf.util.Pair<String, org.dom4j.Document>> paths) throws IOExceptionCreates multiple XML documents at the specified paths.- Parameters:
paths- list of path, document pairs- Throws:
IOException- if a document already exists or a create fails
-
updateDocument
Updates an existing document.- Parameters:
documentPath- document pathcontent- content to update the document with- Throws:
IOException- if the document does not exist or the update fails
-
removeDocument
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
-
isReadOnly
boolean isReadOnly()Indicates whether or not this store can be written to.- Returns:
trueIf the store cannot be written to andfalseotherwise.
-