|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.tinyjee.maven.dim.spi.Globals
public class Globals
Is a global, thread-local, recursive configuration singleton that may be used to exchange global settings between classes.
Method Summary | |
---|---|
String |
attachBinaryContent(String url)
Overloads attachBinaryContent(URL) . |
String |
attachBinaryContent(String fileName,
byte[] binaryContent)
Overloads attachBinaryContent(String, java.io.InputStream) . |
String |
attachBinaryContent(String fileName,
InputStream binaryContent)
Attempts to attach the given content as a file and returns the relative link to the content on success. |
String |
attachBinaryContent(String fileName,
String url)
Overloads attachBinaryContent(String, URL) . |
String |
attachBinaryContent(String fileName,
URL sourceUrl)
Overloads attachBinaryContent(String, java.io.InputStream) . |
String |
attachBinaryContent(URL sourceUrl)
Overloads attachBinaryContent(String, URL) . |
String |
attachContent(String fileName,
String content)
Attempts to attach the given content as a file and returns the relative link to the content on success. |
boolean |
attachCss(String fileName,
String cssContent)
Attempts to attach the given CSS (cascading style sheet). |
boolean |
attachJs(String fileName,
String scriptContent)
Attempts to attach the given client side java script. |
boolean |
attachScript(String fileName,
String scriptContent,
String scriptLanguage,
String contentType)
Attempts to attach the given client side script. |
static void |
cleanupGlobals()
|
byte[] |
fetch(String path)
Fetches the given url and converts the content to a string. |
String |
fetchText(String path)
Fetches the given path and converts the content to a string. |
byte[] |
fetchUrl(URL url)
Fetches the given url and converts the content to a string. |
String |
fetchUrlText(URL url)
Fetches the given url and converts the content to a string. |
static String |
getAttachedIncludesDirectory()
Returns the relative path (from web root) to the directory hosting the attached includes. |
File |
getAttachedIncludesPath()
Returns the file path to use for storing attached includes. |
Set<String> |
getAttachedResources()
Returns a set of all resources that were attached to the current sink. |
File |
getBasedir()
Returns the current base directory the Macro is operating against. |
Charset |
getCharset()
Returns the charset to use when reading text. |
boolean |
getCharsetIsUserSupplied()
Returns true if the user supplied a charset with the macro call. |
static Globals |
getInstance()
Returns a thread local, recursion safe instance. |
static org.apache.maven.doxia.logging.Log |
getLog()
Returns a safe logger. |
org.apache.maven.doxia.logging.Log |
getLogger()
Returns a macro logger to use for logging to the build log. |
MacroRequest |
getRequest()
The current macro request, may be 'null'. |
Sink |
getSink()
The current sink, may be 'null'. |
static Globals |
initializeGlobals(String charset,
Sink sink,
MacroRequest request,
org.apache.maven.doxia.logging.Log logger,
File attachedIncludesPath)
|
boolean |
isHTMLCapableSink()
Returns true if the sink produces some sort of HTML. |
int |
nextId()
Returns the next value of the monotonically increasing integer ID (IDs are consistent only for the lifetime of a single module's site build). |
int |
nextLocalId()
Returns the next page local value of the increasing integer ID (local IDs are consistent only within a single page). |
Globals |
operateOnSink(Sink sink)
Creates a globals instance for the given sink. |
static Globals |
reInitializeGlobals(String charset,
Sink sink,
MacroRequest request,
org.apache.maven.doxia.logging.Log logger,
File attachedIncludesPath)
|
File |
resolveLocalPath(String localPath)
Resolves the given local path and returns the corresponding file. |
URL |
resolvePath(String path)
Resolves the given path to an URL that can be fetched via UrlFetcher . |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static Globals initializeGlobals(String charset, Sink sink, MacroRequest request, org.apache.maven.doxia.logging.Log logger, File attachedIncludesPath)
public static Globals reInitializeGlobals(String charset, Sink sink, MacroRequest request, org.apache.maven.doxia.logging.Log logger, File attachedIncludesPath)
public static void cleanupGlobals()
public static Globals getInstance()
public static org.apache.maven.doxia.logging.Log getLog()
public static String getAttachedIncludesDirectory()
public Charset getCharset()
public boolean getCharsetIsUserSupplied()
public org.apache.maven.doxia.logging.Log getLogger()
public int nextId()
public int nextLocalId()
public Sink getSink()
public Globals operateOnSink(Sink sink)
sink
- the sink to return a globals instance for.
public boolean isHTMLCapableSink()
public MacroRequest getRequest()
public File getBasedir()
public File getAttachedIncludesPath()
public URL resolvePath(String path)
UrlFetcher
.
Note: Under the hood this method delegates to ResourceResolver.findSource(java.io.File, String)
.
path
- the path to resolve.
public File resolveLocalPath(String localPath)
localPath
- the local path to resolve.
public byte[] fetchUrl(URL url) throws IOException
url
- the url to fetch.
IOException
- In case of IO failed.public byte[] fetch(String path) throws IOException
path
- the path to fetch.
IOException
- In case of IO failed.public String fetchUrlText(URL url) throws IOException
url
- the url to fetch.
IOException
- In case of IO failed.public String fetchText(String path) throws IOException
path
- the path to fetch.
IOException
- In case of IO failed.public Set<String> getAttachedResources()
public boolean attachCss(String fileName, String cssContent) throws IOException
fileName
- a unique name to reference the content. If the name is empty the css will be inlined.cssContent
- the content to attach, either in-lined or using the filename reference.
If the css content starts with "classpath:", it is interpreted as a classpath URL to include
instead of the real content.
IOException
- In case of disk IO failed.public boolean attachJs(String fileName, String scriptContent) throws IOException
fileName
- a unique name to reference the script.scriptContent
- the content to attach, either in-lined or using the filename reference.
If the script content starts with "classpath:", it is interpreted as a classpath URL to include
instead of the real content.
IOException
- In case of disk IO failed.public boolean attachScript(String fileName, String scriptContent, String scriptLanguage, String contentType) throws IOException
fileName
- a unique name to reference the script. If the name is empty the script will be inlined.scriptContent
- the content to attach, either in-lined or using the filename reference.
If the script content starts with "classpath:", it is interpreted as a classpath URL to include
instead of the real content.scriptLanguage
- the script language, defaults to "javascript".contentType
- the content type, defaults to "text/javascript".
IOException
- In case of disk IO failed.public String attachContent(String fileName, String content) throws IOException
fileName
- a unique name to reference the content.content
- the content to attach.
If the content starts with "classpath:", it is interpreted as a classpath URL to include
instead of the real content.
IOException
- In case of disk IO failed.public String attachBinaryContent(String url) throws IOException
attachBinaryContent(URL)
.
url
- the url or path to fetch the binary content from.
IOException
- In case of disk IO failed.public String attachBinaryContent(String fileName, String url) throws IOException
attachBinaryContent(String, URL)
.
fileName
- a unique name to reference the content.url
- the url or path to fetch the binary content from.
IOException
- In case of disk IO failed.public String attachBinaryContent(URL sourceUrl) throws IOException
attachBinaryContent(String, URL)
.
sourceUrl
- an URL to fetch the binary content that should be attached.
IOException
- In case of disk IO failed.public String attachBinaryContent(String fileName, URL sourceUrl) throws IOException
attachBinaryContent(String, java.io.InputStream)
.
fileName
- a unique name to reference the content.sourceUrl
- an URL to fetch the binary content that should be attached.
IOException
- In case of disk IO failed.public String attachBinaryContent(String fileName, byte[] binaryContent) throws IOException
attachBinaryContent(String, java.io.InputStream)
.
fileName
- a unique name to reference the content.binaryContent
- the content to attach.
IOException
- In case of disk IO failed.public String attachBinaryContent(String fileName, InputStream binaryContent) throws IOException
fileName
- a unique name to reference the content.binaryContent
- the content to attach.
IOException
- In case of disk IO failed.public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |