@Exported public final class AssemblerEngine extends Object
AssemblerEngine.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.Modifier and Type | Method and Description |
---|---|
URI |
assemble(Definition definition,
String assembler)
This method assembles the Definition into a URI using the assembler
specified.
|
Definition |
disassemble(URI uri,
Definition.ContainerType type)
This method attempts to disassemble a URI using all registered assemblers
until a match is found.
|
static String |
getAssemblerClassnamePropName(int i)
Get the classname property name for the URI Assembler given the rank index specified.
|
static String |
getAssemblerShortFormPropName(int i)
Get the short form property name for the URI Assembler given the rank index specified.
|
static AssemblerEngine |
newInstance(Properties registrationProps,
Properties assemblerProps)
Construct an AssemblerEngine given the properties specified.
|
public static AssemblerEngine newInstance(Properties registrationProps, Properties assemblerProps)
registrationProps
- Properties containing information about currently
registered assemblers.assemblerProps
- Properties containing information that will be passed
to all registered assemblers. These are the properties defined
in Assembler.setProperties(Properties)
.public static String getAssemblerClassnamePropName(int i)
i
- rankpublic static String getAssemblerShortFormPropName(int i)
i
- rankpublic URI assemble(Definition definition, String assembler) throws URISyntaxException
definition
- Definitionassembler
- Assembler short form name.URISyntaxException
- on errorpublic Definition disassemble(URI uri, Definition.ContainerType type) throws URISyntaxException
uri
- URI to decodetype
- ContainerType that this is being decoded in.URISyntaxException
- if an assembler chokes on the URI to disassemble.