public class ClassPathStore extends AbstractStore implements org.springframework.context.ApplicationContextAware, Store
| Modifier and Type | Class and Description |
|---|---|
protected class |
ClassPathStore.ClassPathTemplateLoader
Class Path Store implementation of a Template Loader
Retrieves templates either from classes in the class path or classes inside of JAR files
within the class path
|
protected class |
ClassPathStore.ClassPathTemplateSource
Template Source - loads from a Class Path Store
|
| Modifier and Type | Field and Description |
|---|---|
protected org.springframework.context.ApplicationContext |
applicationContext |
protected String |
classPath |
protected boolean |
exists |
protected boolean |
mustExist |
protected ClassPathStoreResourceResolver |
resolver |
protected String[] |
storeDirs |
protected static String |
VFSFILE_URL_PREFIX |
protected static String |
VFSJAR_URL_SEPARATOR |
protected static String |
VFSWAR_CLASSES_URL_SEPARATOR |
protected static String |
VFSWAR_URL_SEPARATOR |
protected static String |
VFSZIP_URL_PREFIX |
DESC_PATH_PATTERN| Constructor and Description |
|---|
ClassPathStore() |
| Modifier and Type | Method and Description |
|---|---|
void |
createDocument(String documentPath,
String content)
Creates a document.
|
static String |
createPath(String path,
String relativePath)
Helper method for creating fully qualified paths
|
boolean |
exists()
Determines whether the store actually exists
|
protected static URL |
extractJarFileURL(URL jarUrl)
Extract the URL for the actual jar file from the given URL
(which may point to a resource in a jar file or to a jar file itself).
|
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[] |
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)
|
protected static boolean |
isJarURL(URL url)
Determine whether the given URL points to a resource in a jar file,
that is, has protocol "jar", "zip", "vfszip", "wsjar" or "code-source".
|
boolean |
isReadOnly()
Whether the store is in read-only mode
|
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 |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setClassPath(String classPath)
Sets the class path
|
void |
setMustExist(boolean mustExist)
Sets whether the class path must exist
If it must exist, but it doesn't exist, an exception is thrown
on initialisation of the store
|
String |
toString() |
void |
updateDocument(String documentPath,
String content)
Updates an existing document.
|
createDocuments, getDocumentPaths, getPreviewContext, setPreviewContextProvider, setReadOnlyclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcreateDocuments, getDocumentPathsprotected static final String VFSFILE_URL_PREFIX
protected static final String VFSZIP_URL_PREFIX
protected static final String VFSJAR_URL_SEPARATOR
protected static final String VFSWAR_URL_SEPARATOR
protected static final String VFSWAR_CLASSES_URL_SEPARATOR
protected ClassPathStoreResourceResolver resolver
protected String[] storeDirs
protected org.springframework.context.ApplicationContext applicationContext
protected String classPath
protected boolean mustExist
protected boolean exists
public void setMustExist(boolean mustExist)
mustExist - booleanpublic void setClassPath(String classPath)
classPath - classpathpublic void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionpublic void init()
Storepublic boolean exists()
Storepublic String getBasePath()
StoregetBasePath in interface Storepublic boolean isSecure()
Storepublic boolean isReadOnly()
AbstractStoreisReadOnly in interface StoreisReadOnly in class AbstractStorepublic String[] getAllDocumentPaths()
StoregetAllDocumentPaths in interface Storepublic String[] getDocumentPaths(String path, boolean includeSubPaths, String documentPattern) throws IOException
StoregetDocumentPaths in interface Storepath - start pathincludeSubPaths - if true, include sub-pathsdocumentPattern - document name, allows wildcards, eg. *.ftl or my*.ftlIOExceptionpublic String[] getDescriptionDocumentPaths() throws IOException
StoregetDescriptionDocumentPaths in interface StoreIOExceptionpublic String[] getScriptDocumentPaths(WebScript script) throws IOException
StoregetScriptDocumentPaths in interface Storescript - web scriptIOExceptionpublic long lastModified(String documentPath) throws IOException
StorelastModified in interface StoredocumentPath - document path to an existing documentIOException - if the document does not exist in the storepublic boolean hasDocument(String documentPath)
StorehasDocument in interface StoredocumentPath - document pathpublic InputStream getDocument(String documentPath) throws IOException
StoregetDocument in interface StoredocumentPath - document pathIOException - if the document does not exist in the storepublic void createDocument(String documentPath, String content) throws IOException
StorecreateDocument in interface StoredocumentPath - document pathcontent - content of the document to writeIOException - if the document already exists or the create failspublic void updateDocument(String documentPath, String content) throws IOException
StoreupdateDocument in interface StoredocumentPath - document pathcontent - content to update the document withIOException - if the document does not exist or the update failspublic boolean removeDocument(String documentPath) throws IOException
StoreremoveDocument in interface StoredocumentPath - document pathIOException - if the document does not exist or the remove failspublic freemarker.cache.TemplateLoader getTemplateLoader()
StoregetTemplateLoader in interface Storepublic ScriptLoader getScriptLoader()
StoregetScriptLoader in interface Storepublic static String createPath(String path, String relativePath)
path - StringrelativePath - Stringprotected static boolean isJarURL(URL url)
"zip" and "wsjar" and "vfszip" are used by BEA WebLogic Server and IBM WebSphere and JBoss, respectively, but can be treated like jar files. The same applies to "code-source" URLs on Oracle OC4J, provided that the path contains a jar separator.
url - the URL to checkprotected static URL extractJarFileURL(URL jarUrl) throws MalformedURLException
jarUrl - the original URLMalformedURLException - if no valid jar file URL could be extractedCopyright © 2005–2018 Alfresco Software. All rights reserved.