Version: 1.1.1

ca.ucalgary.seahawk.services
Class TextClient

java.lang.Object
  extended by 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.


Field Summary
static String DATA_MAPPING_XSLT_RESOURCE
           
static String RESOURCE_SYSTEM_PROPERTY
           
static String XSLT_MODE_VAR
           
static String XSLT_NS
           
 
Constructor Summary
TextClient()
           
TextClient(Registry reg)
           
 
Method Summary
 String addMappingsFromURL(URL xsltURL)
           
 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.
static MobyPrimaryDataSimple getObjectConsumed(URL ruleSource, String ruleURI, Registry reg)
          Convenience method to backtrack from a mapping rule to the Moby datatype it consumes.
 String[] getPossibleTextTypes(MobyPrimaryData dataTemplate, boolean mustHaveURN)
           
 Registry getRegistry()
           
 String getTemplateURN(String templateName)
           
 String getText(MobyDataInstance mobyData, String targetTextType)
          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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

TextClient

public TextClient()
           throws Exception
Throws:
Exception

TextClient

public TextClient(Registry reg)
           throws Exception
Throws:
Exception
Method Detail

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 from
ruleURI - 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()

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010