public class ReferenceManager extends Object
The reference manager is a singleton class which is responsible for deriving reference URI's into references at runtime.
Raw reference factories (which are capable of actually creating fully qualified reference objects) are added with the addFactory() method. The most common method of doing so is to implement the PrefixedRootFactory as either a full class, or an anonymous inner class, providing the roots available in the current environment and the code for constructing a reference from them.
RootTranslators (which rely on other factories) are used to describe that a particular reference style (generally a high level reference like "jr://media/" or "jr://images/") should be translated to another available reference in this environment like "jr://file/". Root Translators do not directly derive references, but rather translate them to what the reference should look like in the current circumstances.
| Modifier and Type | Method and Description |
|---|---|
static ReferenceManager |
__()
Deprecated.
use instance() instead
|
void |
addReferenceFactory(ReferenceFactory factory)
Adds a factory for deriving reference URI's into references
|
void |
addRootTranslator(RootTranslator translator)
Adds a new Translator to the current environment.
|
void |
addSessionRootTranslator(RootTranslator translator)
Adds a root translator that is maintained over the course of a session.
|
void |
clearSession()
Wipes out all of the translators being maintained in the current session (IE: Any translators
added via "addSessionRootTranslator".
|
Reference |
deriveReference(String uri)
Derives a global reference from a URI in the current environment.
|
Reference |
DeriveReference(String uri)
Deprecated.
use deriveReference instead
|
Reference |
deriveReference(String uri,
Reference context)
Derives a reference from a URI in the current environment.
|
Reference |
DeriveReference(String uri,
Reference context)
Deprecated.
use deriveReference instead
|
Reference |
deriveReference(String uri,
String context)
Derives a reference from a URI in the current environment.
|
Reference |
DeriveReference(String uri,
String context)
Deprecated.
use deriveReference instead
|
ReferenceFactory[] |
getFactories() |
static ReferenceManager |
instance() |
static boolean |
isRelative(String URI) |
boolean |
removeReferenceFactory(ReferenceFactory factory) |
void |
reset() |
public void reset()
public static ReferenceManager instance()
@Deprecated public static ReferenceManager __()
instancepublic ReferenceFactory[] getFactories()
public void addRootTranslator(RootTranslator translator)
public void addReferenceFactory(ReferenceFactory factory)
factory - A raw ReferenceFactory capable of creating
a reference.public boolean removeReferenceFactory(ReferenceFactory factory)
public Reference deriveReference(String uri) throws InvalidReferenceException
uri - The URI representing a global reference.InvalidReferenceException - If the current reference could
not be derived by the current environmentpublic Reference deriveReference(String uri, Reference context) throws InvalidReferenceException
uri - The URI representing a reference.context - A reference which provides context for any
relative reference accessors.InvalidReferenceException - If the current reference could
not be derived by the current environmentpublic Reference deriveReference(String uri, String context) throws InvalidReferenceException
uri - The URI representing a reference.context - A reference URI which provides context for any
relative reference accessors.InvalidReferenceException - If the current reference could
not be derived by the current environment, or if the context URI
is not valid in the current environment.public void addSessionRootTranslator(RootTranslator translator)
translator - A Root Translator that will be added to the current sessionpublic void clearSession()
public static boolean isRelative(String URI)
@Deprecated public Reference DeriveReference(String uri) throws InvalidReferenceException
InvalidReferenceException@Deprecated public Reference DeriveReference(String uri, Reference context) throws InvalidReferenceException
InvalidReferenceException@Deprecated public Reference DeriveReference(String uri, String context) throws InvalidReferenceException
InvalidReferenceExceptionCopyright © 2024. All rights reserved.