Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.saxon.java
Class JavaPlatform

    java.lang.Object
      net.sf.saxon.java.JavaPlatform

All Implemented Interfaces:
  Serializable, Platform

    public class JavaPlatform

extends Object
implements Platform

Implementation of the Platform class containing methods specific to the Java platform (as distinct from .NET). This is a singleton class with no instance data.

See Also:
  Serialized Form

Method Summary
`void` | `addFunctionLibraries(FunctionLibraryList list, Configuration config)` Add platform-specific function libraries to the function library list
`boolean` | `canReturnCollationKeys(StringCollator collation)` Given a collation, determine whether it is capable of returning collation keys.
`RegularExpression` | `compileRegularExpression(CharSequence regex, boolean isXPath, CharSequence flags)` Create a compiled regular expression
`void` | `declareJavaClass(FunctionLibrary library, String uri, Class theClass)` Register a namespace-to-Java-class mapping declared using saxon:script in an XSLT stylesheet
`Object` | `getCollationKey(NamedCollation namedCollation, String value)` Given a collation, get a collation key.
`SchemaType` | `getExternalObjectType(Configuration config, String uri, String localName)`
`static JavaPlatform` | `getInstance()`
`Source` | `getParserSource(Configuration config, StreamSource input, int validation, boolean dtdValidation, int stripspace)` Convert a StreamSource to either a SAXSource or a PullSource, depending on the native parser of the selected platform
`String` | `getPlatformSuffix()` Get a suffix letter to add to the Saxon version number to identify the platform
`String` | `getPlatformVersion()` Get the platform version
`void` | `initialize(Configuration config)` Perform platform-specific initialization of the configuration
`boolean` | `isDotNet()` Return true if this is the .NET platform
`boolean` | `isJava()` Return true if this is the Java platform
`URI` | `makeAbsolute(String relativeURI, String base)` Construct an absolute URI from a relative URI and a base URI.
`StringCollator` | `makeCollation(Configuration config, Properties props, String uri)` Obtain a collation with a given set of properties.
`FunctionLibrary` | `makeExtensionLibrary(Configuration config)` Make the default extension function factory appropriate to the platform

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getInstance

    public static JavaPlatform getInstance()

### initialize

    public void initialize(Configuration config)

  Perform platform-specific initialization of the configuration

  Specified by:
    `initialize` in interface `Platform`

### isJava

    public boolean isJava()

  Return true if this is the Java platform

  Specified by:
    `isJava` in interface `Platform`

### isDotNet

    public boolean isDotNet()

  Return true if this is the .NET platform

  Specified by:
    `isDotNet` in interface `Platform`

### makeAbsolute

    public URI makeAbsolute(String relativeURI,
                            String base)
                     throws URISyntaxException

  Construct an absolute URI from a relative URI and a base URI. The method uses the resolve method of the java.net.URI class, except where the base URI uses the (non-standard) "jar:" scheme, in which case the method used is `new URL(baseURL, relativeURL)`.

  Spaces in either URI are converted to %20

  If no base URI is available, and the relative URI is not an absolute URI, then the current directory is used as a base URI.

  Specified by:
    `makeAbsolute` in interface `Platform`
  Parameters:
    `relativeURI` - the relative URI. Null is permitted provided that the base URI is an absolute URI
    `base` - the base URI
  Returns:
    the absolutized URI
  Throws:
    `URISyntaxException` - if either of the strings is not a valid URI or if the resolution fails

### getPlatformVersion

    public String getPlatformVersion()

  Get the platform version

  Specified by:
    `getPlatformVersion` in interface `Platform`

### getPlatformSuffix

    public String getPlatformSuffix()

  Get a suffix letter to add to the Saxon version number to identify the platform

  Specified by:
    `getPlatformSuffix` in interface `Platform`

