|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.fatwire.cs.core.uri.AssemblerEngine
public final class AssemblerEngine
This class is a utility that manages the invocation of the Assembler interface.
Multiple assemblers can be registered, with a priority, and then used together to encode and decod URIs for applications. For example, unless otherwise specified, theAssemblerEngine.assemble(com.fatwire.cs.core.uri.Definition, java.lang.String)
method will always construct URIs using the top-ranked assembler.
A user may request that a specific assembler be used to generate a URI. If the
specified assembler has been registered, then the URI will be constructed using it.
This class also manages the sequential invocation of the AssemblerEngine.disassemble(java.net.URI, com.fatwire.cs.core.uri.Definition.ContainerType)
method.
Each registered assembler will return null if it is unable to identify the input URI
as its own. Once the highest-ranked assembler successfully disassembles the input URI,
the method returns.
This class also handles configuration and registration of assemblers. It is thread-safe.
Method Summary | |
---|---|
java.net.URI |
assemble(Definition definition,
java.lang.String assembler)
This method assembles the Definition into a URI using the assembler specified. |
Definition |
disassemble(java.net.URI uri,
Definition.ContainerType type)
This method attempts to disassemble a URI using all registered assemblers until a match is found. |
static java.lang.String |
getAssemblerClassnamePropName(int i)
Get the classname property name for the URI Assembler given the rank index specified |
static java.lang.String |
getAssemblerShortFormPropName(int i)
Get the shortform property name for the URI Assembler given the rank index specified |
static AssemblerEngine |
newInstance(java.util.Properties registrationProps,
java.util.Properties assemblerProps)
Construct an AssemblerEngine given the properties specified. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static AssemblerEngine newInstance(java.util.Properties registrationProps, java.util.Properties assemblerProps)
registrationProps
- properties containing information about currently
registered assemblersassemblerProps
- properties containing information that will be passed
to all registered assemblers. These are the properties defined
in Assembler.setProperties(Properties)
.
public static java.lang.String getAssemblerClassnamePropName(int i)
i
- rank
public static java.lang.String getAssemblerShortFormPropName(int i)
i
- rank
public java.net.URI assemble(Definition definition, java.lang.String assembler) throws java.net.URISyntaxException
definition
- Definitionassembler
- Assembler shortform name
java.net.URISyntaxException
- on errorpublic Definition disassemble(java.net.URI uri, Definition.ContainerType type) throws java.net.URISyntaxException
uri
- URI to decodetype
- ContainerType that this is being decoded in
java.net.URISyntaxException
- if an assembler chokes on the URI to disassemble.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |