ca.ucalgary.seahawk.services
Class TextClient
java.lang.Object
ca.ucalgary.seahawk.services.TextClient
public class TextClient
- extends Object
This class uses XSLT rules to transform MOBY XML data representation
(during service invocation) to plain text. It can be thought of as the
opposite of the MobyClient, which generates MOBY objects from text using
regular expressions.
DATA_MAPPING_XSLT_RESOURCE
public static final String DATA_MAPPING_XSLT_RESOURCE
- See Also:
- Constant Field Values
RESOURCE_SYSTEM_PROPERTY
public static final String RESOURCE_SYSTEM_PROPERTY
- See Also:
- Constant Field Values
XSLT_NS
public static final String XSLT_NS
- See Also:
- Constant Field Values
XSLT_MODE_VAR
public static final String XSLT_MODE_VAR
- See Also:
- Constant Field Values
TextClient
public TextClient()
throws Exception
- Throws:
Exception
TextClient
public TextClient(Registry reg)
throws Exception
- Throws:
Exception
getPossibleTextTypes
public String[] getPossibleTextTypes(MobyPrimaryData dataTemplate,
boolean mustHaveURN)
getTemplateURN
public String getTemplateURN(String templateName)
addMappingsFromURL
public String addMappingsFromURL(URL xsltURL)
throws Exception
- Returns:
- the data format the xslt creates (the last template mode attribute in the file)
- Throws:
Exception
canProduceTextTypeFromMoby
public boolean canProduceTextTypeFromMoby(String textType,
MobyPrimaryData dataTemplate)
- Report whether a rule exists in the provided XSLT that converts the given MOBY
data to the given text type.
getText
public String getText(MobyDataInstance mobyData,
String targetTextType)
throws Exception
- Because XSLT works on XPath, and we don't know the MOBY tag name (it
may be a subclass of the object type we have a rule for), we iteratively
try representing the data in simpler top level objects until we get a rule
that produces something.
- Parameters:
mobyData
- must be an instance of a MobyPrimaryData that will be transformed
- Returns:
- null if the moby data or target text type is null, null if data is not primary, null if no templates apply, or a string representing the transformation if successful
- Throws:
Exception
getObjectConsumed
public static MobyPrimaryDataSimple getObjectConsumed(URL ruleSource,
String ruleURI,
Registry reg)
throws Exception
- Convenience method to backtrack from a mapping rule to the Moby datatype it consumes.
- Parameters:
ruleSource
- where the rule should be loaded fromruleURI
- a unique ID for the rule, in the source XML using Dublin Core
- Returns:
- a template object with the (minimal) datatype and namespaces consumed by the rule
- Throws:
Exception
getRegistry
public Registry getRegistry()
Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010