### getParserSource

    public Source getParserSource(Configuration config,
                                  StreamSource input,
                                  int validation,
                                  boolean dtdValidation,
                                  int stripspace)

  Convert a StreamSource to either a SAXSource or a PullSource, depending on the native parser of the selected platform

  Specified by:
    `getParserSource` in interface `Platform`
  Parameters:
    `config` -
    `input` - the supplied StreamSource
    `validation` -
    `dtdValidation` -
    `stripspace` -
  Returns:
    the PullSource or SAXSource, initialized with a suitable parser, or the original input Source, if now special handling is required or possible. This implementation always returns the original input unchanged.

### compileRegularExpression

    public RegularExpression compileRegularExpression(CharSequence regex,
                                                      boolean isXPath,
                                                      CharSequence flags)
                                               throws XPathException

  Create a compiled regular expression

  Specified by:
    `compileRegularExpression` in interface `Platform`
  Parameters:
    `regex` - the source text of the regular expression, in XML Schema or XPath syntax
    `isXPath` - set to true if this is an XPath regular expression, false if it is XML Schema
    `flags` - the flags argument as supplied to functions such as fn:matches(), in string form
  Returns:
    the compiled regular expression
  Throws:
    `XPathException` - if the syntax of the regular expression or flags is incorrect

### makeCollation

    public StringCollator makeCollation(Configuration config,
                                        Properties props,
                                        String uri)
                                 throws XPathException

  Obtain a collation with a given set of properties. The set of properties is extensible and variable across platforms. Common properties with example values include lang=ed-GB, strength=primary, case-order=upper-first, ignore-modifiers=yes, alphanumeric=yes. Properties that are not supported are generally ignored; however some errors, such as failing to load a requested class, are fatal.

  Specified by:
    `makeCollation` in interface `Platform`
  Parameters:
    `config` - the configuration object
    `props` - the desired properties of the collation
    `uri` -
  Returns:
    a collation with these properties
  Throws:
    `XPathException` - if a fatal error occurs

### canReturnCollationKeys

    public boolean canReturnCollationKeys(StringCollator collation)

  Given a collation, determine whether it is capable of returning collation keys. The essential property of collation keys is that if two values are equal under the collation, then the collation keys are equal under the equals() method.

  Specified by:
    `canReturnCollationKeys` in interface `Platform`
  Parameters:
    `collation` - the collation, provided as a Comparator
  Returns:
    true if this collation can supply collation keys

### getCollationKey

    public Object getCollationKey(NamedCollation namedCollation,
                                  String value)

  Given a collation, get a collation key. The essential property of collation keys is that if two values are equal under the collation, then the collation keys are compare correctly under the equals() method.

  Specified by:
    `getCollationKey` in interface `Platform`
  Returns:
    a representation of the collation key, such that two collation keys are equal() if and only if the string values they represent are equal under the specified collation.
  Throws:
    `ClassCastException` - if the collation is not one that is capable of supplying collation keys (this should have been checked in advance)

### makeExtensionLibrary

    public FunctionLibrary makeExtensionLibrary(Configuration config)

  Make the default extension function factory appropriate to the platform

  Specified by:
    `makeExtensionLibrary` in interface `Platform`

### addFunctionLibraries

    public void addFunctionLibraries(FunctionLibraryList list,
                                     Configuration config)

  Add platform-specific function libraries to the function library list

  Specified by:
    `addFunctionLibraries` in interface `Platform`

### declareJavaClass

    public void declareJavaClass(FunctionLibrary library,
                                 String uri,
                                 Class theClass)

  Register a namespace-to-Java-class mapping declared using saxon:script in an XSLT stylesheet

  Specified by:
    `declareJavaClass` in interface `Platform`
  Parameters:
    `library` - the library to contain the function, which must be a JavaExtensionLibrary
    `uri` - the namespace of the function name
    `theClass` - the Java class that implements this namespace

### getExternalObjectType

    public SchemaType getExternalObjectType(Configuration config,
                                            String uri,
                                            String localName)

  Specified by:
    `getExternalObjectType` in interface `Platform`

Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) Michael H. Kay. All rights reserved.