public class GauloisPipe extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
GAULOIS_DEBUG_DIR_PROPERTY
The property name to specify the debug output directory
|
static String |
INSTANCE_DEFAULT_NAME |
| Constructor and Description |
|---|
GauloisPipe(SaxonConfigurationFactory configurationFactory)
Constructs a new GauloisPipe.
|
GauloisPipe(SaxonConfigurationFactory configurationFactory,
List<String> inputs,
String outputDirectory,
List<String> templatePaths,
int nbThreads,
String instanceName)
The constructor with detail config.
|
| Modifier and Type | Method and Description |
|---|---|
protected URIResolver |
buildUriResolver(URIResolver defaultUriResolver)
Build the uri resolver.
|
void |
collectError(Exception ex,
String... message)
Adds an error to the error reporting system
|
void |
collectError(GauloisRunException ex,
String... message) |
void |
doPostCloseService(ExecutionContext context) |
void |
execute(Pipe pipe,
ParametrableFile input,
net.sf.saxon.s9api.MessageListener listener,
Map<String,OutputStream>... outputs)
Execute the pipe for the specified input stream to the specified
serializer.
|
Config |
getConfig()
Returns the config the gaulois-pipe is configured to process.
|
protected String |
getCurrentDirUri() |
DatatypeFactory |
getDatatypeFactory() |
int |
getDocumentCacheSize()
Returns ...
|
EntityResolver2 |
getEntityResolver()
Returns the Entity resolver to use.
|
List<String> |
getErrors() |
String |
getInstanceName() |
protected ThreadFactory |
getThreadFactory() |
URIResolver |
getUriResolver()
Returns the entity resolver to use.
|
int |
getXsltCacheSize()
Returns...
|
static boolean |
isProtocolInstalled() |
void |
launch()
Launch the pipe.
|
static void |
main(String[] args)
Main entry point of saxon xslt pipe.
|
Config |
parseCommandLine(String[] args) |
protected void |
sendError(String error) |
void |
setConfig(Config config) |
void |
setInstanceName(String instanceName) |
void |
setMessageListenerclass(Class messageListenerclass)
Set the MessageListener class to use.
|
static void |
setProtocolInstalled(boolean installed)
Tells Gaulois whether cp protocol impementation has been installed or not.
|
void |
setThreadFactory(ThreadFactory threadFactory)
Sets the ThreadFactory to be used by executors.
|
protected void |
startErrorCollector() |
protected int |
terminateErrorCollector() |
public static final String INSTANCE_DEFAULT_NAME
public static final transient String GAULOIS_DEBUG_DIR_PROPERTY
public GauloisPipe(SaxonConfigurationFactory configurationFactory) throws InvalidSyntaxException
configurationFactory - The configuration factory to useInvalidSyntaxException - If a problem in configuration existspublic GauloisPipe(SaxonConfigurationFactory configurationFactory, List<String> inputs, String outputDirectory, List<String> templatePaths, int nbThreads, String instanceName) throws InvalidSyntaxException
configurationFactory - The Saxon's Configuration factory to useinputs - the input filesoutputDirectory - the output directorytemplatePaths - the template pathsnbThreads - the nbThreadsinstanceName - The instance name to use in the logsInvalidSyntaxException - If config's syntax is incorrectpublic void launch()
throws InvalidSyntaxException,
FileNotFoundException,
net.sf.saxon.s9api.SaxonApiException,
URISyntaxException,
IOException,
ParserConfigurationException,
TransformerException,
SAXException
InvalidSyntaxException - If config's syntax is incorrectFileNotFoundException - If a file is not found...net.sf.saxon.s9api.SaxonApiException - If a SaxonApi problem occursURISyntaxException - Because MVN forces to have comments...ParserConfigurationException - If a SAXParser configuration issue is thrownSAXException - If a SAXException is thrownTransformerException - If a TransformerException is thrownIOExceptionpublic int getDocumentCacheSize()
public int getXsltCacheSize()
public Config getConfig()
public void execute(Pipe pipe, ParametrableFile input, net.sf.saxon.s9api.MessageListener listener, Map<String,OutputStream>... outputs) throws net.sf.saxon.s9api.SaxonApiException, MalformedURLException, InvalidSyntaxException, URISyntaxException, FileNotFoundException, IOException
pipe - the pipe to runinput - the specified input streamlistener - the message listener to useoutputs - An optional map that contains OutputStream to bind to cfg:output elements.net.sf.saxon.s9api.SaxonApiException - when a problem occursMalformedURLException - When an URL is not correctly formedInvalidSyntaxException - When config file is invalidURISyntaxException - When URI is invalidFileNotFoundException - And when the file can not be found !IOExceptionprotected URIResolver buildUriResolver(URIResolver defaultUriResolver)
defaultUriResolver - Default Saxon's URIResolverpublic void doPostCloseService(ExecutionContext context)
public static void main(String[] args)
If --config option is given, it must be in first position, and all other options may be ignored. It is impossible to overwrite a config-file.xml option via command-line option, but it is possible to add XSL, input files and parameters
It is possible to define a pipe parameter for a single input file or a single XSL : just add parenthesis after the file/xsl URI, with comma-separated list of parameter=value
Command samples :
Files whom size is over multi-thread limit (default is 10Mb) are processed first, on a single-thread waiting queue. Then, files whom size is under limit are processed on the multi-threaded waiting queue.
Using config file gives much more control on Saxon-pipe on things taht can't be set via command-line :
args - the argumentspublic void setMessageListenerclass(Class messageListenerclass)
launch() call.messageListenerclass - The class of the listener to usepublic Config parseCommandLine(String[] args) throws InvalidSyntaxException
InvalidSyntaxExceptionpublic URIResolver getUriResolver()
getEntityResolver()public EntityResolver2 getEntityResolver()
getUriResolver(), which returns a org.xmlresolver.Resolver,
which is also an EntityResolver. If you override getUriResolver(), be careful, you may need to override
this method too.public void setInstanceName(String instanceName)
public void setConfig(Config config)
public String getInstanceName()
public void setThreadFactory(ThreadFactory threadFactory)
Executors.defaultThreadFactory() is used.
Warning: if you define your own ThreadFactory, be aware that log messages may change,
as thread names are defined by the ThreadFactory, not by gaulois-pipe.threadFactory - The threadFactory to useprotected ThreadFactory getThreadFactory()
public void collectError(Exception ex, String... message)
ex - The exception thrown to be reportedmessage - Optionnal messages to reportpublic void collectError(GauloisRunException ex, String... message)
protected void sendError(String error)
protected void startErrorCollector()
protected int terminateErrorCollector()
protected String getCurrentDirUri()
public DatatypeFactory getDatatypeFactory()
public static void setProtocolInstalled(boolean installed)
installed - Define if CP protocol handler has already been installedpublic static boolean isProtocolInstalled()
Copyright © 2019. All rights reserved.