A
- The attributespublic class DocumentService<A extends com.threecrickets.prudence.internal.attributes.DocumentExecutionAttributes> extends Object
Modifier and Type | Field and Description |
---|---|
protected A |
attributes
The attributes.
|
protected LinkedList<DocumentDescriptor<Executable>> |
documentDescriptorStack
The document stack.
|
Constructor and Description |
---|
DocumentService(A attributes)
Constructor.
|
DocumentService(A attributes,
DocumentDescriptor<Executable> documentDescriptor)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addDependency(String documentName)
Explicitly add a dependency to this document.
|
void |
addFileDependency(String path)
Explicitly add a dependency to this document.
|
void |
execute(String documentName)
Executes a source code document.
|
void |
executeOnce(String documentName)
As
execute(String) , but will only execute once per this thread. |
ClientResource |
external(String uri,
String mediaTypeName)
Access any resource.
|
Cache |
getCache()
The cache.
|
DocumentDescriptor<Executable> |
getDescriptor()
The descriptor for the currently executing document (the one at the top
of the stack).
|
protected DocumentDescriptor<Executable> |
getDocumentDescriptor(String documentName)
Finds a document.
|
DocumentSource<Executable> |
getSource()
The
DocumentSource used to fetch executables. |
ClientResource |
internal(String resourceUri,
String mediaTypeName)
Access a resource internal to the current application.
|
ClientResource |
internalOther(String applicationInternalName,
String resourceUri,
String mediaTypeName)
Access a resource internal to the current Prudence instance.
|
void |
invalidate(String documentName)
Invalidates a document, which can affect documents that depend on it.
|
void |
invalidateCurrent()
Invalidates the current document, which can affect documents that depend
on it.
|
boolean |
markExecuted(String documentName,
boolean wasExecuted)
Marks a document as executed for this thread's
ExecutionContext . |
protected DocumentDescriptor<Executable> |
popDocumentDescriptor()
Remove the top document from the stack.
|
protected void |
pushDocumentDescriptor(DocumentDescriptor<Executable> documentDescriptor)
Add a document to the top of stack.
|
void |
require(String... documentNames)
|
protected final A extends com.threecrickets.prudence.internal.attributes.DocumentExecutionAttributes attributes
protected LinkedList<DocumentDescriptor<Executable>> documentDescriptorStack
public DocumentService(A attributes)
attributes
- The attributespublic DocumentService(A attributes, DocumentDescriptor<Executable> documentDescriptor)
attributes
- The attributesdocumentDescriptor
- The initial document descriptorpublic Cache getCache()
public DocumentSource<Executable> getSource()
DocumentSource
used to fetch executables.public DocumentDescriptor<Executable> getDescriptor()
public void execute(String documentName) throws ParsingException, ExecutionException, DocumentException, IOException
documentName
- The document nameParsingException
- In case of a Scripturian parsing errorExecutionException
- In case of a Scripturian execution errorDocumentException
- In case of a Scripturian document retrieval errorIOException
- In case of a Scripturian writing errorpublic void executeOnce(String documentName) throws ParsingException, ExecutionException, DocumentException, IOException
execute(String)
, but will only execute once per this thread.documentName
- The document nameParsingException
- In case of a Scripturian parsing errorExecutionException
- In case of a Scripturian execution errorDocumentException
- In case of a Scripturian document retrieval errorIOException
- In case of a Scripturian writing errormarkExecuted(String, boolean)
public void require(String... documentNames) throws ParsingException, ExecutionException, DocumentException, IOException
documentNames
- The document namesParsingException
- In case of a Scripturian parsing errorExecutionException
- In case of a Scripturian execution errorDocumentException
- In case of a Scripturian document retrieval errorIOException
- In case of a Scripturian writing errorpublic boolean markExecuted(String documentName, boolean wasExecuted)
ExecutionContext
.documentName
- The document namewasExecuted
- True if marked as executed, false to clear execution flagexecuteOnce(String)
public void addDependency(String documentName) throws ParsingException, DocumentException
documentName
- The document nameDocumentException
- In case of a Scripturian document retrieval errorParsingException
- In case of a Scripturian parsing errorpublic void addFileDependency(String path) throws ParsingException, DocumentException
addDependency(String)
, any file can be added here. The contents
of the file are never read.path
- The document nameParsingException
- In case of a Scripturian parsing errorDocumentException
- In case of a Scripturian document retrieval errorpublic void invalidate(String documentName) throws ParsingException, DocumentException, IOException
documentName
- The document nameDocumentException
- In case of a Scripturian document retrieval errorParsingException
- In case of a Scripturian parsing errorIOException
- In case of a Scripturian writing errorpublic void invalidateCurrent()
public ClientResource internal(String resourceUri, String mediaTypeName)
resourceUri
- The URImediaTypeName
- The preferred media typepublic ClientResource internalOther(String applicationInternalName, String resourceUri, String mediaTypeName)
applicationInternalName
- The application internal nameresourceUri
- The URImediaTypeName
- The preferred media typepublic ClientResource external(String uri, String mediaTypeName)
uri
- The URImediaTypeName
- The preferred media typeprotected void pushDocumentDescriptor(DocumentDescriptor<Executable> documentDescriptor)
documentDescriptor
- The document descriptorprotected DocumentDescriptor<Executable> popDocumentDescriptor()
protected DocumentDescriptor<Executable> getDocumentDescriptor(String documentName) throws ParsingException, DocumentException
documentName
- The document nameParsingException
- In case of a Scripturian parsing errorDocumentException
- In case of a Scripturian document retrieval errorCopyright © 2009-2016 Three Crickets LLC.