com.mkdoc.store
Class AbstractFileStoreManager

java.lang.Object
  |
  +--com.mkdoc.store.AbstractFileStoreManager
Direct Known Subclasses:
HtmlFileStoreManager, TripleFileStoreManager

public abstract class AbstractFileStoreManager
extends java.lang.Object

Common methods for managing file system resources.

Version:
0.8 2005-12-09
Author:
Philip Shaw

Field Summary
static java.lang.String ABSOLUTE
          The absolute file path property name.
static java.lang.String DOT
          The default output folder.
static java.lang.String FOLDER
          The output file path property name.
protected  java.io.File outputDir
          The current output directory.
 
Constructor Summary
AbstractFileStoreManager()
           
 
Method Summary
protected  java.lang.String configureOutput(ApplicationContext context)
          Configure the output directory from the plugin property set.
protected static void createDirectories(java.io.File outFile)
          Create directories above a target output file.
protected abstract  java.lang.String getExtension()
          Get the extension for storage files.
 java.io.OutputStream getOutputStream(java.net.URL subject)
          Issue an output stream to which RDF statements can be passed directly.
protected  java.io.File getStorageFile(java.net.URL subject)
          Get a storage file reference for management.
protected  boolean includesFile(java.net.URL url)
          Check whether a URL includes a file part.
protected  boolean isFileUrl(java.net.URL url)
          Check whether a URL refers to a file resource.
protected  void purgeDocumentFile(java.lang.String subjectUri)
          Purge statements about a document by subject URI.
protected  java.lang.String trimExtension(java.net.URL url)
          Trim any extension part from a URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ABSOLUTE

public static final java.lang.String ABSOLUTE
The absolute file path property name.

Since:
Version 0.1 2005-04-26
See Also:
Constant Field Values

FOLDER

public static final java.lang.String FOLDER
The output file path property name.

Since:
Version 0.1 2005-04-26
See Also:
Constant Field Values

DOT

public static final java.lang.String DOT
The default output folder.

Since:
Version 0.1 2005-04-26
See Also:
Constant Field Values

outputDir

protected java.io.File outputDir
The current output directory.

Since:
Version 0.1 2005-04-26
Constructor Detail

AbstractFileStoreManager

public AbstractFileStoreManager()
Method Detail

configureOutput

protected final java.lang.String configureOutput(ApplicationContext context)
Configure the output directory from the plugin property set.

Parameters:
context - The plugin application context.
Returns:
A status message giving the path of the output directory.
Since:
Version 0.1 2005-04-26

getOutputStream

public final java.io.OutputStream getOutputStream(java.net.URL subject)
                                           throws StoreException
Issue an output stream to which RDF statements can be passed directly.

Temporary measure to adapt plugin writeFile methods.

Parameters:
subject - The subject of the RDF statements.
Returns:
An output stream on which to write RDF statements.
Throws:
StoreException - If an error occurs with the triple store.
Since:
Version 0.1 2005-04-26

purgeDocumentFile

protected final void purgeDocumentFile(java.lang.String subjectUri)
                                throws StoreException
Purge statements about a document by subject URI.

Parameters:
subjectUri - The URI of the subject document to purge.
Throws:
StoreException - If an error occurs with the triple store.
Since:
Version 0.3 2005-05-12

getExtension

protected abstract java.lang.String getExtension()
Get the extension for storage files.

Returns:
An type-specific file extension.
Since:
Version 0.1 2005-04-26

getStorageFile

protected final java.io.File getStorageFile(java.net.URL subject)
Get a storage file reference for management.

Parameters:
subject - The URL of the subject resource.
Returns:
A reference to the storage file for the URL subject.
Since:
Version 0.1 2005-04-26

isFileUrl

protected final boolean isFileUrl(java.net.URL url)
Check whether a URL refers to a file resource.

Parameters:
url - The URL to check.
Returns:
true if the URL refers to a file resource.

createDirectories

protected static final void createDirectories(java.io.File outFile)
Create directories above a target output file.

Parameters:
outFile - The target output file reference.
Since:
Version 0.1 2005-04-26

includesFile

protected final boolean includesFile(java.net.URL url)
Check whether a URL includes a file part.

Parameters:
url - The URL to check.
Returns:
true if the part after the last directory separator includes a dot prefixed extension.
Since:
Version 0.1 2005-04-26

trimExtension

protected final java.lang.String trimExtension(java.net.URL url)
Trim any extension part from a URL.

Parameters:
url - The URL to process.
Returns:
The file part of the URL less any "file" extension.
Since:
Version 0.1 2005-04-26