|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.exln.stylus.io.StylusFileFactory
ConverterFactory.
Defines a factory API that enables applications to read and write
data streams using any custom file system which implements the
StylusFile interface. This class also implements the interfaces
URIResolver and EntityResolver.
If you register an instance of this class as the URIResolver and/or EntityResolver
for your parser or transformer, it will use StylusFileFactory to resolve references
as needed.
To use this class:
registerScheme(String scheme, String className, String classPath)).unlockAPI(String installID).registerScheme(String scheme, String className, String classPath) method. Except as
described above, the class paths
are determined automatically from the location of XMLConverters.jar.
The simplest way to use this class is:
StylusFile sf =
StylusFileFactory.getFactory().createStylusFile(String url);
The resulting StylusFile object can be used to access the specified url using one of
the built-in protocols listed above. See StylusFile and createStylusFile.
If you have implemented a custom file system and wish to use this class to access it,
you must register your custom file system as follows, before calling createStylusFile:
StylusFileFactory.getFactory().registerScheme(String scheme, String className);
For more details, see registerScheme.
| Nested Class Summary | |
static class |
StylusFileFactory.ResolverWrapper
Deprecated. This is replaced by methods in ConverterFactory. |
| Method Summary | |
static InputStream |
createInputStream(String uri,
String URIBase)
Deprecated. This is replaced by methods in ConverterFactory and ConverterResolver. |
static Result |
createOutputResult(String uri,
String URIBase)
Deprecated. This is replaced by methods in ConverterFactory and ConverterResolver. |
static OutputStream |
createOutputStream(String uri,
String URIBase)
Deprecated. This is replaced by methods in ConverterFactory and ConverterResolver. |
static StreamSource |
createSource(String uri,
String URIBase,
boolean useResolver)
Deprecated. This is replaced by methods in ConverterFactory and ConverterResolver. |
StylusFile |
createStylusFile(String url)
Deprecated. This is replaced by methods in ConverterFactory. |
StylusFile |
createStylusFile(String url,
InputStream is)
Deprecated. This is replaced by methods in ConverterFactory. |
StylusFile |
createStylusFile(String url,
OutputStream os)
Deprecated. This is replaced by methods in ConverterFactory. |
static StylusFileFactory |
getFactory()
Deprecated. This is replaced by methods in ConverterFactory. |
static String |
getUnlockAPIError()
Deprecated. This method is ignored. The XML Converters 3.0 licensing is controlled by the ConverterFactory object. |
Result |
outputStreamResolver(String uri,
String URIBase)
Deprecated. This is replaced by methods in ConverterFactory and ConverterResolver. |
void |
registerScheme(String scheme,
String className)
Deprecated. |
void |
registerScheme(String scheme,
String className,
String classPath)
Deprecated. |
Source |
resolve(String uri,
String URIBase)
Deprecated. This is replaced by methods in ConverterFactory and ConverterResolver. |
InputSource |
resolveEntity(String publicId,
String systemId)
Deprecated. This is replaced by methods in ConverterFactory and ConverterResolver. |
static boolean |
unlockAPI(String installID)
Deprecated. This method is ignored. The XML Converters 3.0 licensing is controlled by the ConverterFactory object. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static StylusFileFactory getFactory()
ConverterFactory.
StylusFileFactory. If the factory does not yet exist,
it will be created and initialized.
public static boolean unlockAPI(String installID)
public static String getUnlockAPIError()
public StylusFile createStylusFile(String url) throws IOException
ConverterFactory.
StylusFile object for file access through a custom file system.
The parameter String url is parsed to get the scheme prefix. The scheme is
used to select a custom file system which can access files via that protocol.
The scheme should either be a built-in scheme or should have been registered
with registerScheme.
The scheme:// prefix is then removed from the url and the rest is passed as
the String parameter to the constructor for that
StylusFile
class for the selected custom file system.
The StylusFile object returned by createStylusFile can be used to:
StylusFile.getInputStream() or StylusFile.copyToFile(String)StylusFile.getOutputStream() or StylusFile.copyFromFile(String)StylusFile.
StylusFile object for the class which was registered to the scheme.
IOException - in any of the following conditions:
registerScheme StylusFilepublic StylusFile createStylusFile(String url, InputStream is) throws IOException
ConverterFactory.
StylusFile object for file access through a custom file system.
This method differs from createStylusFile(String) in that it invokes a
2 argument constructor (String, InputStream) of the StylusFile class.
This is useful if the
StylusFile object being created is an adapter or converter which
will read input from the InputStream. The application will normally get the
result of the conversion by calling getInputStream() and using it to read the converted
data.
The parameter String url is parsed to get the scheme prefix. The scheme is
used to select a custom file system which can access files via that protocol.
The scheme should either be a built-in scheme or should have been registered
with registerScheme.
The scheme:// prefix is then removed from the url and the rest is passed as
the String parameter to the constructor for that
StylusFile
class for the selected custom file system.
The StylusFile object returned by createStylusFile can be used to:
StylusFile.getInputStream() or StylusFile.copyToFile(String)StylusFile.
StylusFile object for the class which was registered to the scheme.
IOException - in any of the following conditions:
registerScheme StylusFilepublic StylusFile createStylusFile(String url, OutputStream os) throws IOException
ConverterFactory.
StylusFile object for file access through a custom file system.
This method differs from createStylusFile(String) in that it invokes a
2 argument constructor (String, OutputStream) of the StylusFile class.
This is useful if the
StylusFile object being created is an adapter or converter which
will write output to the OutputStream. The application will normally call
the object's getOutputStream method and use that stream to send data to the
adapter.
The parameter String url is parsed to get the scheme prefix. The scheme is
used to select a custom file system which can access files via that protocol.
The scheme should either be a built-in scheme or should have been registered
with one of the registerScheme methods.
The scheme:// prefix is then removed from the url and the rest is passed as
the String parameter to the constructor for that
StylusFile
class for the selected custom file system.
The application can then send data to the
StylusFile object returned by createStylusFile by calling either:
For more details, see StylusFile.
StylusFile object for the class which was registered to the scheme.
IOException - in any of the following conditions:
registerScheme StylusFilepublic void registerScheme(String scheme, String className) throws IllegalArgumentException
StylusFile class name.
The method StylusFileFactory.createStylusFile examines the scheme: part of its URL
parameter to know which class to instantiate.
StylusFileFactory has
a built-in association from the
scheme: to the class name to be instantiated. This built-in list is:
registerScheme method.
StylusFile) and wish to use that class through the StylusFileFactory API, you must register
the association between a scheme: and your class name.
You do this by calling the registerScheme method. You must call it exactly once for each
scheme you wish to register. When your class is needed, StylusFileFactory will create a class loader
whose class path will be taken from the system property className.classpath
scheme - The scheme you wish to register.className - The name of the class which implements StylusFile and which
should be instantiated when a URL with the registered scheme is passed to the
createStylusFile method.
IllegalArgumentException - if
public void registerScheme(String scheme, String className, String classPath) throws IllegalArgumentException
StylusFile class name and classpath.
This method differs from registerScheme(String scheme, String className) by allowing
the caller to specify additional classpath elements to use when loading classes for the
specified scheme.
scheme - The scheme you wish to register.className - The name of the class which implements StylusFile and which
should be instantiated when a URL with the registered scheme is passed to the
createStylusFile method.classPath - Additional ';' separated elements of the classpath which will be used to load
className. These pathnames will be appended after the pathnames in the system property:
className.classpath
IllegalArgumentException - if
public Source resolve(String uri, String URIBase) throws TransformerException
ConverterFactory and ConverterResolver.
Source which can
be used to read data from the URI. The Source returned by this method
is a StreamSource. To get the data, cast it as a StreamSource and call
getInputStream().
resolve in interface URIResolveruri - The URI to be resolved.URIBase - The base URI in effect when the URI was encountered.
TransformerException - If the URI is malformed.public Result outputStreamResolver(String uri, String URIBase) throws TransformerException, IOException
ConverterFactory and ConverterResolver.
uri - The URI to be resolved.URIBase - The base URI in effect when the URI was encountered.
TransformerException - If the URI is malformed.
IOExceptionpublic static StreamSource createSource(String uri, String URIBase, boolean useResolver) throws TransformerException
ConverterFactory and ConverterResolver.
uri - The URI to be resolved.URIBase - The base URI in effect when the URI was encountered.useResolver - Use the Stylus resolver if this is true.
TransformerException - If an error occurs.public static InputStream createInputStream(String uri, String URIBase) throws IOException
ConverterFactory and ConverterResolver.
uri - The URI to be resolved.URIBase - The base URI in effect when the URI was encountered.
IOException - If an error occurs.public static OutputStream createOutputStream(String uri, String URIBase) throws IOException
ConverterFactory and ConverterResolver.
uri - The URI to be resolved.URIBase - The base URI in effect when the URI was encountered.
IOException - If an error occurs.public static Result createOutputResult(String uri, String URIBase) throws IOException
ConverterFactory and ConverterResolver.
uri - The URI to be resolved.URIBase - The base URI in effect when the URI was encountered.
IOException - If an error occurs.public InputSource resolveEntity(String publicId, String systemId) throws IOException
ConverterFactory and ConverterResolver.
resolveEntity in interface EntityResolverpublicId - The public identifier of the external entity being referenced,
or null if none was supplied.systemId - The system identifier of the external entity being referenced.
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||