org.sixdml.xindice
Class xiXsltTransformService

java.lang.Object
  |
  +--org.sixdml.xindice.xiServiceBase
        |
        +--org.sixdml.xindice.xiXsltTransformService
All Implemented Interfaces:
Configurable, Service, SixdmlConstants, SixdmlTransformService

class xiXsltTransformService
extends xiServiceBase
implements SixdmlTransformService, SixdmlConstants

  
 xiXsltTransformService.java

 Performs XSLT ransformations on Nodes. 
 

Version:
1.0

Fields inherited from class org.sixdml.xindice.xiServiceBase
collection, properties
 
Fields inherited from interface org.sixdml.SixdmlConstants
SIXDML_NS, SIXDML_VERSION
 
Constructor Summary
(package private) xiXsltTransformService()
          Default constructor initializes service.
 
Method Summary
static String getContentsOfURL(URL source)
          Obtains the contents at a particular URL and returns them as a string.
 String getName()
          Gets the name of the service.
 SixdmlTransformType[] getSupportedTransformTypes()
          Gets the types of transforms that are supported by the this database.
 SixdmlTransformType getType()
          Get the type of this object as a SixdmlTransformType.
static void main(String[] args)
          Main used for testing class.
 String transformAndReturnString(String transformCode, SixdmlResource resource)
          Transforms a SixdmlResource from one XML document to another and returns the results in a string.
 String transformAndReturnString(String transformCode, String sourceXML)
          Transforms a string representation of a wellformed XML document to another and returns the results in a string.
 String transformAndReturnString(URL source, SixdmlResource resource)
          Transforms a SixdmlResource from one XML document to another and returns the results in a string.
 String transformAndReturnString(URL source, String sourceXML)
          Transforms a SixdmlResource from one XML document to another and returns the results in a string.
 
Methods inherited from class org.sixdml.xindice.xiServiceBase
getProperty, getVersion, setCollection, setProperty
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 
Methods inherited from interface org.xmldb.api.base.Service
getVersion, setCollection
 
Methods inherited from interface org.xmldb.api.base.Configurable
getProperty, setProperty
 

Constructor Detail

xiXsltTransformService

xiXsltTransformService()
Default constructor initializes service.
Parameters:
session - the DXE session associated with the class.
Method Detail

getType

public SixdmlTransformType getType()
Get the type of this object as a SixdmlTransformType.
Specified by:
getType in interface SixdmlTransformService
Returns:
the type of this object.

getSupportedTransformTypes

public SixdmlTransformType[] getSupportedTransformTypes()
Gets the types of transforms that are supported by the this database. Currently only XSLT is supported.
Specified by:
getSupportedTransformTypes in interface SixdmlTransformService
Returns:
an array of SixdmlTransformTypes which the database supports.

transformAndReturnString

public String transformAndReturnString(URL source,
                                       SixdmlResource resource)
                                throws IOException,
                                       InvalidTransformException
Transforms a SixdmlResource from one XML document to another and returns the results in a string. If the results are not XML then the root node will be a <transform-result< element from the http://www.25hoursaday.com/sixdml namespace containing the actual results in a CDATA child node.
Specified by:
transformAndReturnString in interface SixdmlTransformService
Parameters:
source - the URL to the location of the file containing the transform.
resource - the resource to transform
Returns:
the results of the transform in a string.
Throws:
IOException - if an error occurs while trying to retrieve the file.
InvalidTransformException - if the transform specified is an invalid or non-well formed query or document.

transformAndReturnString

public String transformAndReturnString(String transformCode,
                                       SixdmlResource resource)
                                throws InvalidTransformException
Transforms a SixdmlResource from one XML document to another and returns the results in a string. If the results are not XML then the root node will be a <transform-result< element from the http://www.25hoursaday.com/sixdml namespace containing the actual results in a CDATA child node.
Specified by:
transformAndReturnString in interface SixdmlTransformService
Parameters:
transformCode - the actual code for the stylesheet or query.
resource - the resource to transform
Returns:
the results of the transform in a string.
Throws:
InvalidTransformException - if the transform specified is an invalid or non-well formed query or document.

transformAndReturnString

public String transformAndReturnString(String transformCode,
                                       String sourceXML)
                                throws InvalidTransformException,
                                       NonWellFormedXMLException
Transforms a string representation of a wellformed XML document to another and returns the results in a string.
Specified by:
transformAndReturnString in interface SixdmlTransformService
Parameters:
transformCode - the actual code for the stylesheet or query.
sourceXML - the XML to transform
Returns:
the results of the transform in a string.
Throws:
InvalidTransformException - if the transform specified is an invalid or non-well formed query or document.
NonWellFormedXMLException - if the data to transform is not a wellformed XML document.

transformAndReturnString

public String transformAndReturnString(URL source,
                                       String sourceXML)
                                throws IOException,
                                       InvalidTransformException,
                                       NonWellFormedXMLException
Transforms a SixdmlResource from one XML document to another and returns the results in a string.
Specified by:
transformAndReturnString in interface SixdmlTransformService
Parameters:
source - the URL to the location of the file containing the transform.
sourceXML - the XML to transform
Returns:
the results of the transform in a string.
Throws:
IOException - if an error occurs while trying to retrieve the file.
InvalidTransformException - if the transform specified is an invalid or non-well formed query or document.
NonWellFormedXMLException - if the data to transform is not a wellformed XML document.

getName

public String getName()
Gets the name of the service.
Specified by:
getName in interface Service
Overrides:
getName in class xiServiceBase
Returns:
the name of the service.

getContentsOfURL

public static String getContentsOfURL(URL source)
                               throws IOException
Obtains the contents at a particular URL and returns them as a string.
Parameters:
source - the URL to obtaion the data from.
Returns:
the contents at the specified URL.
Throws:
IOException - if an error occurs while trying to retrieve the file.

main

public static void main(String[] args)
                 throws Exception
Main used for testing class.
Parameters:
args - IGNORED