public class PackageLibrary
extends java.lang.Object
Constructor and Description |
---|
PackageLibrary(CompilerInfo compilerInfo)
Create an empty package library
|
PackageLibrary(CompilerInfo info,
java.util.Set<java.io.File> files)
Create a package library from a set of source files (being either the source XSLT of the
top-level modules of the packages in question, or the exported SEF file representing the
compiled package)
|
PackageLibrary(PackageLibrary library)
Create a package library as a copy of an existing package library
|
Modifier and Type | Method and Description |
---|---|
void |
addPackage(java.io.File file)
Add a package supplied in the form of a file: either a source XSLT package, or
an exported package
|
void |
addPackage(PackageDetails details)
Add an entry for a package to the library
|
void |
addPackage(StylesheetPackage packageIn)
Add a compiled and loaded package to this package library.
|
PackageDetails |
findDetailsForAlias(java.lang.String shortName)
Find the entry with a given shortName.
|
PackageDetails |
findPackage(java.lang.String name,
PackageVersionRanges ranges)
Find a package from the library that has the given name and whose version lies in the given ranges.
|
CompilerInfo |
getCompilerInfo() |
java.util.List<StylesheetPackage> |
getPackages()
Supply all the packages that currently exist in this library
|
StylesheetPackage |
obtainLoadedPackage(PackageDetails details,
java.util.List<VersionedPackageName> disallowed)
Obtain a loaded package, given details of the package.
|
public PackageLibrary(CompilerInfo compilerInfo)
compilerInfo
- the compiler options to be used if any package from the library
needs to be compiled. The package library retains a reference
to the CompilerInfo, so any subsequent changes to the options in the
CompilerInfo will take effect.public PackageLibrary(PackageLibrary library)
library
- the existing package library to be copied. The new package
library will contain a reference to the same CompilerInfo
as the supplied package library, and any subsequent changes
to this CompilerInfo will take effect.public PackageLibrary(CompilerInfo info, java.util.Set<java.io.File> files) throws XPathException
info
- the compiler to which this library belongsfiles
- the files making up the package libraryXPathException
- if any of the files doesn't have a top-level xsl:package element
containing the package name and package-version attributes. Note that validation
of the content of the file is minimal; if the name and version can be successfully
extracted, then full validation will be carried out if and when the package is actually
used.public CompilerInfo getCompilerInfo()
public void addPackage(StylesheetPackage packageIn)
packageIn
- The stylesheet package to be addedpublic void addPackage(PackageDetails details)
details
- details of the package to be added. The package
referenced in these details may exist in either
source or compiled form. No static processing
or validation takes place at this stage.public void addPackage(java.io.File file) throws XPathException
file
- a file to be added to the package libraryXPathException
public PackageDetails findPackage(java.lang.String name, PackageVersionRanges ranges)
name
- The name of the package. This must match the name under which the
package is registered in the library, which is not necessarily the same
as the package name appearing in the source code.ranges
- The ranges of versions of that package that are acceptablepublic PackageDetails findDetailsForAlias(java.lang.String shortName)
shortName
- the shortName of the entryjava.lang.IllegalStateException
- if there is more than one entry with the requested shortNamepublic StylesheetPackage obtainLoadedPackage(PackageDetails details, java.util.List<VersionedPackageName> disallowed) throws XPathException
details
- the package details for the required package, as previously returned
(perhaps) using findPackage(String, PackageVersionRanges)
disallowed
- the names/versions of packages that reference this package, and that
therefore cannot be referenced by this package without creating a cycle of dependencies.XPathException
- if loading the package fails, typically either because (a) a package
contains static XSLT errors, or (b) because there is a cycle of package dependenciespublic java.util.List<StylesheetPackage> getPackages()
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.