public class Parser
extends java.lang.Object
implements java.io.Closeable
Modifier and Type | Class and Description |
---|---|
static class |
Parser.Result |
Modifier and Type | Field and Description |
---|---|
private ParsingContext |
context |
private int |
DEFAULT_TIMEOUT |
static java.lang.String |
DEFAULT_WAIT_SYSPROP |
private java.util.concurrent.ExecutorService |
executorService |
private java.util.Stack<java.util.concurrent.Future<Parser.Result>> |
futures |
private java.util.concurrent.locks.ReadWriteLock |
lock |
private boolean |
ownES |
private java.util.Map<java.lang.String,Types> |
processedURI |
Constructor and Description |
---|
Parser(ParsingContext context) |
Modifier and Type | Method and Description |
---|---|
java.lang.Exception[] |
awaitTermination() |
java.lang.Exception[] |
awaitTermination(int timeOut,
java.util.concurrent.TimeUnit unit) |
void |
close() |
private ArchiveAdapter |
createArchiveAdapter(java.io.File source,
java.lang.Runnable doneHook) |
private java.util.concurrent.ExecutorService |
createExecutorService() |
private void |
doJob(ArchiveAdapter adapter,
java.lang.Runnable doneHook) |
ParsingContext |
getContext()
Returns the context this parser instance was initialized with during
the call to
Parser(ParsingContext) |
private static java.net.URI |
getDefiningURI(java.io.File file) |
private static java.io.File |
getFilePath(java.lang.String path,
java.lang.String resourceName) |
private Types |
getResult(java.net.URI uri) |
java.util.concurrent.Future<Parser.Result> |
parse(ArchiveAdapter source,
java.lang.Runnable doneHook)
Parse the archive adapter entries and run the runnable hook on completion.
|
void |
parse(java.io.File source,
java.lang.Runnable doneHook) |
private void |
saveResult(java.net.URI uri,
Types types) |
public static final java.lang.String DEFAULT_WAIT_SYSPROP
private final ParsingContext context
private final java.util.Map<java.lang.String,Types> processedURI
private final java.util.Stack<java.util.concurrent.Future<Parser.Result>> futures
private final java.util.concurrent.ExecutorService executorService
private final boolean ownES
private final java.util.concurrent.locks.ReadWriteLock lock
private final int DEFAULT_TIMEOUT
public Parser(ParsingContext context)
public java.lang.Exception[] awaitTermination() throws java.lang.InterruptedException
java.lang.InterruptedException
public java.lang.Exception[] awaitTermination(int timeOut, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
java.lang.InterruptedException
private static java.net.URI getDefiningURI(java.io.File file)
private static java.io.File getFilePath(java.lang.String path, java.lang.String resourceName)
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public void parse(java.io.File source, java.lang.Runnable doneHook) throws java.io.IOException
java.io.IOException
private ArchiveAdapter createArchiveAdapter(java.io.File source, java.lang.Runnable doneHook) throws java.io.IOException
java.io.IOException
public java.util.concurrent.Future<Parser.Result> parse(ArchiveAdapter source, java.lang.Runnable doneHook) throws java.io.IOException
source
- the archive adapter to parsedoneHook
- the runnable hook to run after completionjava.io.IOException
- thrown by the source archive adapter when accessing entriesprivate Types getResult(java.net.URI uri)
private void saveResult(java.net.URI uri, Types types)
private void doJob(ArchiveAdapter adapter, java.lang.Runnable doneHook) throws java.lang.Exception
java.lang.Exception
public ParsingContext getContext()
Parser(ParsingContext)
private java.util.concurrent.ExecutorService createExecutorService()